:root {
    color-scheme: light dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
    --ink: light-dark(#17221f, #eaf1ee);
    --muted: light-dark(#67736f, #9caaa5);
    --canvas: light-dark(#f3f3ef, #101513);
    --surface: light-dark(#fff, #18201d);
    --surface-2: light-dark(#e9ece7, #222c28);
    --line: light-dark(#d8ddd9, #33413c);
    --green: #258d76;
    --green-soft: light-dark(#dceee8, #173a31);
    --blue: #477c99;
    --orange: #d1764f;
    --amber: #bd8735;
    --violet: #7567a8;
    --red: #b9574f;
    --cyan: #3f8f9b;
    --shadow: 0 18px 48px light-dark(rgb(34 52 46 / 8%), rgb(0 0 0 / 20%));
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { color: inherit; font: inherit; }
button, .primary-action { border: 0; border-radius: .65rem; background: var(--green); color: white; padding: .72rem 1rem; font-weight: 750; cursor: pointer; text-decoration: none; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 245px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 1.4rem; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; gap: .75rem; align-items: center; color: inherit; text-decoration: none; margin-bottom: 2.7rem; }
.brand-mark { width: 2.5rem; aspect-ratio: 1; border-radius: .7rem; display: grid; place-items: center; color: white; background: var(--green); font-weight: 900; font-size: 1.2rem; }
.brand strong, .brand small { display: block; }.brand small { color: var(--muted); margin-top: .1rem; }
nav { display: grid; gap: .35rem; }
nav a { display: flex; align-items: center; gap: .8rem; padding: .8rem; border-radius: .65rem; color: var(--muted); text-decoration: none; font-weight: 700; }
nav a span { font-size: .68rem; opacity: .65; } nav a b { margin-left: auto; min-width: 1.4rem; padding: .15rem .4rem; border-radius: 99px; text-align: center; color: white; background: var(--orange); font-size: .7rem; }
nav a:hover, nav a.active { color: var(--ink); background: var(--surface-2); } nav a.active span { color: var(--green); opacity: 1; }
.sidebar-foot { margin-top: auto; color: var(--muted); }.sidebar-foot form { margin-top: .6rem; }.text-button { padding: 0; color: var(--muted); background: transparent; font-weight: 650; }
.content { width: min(1260px, 100%); margin: 0 auto; padding: 2.4rem clamp(1rem, 4vw, 3.5rem) 5rem; min-width: 0; }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 1.8rem; }
.eyebrow { margin: 0 0 .45rem; color: var(--green); font-size: .7rem; letter-spacing: .14em; font-weight: 850; }
h1, h2 { letter-spacing: -.035em; } h1 { margin: 0; font-size: clamp(2.3rem, 5vw, 4.5rem); line-height: .95; } h2 { margin: 0; font-size: 1.3rem; }
.page-header p:last-child, .muted { color: var(--muted); }.page-header p:last-child { margin: .7rem 0 0; }
.notice { margin-bottom: 1rem; border: 1px solid color-mix(in srgb, var(--green) 35%, var(--line)); border-left: 4px solid var(--green); border-radius: .65rem; padding: .85rem 1rem; background: var(--green-soft); }
.notice-error { border-color: color-mix(in srgb, var(--orange) 50%, var(--line)); border-left-color: var(--orange); background: color-mix(in srgb, var(--orange) 11%, var(--surface)); }.notice-warning { border-left-color: var(--amber); }
.panel, .metrics article, .filter-bar, .upload-card, .process-steps, .empty-state, .approval-form { border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); box-shadow: var(--shadow); }
.filter-bar { display: flex; align-items: end; gap: .75rem; padding: .85rem; width: fit-content; margin-bottom: 1rem; }
label { display: grid; gap: .35rem; color: var(--muted); font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
input, select, textarea { border: 1px solid var(--line); border-radius: .55rem; background: var(--canvas); padding: .58rem .65rem; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; margin-bottom: .85rem; }
.metrics article { padding: 1.1rem; box-shadow: none; }.metrics span, .metrics small { color: var(--muted); display: block; }.metrics span { font-size: .73rem; text-transform: uppercase; font-weight: 800; letter-spacing: .06em; }.metrics strong { display: block; font-size: 2.2rem; letter-spacing: -.06em; margin: .3rem 0; }.metrics small { font-size: .72rem; }.metrics .accent-metric { color: white; background: var(--green); border-color: var(--green); }.metrics .accent-metric span, .metrics .accent-metric small { color: rgb(255 255 255 / 75%); }
.panel { padding: 1.2rem; margin-bottom: .85rem; box-shadow: none; }.section-title { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.2rem; }
.legend { display: flex; gap: .8rem; color: var(--muted); font-size: .74rem; }.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .3rem; }.assigned-dot { background: var(--green); }.unassigned-dot { background: var(--orange); }
.daily-row { display: grid; grid-template-columns: 7rem 1fr 3rem; gap: .8rem; align-items: center; margin: .85rem 0; font-size: .8rem; }.stack { display: flex; height: .9rem; overflow: hidden; border-radius: 99px; background: var(--surface-2); }.stack i { width: var(--assigned); background: var(--green); }.stack b { flex: 1; background: var(--orange); }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }.rank { display: grid; grid-template-columns: minmax(7rem, 1.35fr) 2fr 2rem; gap: .6rem; align-items: center; margin: .75rem 0; font-size: .78rem; }.rank > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }.rank > div { height: .5rem; background: var(--surface-2); border-radius: 99px; overflow: hidden; }.rank i { display: block; height: 100%; border-radius: inherit; }.rank i.blue { background: var(--blue); }.rank i.green { background: var(--green); }
.all-teachers { padding: 0; overflow: hidden; }.all-teachers summary { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; cursor: pointer; list-style: none; }.all-teachers summary::-webkit-details-marker { display: none; }.all-teachers summary::after { content: '+'; margin-left: .25rem; color: var(--muted); font-size: 1.35rem; }.all-teachers[open] summary::after { content: '−'; }.all-teachers summary span { margin-right: auto; }.all-teachers summary strong, .all-teachers summary small { display: block; }.all-teachers summary small { color: var(--muted); margin-top: .2rem; font-weight: 500; }.all-teachers summary > b { min-width: 2rem; padding: .3rem .55rem; border-radius: 99px; color: var(--green); background: var(--green-soft); text-align: center; font-size: .75rem; }.teacher-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }.teacher-grid article { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); }.teacher-grid article:nth-child(odd) { border-right: 1px solid var(--line); }.teacher-position { color: var(--muted); font-size: .7rem; font-weight: 800; }.teacher-grid article div strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }.teacher-grid article div i { display: block; height: 3px; margin-top: .45rem; overflow: hidden; border-radius: 99px; background: var(--surface-2); }.teacher-grid article div i b { display: block; height: 100%; background: var(--blue); }.teacher-grid article em { color: var(--muted); font-size: .72rem; font-style: normal; }
.substitutes-list .teacher-grid article div i b { background: var(--green); }
.course-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .65rem; }.course { position: relative; overflow: hidden; padding: .8rem; border-radius: .7rem; background: var(--surface-2); }.course span, .course strong { position: relative; z-index: 1; }.course strong { float: right; }.course i { position: absolute; height: 3px; bottom: 0; left: 0; background: var(--amber); }
.upload-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1rem; }.upload-card, .process-steps { padding: clamp(1.3rem, 4vw, 2.5rem); }.upload-card > p { color: var(--muted); max-width: 38rem; }.upload-icon { width: 4rem; aspect-ratio: 1; display: grid; place-items: center; border-radius: 1rem; color: white; background: var(--orange); font-weight: 900; margin-bottom: 1.5rem; }.upload-form { margin-top: 1.6rem; }.file-drop { position: relative; display: grid; place-items: center; min-height: 11rem; border: 1px dashed var(--line); border-radius: .8rem; background: var(--canvas); cursor: pointer; text-align: center; }.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }.file-drop span { color: var(--ink); font-size: 1rem; }.file-drop small { margin-top: -.5rem; }.upload-form button { width: 100%; margin-top: .8rem; }.process-steps ol { padding: 0; list-style: none; }.process-steps li { display: flex; gap: 1rem; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }.process-steps li b { color: var(--green); font-size: .72rem; }.process-steps li strong, .process-steps li span { display: block; }.process-steps li span { color: var(--muted); font-size: .82rem; }.process-steps li strong { color: var(--ink); font-size: .95rem; margin-bottom: .2rem; }
.empty-state { padding: 4rem 1.5rem; text-align: center; }.empty-state > span { color: var(--green); font-weight: 800; text-transform: uppercase; font-size: .7rem; letter-spacing: .1em; }.empty-state h2 { font-size: 2rem; margin-top: .5rem; }.empty-state p { color: var(--muted); margin-bottom: 1.5rem; }
.document-tabs { display: flex; gap: .6rem; overflow-x: auto; margin-bottom: 1rem; padding-bottom: .3rem; }.document-tabs a { min-width: 8.5rem; padding: .8rem; border: 1px solid var(--line); border-radius: .75rem; color: var(--muted); text-decoration: none; background: var(--surface); }.document-tabs a span, .document-tabs a small { display: block; }.document-tabs a span { color: var(--ink); font-size: 1.2rem; font-weight: 850; }.document-tabs a small { margin-top: .25rem; }.document-tabs a.active { border-color: var(--green); background: var(--green-soft); }
.review-heading { display: flex; justify-content: space-between; align-items: center; margin: 1.5rem 0 .8rem; }.review-heading p { color: var(--muted); margin: .25rem 0; }.status, .row-state { display: inline-block; width: fit-content; border-radius: 99px; padding: .3rem .55rem; font-size: .69rem; font-weight: 800; }.status-pending, .row-pending { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, var(--surface)); }.status-approved, .row-validated { color: var(--green); background: var(--green-soft); }.row-corrected { color: var(--blue); background: color-mix(in srgb, var(--blue) 14%, var(--surface)); }.review-help { margin-bottom: .8rem; padding: .8rem; border-radius: .65rem; color: var(--muted); background: var(--surface-2); font-size: .82rem; }
.review-form { min-width: 0; }.review-table-wrap, .table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: .85rem; background: var(--surface); }.review-table, table { width: 100%; border-collapse: collapse; }.review-table th, table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }.review-table th, .review-table td, table th, table td { padding: .7rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }.review-table input { width: 8.5rem; }.review-table td:nth-child(6) input, .review-table td:nth-child(7) input { width: 11rem; }.review-table td:nth-child(8) input { width: 16rem; }.sticky-actions { position: sticky; bottom: 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1rem auto; max-width: 42rem; padding: .8rem; border: 1px solid var(--line); border-radius: .8rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); box-shadow: var(--shadow); }.sticky-actions p { margin: 0; color: var(--muted); }.approval-form { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; padding: 1rem; border-color: var(--green); background: var(--green-soft); }.approval-form p { margin: .25rem 0 0; color: var(--muted); }
.table-panel { padding: 0; overflow: hidden; }.table-panel .section-title { padding: 1.2rem; margin: 0; }table td small { display: block; color: var(--muted); margin-top: .2rem; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(circle at 20% 10%, var(--green-soft), transparent 35%), var(--canvas); }.login-card { width: min(430px, 100%); padding: 2rem; border: 1px solid var(--line); border-radius: 1.2rem; background: var(--surface); box-shadow: var(--shadow); }.login-card h1 { font-size: 2.5rem; margin-top: 1rem; }.form-stack { display: grid; gap: 1rem; margin-top: 1.5rem; }.form-stack input { width: 100%; }
@media (max-width: 900px) { .app-shell { grid-template-columns: 1fr; }.sidebar { position: static; width: 100%; height: auto; padding: .8rem; border-right: 0; border-bottom: 1px solid var(--line); }.brand { margin-bottom: .8rem; }.sidebar nav { display: flex; overflow-x: auto; }.sidebar nav a { flex: 1; min-width: max-content; }.sidebar-foot { display: none; }.content { padding-top: 1.5rem; }.course-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 680px) { .page-header { align-items: start; }.page-header .primary-action { display: none; }.metrics { grid-template-columns: 1fr 1fr; }.two-columns, .upload-layout, .teacher-grid { grid-template-columns: 1fr; }.teacher-grid article:nth-child(odd) { border-right: 0; }.course-grid { grid-template-columns: 1fr 1fr; }.filter-bar { width: 100%; flex-wrap: wrap; }.filter-bar label { flex: 1; }.filter-bar input { width: 100%; }.daily-row { grid-template-columns: 5.5rem 1fr 2rem; }.approval-form, .sticky-actions { align-items: stretch; flex-direction: column; }.approval-form button, .sticky-actions button { width: 100%; } }

