:root {
  color-scheme: light;
  --ink: #17322d;
  --muted: #6e7d78;
  --paper: #f4f5ef;
  --card: #fffefa;
  --line: #dce2dc;
  --green: #174d42;
  --green-2: #2d7566;
  --mint: #dceee7;
  --amber: #d58a24;
  --amber-bg: #fff0d8;
  --blue: #2f6f9f;
  --blue-bg: #e3f1fa;
  --red: #a64343;
  --red-bg: #f9e2df;
  --shadow: 0 14px 35px rgba(31, 58, 49, .08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
body { margin: 0; color: var(--ink); background: var(--paper); min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button, .button-link { min-height: 42px; border-radius: 12px; border: 1px solid transparent; padding: 0 16px; cursor: pointer; font-weight: 650; transition: .18s ease; }
button:hover, .button-link:hover { transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: wait; transform: none; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: white; padding: 10px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(45,117,102,.12); }
label { display: grid; gap: 6px; color: #4b5e58; font-size: 13px; font-weight: 600; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; letter-spacing: -.03em; }
h2 { margin-bottom: 0; font-size: 21px; }
h3 { font-size: 15px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.eyebrow { color: var(--green-2); font-size: 11px; letter-spacing: .18em; font-weight: 800; margin-bottom: 6px; }
.primary { background: var(--green); color: white; }
.secondary { color: var(--green); border-color: #a8c6bd; background: #f5fbf8; }
.ghost { color: var(--ink); border-color: var(--line); background: transparent; }
.small { min-height: 34px; padding: 0 12px; border-radius: 9px; }
.wide { width: 100%; }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.text-icon { display: inline-block; margin-right: 6px; font-weight: 800; line-height: 1; }
.card { background: var(--card); border: 1px solid rgba(185,197,190,.75); box-shadow: var(--shadow); border-radius: 18px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #e4f0e8 0, transparent 36%), radial-gradient(circle at 90% 88%, #ece0c7 0, transparent 34%), var(--paper); }
.login-card { width: min(410px, 100%); padding: 38px; background: rgba(255,254,250,.94); border: 1px solid #d7ded8; border-radius: 26px; box-shadow: 0 28px 65px rgba(30,55,48,.14); }
.brand-mark { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--green); color: white; font: 700 29px/1 serif; margin-bottom: 22px; }
.stack-form { display: grid; gap: 16px; margin-top: 26px; }
.compact-form { margin-top: 18px; gap: 12px; }
.form-error { color: var(--red); margin: 14px 0 0; font-size: 13px; }

.app-shell { width: min(1440px, 100%); margin: auto; padding: 24px 28px 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.topbar h1 { font-size: 28px; }
.user-block { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.tabbar { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-bottom: 16px; border-bottom: 1px solid #ccd6d0; }
.tabs { display: flex; gap: 6px; }
.tab { background: transparent; color: var(--muted); border-radius: 9px 9px 0 0; padding: 0 20px; }
.tab.active { color: var(--green); border-bottom: 3px solid var(--green); }
.tab-actions { display: flex; gap: 6px; padding-bottom: 5px; }
.tab-actions .button-link { min-height: 34px; }
.toolbar { padding: 12px; display: flex; gap: 10px; align-items: end; margin-bottom: 12px; }
.toolbar label { min-width: 160px; }
#refresh-button.is-loading { opacity: .6; cursor: wait; }
.my-student-entry { margin-top: 16px; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-color: #8bb9aa; background: linear-gradient(135deg, #e5f3ed, #fffefa); }
.my-student-entry > div:first-child { display: grid; gap: 3px; }
.my-student-entry span { color: var(--muted); font-size: 12px; }
.my-student-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.workflow { margin-bottom: 12px; padding: 14px; }
.workflow-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.workflow-heading span { color: var(--muted); font-size: 12px; }
.workflow-steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.workflow-step { min-height: 54px; padding: 6px 9px; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); background: #f6f8f5; border-color: var(--line); }
.workflow-icon { display: inline-grid; place-items: center; flex: 0 0 25px; width: 25px; height: 25px; border-radius: 8px; background: #e5ebe7; color: var(--green-2); font-size: 14px; }
.workflow-copy { display: grid; gap: 1px; text-align: left; line-height: 1.15; }
.workflow-copy small { color: #8a9893; font-size: 9px; font-weight: 650; }
.workflow-step.active { color: white; background: var(--green); border-color: var(--green); }
.workflow-step.active .workflow-icon { color: var(--green); background: white; }
.workflow-step.active .workflow-copy small { color: #c7ddd6; }
.mode-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 42px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.mode-bar > span { color: var(--muted); font-size: 12px; flex: 1; }
.compact-segmented { display: flex; width: 230px; }
.compact-segmented button { flex: 1; padding-inline: 9px; }
.access-note { margin: 0 0 16px; padding: 14px 16px; border: 1px solid #e1b96f; border-radius: 14px; background: var(--amber-bg); color: #77501b; }
.rest-day-note { border-color: #bfc8c3; color: #596761; background: #eef1ef; }
.assignment-links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.assignment-link { min-height: 32px; padding: 0 10px; border-color: #d9ab5e; background: rgba(255,255,255,.55); color: #77501b; font-size: 12px; }

.summary-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 16px; }
.summary-card { position: relative; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.summary-card span { color: var(--muted); font-size: 12px; }
.summary-card strong { display: block; font-size: 26px; margin-top: 5px; }
.summary-icon { position: absolute; right: 13px; top: 12px; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: #edf4f0; color: var(--green-2); font-size: 14px; font-weight: 800; }

.workspace-card { padding: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.section-heading.compact { align-items: end; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 3px rgba(255,255,255,.8), 0 2px 5px rgba(49,64,58,.16); }
.dot.leave { background: #9aa3a0; }.dot.late { background: #45b7e8; }.dot.early { background: #ee5a98; }.dot.out { background: #ef8958; }.dot.dismissed { background: #9275d1; }.dot.discipline { background: #e3cf38; }
.seat-map { display: grid; gap: 20px; }
.seat-row { display: grid; gap: 15px; align-items: end; }
.seat-row-1 { grid-template-columns: minmax(105px, 1fr); }
.seat-row-2 { grid-template-columns: repeat(2, minmax(105px, 1fr)); }
.seat-row-3 { grid-template-columns: repeat(3, minmax(105px, 1fr)); }
.seat-row-4 { grid-template-columns: repeat(4, minmax(105px, 1fr)); }
.seat-row-7 { grid-template-columns: repeat(7, minmax(105px, 1fr)); }
.seat-group { display: grid; gap: 7px; }
.group-label { text-align: center; color: var(--muted); font-size: 12px; margin-top: 3px; }
.seat { position: relative; height: 76px; min-height: 76px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px; padding: 8px; background: #fff; border: 1px solid #cad5ce; border-radius: 13px; cursor: pointer; text-align: center; }
.seat:hover { border-color: var(--green-2); box-shadow: 0 7px 18px rgba(31,85,71,.12); transform: translateY(-1px); }
.seat .number { position: relative; font: 750 19px/1.1 ui-rounded, system-ui, sans-serif; }
.seat .name { width: 100%; min-height: 17px; color: var(--muted); font-size: 12px; line-height: 1.2; overflow-wrap: anywhere; }
.seat .leader { position: absolute; left: calc(100% + 4px); top: 50%; color: #c78d22; line-height: 1; transform: translateY(-50%); }
.seat .lunch-icon { position: absolute; right: 5px; top: 4px; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 7px; color: #604700; background: #f3c94f; box-shadow: 0 3px 8px rgba(133,95,0,.26); font-size: 12px; font-weight: 900; line-height: 1; }
.seat .lunch-icon.lunch-no { color: #737b77; background: #e4e7e5; box-shadow: 0 2px 6px rgba(67,76,72,.18); }
.seat .lunch-icon.lunch-no::after { content: ""; position: absolute; width: 23px; height: 2px; border-radius: 2px; background: #dc3f52; box-shadow: 0 0 0 1px rgba(255,255,255,.35); transform: rotate(45deg); }
.seat.has-lunch-mark { padding-top: 14px; }
.seat.has-leave-plan { padding-top: 20px; padding-bottom: 4px; gap: 1px; }
.seat .badges { display: flex; align-items: center; gap: 4px; position: absolute; left: 6px; top: 5px; max-width: calc(100% - 12px); }
.seat.has-lunch-mark .badges { max-width: calc(100% - 36px); }
.seat .leave-plan-tag { min-width: 0; max-width: 100%; overflow: hidden; padding: 2px 4px; border: 1px solid #b8d6e9; border-radius: 999px; color: #285e84; background: #e7f3fb; font-size: 8px; font-weight: 800; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.seat .badge-dot { width: 7px; height: 7px; border-radius: 50%; }
.seat.has-leave { background: #f1f2f0; border-color: #b7bdb9; }
.seat.has-late { background: #def4fd; border-color: #79cbed; }
.seat.has-discipline::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #e3cf38; position: absolute; left: 7px; bottom: 7px; box-shadow: 0 0 0 1px rgba(83,72,0,.18); }
.seat .scenario-label { width: 100%; margin-top: 2px; color: var(--green-2); font-size: 10px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.seat.attendance-owned { box-shadow: inset 0 0 0 1px rgba(45,117,102,.18); }
.seat.scenario-disabled:disabled { opacity: 1; cursor: not-allowed; }
.seat.has-attendance,
.seat.has-attendance.scenario-disabled:disabled { color: white; background: #176454; border-color: #0f5547; box-shadow: 0 6px 16px rgba(23,77,66,.25); }
.seat.is-out,
.seat.is-out.scenario-disabled:disabled { color: white; background: #d66d2e; border-color: #bd5620; box-shadow: 0 6px 16px rgba(190,83,31,.26); animation: breathe-orange 2s ease-in-out infinite; }
.seat.has-dismissed,
.seat.has-dismissed.scenario-disabled:disabled { color: white; background: #7656ad; border-color: #64449a; box-shadow: 0 6px 16px rgba(100,68,154,.24); }
.seat.has-attendance .name, .seat.has-attendance .scenario-label,
.seat.is-out .name, .seat.is-out .scenario-label,
.seat.has-dismissed .name, .seat.has-dismissed .scenario-label { color: white; }
.seat.has-attendance .leader { color: #ffe09a; }
.seat.is-unavailable,
.seat.is-unavailable.scenario-disabled:disabled { color: var(--ink); background: #e9ebe8; border-color: #b8bfba; box-shadow: none; animation: none; }
.seat.is-unavailable .name,
.seat.is-unavailable .scenario-label { color: #727b77; }
@keyframes breathe-orange { 50% { box-shadow: 0 0 0 5px rgba(224,112,48,.13), 0 6px 16px rgba(190,83,31,.22); } }
.platform { width: 32%; min-width: 220px; border-top: 2px solid #6f7c77; text-align: center; letter-spacing: 1.5em; margin: 28px auto 0; padding-top: 8px; color: var(--muted); }
.mobile-help { margin-top: 16px; padding: 14px 18px; display: flex; gap: 12px; font-size: 13px; color: var(--muted); }
.handoff-card { margin-top: 16px; padding: 18px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.handoff-list { display: flex; flex-wrap: wrap; gap: 8px; }
.handoff-person { padding: 9px 12px; border-radius: 10px; background: var(--mint); font-weight: 700; }

.my-page-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px; margin-bottom: 16px; }
.my-page-head p:last-child { margin: 5px 0 0; }
.my-page-grid { display: grid; gap: 16px; }
.my-page-card { padding: 22px; }
.my-month-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.my-month-picker { display: grid; grid-template-columns: 36px minmax(145px, 180px) 36px; align-items: center; gap: 6px; }
.my-month-picker button { min-height: 40px; padding: 0; font-size: 22px; }
.my-month-picker input { min-height: 40px; padding-block: 7px; }
.leave-month-picker { margin-bottom: 12px; }
.lunch-month-mode { width: min(360px, 100%); grid-template-columns: 1fr 1fr; }
.my-month-controls + .field-help { min-height: 18px; margin: 9px 0 11px; }
.my-month-controls + .field-help strong { color: #50615b; }
.my-calendar-weekdays, .my-calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.my-calendar-weekdays { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 750; text-align: center; }
.my-calendar-days { margin-bottom: 14px; }
.my-calendar-blank { min-width: 0; }
.my-calendar-day { position: relative; min-width: 0; min-height: 88px; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fafbf8; text-align: left; overflow: hidden; }
.my-calendar-day strong { color: var(--green-2); font-size: 16px; line-height: 1; font-variant-numeric: tabular-nums; }
.my-calendar-day small { width: 100%; color: var(--muted); font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; }
.my-calendar-day em { margin-top: auto; color: var(--green-2); font-size: 9px; font-style: normal; font-weight: 750; }
.lunch-calendar-day { cursor: pointer; }
.lunch-calendar-day input { position: absolute; right: 7px; top: 7px; width: 15px; height: 15px; margin: 0; accent-color: var(--amber); }
.lunch-calendar-day:has(input:checked), .lunch-calendar-day.status-yes { color: #674817; border-color: #d9ac59; background: var(--amber-bg); }
.lunch-calendar-day.status-no, .lunch-calendar-day.register-mode:not(:has(input:checked)) { border-color: #c4cbc7; background: #e9ebe8; }
.lunch-calendar-day.status-mode { cursor: default; }
.lunch-calendar-day.leave-override { cursor: not-allowed; border-color: #d9ac59; background: #fff4df; }
.lunch-calendar-day.leave-override small { color: #9a651e; font-weight: 700; }
.lunch-calendar-day.locked-day { cursor: not-allowed; }
.my-calendar-day.rest-day { cursor: default; color: #7c8884; border-color: #cbd1cd; border-style: dashed; background: #f1f2f0; }
.my-calendar-day.rest-day strong, .my-calendar-day.rest-day small { color: #7c8884; }
.leave-calendar-day { min-height: 96px; font-weight: 600; }
.leave-calendar-day:hover:not(:disabled) { border-color: #7cae9e; box-shadow: 0 5px 14px rgba(45,117,102,.12); }
.leave-calendar-day.has-leave { border-color: #9abed8; background: var(--blue-bg); }
.leave-calendar-day.has-leave small { color: #315f7d; font-weight: 700; }
.leave-calendar-day.editable-leave { border-color: #62a18e; box-shadow: inset 0 0 0 1px #62a18e; }
.leave-calendar-day.past-day:not(.has-leave) { background: #f4f5f2; }
.leave-calendar-day:disabled { opacity: 1; cursor: default; }
.my-day-list { display: grid; gap: 8px; }
.my-day-row { display: grid; grid-template-columns: 105px 1fr; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.my-day-row time { color: var(--green-2); font-weight: 750; }

.admin-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); gap: 16px; }
.admin-grid .card { padding: 22px; }
.admin-side { display: grid; gap: 16px; align-content: start; }
.student-editor { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.guardian-account-editor { display: grid; gap: 8px; margin-top: 12px; }
.guardian-account-row { display: grid; grid-template-columns: 46px minmax(150px, 1fr) minmax(170px, 1fr) auto; gap: 8px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 11px; background: #fafbf8; font-size: 12px; }
.guardian-account-row .seat-label { text-align: center; color: var(--muted); font-weight: 750; }
.guardian-account-row input { min-width: 0; }
.module-import { margin-bottom: 18px; padding: 14px; border-radius: 13px; background: #f3f7f4; border: 1px solid var(--line); }
.module-import > div:first-child { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.template-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 14px; }
.guardian-module-import { margin-top: 12px; }
.template-link { display: inline-block; color: var(--green-2); font-size: 12px; font-weight: 750; }
.inline-import-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.inline-import-form input { min-width: 0; }
.subheading { margin: 20px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.account-editor { display: grid; gap: 7px; margin-top: 10px; }
.schedule-grid { display: grid; grid-template-columns: 46px 1fr 1fr; gap: 9px; align-items: end; margin: 16px 0; }
.schedule-grid > strong { align-self: center; font-size: 13px; }
.daily-schedule-grid { grid-template-columns: 1fr 1fr; }
.study-calendar-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin: 14px 0 10px; }
.study-calendar-toolbar label { min-width: 170px; }
.study-calendar-count { color: var(--green-2); font-size: 12px; font-weight: 750; }
.study-calendar-weekdays, .study-calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.study-calendar-weekdays { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 750; text-align: center; }
.study-calendar-days { margin-bottom: 12px; }
.study-calendar-blank { aspect-ratio: 1; }
.study-calendar-day { position: relative; min-width: 0; aspect-ratio: 1; display: grid; place-content: center; gap: 1px; border: 1px solid var(--line); border-radius: 9px; color: #78847f; background: #f3f4f1; cursor: pointer; text-align: center; }
.study-calendar-day input { position: absolute; right: 3px; top: 3px; width: 12px; height: 12px; margin: 0; accent-color: var(--green); }
.study-calendar-day strong { font-size: 13px; line-height: 1; }
.study-calendar-day small { font-size: 8px; font-weight: 650; }
.study-calendar-day:has(input:checked) { color: var(--green); border-color: #8bb9aa; background: var(--mint); }
.study-calendar-day.weekend:not(:has(input:checked)) { background: #eceeeb; }
.admin-leave-list { display: grid; gap: 8px; margin-top: 12px; }
.admin-leave-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; background: #f5f7f4; font-size: 12px; }
.admin-leave-row button { min-height: 32px; padding-inline: 10px; color: var(--red); }
.account-edit-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.assignment-table { display: grid; gap: 6px; max-height: 280px; overflow: auto; }
.assignment-row { display: grid; grid-template-columns: 92px 48px 1fr; gap: 8px; padding: 8px; border-radius: 9px; background: #f6f8f5; font-size: 12px; }
.student-edit-row { display: grid; grid-template-columns: 48px 1fr auto; gap: 7px; align-items: center; }
.student-edit-row .seat-label { text-align: center; color: var(--muted); font-weight: 700; }
.student-edit-row button { min-height: 38px; padding: 0 11px; }
.import-preview { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.preview-stats { display: flex; gap: 18px; margin-bottom: 12px; }
.preview-list { max-height: 250px; overflow: auto; font-size: 12px; background: #f7f8f5; border-radius: 10px; padding: 8px 12px; }
.preview-row { padding: 7px 0; border-bottom: 1px solid #e2e7e2; }
.warning { color: #9a651e; }
.roster-controls label { flex: 1; }
.check-list { display: grid; gap: 7px; margin: 14px 0; }
.check-row { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafbf8; cursor: pointer; }
.check-row input { width: auto; margin: 0; }
.check-row small { margin-left: auto; color: var(--muted); }
.backup-list { display: grid; gap: 7px; margin-top: 14px; }
.backup-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.backup-row a { color: var(--green-2); font-weight: 700; text-decoration: none; }

.data-summary { margin-top: 16px; padding: 22px; }
.data-summary-controls { display: flex; align-items: end; gap: 10px; }
.data-summary-scope { flex: 0 0 300px; }
#data-summary-date-field { min-width: 170px; }
.data-summary-range { margin: 13px 0 0; font-size: 12px; }
.data-summary-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.data-summary-grid .summary-card { min-width: 0; padding: 14px; }
.data-summary-grid .summary-card strong { font-size: 23px; }
.data-summary-table-wrap { max-height: 620px; overflow: auto; border: 1px solid var(--line); border-radius: 13px; }
.data-summary-table { width: 100%; min-width: 1040px; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.data-summary-table th, .data-summary-table td { padding: 10px 9px; border-bottom: 1px solid #e1e7e2; text-align: center; white-space: nowrap; }
.data-summary-table th { position: sticky; top: 0; z-index: 2; color: #315d53; background: #e5f1ec; font-weight: 800; }
.data-summary-table tbody tr:nth-child(even) td { background: #fafbf8; }
.data-summary-table tbody tr:hover td { background: #f0f6f2; }
.data-summary-table .summary-seat { color: var(--green-2); font-weight: 800; }
.data-summary-table .summary-student-name { min-width: 120px; text-align: left; font-weight: 700; }
.data-summary-table .metric-number { font-variant-numeric: tabular-nums; }
.data-summary-table .metric-alert { color: #b34242; font-weight: 800; }
.data-summary[aria-busy="true"] { opacity: .72; }
.special-report-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.special-report-controls { display: flex; align-items: end; gap: 10px; margin-bottom: 14px; }
.special-report-controls label { min-width: 170px; }
.special-report-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.35fr); gap: 14px; }
.special-report-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #fbfcf9; }
.special-report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.special-report-head h3 { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; font-size: 16px; }
.special-report-head p { margin: 0; font-size: 11px; }
.report-dot { display: inline-block; width: 10px; height: 10px; border-radius: 4px; }
.report-dot.lunch-yes { background: #f3c94f; }.report-dot.leave { background: #9aa3a0; }
.special-totals { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.special-total { padding: 7px 10px; border-radius: 9px; color: #52625d; background: #edf1ee; font-size: 11px; }
.special-total strong { margin-left: 4px; color: var(--ink); font-size: 15px; }
.special-table-wrap { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; }
.special-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11px; }
.special-table th, .special-table td { padding: 8px 7px; border-bottom: 1px solid #e1e7e2; text-align: center; white-space: nowrap; }
.special-table th { position: sticky; top: 0; z-index: 1; color: #315d53; background: #e5f1ec; }
.special-table tbody tr:last-child td { border-bottom: 0; }
.special-table .lunch-yes-cell { background: #f8e49d; }.special-table .lunch-no-cell, .special-table .leave-cell { background: #e9ebe8; }
.special-table .late-cell { background: #def4fd; }.special-table .early-cell { background: #fce0ec; }.special-table .out-cell { background: #fbe3d5; }

.student-dialog { width: min(600px, calc(100% - 24px)); max-height: calc(100vh - 28px); border: 0; border-radius: 22px; padding: 0 22px 24px; color: var(--ink); box-shadow: 0 30px 80px rgba(22,45,38,.28); }
.student-dialog::backdrop { background: rgba(19,41,34,.44); backdrop-filter: blur(3px); }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; background: white; padding: 20px 0 14px; border-bottom: 1px solid var(--line); }
.icon-button { width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 50%; background: #f0f3f0; font-size: 24px; font-weight: 400; }
.status-line { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 0 0; }
.status-pill { border-radius: 999px; background: #eef2ef; padding: 5px 9px; font-size: 12px; color: #50615b; }
.student-nav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 12px 0; }
.student-nav span { text-align: center; font-size: 12px; }
.quick-section { margin: 0 -10px; padding: 14px 10px; border-radius: 14px; background: #f0f7f4; border: 1px solid #d5e6df; }
.quick-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.quick-heading h3 { margin: 0; }
.quick-heading span { color: var(--muted); font-size: 11px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.quick-action { min-height: 46px; padding: 0 7px; background: white; border-color: #cbdad4; }
.quick-action.present { color: var(--green); }
.quick-action.late { color: #9c671e; }
.quick-action.out { color: var(--blue); }
.quick-action.out.return { color: white; background: var(--blue); border-color: var(--blue); }
.quick-action.lunch { color: #69551f; }
.quick-action.active { color: white; background: var(--green); border-color: var(--green); box-shadow: 0 3px 10px rgba(23,77,66,.18); }
.action-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.action-section:last-child { border-bottom: 0; }
.inline-fields { display: flex; gap: 10px; align-items: end; margin-bottom: 10px; }
.inline-fields label { min-width: 132px; }.inline-fields .grow { flex: 1; }
.button-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.status-action { padding: 0 8px; background: #f5f7f5; border-color: var(--line); }
.status-action.present { color: var(--green); }.status-action.late { color: #9c671e; }.status-action.leave { color: var(--blue); }.status-action.absent { color: var(--red); }
.status-action.active { background: var(--mint); border-color: var(--green-2); }
.active-callout { background: var(--blue-bg); color: #285e84; padding: 11px; border-radius: 10px; font-size: 13px; }
.planned-exit-note { margin-bottom: 10px; padding: 10px; border-radius: 10px; color: #77501b; background: var(--amber-bg); font-size: 12px; }
.reason-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.reason-tag { min-height: 30px; padding: 0 10px; border-radius: 999px; color: var(--blue); background: var(--blue-bg); border-color: #b8d6e9; font-size: 12px; }
.field-help { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: #edf1ee; padding: 5px; border-radius: 13px; }
.segmented button { background: transparent; min-height: 36px; }
.segmented button.active { background: white; color: var(--green); box-shadow: 0 2px 8px rgba(35,65,56,.1); }
.record-list { margin-top: 13px; display: grid; gap: 7px; }
.record-item { padding: 10px; background: #f5f6f3; border-radius: 10px; font-size: 12px; }
.time-wheel-trigger { width: 100%; justify-content: flex-start; color: var(--ink); background: white; border-color: #cdd7d1; font-variant-numeric: tabular-nums; }
.time-wheel-trigger.empty { color: #82908a; }
.time-wheel-dialog { width: min(410px, calc(100% - 24px)); border: 0; border-radius: 22px; padding: 0 20px 20px; color: var(--ink); box-shadow: 0 30px 80px rgba(22,45,38,.3); }
.time-wheel-dialog::backdrop { background: rgba(19,41,34,.48); backdrop-filter: blur(3px); }
.time-wheel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 12px; border-bottom: 1px solid var(--line); }
.time-wheel-head h2 { font-size: 19px; }
.time-wheel-columns { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; padding: 14px 24px; }
.time-wheel-column { display: grid; gap: 7px; text-align: center; }
.time-wheel-column > strong { color: var(--muted); font-size: 12px; }
.time-wheel-colon { font-size: 28px; font-weight: 800; }
.time-wheel-list { height: 220px; overflow-y: auto; padding: 88px 0; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(to bottom, #f5f7f4 0 39%, #e3f0ea 39% 61%, #f5f7f4 61% 100%); scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.time-wheel-list::-webkit-scrollbar { display: none; }
.time-wheel-list button { display: block; width: 100%; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 0; color: #87928e; background: transparent; font-size: 18px; font-variant-numeric: tabular-nums; scroll-snap-align: center; }
.time-wheel-list button.active { color: var(--green); font-size: 23px; font-weight: 850; }
.time-wheel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: #183c34; color: white; padding: 11px 17px; border-radius: 12px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.student-dialog.focus-exit #quick-section,
.student-dialog.focus-exit #attendance-section,
.student-dialog.focus-exit #discipline-section,
.student-dialog.focus-exit #lunch-section,
.student-dialog.focus-exit #leave-section { display: none !important; }
.student-dialog.focus-discipline #quick-section,
.student-dialog.focus-discipline #attendance-section,
.student-dialog.focus-discipline #exit-section,
.student-dialog.focus-discipline #lunch-section,
.student-dialog.focus-discipline #leave-section { display: none !important; }
.student-dialog.focus-leave #quick-section,
.student-dialog.focus-leave #attendance-section,
.student-dialog.focus-leave #exit-section,
.student-dialog.focus-leave #discipline-section,
.student-dialog.focus-leave #lunch-section { display: none !important; }

@media (max-width: 900px) {
  .app-shell { padding: 18px 14px 40px; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .seat-row-1 { grid-template-columns: minmax(85px, 1fr); }
  .seat-row-2 { grid-template-columns: repeat(2, minmax(85px, 1fr)); }
  .seat-row-3 { grid-template-columns: repeat(3, minmax(85px, 1fr)); }
  .seat-row-4 { grid-template-columns: repeat(4, minmax(85px, 1fr)); }
  .seat-row-7 { grid-template-columns: repeat(4, minmax(85px, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
  .data-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .special-report-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .app-shell { padding: 10px 10px 30px; }
  .topbar { margin-bottom: 8px; }
  .topbar h1 { font-size: 22px; }.topbar .eyebrow { display: none; }
  .user-block { align-items: end; flex-direction: column; gap: 2px; font-size: 12px; }
  .tabbar { margin-bottom: 10px; }
  .tab { min-height: 36px; padding-inline: 10px; font-size: 13px; }
  .tab-actions { gap: 4px; padding-bottom: 3px; }
  .tab-actions .button-link { min-height: 32px; padding-inline: 8px; font-size: 11px; }
  .toolbar { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .7fr) auto; gap: 6px; padding: 9px; }
  .toolbar label { min-width: 0; gap: 3px; font-size: 11px; }
  .toolbar input, .toolbar select { min-width: 0; padding: 8px 6px; font-size: 12px; }
  .toolbar button { width: auto; min-height: 38px; padding-inline: 8px; font-size: 11px; }
  .toolbar .text-icon { margin-right: 3px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .workspace-card { padding: 16px 12px; }
  .section-heading { display: block; }.legend { margin-top: 12px; }
  .my-student-entry { align-items: stretch; flex-direction: column; }
  .my-student-buttons button { width: 100%; }
  .workflow { padding: 10px; overflow: hidden; }
  .workflow-heading { align-items: baseline; gap: 6px; margin-bottom: 8px; }
  .workflow-heading strong { flex: 0 0 auto; font-size: 13px; }
  .workflow-heading > span { text-align: right; font-size: 9px; }
  .workflow-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workflow-step { min-width: 0; min-height: 52px; padding: 4px; gap: 4px; }
  .workflow-icon { flex-basis: 23px; width: 23px; height: 23px; }
  .workflow-copy { font-size: 11px; }
  .mode-bar { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 5px 8px; min-height: 0; margin-top: 8px; padding-top: 8px; }
  .mode-bar > span { line-height: 1.35; }
  .compact-segmented { grid-column: 1 / -1; width: 100%; padding: 3px; }
  .compact-segmented button { min-height: 32px; font-size: 11px; }
  .seat-map { gap: 14px; }
  .seat-row { gap: 8px; }
  .seat-row-1 { grid-template-columns: minmax(0, 1fr); }
  .seat-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seat-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .seat-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .seat-row-7 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .seat { height: 72px; min-height: 72px; }.platform { min-width: 180px; width: 70%; }
  .scenario-map .seat-group { gap: 5px; }
  .scenario-map .seat { height: 72px; min-height: 72px; padding: 5px 3px; border-radius: 10px; }
  .scenario-map .seat.has-lunch-mark { padding-top: 14px; }
  .scenario-map .seat.has-leave-plan { padding: 18px 3px 3px; gap: 1px; }
  .scenario-map .seat .number { font-size: 16px; }
  .scenario-map .seat .name { min-height: 13px; font-size: 10px; }
  .scenario-map .seat .leader { font-size: 11px; }
  .mobile-help { align-items: flex-start; flex-direction: column; gap: 4px; }
  .handoff-card { align-items: flex-start; flex-direction: column; }
  .my-page-head { align-items: stretch; flex-direction: column; }
  .my-page-head button { width: 100%; }
  .my-page-card { padding: 16px; }
  .my-page-card .section-heading span { display: block; margin-top: 5px; }
  .my-month-controls { align-items: stretch; flex-direction: column; }
  .my-month-picker { grid-template-columns: 34px minmax(0, 1fr) 34px; }
  .lunch-month-mode { width: 100%; }
  .my-calendar-weekdays, .my-calendar-days { gap: 4px; }
  .my-calendar-day { height: 73px; min-height: 73px; padding: 7px 5px; border-radius: 9px; }
  .my-calendar-day strong { font-size: 14px; }
  .my-calendar-day small { font-size: 9px; line-height: 1.25; }
  .leave-calendar-day { height: 82px; min-height: 82px; }
  .leave-calendar-day small { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
  .time-wheel-columns { padding-inline: 8px; }
  .my-day-row { grid-template-columns: 1fr; gap: 4px; }
  .guardian-account-row { grid-template-columns: 42px 1fr auto; }
  .guardian-account-row input { grid-column: 2 / -1; grid-row: 2; }
  .inline-import-form { grid-template-columns: 1fr; }
  .student-editor { grid-template-columns: 1fr; }
  .data-summary { padding: 16px; }
  .data-summary .section-heading span { display: block; margin-top: 5px; }
  .data-summary-controls { display: grid; grid-template-columns: 1fr auto; align-items: end; }
  .data-summary-scope { grid-column: 1 / -1; width: 100%; }
  #data-summary-date-field { min-width: 0; }
  .data-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-summary-grid .summary-card { padding: 12px; }
  .special-report-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .special-report-controls label { min-width: 0; }
  .special-report-controls button { grid-column: 1 / -1; }
  .special-report-head { display: grid; }
  .special-report-head .button-link { width: 100%; }
  .inline-fields { display: grid; grid-template-columns: 1fr 1fr; }.inline-fields .grow { grid-column: 1 / -1; }
  .button-grid { grid-template-columns: repeat(2, 1fr); }
  .student-dialog { padding-inline: 16px; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
}
