/* ==========================================================================
   Ponto Lotus — Tema moderno
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
    --bg:               #f1f5f9;
    --surface:          #ffffff;
    --surface-2:        #f8fafc;
    --border:           #e2e8f0;
    --border-strong:    #cbd5e1;

    --text:             #0f172a;
    --text-muted:       #64748b;
    --text-inverse:     #f8fafc;

    --primary:          #0d9488;          /* teal */
    --primary-hover:    #0f766e;
    --primary-soft:     #ccfbf1;

    --success:          #16a34a;
    --success-soft:     #bbf7d0;
    --warning:          #f59e0b;
    --warning-soft:     #fef3c7;
    --danger:           #dc2626;
    --danger-soft:      #fecaca;

    --sidebar-bg:       linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    --sidebar-width:    260px;
    --sidebar-width-collapsed: 72px;
    --topbar-height:    64px;

    --radius:           12px;
    --radius-sm:        8px;
    --radius-lg:        16px;

    --shadow-sm:        0 1px 2px 0 rgb(0 0 0 / 0.04);
    --shadow:           0 4px 6px -1px rgb(0 0 0 / 0.06), 0 2px 4px -2px rgb(0 0 0 / 0.06);
    --shadow-lg:        0 10px 25px -5px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
}

/* ---------- Reset/base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 0.95rem;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.01em;
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

/* ==========================================================================
   App shell — sidebar + main
   ========================================================================== */
.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ---------- Sidebar ---------- */
.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--text-inverse);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    transition: width 0.22s ease, transform 0.25s ease;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.app-sidebar__nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0.75rem;
    list-style: none;
    margin: 0;
    -webkit-overflow-scrolling: touch;
}

.app-sidebar__section {
    font-size: 0.7rem;
    color: rgb(255 255 255 / 0.4);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 1rem 0.75rem 0.5rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s ease, padding 0.22s ease;
}

.app-sidebar__item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 0.9rem;
    margin: 2px 0;
    color: rgb(248 250 252 / 0.75);
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
    min-height: 44px;            /* área de toque mínima */
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}
.app-sidebar__item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}
.app-sidebar__item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.15s ease;
}
.app-sidebar__item:hover {
    background: rgb(255 255 255 / 0.06);
    color: var(--text-inverse);
}
.app-sidebar__item:active {
    background: rgb(255 255 255 / 0.12);
}
.app-sidebar__item.active {
    background: rgb(13 148 136 / 0.18);
    color: var(--text-inverse);
    box-shadow: inset 3px 0 0 var(--primary);
}

.app-sidebar__footer {
    padding: 1rem;
    border-top: 1px solid rgb(255 255 255 / 0.06);
    font-size: 0.75rem;
    color: rgb(255 255 255 / 0.4);
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s ease, padding 0.22s ease;
}
.app-sidebar__footer a {
    color: rgb(255 255 255 / 0.7);
    text-decoration: none;
}
.app-sidebar__footer a:hover { color: var(--text-inverse); }

/* Backdrop (mobile) */
.app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 0.5);
    z-index: 1039;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.app-sidebar-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Main content ---------- */
.app-main {
    flex: 1 1 auto;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    transition: margin-left 0.22s ease;
}

.app-topbar {
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
    gap: 0.75rem;
}

