:root {
    --bg: #0b1220;
    --surface: #131c31;
    --surface-2: #1b2844;
    --border: rgba(148, 163, 184, 0.16);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 16px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif;
    min-height: 100%;
    overscroll-behavior-y: none;
}

.hidden { display: none !important; }

/* ---------- LOGIN ---------- */
.login-screen {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px 18px;
    max-width: 430px;
    margin: 0 auto;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 28px 22px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.4);
}

.brand-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
}

.login-card h1 {
    margin: 0 0 6px;
    text-align: center;
    font-size: 1.4rem;
}

.login-card p.sub {
    margin: 0 0 22px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.field {
    margin-bottom: 14px;
}

.field label {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.field input, .field select, .field textarea {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #0d1526;
    color: var(--text);
    font-size: 1rem;
    outline: none;
}

.field input:focus, .field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ---------- BOTÕES ---------- */
.btn {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.12s ease, opacity 0.15s ease, background 0.15s ease;
    color: #fff;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.btn-success { background: linear-gradient(135deg, #059669, #10b981); }
.btn-warning { background: linear-gradient(135deg, #d97706, #f59e0b); color: #0f172a; }
.btn-danger { background: linear-gradient(135deg, #dc2626, #ef4444); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: 8px 12px; font-size: 0.82rem; border-radius: 10px; width: auto; }

/* ---------- LAYOUT APP ---------- */
.app-shell {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100dvh;
    padding-bottom: 84px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(11, 18, 32, 0.92);
    backdrop-filter: blur(10px);
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.topbar-title {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
}

.topbar-sub {
    font-size: 0.78rem;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
}

.badge-ok { background: rgba(16, 185, 129, 0.16); color: #34d399; }
.badge-warn { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.badge-err { background: rgba(239, 68, 68, 0.16); color: #f87171; }
.badge-info { background: rgba(59, 130, 246, 0.16); color: #60a5fa; }

.page { padding: 14px 14px 24px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ---------- RELÓGIO ---------- */
.clock-card {
    text-align: center;
    background: linear-gradient(160deg, #16233f 0%, #0f172a 100%);
    padding: 20px 16px;
}

.clock-date {
    font-size: 0.9rem;
    color: #93c5fd;
    text-transform: capitalize;
    margin-bottom: 4px;
}

.clock-time {
    font-size: 2.85rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    line-height: 1.05;
}

.gps-bar {
    margin-top: 12px;
    padding: 9px 12px;
    background: rgba(11, 18, 32, 0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--muted);
    text-align: left;
}

/* ---------- SELETOR DE TIPO DE BATIDA ---------- */
.tipo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.tipo-btn {
    border: 1px solid var(--border);
    background: #0d1526;
    color: var(--muted);
    padding: 11px 8px;
    border-radius: 12px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}

.tipo-btn.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.actions-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---------- LISTA DE BATIDAS DO DIA ---------- */
.punch-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.punch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0d1526;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 12px;
    gap: 10px;
}

.punch-time {
    font-size: 1.15rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.punch-meta {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 2px;
}

/* ---------- MODAL CÂMERA FACIAL ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(5, 10, 20, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-box {
    width: 100%;
    max-width: 430px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px;
}

.camera-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 55dvh;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    margin: 12px 0;
}

.camera-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.face-oval {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.face-oval::after {
    content: "";
    width: 66%;
    height: 70%;
    border: 3px dashed rgba(56, 189, 248, 0.85);
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.camera-status {
    text-align: center;
    font-size: 0.86rem;
    color: #93c5fd;
    min-height: 22px;
    margin-bottom: 12px;
}

/* ---------- ESPELHO ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.kpi-box {
    background: #0d1526;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px;
}

.kpi-label { font-size: 0.72rem; color: var(--muted); }
.kpi-val { font-size: 1.2rem; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }

.day-row {
    background: #0d1526;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.day-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.88rem;
}

.day-times {
    font-size: 0.8rem;
    color: #cbd5e1;
    margin: 5px 0;
}

.day-foot {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--muted);
}

/* ---------- NAV INFERIOR ---------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    z-index: 30;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
}

.nav-btn.active { color: #60a5fa; }

/* ---------- TOAST ---------- */
.toast {
    position: fixed;
    top: calc(56px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    max-width: 92vw;
    width: 400px;
    padding: 13px 16px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.2s ease;
}

.toast-ok { background: #065f46; border: 1px solid #10b981; color: #ecfdf5; }
.toast-err { background: #7f1d1d; border: 1px solid #ef4444; color: #fef2f2; }
.toast-info { background: #1e3a8a; border: 1px solid #3b82f6; color: #eff6ff; }

@keyframes slideDown {
    from { opacity: 0; transform: translate(-50%, -12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.tipo-btn:disabled {
    opacity: 0.28;
    cursor: not-allowed;
    text-decoration: line-through;
    filter: grayscale(1);
}

.tipo-btn.extra-mode.active {
    background: rgba(245, 158, 11, 0.22);
    border-color: #f59e0b;
    color: #fef3c7;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
}

.extra-banner {
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fde68a;
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 0.8rem;
    margin-bottom: 10px;
}
