:root {
    color-scheme: light;
    font-family: "DM Sans", "Avenir Next", sans-serif;
    color: #1b2c24;
    background: #f4f5ef;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    --ink: #1b2c24;
    --muted: #77837b;
    --line: #e3e6de;
    --surface: #fffefa;
    --canvas: #f4f5ef;
    --green: #286b4d;
    --green-deep: #1e503b;
    --green-soft: #e7f1e8;
    --amber: #bd772c;
    --amber-soft: #fbf0de;
    --red: #bb574b;
    --red-soft: #f8e9e5;
    --mono: "IBM Plex Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
body { min-width: 0; min-height: 100vh; min-height: 100svh; margin: 0; background: var(--canvas); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app-frame { display: grid; min-height: 100vh; min-height: 100svh; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; height: 100svh; flex-direction: column; padding: 27px 18px 18px; border-right: 1px solid var(--line); background: #fbfcf7; }
.brand { display: flex; align-items: center; gap: 10px; width: max-content; color: var(--ink); text-decoration: none; }
.brand-symbol { display: grid; width: 34px; aspect-ratio: 1; place-items: center; border-radius: 8px; background: var(--green); color: white; font: italic 25px/1 Georgia, serif; }
.brand-name { font-size: 21px; font-weight: 700; }
.brand-name span { color: var(--amber); }
.institution-label, .nav-caption, .eyebrow, .stat-label, .crumb, .summary-topline, .data-table th, .page-footer { font-family: var(--mono); font-size: 9px; font-weight: 500; letter-spacing: 0; }
.institution-label { margin: 48px 0 12px 11px; color: #8d978f; }
.nav-caption { margin: 0 0 7px 11px; color: #a1aaa2; }
.side-nav { display: grid; gap: 4px; }
.nav-item { display: flex; min-height: 42px; align-items: center; gap: 11px; padding: 0 11px; border: 0; border-radius: 5px; background: transparent; color: #56645a; cursor: pointer; font-size: 13px; font-weight: 600; text-align: left; transition: background-color 130ms ease, color 130ms ease; }
.nav-item:hover { background: #f0f2eb; color: var(--ink); }
.nav-item.is-active { background: var(--green-soft); color: var(--green-deep); }
.nav-icon { color: #96a198; font: 10px var(--mono); }
.nav-item.is-active .nav-icon { color: var(--green); }
.sidebar-bottom { display: grid; grid-template-columns: 34px 1fr 8px; align-items: center; gap: 10px; margin-top: auto; padding: 14px 5px 2px; border-top: 1px solid var(--line); }
.school-mark, .account-avatar { display: grid; place-items: center; border-radius: 50%; background: #e4e9dc; color: var(--green-deep); font: 600 10px var(--mono); }
.school-mark { width: 34px; aspect-ratio: 1; }
.sidebar-bottom strong, .sidebar-bottom span, .account-chip strong, .account-chip small { display: block; }
.sidebar-bottom strong { font-size: 11px; }
.sidebar-bottom div:nth-child(2) span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.sync-dot, .live-indicator { width: 7px; aspect-ratio: 1; border-radius: 50%; background: #93b958; }
.main-column { min-width: 0; }
.topbar { display: flex; height: 66px; align-items: center; justify-content: space-between; gap: 14px; padding: 0 42px; border-bottom: 1px solid var(--line); background: rgba(255,254,250,.78); }
.crumb { display: flex; gap: 9px; color: #7c887f; }
.crumb-slash { color: #bdc4bb; }
.cohort-picker { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.cohort-picker label { display: grid; gap: 3px; color: #849087; font: 8px var(--mono); }
.cohort-picker select { max-width: 180px; height: 31px; padding: 0 8px; border: 1px solid #dfe4dc; border-radius: 4px; background: var(--surface); color: var(--ink); font: 10px "DM Sans", sans-serif; }
.cohort-picker label:last-child select { min-width: 112px; }
.account-chip { display: flex; align-items: center; gap: 9px; }
.account-avatar { width: 31px; aspect-ratio: 1; background: #f4e8dc; color: #875b3a; font-size: 12px; }
.account-chip strong { font-size: 11px; }
.account-chip small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.main-content { width: min(1440px, 100%); margin: 0 auto; padding: 38px 42px 24px; }
.view-panel { animation: reveal 300ms ease both; }
.view-panel[hidden], .empty-state[hidden] { display: none; }
.page-heading { display: flex; min-height: 112px; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 21px; }
.eyebrow { margin: 0 0 10px; color: #849087; }
.eyebrow span { padding: 0 4px; color: var(--amber); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: 32px; font-weight: 600; line-height: 1.15; }
h1 em, .summary-panel h2 em { color: var(--green); font-family: Georgia, serif; font-weight: 400; }
.page-description { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.date-control { display: grid; min-width: 174px; gap: 7px; }
.date-control label { color: #879188; font: 9px var(--mono); }
.date-control input, .form-field input, .search-field input { min-width: 0; border: 1px solid #dfe4dc; border-radius: 5px; background: var(--surface); color: var(--ink); }
.date-control input { height: 38px; padding: 0 10px; font-size: 12px; }
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.stat-item { display: grid; min-height: 102px; align-content: center; gap: 4px; padding: 13px 21px; }
.stat-item + .stat-item { border-left: 1px solid var(--line); }
.stat-label { color: #89958c; }
.stat-item strong { font: 500 25px/1.2 var(--mono); }
.stat-present strong { color: var(--green); }
.stat-late strong { color: var(--amber); }
.stat-absent strong { color: var(--red); }
.stat-note { color: #89958c; font-size: 10px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 275px; align-items: start; gap: 17px; }
.panel, .summary-panel { min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.attendance-panel, .roster-panel, .report-panel { overflow: hidden; }
.panel-heading { display: flex; min-height: 81px; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 19px; }
.panel-heading .eyebrow, .roster-heading .eyebrow { margin-bottom: 4px; }
.panel-heading h2, .roster-heading h2, .form-copy h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 15px; font-weight: 600; }
.panel-heading h2 span, .roster-heading h2 span { display: inline-grid; min-width: 22px; height: 20px; place-items: center; padding: 0 5px; border-radius: 10px; background: #f0f2eb; color: #738077; font: 500 9px var(--mono); }
.panel-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.export-control { display: inline-flex; align-items: center; gap: 6px; }
.export-control select { max-width: 145px; height: 36px; padding: 0 9px; border: 1px solid #dce5d9; border-radius: 5px; background: #fffefa; color: var(--green-deep); font-size: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
.button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 10px; padding: 0 12px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; font-size: 11px; font-weight: 600; white-space: nowrap; transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--green); color: white; }
.button-primary:hover { background: var(--green-deep); }
.button-secondary { border-color: #dce5d9; background: #f5f8f1; color: var(--green-deep); }
.button-secondary:hover { background: var(--green-soft); }
.table-tools { display: flex; min-height: 55px; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 19px; border-block: 1px solid var(--line); }
.search-field { display: flex; width: min(260px, 45%); height: 32px; align-items: center; gap: 7px; padding: 0 8px; border: 1px solid #e4e7df; border-radius: 4px; color: #87938a; }
.search-field span { font-size: 17px; line-height: 1; }
.search-field input { width: 100%; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; font-size: 10px; }
.filter-group { display: flex; gap: 3px; }
.filter-button { min-height: 27px; padding: 0 8px; border: 0; border-radius: 4px; background: transparent; color: #758178; cursor: pointer; font-size: 9px; }
.filter-button:hover, .filter-button.is-selected { background: #edf3e9; color: var(--green-deep); }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { height: 36px; padding: 0 19px; background: #f7f8f3; color: #849087; font-size: 8px; font-weight: 500; white-space: nowrap; }
.data-table td { height: 55px; padding: 7px 19px; border-top: 1px solid #edf0e9; color: #35443a; font-size: 11px; }
.data-table tbody tr { transition: background-color 110ms ease; }
.data-table tbody tr:hover { background: #fbfcf8; }
.student-cell { display: flex; align-items: center; gap: 9px; }
.student-initials { display: grid; width: 29px; aspect-ratio: 1; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #e9eee3; color: #506e54; font-size: 9px; font-weight: 700; }
.student-name { color: var(--ink); font-size: 11px; font-weight: 600; }
.status-select { width: 148px; height: 30px; padding: 0 9px; border: 1px solid #e1e5dc; border-radius: 4px; background: white; color: #47554b; cursor: pointer; font-size: 10px; }
.status-select[data-status="present"] { border-color: #d3e6d4; background: #f0f7ef; color: #356b43; }
.status-select[data-status="late"] { border-color: #f0ddbd; background: #fff8eb; color: #98631f; }
.status-select[data-status="absent"] { border-color: #ecd1cc; background: #fcf1ee; color: #9e4d42; }
.panel-footer { display: flex; min-height: 60px; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 19px; border-top: 1px solid var(--line); }
.save-message { margin: 0; color: #78847b; font-size: 10px; }
.save-message.is-error { color: var(--red); }
.save-message.is-success { color: var(--green); }
.summary-panel { padding: 19px; background: #fdfefa; }
.summary-topline { display: flex; align-items: center; gap: 7px; color: #869188; }
.live-indicator { width: 6px; }
.summary-panel h2 { max-width: 210px; margin: 21px 0 7px; font-size: 20px; font-weight: 600; line-height: 1.18; }
.summary-date { color: #87938a; font-size: 10px; }
.attendance-rate { display: grid; gap: 1px; margin-top: 25px; }
.attendance-rate strong { color: var(--green); font: 500 36px/1.1 var(--mono); }
.attendance-rate span { color: #869188; font-size: 9px; }
.rate-track { height: 5px; overflow: hidden; margin: 13px 0 19px; border-radius: 5px; background: #e8ece4; }
.rate-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width 240ms ease; }
.summary-legend { display: grid; gap: 11px; padding-top: 14px; border-top: 1px solid var(--line); }
.summary-legend div { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 8px; color: #748077; font-size: 10px; }
.summary-legend strong { color: var(--ink); font: 500 10px var(--mono); }
.legend-dot { width: 7px; aspect-ratio: 1; border-radius: 50%; }
.legend-present { background: #71a575; }
.legend-late { background: #d3a14d; }
.legend-absent { background: #c87c6d; }
.legend-unmarked { background: #aab3aa; }
.summary-footnote { margin: 19px -19px -19px; padding: 12px 19px; border-top: 1px solid var(--line); background: #f7f8f3; color: #8a958c; font-size: 9px; }
.empty-state { display: grid; min-height: 160px; align-content: center; justify-items: center; gap: 7px; padding: 20px; color: #87938a; text-align: center; }
.empty-mark { display: grid; width: 31px; aspect-ratio: 1; place-items: center; margin-bottom: 2px; border-radius: 50%; background: #f0f2eb; color: var(--green); font: 16px var(--mono); }
.empty-state strong { color: #526056; font-size: 11px; }
.empty-state > span:last-child { max-width: 330px; font-size: 10px; line-height: 1.5; }
.add-student-form { display: grid; grid-template-columns: minmax(170px, .8fr) minmax(220px, 1.3fr) auto; align-items: end; gap: 17px; padding: 22px 20px; border-bottom: 1px solid var(--line); background: #fbfcf7; }
.form-field { display: grid; gap: 6px; color: #68766c; font-size: 10px; }
.form-field input { width: 100%; height: 37px; padding: 0 10px; font-size: 11px; }
.roster-heading { padding: 19px 20px 13px; }
.roster-heading h2 { font-size: 14px; }
.report-total { color: #849087; font-size: 10px; }
.report-panel .data-table { min-width: 590px; }
.report-rate { color: var(--green); font: 10px var(--mono); }
.page-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 23px; color: #9aa39b; font-size: 8px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(190,119,44,.5); outline-offset: 2px; }

@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1100px) {
    .app-frame { grid-template-columns: 205px minmax(0, 1fr); }
    .topbar, .main-content { padding-right: 25px; padding-left: 25px; }
    .dashboard-grid { grid-template-columns: minmax(0, 1fr) 245px; gap: 12px; }
    .data-table th, .data-table td { padding-right: 12px; padding-left: 12px; }
}

@media (max-width: 850px) {
    .app-frame { display: block; }
    .sidebar { position: static; display: grid; width: 100%; height: auto; grid-template-columns: auto 1fr; align-items: center; gap: 16px; padding: 12px 20px 0; border-right: 0; border-bottom: 1px solid var(--line); }
    .institution-label, .sidebar-bottom { display: none; }
    .side-nav { display: flex; min-width: 0; justify-content: flex-end; gap: 3px; overflow-x: auto; }
    .nav-caption { display: none; }
    .nav-item { min-height: 42px; flex: 0 0 auto; padding: 0 9px; font-size: 11px; }
    .nav-icon { display: none; }
    .topbar { height: 55px; }
    .main-content { padding-top: 29px; }
    .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
    .summary-panel { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
    .summary-topline, .summary-panel h2, .summary-date, .attendance-rate, .rate-track, .summary-footnote { grid-column: 1 / -1; }
    .summary-panel h2 { max-width: none; margin-top: 13px; }
    .attendance-rate { margin-top: 15px; }
    .summary-legend { grid-row: 4 / span 2; grid-column: 2; align-content: center; border-top: 0; }
    .rate-track { margin-bottom: 14px; }
}

@media (max-width: 600px) {
    .sidebar { grid-template-columns: 1fr; gap: 7px; padding: 10px 14px 0; }
    .brand-symbol { width: 30px; }
    .brand-name { font-size: 19px; }
    .side-nav { justify-content: flex-start; margin: 0 -14px; padding: 0 14px; }
    .nav-item { min-height: 38px; }
    .topbar { display: grid; height: auto; min-height: 48px; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 8px 16px; }
    .crumb { grid-column: 1; grid-row: 1; }
    .account-chip { grid-column: 2; grid-row: 1; }
    .cohort-picker { grid-column: 1 / -1; grid-row: 2; width: 100%; padding-bottom: 2px; }
    .cohort-picker label:first-child { min-width: 0; flex: 1; }
    .cohort-picker label:first-child select { width: 100%; max-width: none; }
    .cohort-picker label:last-child select { min-width: 0; }
    .account-chip small { display: none; }
    .main-content { padding: 24px 14px 18px; }
    .page-heading { display: grid; min-height: 0; gap: 15px; margin-bottom: 17px; }
    .page-heading h1 { font-size: 27px; }
    .page-description { max-width: 360px; font-size: 11px; line-height: 1.5; }
    .date-control { width: 100%; }
    .date-control input { height: 40px; }
    .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 13px; }
    .stat-item { min-height: 85px; padding: 11px 13px; }
    .stat-item:nth-child(3) { border-top: 1px solid var(--line); border-left: 0; }
    .stat-item:nth-child(4) { border-top: 1px solid var(--line); }
    .stat-item strong { font-size: 22px; }
    .panel-heading { min-height: 72px; padding: 12px; }
    .panel-heading h2 { font-size: 14px; }
    .export-control select { height: 34px; max-width: 130px; }
    .page-heading > .export-control { width: 100%; justify-content: flex-start; }
    .button { min-height: 34px; padding: 0 9px; font-size: 10px; }
    .table-tools { align-items: stretch; flex-direction: column; padding: 10px 12px; }
    .search-field { width: 100%; height: 36px; }
    .filter-group { justify-content: flex-start; }
    .filter-button { min-height: 30px; padding: 0 10px; font-size: 10px; }
    .data-table { min-width: 380px; }
    .data-table th { height: 32px; font-size: 8px; }
    .data-table td { height: 51px; }
    .student-initials { width: 26px; }
    .status-select { width: 135px; }
    .panel-footer { align-items: stretch; flex-direction: column; padding: 11px 12px; }
    .panel-footer .button { min-height: 40px; }
    .summary-panel { padding: 15px; }
    .summary-panel h2 { font-size: 18px; }
    .summary-legend { gap: 8px; }
    .summary-footnote { margin: 15px -15px -15px; padding: 11px 15px; }
    .add-student-form { grid-template-columns: minmax(0, 1fr); gap: 13px; padding: 17px 14px; }
    .add-student-form .button { min-height: 40px; }
    .roster-heading { padding: 16px 14px 11px; }
    .report-panel .data-table { min-width: 590px; }
    .page-footer { flex-direction: column; gap: 5px; font-size: 7px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}