.app-topbar__toggle {
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 1.5rem;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
    flex-shrink: 0;
}
.app-topbar__toggle:hover    { background: rgb(15 23 42 / 0.06); }
.app-topbar__toggle:active   { background: rgb(15 23 42 / 0.12); }
.app-topbar__toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Logomarca ao lado do botão de menu */
.app-topbar__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    min-width: 0;
    transition: opacity 0.15s ease;
}
.app-topbar__brand:hover { opacity: 0.8; color: var(--text); }
.app-topbar__brand img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex-shrink: 0;
}
.app-topbar__brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-topbar__user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
    min-width: 0;
}
.app-topbar__user > div {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-topbar__avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.app-content {
    flex: 1 1 auto;
    padding: 1.5rem;
    max-width: 100%;
    overflow-x: hidden;
}

/* ==========================================================================
   Estado: sidebar colapsada (desktop) — apenas ícones
   ========================================================================== */
@media (min-width: 992px) {
    .app-shell--collapsed .app-sidebar {
        width: var(--sidebar-width-collapsed);
    }
    .app-shell--collapsed .app-sidebar__brand {
        padding: 1.25rem 0.5rem;
    }
    .app-shell--collapsed .app-sidebar__brand img {
        width: 36px; height: 36px;
    }
    .app-shell--collapsed .app-sidebar__nav {
        padding: 1rem 0.5rem;
    }
    .app-shell--collapsed .app-sidebar__item {
        justify-content: center;
        padding: 0.8rem 0;
    }
    .app-shell--collapsed .app-sidebar__item span {
        opacity: 0;
        width: 0;
        flex: 0;
        margin: 0;
        padding: 0;
        pointer-events: none;
    }
    /* Tooltip ao passar o mouse */
    .app-shell--collapsed .app-sidebar__item:hover::after {
        content: attr(data-label);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%);
        background: #1e293b;
        color: #f8fafc;
        padding: 0.4rem 0.7rem;
        border-radius: var(--radius-sm);
        font-size: 0.8rem;
        font-weight: 500;
        white-space: nowrap;
        box-shadow: var(--shadow);
        z-index: 1050;
        pointer-events: none;
    }
    .app-shell--collapsed .app-sidebar__section,
    .app-shell--collapsed .app-sidebar__footer {
        opacity: 0;
        padding: 0;
        height: 0;
        overflow: hidden;
    }
    .app-shell--collapsed .app-main {
        margin-left: var(--sidebar-width-collapsed);
    }
}

/* ==========================================================================
   Mobile (< 992px): sidebar vira off-canvas
   ========================================================================== */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);   /* sempre largura completa em mobile */
    }
    .app-sidebar.is-open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .app-content {
        padding: 1rem;
    }
}

/* Telas muito pequenas — ajustes finos */
@media (max-width: 575.98px) {
    .app-topbar {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }
    .app-topbar__user > div {
        display: none !important;     /* esconde nome/cargo, mantém só o avatar */
    }
    .app-topbar__brand-text {
        display: none;                /* em telas pequenas mostra só a logo */
    }
    .app-topbar__brand img {
        width: 32px; height: 32px;
    }
    .app-content {
        padding: 0.75rem;
    }
}

/* ==========================================================================
   Componentes — cards, inputs, botões
   ========================================================================== */

/* Card base */
.card,
.surface-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.surface-card {
    padding: 1.25rem;
}

/* Botões — refinamento Bootstrap */
.btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}
.btn-success {
    background-color: var(--success);
    border-color: var(--success);
}

.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-strong);
    padding: 0.6rem 0.8rem;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(13 148 136 / 0.15);
}

