:root {
    color-scheme: light;
    --ink: #302324;
    --muted: #675457;
    --line: #ecdcdb;
    --field-border: #bca6a6;
    --paper: #fbf7f6;
    --surface-tint: #f8eceb;
    --nav: #6f101d;
    --nav-hover: #821623;
    --nav-active: #971b29;
    --nav-muted: #f5d9d8;
    --red: #b41420;
    --red-dark: #91121c;
    --green: #296237;
    --green-tint: #e8f3e7;
    font: 15px/1.5 "Segoe UI", "Inter", system-ui, sans-serif;
    color: var(--ink);
    background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--red-dark); font-weight: 650; text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.sidebar :focus-visible { outline-color: #ffe1dd; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 3vw, 2.45rem); line-height: 1.17; letter-spacing: -.045em; }
h2 { font-size: 1.17rem; line-height: 1.3; letter-spacing: -.02em; }
h3 { font-size: 1rem; }
p + p { margin-top: .55rem; }
small { display: block; color: var(--muted); font-size: .84rem; }

.shell { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 235px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.sidebar { background: var(--nav); color: white; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 24px 16px 17px; }
.brand { display: flex; gap: 12px; align-items: center; color: white; font-size: 1.03rem; line-height: 1.2; overflow-wrap: anywhere; }
.sidebar .brand { flex-shrink: 0; padding: 0 8px; }
.brand:hover { text-decoration: none; }
.brand small { color: var(--nav-muted); font-weight: 400; margin-top: 4px; }
.brand-mark { display: block; flex: 0 0 auto; width: 54px; height: 54px; padding: 5px; border-radius: 10px; background: white; object-fit: contain; }
.brand-name { min-width: 0; font-weight: 700; }
.logo-setting { display: flex; align-items: center; gap: 10px; }
.logo-setting .brand-mark { width: 62px; height: 62px; border: 1px solid var(--line); }
.logo-setting label { flex: 1; min-width: 0; }
.sidebar nav { margin-top: 34px; display: grid; gap: 4px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sidebar nav a:focus-visible { outline-offset: -3px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; color: var(--nav-muted); border-radius: 9px; padding: 10px 11px; font-weight: 500; white-space: nowrap; }
.sidebar nav a:hover { background: var(--nav-hover); text-decoration: none; }
.sidebar nav .active { background: var(--nav-active); color: white; font-weight: 700; }
.nav-icon { width: 21px; text-align: center; color: #ffd1cd; font-size: 1.15rem; }
.nav-count { padding: 0 7px; border-radius: 8px; color: #583400; background: #ffe0a2; margin-left: auto; font-size: .8rem; }
.account { display: flex; flex-shrink: 0; gap: 9px; align-items: center; margin-top: auto; padding: 15px 2px 0; }
.account-profile { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 6px; border-radius: 9px; color: white; }
.account-profile:hover, .account-profile[aria-current="page"] { background: var(--nav-hover); text-decoration: none; }
.account-profile > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.account strong { display: block; font-size: .87rem; }
.account small { color: var(--nav-muted); font-size: .76rem; }
.account form { margin-left: auto; }
.avatar { display: grid; place-items: center; border-radius: 100%; width: 33px; height: 33px; flex: 0 0 33px; background: var(--nav-active); color: #fff; font-weight: 700; }
.signout { color: white; background: transparent; border: 0; padding: 7px; font-size: 1.1rem; }
.workspace { display: grid; grid-template-rows: minmax(0, 1fr); min-width: 0; min-height: 0; }
.workspace-scroll { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; scroll-padding-block: 12px; }
.workspace-scroll:focus-visible, .print-scroll:focus-visible { outline-offset: -3px; }
.content { max-width: 1480px; margin: 0 auto; padding: 31px clamp(18px,4vw,49px) 50px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 24px; }
.page-head p, .muted { color: var(--muted); }
.page-head p { margin-top: 7px; }
.student-heading { display: flex; align-items: center; gap: 13px; min-width: 0; overflow-wrap: anywhere; }
.student-avatar { flex: 0 0 auto; display: grid; place-items: center; width: clamp(48px, 8vw, 70px); aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-tint); color: var(--red-dark); }
.student-avatar svg { display: block; width: 64%; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--field-border); border-radius: 8px; padding: 8px 14px; color: var(--ink); background: white; font-weight: 650; text-align: center; }
.button:hover { text-decoration: none; background: var(--surface-tint); }
.button.primary { background: var(--red); border-color: var(--red); color: white; }
.button.primary:hover { background: var(--red-dark); }
.button.danger { color: #97291d; border-color: #e9bbba; }
.button.danger:hover { background: #fff1ef; }
.card, .metric { background: white; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 2px 5px #5a172011; }
.card { padding: clamp(16px,2.3vw,23px); min-width: 0; }
.card > h2 { margin-bottom: 12px; }
.narrow { max-width: 530px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 15px; margin-bottom: 20px; }
.metric { display: grid; gap: 6px; color: var(--ink); font-weight: 650; padding: 16px 17px; border-top: 3px solid var(--red); }
.metric:hover { text-decoration: none; background: var(--paper); }
.metric span { color: var(--muted); }
.metric strong { font-size: 2.18rem; line-height: 1.2; }
.metric.green { border-top-color: var(--green); }
.metric.neutral { border-top-color: #917275; }
.metric.amber { border-top-color: #c68731; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(240px, 1fr); gap: 17px; align-items: start; }
.schedule-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: 12px; }
.calendar-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; gap: clamp(18px, 3vw, 34px); }
.calendar-details { min-width: 0; padding-inline-start: 20px; border-inline-start: 1px solid var(--line); }
.calendar-picker { display: grid; gap: 9px; }
.calendar-mode button { background: transparent; color: var(--ink); font-size: .86rem; font-weight: 650; border: 0; border-radius: 6px; min-height: 37px; padding: 5px; }
.calendar-mode button[aria-pressed="true"] { background: var(--red-dark); color: white; }
.calendar-month { display: flex; justify-content: space-between; gap: 5px; align-items: center; text-align: center; }
.calendar-month strong { text-transform: capitalize; }
.calendar-month .button { min-height: 34px; width: 34px; padding: 0; font-size: 1.25rem; }
.calendar-month button:disabled { opacity: .45; cursor: default; }
.calendar-week, .calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.calendar-week { color: var(--muted); font-size: .77rem; font-weight: 700; }
.calendar-day { position: relative; min-height: 35px; padding: 0; border: 1px solid transparent; border-radius: 7px; color: var(--ink); background: var(--paper); font-size: .88rem; font-weight: 650; }
.calendar-day:hover:not(:disabled) { border-color: var(--red); }
.calendar-day[aria-current="date"] { border-color: var(--field-border); }
.calendar-day[aria-pressed="true"] { background: var(--red-dark); color: white; }
.calendar-day:disabled { background: transparent; color: #856f73; cursor: default; font-weight: 400; }
.calendar-key::before, .calendar-day.calendar-saved::after { width: 5px; height: 5px; border-radius: 50%; background: #94601c; content: ""; }
.calendar-day.calendar-saved::after { position: absolute; bottom: 3px; left: calc(50% - 2.5px); }
.calendar-day.calendar-saved[aria-pressed="true"]::after { background: #ffdfa6; }
.calendar-key::before { display: inline-block; margin: 0 6px 2px 1px; }
.calendar-selection { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 3px 8px; align-items: start; }
.calendar-selection button { font-size: .83rem; }
[data-calendar-save]:disabled { opacity: .5; cursor: default; }
.calendar-saved-days { max-height: 236px; overflow-y: auto; }
.check-grid { display: grid; grid-template-columns: minmax(250px, 1.25fr) minmax(225px, 1fr); gap: 17px; align-items: start; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-title time { white-space: nowrap; color: var(--muted); }
.empty { padding: 27px 12px; border: 1px dashed var(--field-border); border-radius: 9px; background: var(--paper); text-align: center; }
.empty p { color: var(--muted); margin-top: 3px; }
.shift dl, .details { margin: 0 0 10px; }
.shift dl div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 9px 0; }
.shift dd, .details dd { margin: 0; font-weight: 650; }
.details div { display: grid; grid-template-columns: minmax(110px,.6fr) 1fr; gap: 9px; padding: 5px 0; }
.details dt, .shift dt { color: var(--muted); }
.details dd { overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .035em; background: var(--surface-tint); }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td, th { min-width: 84px; }
td small { margin-top: 3px; }
.stack { display: grid; gap: 13px; }
.compact { gap: 5px; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0, 1fr)); gap: 13px 16px; }
.fields .wide { grid-column: 1/-1; }
.student-form { display: grid; gap: 16px; }
.student-form-card { overflow: hidden; padding: 0; border-radius: 16px; }
.student-form-heading { display: flex; align-items: center; gap: 12px; padding: 15px clamp(16px, 2.4vw, 24px); background: var(--paper); border-bottom: 1px solid var(--line); }
.student-form-heading .document-block-icon { flex-basis: 42px; height: 42px; border-radius: 12px; }
.student-form-heading h2 { font-size: 1.25rem; }
.student-form-heading p { margin-top: 3px; }
.student-form-fields { padding: clamp(16px, 2.4vw, 24px); }
.student-form-fields :is(input, select) { min-height: 44px; }
.student-form-fields textarea { min-height: 68px; }
.student-upload { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.student-upload label { flex: 1; min-width: 0; }
.student-upload input[type="file"] { padding: 5px; background: white; font-weight: 400; }
.student-upload input::file-selector-button { margin-right: 7px; padding: 6px; color: var(--red-dark); border: 0; border-radius: 6px; background: var(--surface-tint); font: inherit; cursor: pointer; }
.student-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.student-form > .student-form-actions { padding: 12px 0 0; border-top: 1px solid var(--line); }
.student-form-actions .button { min-height: 44px; }
@media (min-width: 1080px) {
    .student-form { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
    .student-form-documents, .student-form > .student-form-actions { grid-column: 1 / -1; }
}
.filters { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters:last-child { margin-bottom: 0; }
.filters label { flex: 0 1 300px; }
.fields .muted, .card > .muted { margin-bottom: 11px; }
label { display: grid; gap: 5px; font-weight: 630; color: var(--ink); font-size: .91rem; }
input, select, textarea { display: block; width: 100%; min-width: 0; min-height: 40px; padding: 7px 10px; border: 1px solid var(--field-border); border-radius: 7px; background: white; color: var(--ink); font-weight: 400; }
textarea { resize: vertical; }
input[type=file] { padding: 6px; background: var(--paper); }
input[type=file]::file-selector-button { cursor: pointer; padding: 5px 8px; margin-right: 7px; font: inherit; border: 1px solid var(--line); background: white; border-radius: 4px; }
.uppercase { text-transform: uppercase; }
.mono, code { font-family: Consolas, "Courier New", monospace; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: .8rem; font-weight: 650; }
.pill.warning, .notice.warning { background: #fff2dc; color: #795015; }
.pill.ok, .notice.ok { background: var(--green-tint); color: var(--green); }
.pill.neutral { background: var(--surface-tint); color: var(--muted); }
.notice { border-radius: 8px; margin-bottom: 15px; padding: 11px 13px; }
.notice.error { background: #fbe9e6; color: #8d251b; }
.notice.info { background: var(--surface-tint); color: var(--ink); }
.notice a { color: inherit; text-decoration: underline; }
.qr { display: grid; justify-items: center; text-align: center; }
.qr img { max-width: 100%; height: auto; display: block; margin: 0 0 11px; }
.badge-preview-trigger { display: block; max-width: 100%; margin: 0 0 11px; padding: 0; border: 0; border-radius: 14px; background: transparent; cursor: zoom-in; }
.badge-preview-trigger img { margin: 0; }
.service-dialog.badge-preview-dialog { width: min(540px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 14px; }
.badge-preview-dialog .service-dialog-head { align-items: center; margin-bottom: 10px; }
.badge-preview-dialog img { width: min(100%, 460px, calc(75dvh - 74px)); margin: 0 auto; }
.qr > .muted { margin: 8px 0 0; }
.badge-family-access { margin: 0 0 10px; padding: 7px 11px; border-radius: 8px; background: var(--surface-tint); }
.badge-family-access strong { color: var(--red-dark); letter-spacing: .08em; white-space: nowrap; }
.documents-heading { margin: 18px 0 10px; }
.document-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 212px), 1fr)); gap: 10px; list-style: none; margin: 0; padding: 0; }
.document-block { display: flex; align-items: center; gap: 11px; min-height: 67px; height: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); }
.document-block:hover:not(.pending) { text-decoration: none; border-color: #b56c73; background: var(--surface-tint); box-shadow: 0 2px 6px #5a17201a; }
.document-block-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 9px; background: var(--surface-tint); color: var(--red-dark); }
.document-block strong { display: block; font-size: .94rem; line-height: 1.25; }
.document-block small { margin-top: 2px; color: var(--red-dark); font-weight: 650; }
.document-block.pending { border-style: dashed; background: white; }
.document-block.pending .document-block-icon { background: var(--paper); color: var(--muted); }
.document-block.pending small { color: var(--muted); font-weight: 400; }
.document-upload-block { position: relative; cursor: pointer; }
.document-upload-block > span { min-width: 0; }
.document-upload-block small { overflow-wrap: anywhere; }
.document-upload-block input { position: absolute; inset: 0; height: 100%; opacity: 0; cursor: pointer; }
.document-upload-block:hover, .document-upload-block.has-file { border-color: #b56c73; background: var(--surface-tint); }
.document-upload-block:focus-within { outline: 3px solid var(--red); outline-offset: 3px; }
.document-save { margin-top: 13px; }
.document-save:disabled { opacity: .55; cursor: default; }
.student-services { margin-top: 15px; }
.student-services button { text-align: left; }
.history-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 14px; }
.history-actions .document-block { flex: 0 1 250px; height: auto; text-align: left; }
.service-dialog.history-dialog { width: min(860px, calc(100% - 28px)); }
.history-filters label { flex-basis: 210px; }
.history-hint { font-size: .87rem; margin: -5px 0 10px; }
.history-results { margin-top: 8px; }
.service-dialog { width: min(690px, calc(100% - 28px)); max-height: 88dvh; overflow-y: auto; color: var(--ink); border: 1px solid var(--line); border-radius: 17px; padding: clamp(17px, 4vw, 26px); box-shadow: 0 20px 70px #32101440; }
.service-dialog::backdrop { background: #26111485; }
.service-dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 17px; }
.service-dialog-head p { margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.service-close { width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--red-dark); font-size: 1.4rem; }
.service-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.service-actions button:disabled { opacity: .5; cursor: default; }
.fee-plan-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr); }
.fee-panel { margin-top: 16px; }
.fee-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr)); gap: 8px; margin: 0; }
.fee-totals > div { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; }
.fee-totals dt { font-size: .8rem; color: var(--muted); }
.fee-totals dd { margin: 2px 0 0; font-weight: 750; }
.school-print { background: var(--paper); }
.print-toolbar { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; max-width: 870px; margin: 18px auto 12px; padding: 0 14px; }
.print-sheet { max-width: 840px; margin: 0 auto 20px; padding: clamp(18px, 5vw, 42px); background: white; border: 1px solid var(--line); border-radius: 10px; }
.print-brand { display: flex; align-items: center; gap: 14px; padding-bottom: 13px; border-bottom: 2px solid var(--red-dark); }
.print-brand img { flex: 0 0 65px; width: 65px; height: 65px; object-fit: contain; }
.print-brand p, .print-sheet dd { overflow-wrap: anywhere; }
.print-school-name { font-size: 1.09rem; font-weight: 750; }
.print-sheet h1 { font-size: 1.95rem; margin: 20px 0 13px; overflow-wrap: anywhere; }
.print-date { color: var(--muted); }
.print-recipient { margin: 19px 0 10px; font-weight: 750; }
.print-data { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr)); gap: 10px; margin: 17px 0; }
.print-data > div { padding: 8px 10px; border-top: 1px solid var(--line); break-inside: avoid; }
.print-data dt { color: var(--muted); font-size: .82rem; }
.print-data dd { margin: 2px 0 0; font-weight: 650; }
.print-signature { margin: 45px auto 0; max-width: 315px; padding-top: 8px; border-top: 1px solid var(--line); text-align: center; break-inside: avoid; }
.receipt-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.receipt-head time { color: var(--muted); }
.receipt-amounts { margin: 17px 0 0; }
.receipt-amounts > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.receipt-amounts dd { margin: 0; font-weight: 750; }
.receipt-payment { color: var(--red-dark); background: var(--surface-tint); font-weight: 750; }
@page schoolDocument { size: letter; margin: 16mm; }
@media screen {
    .school-print { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
    .print-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; }
}
@media print {
    html:has(.school-print) { background: white; }
    .school-print { page: schoolDocument; background: white; color: #222; print-color-adjust: exact; }
    .school-print .print-toolbar { display: none; }
    .school-print .print-sheet { max-width: none; margin: 0; padding: 0; border: 0; }
    .school-print .print-data { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.document-list { list-style: none; padding: 0; margin: 10px 0 0; }
.document-list li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: space-between; align-items: center; }
.calendar-saved-days li { flex-wrap: wrap; align-items: baseline; }
.calendar-range-label { min-width: 0; overflow-wrap: anywhere; }
.calendar-range-removal[open] { flex-basis: 100%; }
.calendar-range-removal form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 8px; }
.calendar-range-removal label { flex: 1 1 155px; }
.spaced { margin-top: 17px; }
.report { border-top: 1px solid var(--line); padding: 13px 0; }
.report .section-title { margin-bottom: 6px; }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.evidence { display: inline-block; margin: 5px 9px 0 0; overflow-wrap: anywhere; }
details > summary { font-weight: 750; color: var(--red-dark); }
.inset { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.student-removal-button { width: min(100%, 250px); border-color: #e8c4c0; color: var(--red-dark); text-align: left; }
.student-removal-button .document-block-icon { background: #f9e2df; }
.student-removal-dialog { width: min(490px, calc(100% - 28px)); }
.link-button { color: var(--red-dark); text-decoration: underline; border: 0; background: transparent; padding: 0; }
.scan-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 15px 24px; margin-bottom: 20px; padding: clamp(16px, 3vw, 28px); border-radius: 18px; color: white; background: radial-gradient(ellipse at right top, #a12030, var(--nav) 70%); }
.scan-header-identity, .scan-header-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 15px; }
.scan-header-identity { flex: 1 1 290px; flex-wrap: nowrap; overflow-wrap: anywhere; }
.scan-header-identity .brand-mark { width: clamp(50px, 7vw, 76px); height: auto; aspect-ratio: 1; padding: 7px; }
.scan-header-identity p, .scan-clock-date { color: var(--nav-muted); font-weight: 650; }
.scan-header-identity h1 { margin-top: 4px; }
.scan-clock { padding-inline: 12px; border-inline-start: 1px solid #ffffff44; font-variant-numeric: tabular-nums; }
.scan-clock time { display: block; }
.scan-clock-time { font-size: clamp(1.7rem, 4vw, 3rem); font-weight: 750; line-height: 1.1; }
.scan-collapse { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: white; }
.scan-collapse:hover { background: #ffffff24; }
.scan-collapse:focus-visible { outline-color: white; }
.scanner { text-align: center; padding: clamp(20px, 3vw, 36px); }
.scanner h2 { font-size: clamp(1.35rem, 2.2vw, 1.85rem); }
.scanner > p { max-width: 46ch; margin-inline: auto; }
.scanner form { width: 100%; max-width: 500px; margin: 19px auto 0; text-align: left; }
.scanner form label { font-size: 1rem; }
.scanner #scan-token { min-height: clamp(56px, 8vh, 76px); padding-inline: 17px; font-size: clamp(1.15rem, 2vw, 1.4rem); }
.scan-last-result { max-width: 375px; margin: 17px auto 0; overflow-wrap: anywhere; }
.scan-activity > h2 { margin-bottom: 3px; font-size: clamp(1.2rem, 2vw, 1.6rem); }
.scan-activity > .empty { margin-top: 14px; }
.scan-activity-list { display: grid; margin: 13px 0 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 12px; }
.scan-activity-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px clamp(8px, 1.4vw, 16px); min-height: 38px; padding: 7px clamp(9px, 1.4vw, 15px); }
.scan-activity-list li + li { border-top: 1px solid var(--line); }
.scan-activity-list li:nth-child(even) { background: var(--paper); }
.scan-activity-list li:last-child { border-radius: 0 0 11px 11px; }
.scan-activity-list strong { overflow-wrap: anywhere; line-height: 1.25; }
.scan-activity-list time { font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; }
.shell.scan-projection { grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.scan-shell:not(.scan-projection) .scan-collapse,
.scan-projection .sidebar, .scan-projection #alert-live,
.scan-projection [data-start-projection], .scan-projection .scan-last-result,
:fullscreen .scan-expand { display: none; }
#scan-error { margin: 12px auto 0; max-width: 375px; }
.scan-projection .workspace-scroll {
    background-color: #f7eded;
    background-image:
        radial-gradient(ellipse at 4% 8%, #ca78954a, transparent 49%),
        radial-gradient(ellipse at 94% 95%, #b54f6040, transparent 49%),
        repeating-linear-gradient(-45deg, #9d23340d 0 1px, transparent 1px 24px),
        linear-gradient(145deg, #f9eeed, #fdf9f8 52%, #f4e4e4);
}
.scan-projection .content {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    max-width: 1240px;
    padding-bottom: clamp(20px, 3vh, 34px);
}
.scan-projection .scan-header { margin-bottom: 0; box-shadow: 0 14px 32px #6f101d28; }
.scan-projection .check-grid {
    flex: 1 0 auto;
    min-height: clamp(460px, 60dvh, 560px);
    margin-top: clamp(20px, 4vh, 40px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(17px, 2vw, 26px);
    align-items: stretch;
}
.scan-projection .check-grid > .card {
    display: flex;
    flex-direction: column;
    padding: clamp(18px, 2.5vw, 28px);
    border-top-width: 4px;
    border-radius: 18px;
    box-shadow: 0 10px 26px #6f101d14;
}
.scan-projection .scanner { border-top-color: var(--red); }
.scan-projection .check-grid h2 { margin-bottom: 18px; font-size: clamp(1.65rem, 3.4vw, 2.6rem); text-align: center; }
.scan-projection .scanner > h2 { order: -1; }
.scan-projection .scan-icon { width: clamp(90px, 8.5vw, 118px); height: auto; aspect-ratio: 1; border-radius: 24px; }
.scan-projection .scan-icon svg { width: 56%; height: auto; }
.scan-projection .scanner form { margin-block: auto; padding-top: 19px; }
.scan-projection .scan-activity > .empty { margin-block: auto; }
.scan-projection .scan-activity-list { margin-top: 0; }
@media (max-width: 780px) {
    .scan-projection .check-grid { flex: 0 0 auto; min-height: 0; margin-top: 18px; grid-template-columns: minmax(0, 1fr); }
}
.scan-result { width: min(620px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; color: var(--ink); background: white; border: 1px solid var(--line); border-top: 7px solid var(--green); border-radius: 20px; box-shadow: 0 16px 56px #32101455; padding: clamp(22px, 5vw, 44px); text-align: center; overflow-wrap: anywhere; }
.scan-result::backdrop { background: #2d141c9c; }
.scan-projection .scan-result {
    position: fixed;
    inset: 0;
    height: fit-content;
    margin: auto;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 16px 56px #32101455, 0 0 0 100vmax #2d141c9c;
}
.scan-result.is-late { border-top-color: #a2630f; }
.scan-result-greeting { font-weight: 700; font-size: 1.05rem; color: var(--muted); }
.scan-result h2 { margin: 6px 0 13px; font-size: clamp(1.55rem, 4.6vw, 2.55rem); }
.scan-result-time time { margin-inline-start: 5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.scan-result-feedback { display: inline-block; margin-top: 15px; padding: 7px 15px; border-radius: 10px; background: var(--green-tint); color: var(--green); font-size: clamp(1.07rem, 2.7vw, 1.48rem); font-weight: 800; }
.is-late .scan-result-feedback { background: #fff0d7; color: #794909; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-tint); border-radius: 9px; padding: 4px; gap: 4px; }
.segmented a { padding: 8px; border-radius: 6px; color: var(--ink); }
.segmented .chosen { background: var(--red); color: white; }
.scan-icon { background: var(--surface-tint); color: var(--red); width: 74px; height: 74px; border-radius: 19px; display: grid; place-items: center; margin: 0 auto 14px; }
.scan-icon svg { width: 37px; height: 37px; }
.receipt { background: var(--green-tint); color: var(--green); padding: 13px; border-radius: 8px; }
.receipt p { margin-top: 5px; }

.login { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); overflow-y: auto; overscroll-behavior: contain; background: white; }
.login-side { min-height: 510px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; background: radial-gradient(ellipse at 90% 100%, #ab1c28, var(--nav) 74%); color: white; padding: 45px clamp(24px,6vw,101px); }
.login-side .brand-mark { --logo-size: clamp(104px, 11vw, 144px); width: var(--logo-size); height: var(--logo-size); padding: 9px; }
.login-side h1 { font-size: clamp(2rem,5vw,4rem); max-width: 530px; line-height: 1.02; }
.login-side p { margin-top: 15px; color: var(--nav-muted); max-width: 420px; }
.login-footer { color: var(--nav-muted); font-size: .89rem; }
.login-main { display: grid; place-items: center; padding: 28px; }
.login-form { width: 100%; max-width: 400px; }
.login-form h2 { font-size: 1.9rem; }
.login-form > p { margin: 7px 0 23px; color: var(--muted); }
.login-sections { margin-bottom: 21px; text-align: center; }
.family-workspace { height: 100vh; height: 100dvh; }
.family-brand { min-width: 0; gap: 10px; }
.family-brand .brand-mark { width: 42px; height: 42px; padding: 3px; }
.family-content { max-width: 1020px; }
.family-hero { display: grid; gap: 16px; padding: clamp(18px, 4vw, 30px); margin-bottom: 17px; border-radius: 18px; color: white; background: radial-gradient(ellipse at right top, #ab2633, var(--nav) 72%); box-shadow: 0 8px 22px #6f101d24; }
.family-hero-school, .family-hero-content { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.family-hero-school { padding-bottom: 12px; border-bottom: 1px solid #ffffff44; }
.family-hero-school form { flex: 0 0 auto; }
.family-hero-school button { min-height: 44px; }
.family-profile { display: flex; min-width: 0; align-items: center; gap: 14px; }
.family-profile > div { min-width: 0; overflow-wrap: anywhere; }
.family-profile h1 { margin: 4px 0; font-size: clamp(1.52rem, 3.2vw, 2.2rem); }
.family-profile p { color: #fff0ee; font-size: .89rem; }
.family-profile-icon, .family-time-icon { display: inline-grid; flex: 0 0 auto; place-items: center; border-radius: 10px; }
.family-profile-icon { width: 48px; height: 48px; color: white; background: #ffffff22; border: 1px solid #ffffff55; overflow: hidden; }
.family-profile-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.student-photo-field { display: flex; align-items: center; gap: 12px; }
.student-photo-field > label { flex: 1; min-width: 0; }
.student-photo-field > img { flex: 0 0 64px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.family-refresh { flex: 0 0 auto; gap: 7px; min-height: 44px; color: var(--red-dark); border: 0; }
.family-refresh svg { width: 18px; height: 18px; }
.family-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.family-notification-button { position: relative; min-height: 44px; gap: 7px; color: var(--red-dark); border: 0; }
.family-notification-button svg { width: 18px; height: 18px; }
.family-notification-button.has-unread { background: #fff0ee; box-shadow: 0 0 0 2px #ffb6bc; animation: family-unread-pulse 1.4s ease-in-out infinite; }
.family-unread-count { padding: 2px 6px; border-radius: 20px; color: white; background: var(--red); line-height: 1.25; font-size: .8rem; }
@keyframes family-unread-pulse {
    50% { background: #ffd0d5; box-shadow: 0 0 0 4px #ffafb788; }
}
@media (prefers-reduced-motion: reduce) {
    .family-notification-button.has-unread { animation: none; }
}
.family-inbox > h2 { margin-bottom: 12px; }
.family-inbox-list { display: grid; gap: 9px; list-style: none; margin: 0; padding: 0; }
.family-inbox-list li { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.family-inbox-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; margin-bottom: 4px; }
.family-inbox-heading time { color: var(--muted); font-size: .85rem; }
.announcement-admin { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.announcement-admin .card > h2 { margin-bottom: 14px; }
.announcement-compose > .button { justify-self: start; }
.announcement-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.announcement-message-field { display: grid; gap: 4px; }
.announcement-message-field > span { font-weight: 700; }
.announcement-message-field small { color: var(--muted); }
.announcement-editor { min-height: 145px; max-height: 360px; overflow-y: auto; padding: 9px 10px; border: 1px solid var(--field-border); border-radius: 7px; background: white; }
.announcement-editor:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.announcement-editor img { cursor: pointer; }
.announcement-editor img.is-selected, .announcement-editor img:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.announcement-image-options { position: fixed; z-index: 110; display: grid; gap: 8px; min-width: 166px; max-height: calc(100dvh - 16px); overflow: auto; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); box-shadow: 0 9px 26px #32101430; }
.announcement-option-group { display: grid; gap: 2px; }
.announcement-option-group + .announcement-option-group { padding-top: 5px; border-top: 1px solid var(--line); }
.announcement-option-group strong { padding: 2px 9px; font-size: .8rem; color: var(--muted); }
.announcement-option-group button { min-height: 35px; padding: 4px 9px; border: 0; border-radius: 6px; background: white; color: var(--ink); text-align: left; cursor: pointer; }
.announcement-option-group button:hover, .announcement-option-group button[aria-pressed="true"] { background: var(--surface-tint); color: var(--red-dark); }
.announcement-option-group button[aria-pressed="true"] { font-weight: 700; }
.announcement-dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 10px 14px; }
.announcement-emojis { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.announcement-emojis .button { min-width: 40px; padding: 5px 8px; }
.announcement-text-select { width: auto; min-width: 120px; }
.announcement-emoji-picker { margin-top: -5px; }
.announcement-emoji-picker summary { width: fit-content; cursor: pointer; color: var(--red-dark); font-weight: 700; }
.announcement-emoji-picker .announcement-emojis { margin: 8px 0 0; }
.announcement-upload-feedback { color: var(--red-dark); }
.announcement-preview { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.announcement-preview > h3 { margin-bottom: 8px; color: var(--muted); font-size: .85rem; }
.announcement-preview-body { padding: 12px; border-radius: 8px; background: white; }
.announcement-preview-body h3, .announcement-list-row h3, .announcement-dialog h2 { overflow-wrap: anywhere; }
.announcement-list-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.announcement-list-row > div:not(.announcement-actions), .announcement-list-row > h3 { flex: 1 1 160px; min-width: 0; }
.announcement-read-button { flex: 0 0 auto; }
.announcement-excerpt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; margin-top: 4px; color: var(--muted); }
.announcement-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.announcement-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.announcement-body [data-text-align] { display: block; }
.announcement-body [data-text-align="left"] { text-align: left; }
.announcement-body [data-text-align="center"] { text-align: center; }
.announcement-body [data-text-align="right"] { text-align: right; }
.announcement-body [data-text-align="justify"] { text-align: justify; }
.announcement-dialog .announcement-body { margin-top: 8px; }
.announcement-body img { display: block; max-width: 100%; max-height: 460px; margin-block: 8px; border-radius: 8px; object-fit: contain; }
.announcement-body img[data-size="small"] { max-width: 35%; }
.announcement-body img[data-size="medium"] { max-width: 65%; }
.announcement-body img[data-align="center"] { margin-inline: auto; }
.announcement-body img[data-align="right"] { margin-inline: auto 0; }
.announcement-inline-image { display: block; }
@media (max-width: 800px) {
    .announcement-admin { grid-template-columns: minmax(0, 1fr); }
    .announcement-editor { font-size: 16px; }
}
.family-dashboard { display: grid; grid-template-columns: minmax(0, 1fr); gap: 15px; align-items: start; }
.family-dashboard.has-report-notice { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); grid-template-areas: "attendance direction"; }
.has-report-notice .family-attendance { grid-area: attendance; }
.family-section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 13px; }
.family-section-head time { padding: 4px 9px; border-radius: 8px; background: var(--surface-tint); color: var(--red-dark); font-size: .84rem; font-weight: 700; white-space: nowrap; }
.family-notices { display: grid; gap: 9px; margin-top: 14px; }
.family-notice { margin: 0; overflow-wrap: anywhere; }
.family-notice p { margin-top: 4px; }
.family-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.family-times > div { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.family-times dt { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 650; }
.family-time-icon { width: 34px; height: 34px; background: var(--surface-tint); color: var(--red-dark); }
.family-time-icon svg { width: 19px; height: 19px; }
.family-times .is-registered { border-color: #cfe1cd; background: #f5fbf4; }
.family-times .is-registered .family-time-icon { background: var(--green-tint); color: var(--green); }
.family-times dd { margin: 7px 0 0; font-size: clamp(1.03rem, 2vw, 1.45rem); font-weight: 750; font-variant-numeric: tabular-nums; }
.family-direction { grid-area: direction; border-color: #ead3b2; background: #fff8ed; }
.family-direction .family-time-icon { width: 39px; height: 39px; margin-bottom: 9px; color: #795015; background: #f8e8ce; }
.family-direction > h2 { margin-bottom: 7px; color: #684313; }
.family-direction > p { color: #5f492e; }
@media (max-width: 1050px) {
    .metrics { grid-template-columns: repeat(2,minmax(0, 1fr)); }
}
@media (max-width: 960px) {
    .schedule-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .calendar-layout { grid-template-columns: minmax(0, 1fr); }
    .calendar-details { padding: 16px 0 0; border-inline-start: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 780px) {
    .shell { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); }
    .sidebar { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; max-height: 45dvh; padding: 10px 14px; gap: 8px 12px; }
    .sidebar .brand { grid-area: 1 / 1; padding: 0; }
    .sidebar nav { grid-area: 2 / 1 / 3 / -1; display: flex; min-width: 0; overflow-x: auto; overflow-y: hidden; margin: 0; }
    .sidebar nav a { padding: 7px 8px; }
    .account { grid-area: 1 / 2; margin: 0; padding: 0; }
    .dashboard-grid, .check-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
    .family-dashboard.has-report-notice { grid-template-columns: minmax(0, 1fr); grid-template-areas: "direction" "attendance"; }
}
@media (max-width: 540px) {
    .login { grid-template-columns: 1fr; }
    .login-side { min-height: auto; padding: 25px; }
    .login-side h1 { font-size: 2rem; }
    .login-footer { display: none; }
    .family-login .login-side { gap: 14px; padding: 19px 17px; }
    .family-login .login-side .brand-mark { --logo-size: 60px; padding: 5px; }
    .family-login .login-side h1 { font-size: 1.65rem; }
    .family-login .login-side p { margin-top: 7px; }
    .family-login .login-main { padding: 20px 17px; }
    .family-login .login-form input, .family-login .login-form button { min-height: 44px; }
    .family-login .login-sections a { display: grid; place-items: center; min-height: 44px; }
    .family-login .login-form input { font-size: 16px; }
    .family-content { padding: 18px 14px 28px; }
    .family-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 15px; margin-bottom: 13px; }
    .family-hero-content { display: grid; grid-template-columns: minmax(0, 1fr); }
    .family-actions { justify-content: flex-start; }
    .family-profile { gap: 9px; }
    .family-profile-icon { width: 36px; height: 36px; }
    .family-attendance { padding: 14px; }
    .family-times { gap: 8px; }
    .family-times > div { padding: 10px; }
    .sidebar .avatar { display: none; }
    .fields { grid-template-columns: minmax(0,1fr); }
    .schedule-fields { grid-template-columns: minmax(0,1fr); }
    .page-head { flex-wrap: wrap; align-items: start; }
    .metric { padding: 12px; }
    .content { padding-top: 21px; }
}
@media (max-width: 360px) {
    .family-times { grid-template-columns: minmax(0, 1fr); }
}