/* Extended workflow and administration */
.secondary-button { color: var(--ink); background: var(--surface-2); }
.danger-button { background: var(--orange); }
.danger-text { color: var(--orange); }
.wide-filters { width: 100%; flex-wrap: wrap; }
.wide-filters label { flex: 1; min-width: 8rem; }
.wide-filters select, .wide-filters input { width: 100%; }
.coverage-metrics { grid-template-columns: repeat(5, 1fr); }
.team-teacher-dot { background: var(--amber); }
.advanced-subject-dot { background: var(--violet); }
.suspended-dot { background: var(--orange); }
.merged-groups-dot { background: var(--cyan); }
.unassigned-dot { background: var(--red); }
.stack em { width: var(--team-teacher); background: var(--amber); }
.stack u { width: var(--advanced-subject); background: var(--violet); text-decoration: none; }
.stack s { width: var(--class-suspended); background: var(--orange); text-decoration: none; }
.stack small { width: var(--merged-groups); background: var(--cyan); }
.stack b { background: var(--red); }
.review-table select { min-width: 10rem; }
.daily-panel .section-title { flex-wrap: wrap; }
.trend-controls { display: flex; align-items: end; gap: .65rem; flex-wrap: wrap; margin: 0 0 .8rem; padding: .75rem; border-radius: .7rem; background: var(--surface-2); }
.trend-controls label { min-width: 9rem; }
.trend-controls select { width: 100%; }
.trend-list { max-height: 34rem; overflow-y: auto; padding-right: .4rem; scrollbar-gutter: stable; }
.trend-list .daily-row:first-child { margin-top: .25rem; }
.absence-streaks { overflow: hidden; }
.absence-streaks .section-title > small { color: var(--muted); }
.streak-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .85rem; }
.streak-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: .9rem; background: linear-gradient(145deg, var(--surface), var(--canvas)); }
.streak-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(var(--orange), var(--amber)); }
.streak-card header { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem .6rem 1.15rem; color: var(--muted); font-size: .64rem; font-weight: 850; text-transform: uppercase; letter-spacing: .1em; }
.streak-card header b { color: color-mix(in srgb, var(--orange) 75%, var(--ink)); font-size: .7rem; }
.streak-main { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: center; padding: .25rem 1rem 1rem 1.15rem; }
.streak-metric { display: flex; align-items: center; gap: .45rem; min-width: 6rem; }
.streak-metric strong { font-size: 2.8rem; line-height: .9; letter-spacing: -.08em; color: var(--orange); }
.streak-metric span { color: var(--muted); font-size: .65rem; font-weight: 750; line-height: 1.15; text-transform: uppercase; }
.streak-person { min-width: 0; }
.streak-person h3 { margin: 0 0 .55rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; letter-spacing: -.02em; }
.streak-dates { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .45rem; color: var(--muted); font-size: .68rem; }
.streak-dates i { height: 1px; background: linear-gradient(90deg, var(--orange), var(--line)); }
.streak-card footer { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .7rem 1rem .7rem 1.15rem; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.streak-card footer span { color: var(--muted); font-size: .68rem; }
.streak-card footer a { flex: 0 0 auto; padding: .38rem .65rem; border: 1px solid color-mix(in srgb, var(--green) 45%, var(--line)); border-radius: 99px; color: var(--green); text-decoration: none; font-size: .68rem; font-weight: 800; }
.streak-card footer a:hover { color: white; background: var(--green); border-color: var(--green); }
.streak-note { margin: 1rem 0 0; color: var(--muted); font-size: .72rem; }
.teacher-grid > a { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.teacher-grid > a:hover { background: var(--surface-2); }
.teacher-grid > a:nth-child(odd) { border-right: 1px solid var(--line); }
.teacher-grid > a div strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.teacher-grid > a div i { display: block; height: 3px; margin-top: .45rem; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.teacher-grid > a div i b { display: block; height: 100%; background: var(--blue); }
.teacher-grid > a em { color: var(--muted); font-size: .72rem; font-style: normal; }
.substitutes-list .teacher-grid > a div i b { background: var(--green); }
.status-in_review, .status-reopened { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, var(--surface)); }
.status-rejected { color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, var(--surface)); }
.review-workspace { display: grid; grid-template-columns: minmax(300px, .75fr) minmax(0, 1.25fr); gap: .85rem; align-items: start; }
.pdf-panel { position: sticky; top: 1rem; height: calc(100vh - 2rem); overflow: hidden; border: 1px solid var(--line); border-radius: .85rem; background: var(--surface); }
.pdf-panel > div { display: flex; justify-content: space-between; padding: .75rem; border-bottom: 1px solid var(--line); }
.pdf-panel a { color: var(--green); }
.pdf-panel iframe { width: 100%; height: calc(100% - 3rem); border: 0; }
.review-data { min-width: 0; }
.reject-panel { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: .8rem; }
.reject-panel summary { cursor: pointer; color: var(--orange); font-weight: 750; }
.reject-panel form { display: flex; gap: .8rem; align-items: end; margin-top: 1rem; }
.reject-panel label { flex: 1; }
.reject-panel textarea { width: 100%; min-height: 5rem; }
.table-actions { display: flex; align-items: center; gap: .6rem; }
.table-actions a { color: var(--green); }
.table-actions form { margin: 0; }
.wrap-cell { max-width: 24rem; white-space: normal; }
.narrow-panel { max-width: 35rem; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.permission-list { display: grid; gap: 1rem; padding: 0; list-style: none; color: var(--muted); }
.permission-list strong { display: block; color: var(--ink); margin-bottom: .2rem; }
.user-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; }
.user-card form { display: grid; gap: .7rem; }
.user-card-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .5rem; }
.user-card-head > div { min-width: 0; margin-right: auto; }
.user-card-head strong, .user-card-head small { display: block; }
.user-card-head small { color: var(--muted); }
.avatar { width: 2.4rem; aspect-ratio: 1; display: grid; place-items: center; border-radius: .65rem; color: white; background: var(--blue); font-weight: 850; }
.checkbox { display: flex; grid-template-columns: auto 1fr; align-items: center; }
.user-card details { margin-top: 1rem; }
.user-card summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.inline-form { display: flex !important; margin-top: .6rem; }
.backup-list { display: grid; gap: .5rem; }
.backup-list a { display: flex; justify-content: space-between; padding: .8rem; border-radius: .65rem; color: inherit; text-decoration: none; background: var(--surface-2); }
.backup-list small { color: var(--muted); }
@media (max-width: 1100px) { .review-workspace { grid-template-columns: 1fr; }.pdf-panel { position: static; height: 65vh; }.user-list { grid-template-columns: 1fr 1fr; }.coverage-metrics { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 680px) { .admin-grid, .user-list, .streak-grid { grid-template-columns: 1fr; }.teacher-grid > a:nth-child(odd) { border-right: 0; }.reject-panel form { align-items: stretch; flex-direction: column; }.coverage-metrics { grid-template-columns: 1fr 1fr; }.trend-controls label { flex: 1; }.trend-controls button { width: 100%; }.streak-card footer { align-items: flex-start; flex-direction: column; }.streak-card footer a { align-self: stretch; text-align: center; } }
@media print {
    .sidebar, .page-header .primary-action, .filter-bar, .notice { display: none !important; }
    .app-shell { display: block; }
    .content { width: 100%; padding: 0; }
    .page-header { display: block; margin-bottom: 1rem; }
    .panel, .metrics article { break-inside: avoid; box-shadow: none; }
    details > * { display: block !important; }
    body { background: white; color: #17221f; }
}