/* Modal — refino */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   Tela de login / cadastro
   ========================================================================== */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 20% 20%, rgb(13 148 136 / 0.18) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgb(99 102 241 / 0.12) 0%, transparent 50%),
        linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.auth-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 980px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth-card__brand {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    color: white;
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.auth-card__brand img {
    width: 120px;
    margin-bottom: 1.5rem;
    filter: brightness(0) invert(1);
}
.auth-card__brand h2 {
    color: white;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.auth-card__brand p {
    color: rgb(255 255 255 / 0.85);
    margin: 0;
    font-size: 0.95rem;
}

.auth-card__form {
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-card__form h3 {
    margin-bottom: 0.4rem;
}
.auth-card__form .text-muted {
    color: var(--text-muted) !important;
    margin-bottom: 1.5rem;
}

@media (max-width: 767.98px) {
    .auth-card {
        grid-template-columns: 1fr;
    }
    .auth-card__brand {
        padding: 2rem 1.5rem;
    }
    .auth-card__brand img { width: 80px; margin-bottom: 1rem; }
    .auth-card__form {
        padding: 2rem 1.5rem;
    }
}

/* ---------- Variante "single" — card único centralizado ---------- */
.auth-card--single {
    display: block;
    max-width: 440px;
}
.auth-card--single .auth-card__body {
    padding: 3rem 2.5rem;
    text-align: center;
}
.auth-logo {
    margin: 0 auto 2rem;
}
.auth-logo img {
    width: 160px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

@media (max-width: 575.98px) {
    .auth-card--single .auth-card__body {
        padding: 2.25rem 1.5rem;
    }
    .auth-logo img { width: 130px; }
}

/* ==========================================================================
   Página de Ponto — cards de horários (estilizados via JS)
   ==========================================================================
   Os cards são gerados em ponto.js com a estrutura:
     <div class="row ... " id="hora_XXX_div" style="background-color:#cor;">
       <strong>(badge opcional: 'Você está atrasado!', 'Em análise', etc.)</strong>
       <div class="row col-X">
         <h6>Label do horário</h6>
         <strong>HH:MM</strong>
       </div>
       <button id="hora_XXX_bt" ...>(ícone)</button>
     </div>
   Aplicamos overrides via CSS para padronizar o visual.
   --------------------------------------------------------------------------*/

#escaladiv {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0 !important;
    max-width: 100%;
}

/* ----- Card base (todos os horários) -----
   Estrutura gerada pelo JS pode ter 1 ou 2 .row filhas:
     - 1 row : info simples  (Entrada / 08:00)
     - 2 rows: badge superior + info  ("Você está atrasado" / Entrada / 08:00)
   Usamos CSS Grid com 2 colunas (ícone | conteúdo) e 2 linhas
   (badge | info), reservando uma 3ª coluna para o botão de ação.
   --------------------------------------------------------------------------*/
#escaladiv > div[id^="hora_"][id$="div"] {
    --status-color: var(--border-strong);
    --status-soft:  #f1f5f9;

    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-left: 4px solid var(--status-color) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
    padding: 1.1rem 1.25rem !important;
    margin: 0 !important;
    display: grid !important;
    grid-template-columns: 48px 1fr auto;
    grid-template-areas:
        "icon badge action"
        "icon info  action";
    align-items: center;
    column-gap: 1rem !important;
    row-gap: 0.3rem !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
    min-height: 92px;
}
/* Quando NÃO há badge (uma só .row), info e ícone centralizam na linha do meio */
#escaladiv > div[id^="hora_"][id$="div"]:not(:has(> .row + .row)) {
    grid-template-areas:
        "icon info action"
        "icon info action";
}
#escaladiv > div[id^="hora_"][id$="div"]:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow) !important;
}

/* Ícone de status (à esquerda, ocupa as duas linhas verticalmente) */
#escaladiv > div[id^="hora_"][id$="div"]::before {
    content: "\F293";                           /* bi-clock-history */
    grid-area: icon;
    align-self: center;
    justify-self: center;
    font-family: "bootstrap-icons";
    font-size: 1.4rem;
    width: 48px; height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--status-soft);
    color: var(--status-color);
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

/* ===== BADGE (primeira .row quando há 2 filhas) ===== */
#escaladiv > div[id^="hora_"][id$="div"] > .row:first-of-type:not(:last-of-type) {
    grid-area: badge;
    display: inline-flex !important;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    max-width: 100%;
    min-width: 0;
    align-self: end;
}
/* Pílula em si — <strong> dentro da badge */
#escaladiv > div[id^="hora_"][id$="div"] > .row:first-of-type:not(:last-of-type) strong {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    line-height: 1.1;
    color: var(--status-color) !important;
    background: var(--status-soft) !important;
    padding: 0.3rem 0.7rem !important;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 !important;
    width: auto;
    max-width: 100%;
    white-space: normal;
}

/* ===== INFO (última .row — sempre tem o horário) ===== */
#escaladiv > div[id^="hora_"][id$="div"] > .row:last-of-type {
    grid-area: info;
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    min-width: 0;
    gap: 0.15rem;
    align-self: start;
}
#escaladiv > div[id^="hora_"][id$="div"] h6 {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin: 0 !important;
    padding: 0 !important;
}
#escaladiv > div[id^="hora_"][id$="div"] > .row:last-of-type > strong {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
/* Linha de horários riscado / novo (ex.: solicitação de mudança) */
#escaladiv > div[id^="hora_"][id$="div"] > .row:last-of-type > .row {
    display: flex !important;
    flex-direction: row;
    align-items: baseline;
    gap: 0.6rem;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
}
#escaladiv > div[id^="hora_"][id$="div"] s strong {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
}

