:root {
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #162033;
    --muted: #657188;
    --line: #dfe6ef;
    --primary: #173f67;
    --primary-strong: #102f4f;
    --accent: #0f8b75;
    --accent-soft: #e9f7f3;
    --warning: #a35a00;
    --warning-soft: #fff4df;
    --danger: #a33a3a;
    --danger-soft: #fff0f0;
    --shadow: 0 18px 55px rgba(30, 48, 74, .09);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 3px solid rgba(15, 139, 117, .28);
    outline-offset: 3px;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
    background: var(--surface);
}
.auth-brand {
    padding: clamp(42px, 7vw, 100px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: white;
    background:
        radial-gradient(circle at 14% 14%, rgba(35, 193, 163, .35), transparent 28%),
        linear-gradient(145deg, #102f4f 0%, #173f67 52%, #0f6d68 115%);
}
.brand-mark { display: flex; gap: 14px; align-items: center; font-weight: 850; letter-spacing: -.02em; }
.brand-icon {
    width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
    background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.22); font-size: 22px;
}
.auth-copy { max-width: 680px; }
.auth-copy .eyebrow, .eyebrow { font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .14em; }
.auth-copy .eyebrow { color: #a9eadc; }
.auth-copy h1 { margin: 16px 0 20px; font-size: clamp(42px, 5vw, 72px); line-height: .98; letter-spacing: -.055em; }
.auth-copy p { max-width: 620px; margin: 0; color: rgba(255,255,255,.78); font-size: 18px; line-height: 1.7; }
.auth-foot { color: rgba(255,255,255,.58); font-size: 13px; }
.auth-panel { display: grid; place-items: center; padding: 32px; background: #fbfcfe; }
.auth-card { width: min(440px, 100%); }
.auth-card h2 { margin: 10px 0 8px; font-size: 32px; letter-spacing: -.035em; }
.auth-card > p { margin: 0 0 30px; color: var(--muted); line-height: 1.55; }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 780; color: #344159; }
.field input, .field select, .field textarea, .search-box input {
    width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text);
    border-radius: 13px; padding: 13px 14px; outline: none; transition: border-color .18s, box-shadow .18s;
}
.field textarea { min-height: 100px; resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus, .search-box input:focus {
    border-color: #76a7bf; box-shadow: 0 0 0 4px rgba(23, 63, 103, .08);
}
.field-note { margin-top: -2px; color: var(--muted); font-size: 12px; }

.btn {
    border: 0; border-radius: 12px; min-height: 44px; padding: 10px 16px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
    font-weight: 800; transition: transform .12s, box-shadow .12s, background .12s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { color: white; background: var(--primary); box-shadow: 0 8px 22px rgba(23,63,103,.18); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-accent { color: white; background: var(--accent); }
.btn-soft { color: var(--primary); background: #edf3f8; }
.btn-warning { color: #754000; background: var(--warning-soft); }
.btn-danger-soft { color: #8a3030; background: var(--danger-soft); }
.btn-block { width: 100%; }

.alert { border-radius: 13px; padding: 12px 14px; margin: 0 0 18px; font-size: 14px; line-height: 1.45; }
.alert-error { color: #812e2e; background: var(--danger-soft); border: 1px solid #f0caca; }
.alert-success { color: #126453; background: var(--accent-soft); border: 1px solid #c8e9df; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar {
    background: #102f4f; color: white; padding: 26px 18px; display: flex; flex-direction: column; min-height: 100vh;
    position: sticky; top: 0; height: 100vh;
}
.sidebar .brand-mark { padding: 4px 8px 26px; }
.nav-label { padding: 16px 10px 8px; color: #8fb3ca; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .14em; }
.nav-item { display: block; padding: 11px 12px; border-radius: 10px; text-decoration: none; color: #d9e6ef; font-size: 14px; font-weight: 720; }
.nav-item.active { background: rgba(255,255,255,.11); color: white; }
.sidebar-footer { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-user { font-size: 13px; line-height: 1.45; }
.sidebar-user small { color: #95b4c8; display: block; }
.logout-form { margin-top: 12px; }
.logout-form button { width: 100%; border: 1px solid rgba(255,255,255,.18); background: transparent; color: white; }

.workspace { min-width: 0; padding: 34px clamp(22px, 4vw, 54px) 60px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 28px; }
.topbar .eyebrow { color: var(--accent); }
.topbar h1 { margin: 6px 0 6px; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.045em; }
.topbar p { margin: 0; color: var(--muted); }
.date-chip { white-space: nowrap; background: white; border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; color: #45546d; font-size: 13px; font-weight: 750; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.search-panel { padding: 22px; }
.search-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 14px; }
.search-head h2 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.search-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.search-box { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-box input { min-height: 48px; }

.results { margin-top: 18px; display: grid; gap: 12px; }
.student-card { border: 1px solid var(--line); border-radius: 15px; padding: 16px; background: var(--surface); }
.student-main { display: flex; justify-content: space-between; gap: 22px; align-items: flex-start; }
.student-name { font-size: 17px; font-weight: 850; letter-spacing: -.018em; }
.student-meta { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: 13px; }
.student-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.student-actions .btn { min-height: 38px; padding: 8px 11px; font-size: 12px; }

.empty-state { padding: 34px 20px; text-align: center; color: var(--muted); border: 1px dashed #cfd9e5; border-radius: 14px; }

.operation-panel { margin-top: 22px; overflow: hidden; }
.operation-head { padding: 20px 22px; color: white; background: linear-gradient(120deg, #173f67, #176a74); }
.operation-head .eyebrow { color: #a8e9dc; }
.operation-head h2 { margin: 7px 0 4px; font-size: 24px; letter-spacing: -.03em; }
.operation-head p { margin: 0; color: rgba(255,255,255,.76); font-size: 13px; }
.operation-body { padding: 22px; }
.student-summary { padding: 14px; border-radius: 13px; background: var(--surface-soft); border: 1px solid var(--line); margin-bottom: 20px; }
.student-summary strong { display: block; font-size: 16px; }
.student-summary span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.operation-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.metric-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.metric-card strong { display: block; margin-top: 6px; font-size: 30px; letter-spacing: -.04em; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.spaced-panel { margin-top: 20px; }
.form-panel, .table-panel { padding: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.panel-head .eyebrow { color: var(--accent); }
.panel-head h2 { margin: 5px 0 0; font-size: 21px; letter-spacing: -.025em; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.csv-help { margin: -2px 0 16px; padding: 12px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 12px; text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
td { padding: 13px 12px; border-bottom: 1px solid #edf1f6; vertical-align: top; }
td small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.4; }
.muted-cell { text-align: center; color: var(--muted); padding: 28px; }
.table-link { color: var(--primary); font-weight: 780; }
.normal-weight { font-weight: 600; }
.detail-list { display: grid; gap: 0; }
.detail-list > div { padding: 12px 0; border-bottom: 1px solid #edf1f6; }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list span, .detail-list small { display: block; color: var(--muted); font-size: 12px; }
.detail-list strong { display: block; margin-top: 3px; }
.status-pill { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; background: #edf3f8; color: #3e536a; }
.status-pending_teacher_confirmation { background: var(--warning-soft); color: #7d4a08; }
.status-confirmed { background: var(--accent-soft); color: #126453; }
.status-dismissed { background: var(--danger-soft); color: #812e2e; }
.status-justified { background: #eef0ff; color: #4b4b96; }
.teacher-queue { display: grid; gap: 16px; }
.teacher-card { overflow: hidden; }
.teacher-card-head { padding: 20px 22px; display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.teacher-card-head h2 { margin: 9px 0 4px; font-size: 21px; }
.teacher-card-head p { margin: 0; color: var(--muted); font-size: 13px; }
.occurrence-time { text-align: right; }
.occurrence-time strong, .occurrence-time span { display: block; }
.occurrence-time span { margin-top: 4px; font-size: 20px; font-weight: 850; color: var(--primary); }
.teacher-card-body { padding: 20px 22px; display: grid; grid-template-columns: minmax(0, .75fr) minmax(360px, 1.25fr); gap: 22px; }
.reason-box { padding: 15px; border-radius: 13px; background: var(--surface-soft); border: 1px solid var(--line); }
.reason-box span, .reason-box small { display: block; color: var(--muted); font-size: 12px; }
.reason-box strong { display: block; margin: 6px 0; line-height: 1.5; }
.decision-form .field { margin: 0; }
.decision-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

.security-note { margin-top: 20px; color: var(--muted); font-size: 12px; line-height: 1.6; }

@media (max-width: 1100px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .teacher-card-body { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-brand { min-height: 340px; padding: 42px 28px; }
    .auth-copy h1 { font-size: 48px; }
    .auth-panel { padding: 42px 22px; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: sticky;
        top: 0;
        z-index: 60;
        height: auto;
        min-height: auto;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        box-shadow: 0 8px 28px rgba(8, 31, 51, .18);
    }
    .sidebar .brand-mark { padding: 0; }
    .sidebar .brand-icon { width: 38px; height: 38px; border-radius: 11px; font-size: 18px; }
    .sidebar nav {
        grid-column: 1 / -1;
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 2px 0 1px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar nav::-webkit-scrollbar { display: none; }
    .sidebar .nav-label { display: none; }
    .sidebar .nav-item {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 8px 10px;
        font-size: 12px;
        background: rgba(255,255,255,.06);
    }
    .sidebar .nav-item.active { background: rgba(255,255,255,.16); }
    .sidebar-footer { margin: 0; padding: 0; border: 0; display: flex; gap: 8px; align-items: center; }
    .sidebar-user small { display: none; }
    .logout-form { margin: 0; }
    .logout-form button { width: auto; min-height: 38px; padding: 7px 11px; }
    .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .workspace { padding: 24px 14px 46px; }
    .topbar { flex-direction: column; gap: 12px; }
    .search-box { grid-template-columns: 1fr; }
    .student-main { flex-direction: column; }
    .student-actions { justify-content: flex-start; }
    .form-grid, .three-columns { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .operation-actions, .decision-actions { flex-direction: column-reverse; }
    .operation-actions .btn, .decision-actions .btn { width: 100%; }
    .sidebar-user { display: none; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .teacher-card-head { flex-direction: column; }
    .occurrence-time { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}


/* Fluxo coeso entre criação e acompanhamento de comprovantes */
.document-flow-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(30, 48, 74, .05);
}
.document-flow-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 10px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 850;
    text-decoration: none;
}
.document-flow-tab:hover { background: #edf3f8; }
.document-flow-tab.active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 7px 18px rgba(23,63,103,.16);
}
@media (max-width: 620px) {
    .document-flow-tabs { display: grid; grid-template-columns: 1fr; }
    .document-flow-tab { width: 100%; }
}