/* ===== Botão de ação à direita ===== */
#escaladiv button[id^="hora_"][id$="bt"] {
    grid-area: action;
    width: 56px !important;
    height: 56px !important;
    flex-shrink: 0;
    border-radius: 50% !important;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
    color: white;
    margin: 0 !important;
    padding: 0 !important;
}
#escaladiv button[id^="hora_"][id$="bt"]:hover {
    transform: scale(1.06);
}
#escaladiv button[id^="hora_"][id$="bt"]:active {
    transform: scale(0.95);
}
#escaladiv button.btn-success[id^="hora_"][id$="bt"] {
    background: var(--success) !important;
    box-shadow: 0 4px 12px rgb(22 163 74 / 0.3);
}
#escaladiv button.btn-success[id^="hora_"][id$="bt"]:hover {
    background: #15803d !important;
}
#escaladiv button[id^="hora_"][id$="bt"]:not(.btn-success) {
    background: rgb(13 148 136 / 0.12) !important;
    color: var(--primary) !important;
}
#escaladiv button[id^="hora_"][id$="bt"]:not(.btn-success):hover {
    background: rgb(13 148 136 / 0.22) !important;
}

/* ===== Estados / cores via background-color inline herdado do JS ===== */

/* Pendente de análise (#E9F558) */
#escaladiv > div[id^="hora_"][id$="div"][style*="E9F558"] {
    --status-color: #b45309;
    --status-soft:  #fef3c7;
    background: linear-gradient(90deg, #fef3c7 0%, var(--surface) 40%) !important;
}
#escaladiv > div[id^="hora_"][id$="div"][style*="E9F558"]::before {
    content: "\F33B";    /* bi-hourglass-split */
}

/* Aprovado / marcado OK (#8eb370) */
#escaladiv > div[id^="hora_"][id$="div"][style*="8eb370"] {
    --status-color: #15803d;
    --status-soft:  #dcfce7;
    background: linear-gradient(90deg, #dcfce7 0%, var(--surface) 40%) !important;
}
#escaladiv > div[id^="hora_"][id$="div"][style*="8eb370"]::before {
    content: "\F26B";    /* bi-check-circle-fill */
}

/* ====== ATRASO / FALTA MARCAR (#ff6b7a) — ALERTA COM PULSAR ====== */
#escaladiv > div[id^="hora_"][id$="div"][style*="ff6b7a"] {
    --status-color: #b91c1c;
    --status-soft:  #fecaca;
    background: linear-gradient(90deg, #fecaca 0%, #fef2f2 50%, var(--surface) 100%) !important;
    border: 1px solid #fca5a5 !important;
    border-left: 4px solid #dc2626 !important;
    animation: alert-pulse 2s ease-in-out infinite;
}
#escaladiv > div[id^="hora_"][id$="div"][style*="ff6b7a"]::before {
    content: "\F33A";    /* bi-exclamation-triangle-fill */
    color: white;
    background: #dc2626;
    animation: alert-icon-pulse 1.5s ease-in-out infinite;
}
#escaladiv > div[id^="hora_"][id$="div"][style*="ff6b7a"] strong {
    color: #7f1d1d;
}
#escaladiv > div[id^="hora_"][id$="div"][style*="ff6b7a"] button[id^="hora_"][id$="bt"] {
    background: #dc2626 !important;
    box-shadow: 0 4px 14px rgb(220 38 38 / 0.4);
    color: white !important;
}
#escaladiv > div[id^="hora_"][id$="div"][style*="ff6b7a"] button[id^="hora_"][id$="bt"]:hover {
    background: #b91c1c !important;
}

@keyframes alert-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgb(220 38 38 / 0), var(--shadow-sm);
    }
    50% {
        box-shadow: 0 0 0 6px rgb(220 38 38 / 0.1), 0 4px 12px rgb(220 38 38 / 0.15);
    }
}
@keyframes alert-icon-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}

/* Linha "Entrada registrada com atraso" (firebrick) — manter visual de alerta */
#escaladiv > div[id^="hora_"][id$="div"] strong[style*="firebrick"] {
    color: #b91c1c !important;
    font-size: 1.15rem !important;
}

/* ==========================================================================
   Card "Sem escalas para esta data"
   ========================================================================== */
.sem-escala {
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--text);
}
.sem-escala__icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}
.sem-escala__title {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
}
.sem-escala__subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}
.sem-escala__dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    margin: 0 0.2rem;
    vertical-align: middle;
}

@media (max-width: 575.98px) {
    .sem-escala { padding: 1.5rem 1rem; }
    .sem-escala__icon { width: 56px; height: 56px; font-size: 1.5rem; }
    .sem-escala__title { font-size: 0.98rem; }
    .sem-escala__subtitle { font-size: 0.82rem; }
}

/* ==========================================================================
   Calendário Flatpickr — dias com escala marcados
   ========================================================================== */

/* Visual geral do flatpickr — encaixa com o tema do app */
.flatpickr-calendar {
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    font-family: 'Inter', sans-serif;
}
.flatpickr-day {
    border-radius: var(--radius-sm);
    font-weight: 500;
}
.flatpickr-day.today {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 700;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--primary);
    border-color: var(--primary);
}
.flatpickr-day.selected.today { color: white; }

/* Dia com escala — marcador (bolinha) abaixo do número */
.flatpickr-day.has-escala {
    position: relative;
    font-weight: 600;
}
.flatpickr-day.has-escala::after {
    content: "";
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 2px var(--surface);
}
.flatpickr-day.has-escala.selected::after {
    background: white;
    box-shadow: 0 0 0 2px var(--primary);
}
.flatpickr-day.has-escala:not(.selected):not(.today) {
    background: rgb(13 148 136 / 0.06);
}
.flatpickr-day.has-escala:not(.selected):not(.today):hover {
    background: rgb(13 148 136 / 0.12);
}

/* Input "alt" (visual) do flatpickr — herda visual do .form-control */
.flatpickr-alt-input.form-control {
    background: var(--surface);
    cursor: pointer;
}

/* Container do datepicker no mobile fica menor */
@media (max-width: 575.98px) {
    .flatpickr-calendar { font-size: 0.9rem; }
}

/* ===== Modo somente leitura: data selecionada != hoje =====
   Bloqueia visualmente os botões de marcar/ajustar.
   ============================================================ */
#escaladiv.escala-readonly button[id^="hora_"][id$="bt"] {
    display: none !important;
}
/* Cards ficam mais discretos quando não é o dia atual */
#escaladiv.escala-readonly > div[id^="hora_"][id$="div"] {
    opacity: 0.92;
    grid-template-columns: 48px 1fr;   /* sem coluna de ação */
}

/* Banner indicando que a data não é hoje */
#escaladiv.escala-readonly::before {
    content: "\F299  Você está consultando outra data. A marcação e o ajuste só são permitidos no dia atual.";
    font-family: "bootstrap-icons", "Inter", sans-serif;
    font-size: 0.85rem;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.9rem;
    display: block;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

/* ===== Responsividade dos cards ===== */
@media (max-width: 575.98px) {
    #escaladiv > div[id^="hora_"][id$="div"] {
        padding: 0.95rem !important;
        column-gap: 0.75rem !important;
        row-gap: 0.25rem !important;
        grid-template-columns: 40px 1fr auto;
        min-height: 84px;
    }
    #escaladiv.escala-readonly > div[id^="hora_"][id$="div"] {
        grid-template-columns: 40px 1fr;
    }
    #escaladiv.escala-readonly::before {
        font-size: 0.8rem;
        padding: 0.55rem 0.75rem;
    }
    #escaladiv > div[id^="hora_"][id$="div"]::before {
        width: 40px; height: 40px;
        font-size: 1.15rem;
    }
    #escaladiv > div[id^="hora_"][id$="div"] > .row:last-of-type > strong {
        font-size: 1.4rem;
    }
    #escaladiv > div[id^="hora_"][id$="div"] h6 {
        font-size: 0.66rem;
    }
    #escaladiv > div[id^="hora_"][id$="div"] > .row:first-of-type:not(:last-of-type) strong {
        font-size: 0.66rem !important;
        padding: 0.25rem 0.55rem !important;
    }
    #escaladiv button[id^="hora_"][id$="bt"] {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.1rem;
    }
}

/* Header de "Registro de ponto" */
.ponto-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.ponto-header h3 {
    margin: 0;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.ponto-header h3 i { color: var(--primary); }
.ponto-header input[type="date"] {
    max-width: 220px;
    margin-left: auto;
}

/* Mobile: empilha verticalmente e ocupa 100% */
@media (max-width: 575.98px) {
    .ponto-header {
        padding: 1rem;
    }
    .ponto-header h3 {
        width: 100%;
        font-size: 1rem;
    }
    .ponto-header input[type="date"] {
        max-width: 100%;
        width: 100%;
        margin-left: 0;
    }
}

/* ==========================================================================
   Modal #geoModal — usado tanto para loading quanto para erros de GPS
   ========================================================================== */

/* Mantém visual coerente com o modal de aviso */
.geo-modal .modal-content {
    border: none;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.geo-modal .modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
}
.geo-modal .modal-title {
    font-weight: 600;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    min-width: 0;
}
.geo-modal .modal-body  { padding: 1.25rem; }
.geo-modal .modal-footer{ border-top: 1px solid var(--border); padding: 0.75rem 1.25rem; }

/* ----- Loader (estado "Verificando localização") ----- */
.geo-loader {
    text-align: center;
    padding: 0.5rem 0;
}
.geo-loader__radar {
    position: relative;
    width: 88px;
    height: 88px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: rgb(13 148 136 / 0.12);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.1rem;
}
.geo-loader__radar i { position: relative; z-index: 2; }
.geo-loader__radar::before,
.geo-loader__radar::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
    animation: geo-radar 2s ease-out infinite;
}
.geo-loader__radar::after { animation-delay: 1s; }

@keyframes geo-radar {
    0%   { transform: scale(0.85); opacity: 0.7; }
    100% { transform: scale(2);    opacity: 0;   }
}

.geo-loader__text {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin: 0;
    line-height: 1.45;
}
/* Reticências animadas */
.geo-loader__text::after {
    content: "";
    display: inline-block;
    width: 4px; height: 4px;
    background: currentColor;
    border-radius: 50%;
    margin-left: 4px;
    box-shadow: 8px 0 0 currentColor, 16px 0 0 currentColor;
    animation: dot-fade 1.4s linear infinite;
    vertical-align: middle;
    opacity: 0.3;
}
@keyframes dot-fade {
    0%, 100% { opacity: 0.2; }
    50%      { opacity: 0.9; }
}

/* ==========================================================================
   Dicas de GPS (modal "Sinal de GPS fraco") — versão compacta mobile-first
   ========================================================================== */
.dicas-gps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.dicas-gps li {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    line-height: 1.35;
    color: var(--text);
}
.dicas-gps li > i {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgb(13 148 136 / 0.12);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}
.dicas-gps li > span {
    flex: 1;
    min-width: 0;
}

@media (max-width: 575.98px) {
    .dicas-gps li     { padding: 0.5rem 0.65rem; font-size: 0.85rem; }
    .dicas-gps li > i { width: 28px; height: 28px; font-size: 0.85rem; }
}

/* Comparativo de distância no modal "Fora da área" */
.dist-box {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}
.dist-box__item       { text-align: center; min-width: 0; }
.dist-box__label      {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.dist-box__value      {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.dist-box__value--danger { color: #dc2626; }
.dist-box__sep        {
    color: var(--text-muted);
    font-size: 1.25rem;
}

@media (max-width: 419.98px) {
    .dist-box { grid-template-columns: 1fr; }
    .dist-box__sep {
        transform: rotate(90deg);
        margin: 0;
    }
}

/* Modal de aviso — visual mais limpo */
.aviso-modal .modal-content {
    border-radius: var(--radius);
    overflow: hidden;
}
.aviso-modal .modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
}
.aviso-modal .modal-title {
    font-weight: 600;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
}
.aviso-modal .modal-body {
    padding: 1.25rem;
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.5;
}
.aviso-modal .modal-body p:last-child  { margin-bottom: 0; }
.aviso-modal .modal-footer {
    border-top: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
}

/* Loader bonito */
.loader {
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
}
@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Utilitários
   ========================================================================== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Garante que classes legadas do Bootstrap 4 (fe-*) não quebrem layout */
i.fe::before {
    content: "•";
}
i.fe-clock::before { content: "🕐"; }
i.fe-edit::before { content: "✎"; }
i.fe-check::before { content: "✓"; }
i.fe-alert-triangle::before { content: "⚠"; }
i.fe-x::before { content: "✕"; }
