:root {
    color-scheme: light;
    --ink: #203d54;
    --muted: #587082;
    --blue: #1668a9;
    --border: #dce6ee;
    --page: #fff6e9;
    --tint: #fff1d8;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.5 "Segoe UI", sans-serif; transition: background-color .25s; }
body[data-action="TestScores"] { --page: #edf9ee; --tint: #dcf4df; }
body[data-action="Changes"] { --page: #edf5ff; --tint: #deedff; }
a { color: var(--blue); }
button, select, input { font: inherit; }
button, select, input[type="checkbox"] { cursor: pointer; }
button, select, input { min-height: 48px; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .65; }
:focus-visible { outline: 3px solid #1979bf; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.45rem); line-height: 1.2; letter-spacing: -.035em; }
h2 { font-size: 1.5rem; letter-spacing: -.025em; }
label { display: block; font-size: .85rem; font-weight: 650; margin-bottom: 7px; }
select, input[type="date"], .test-score-fields input { width: 100%; max-width: 100%; padding: 11px 12px; border: 1px solid #bbcfdf; border-radius: 9px; background: white; color: var(--ink); min-width: 0; }
.topbar { background: white; border-bottom: 1px solid var(--border); padding: 16px max(24px, calc((100% - 1080px)/2)); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.topbar form { flex-shrink: 0; margin-left: auto; }
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; font-size: 1.1rem; font-weight: 750; color: var(--ink); min-width: 0; }
.brand small { display: block; font-size: .62rem; letter-spacing: .18em; color: var(--muted); }
.brand-logo { display: block; width: 52px; max-width: 100%; height: auto; flex-shrink: 0; }
.workspace { width: min(1080px, calc(100% - 40px)); margin: 28px auto; }
.demo-notice { padding: 12px 16px; background: #fff5cf; border: 1px solid #e8cf7c; border-radius: 10px; font-size: .83rem; color: #665019; }
.demo-notice strong { font-size: .72rem; letter-spacing: .08em; margin-right: 8px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 32px 0 26px; }
.page-heading > div { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.page-heading > div:first-child { flex: 1; }
.eyebrow { color: var(--blue); font-size: .73rem; font-weight: 800; letter-spacing: .12em; margin-bottom: 9px; }
.intro { color: var(--muted); margin-top: 12px; }
.identity { text-align: right; flex: 0 1 320px; }
.identity small { display: block; font-size: .75rem; margin-top: 9px; overflow-wrap: anywhere; }
.role-badge { display: inline-block; border: 1px solid #c9dcea; border-radius: 30px; background: white; padding: 7px 12px; font-size: .75rem; font-weight: 700; }
.panel { background: white; border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: 0 8px 26px #203d5405; margin-bottom: 22px; }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: 18px; }
body[data-action="TestScores"] .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.filters > div { min-width: 0; }
.filters .filter-student { grid-column: span 2; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.section-heading .eyebrow { margin-bottom: 3px; }
.autosave-label { font-size: .78rem; color: #356653; background: #edf7f0; border-radius: 20px; padding: 7px 12px; white-space: nowrap; }
.hint { font-size: .87rem; color: var(--muted); margin-top: 16px; max-width: 760px; }
.save-feedback { color: #226246; font-size: .85rem; min-height: 24px; margin-top: 10px; }
.save-feedback.error, .alert { color: #a12020; }
.register-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 12px; background: var(--tint); padding: 12px 16px; border-radius: 10px; margin: 6px 0 16px; font-size: .85rem; }
.register-header, .student-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.register-header { color: var(--muted); font-size: .75rem; font-weight: 700; padding: 0 4px 12px; border-bottom: 1px solid var(--border); }
.student-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 14px 4px; border-bottom: 1px solid #edf1f5; }
.student-row:last-child { border-bottom: 0; }
.student-name { display: flex; align-items: center; gap: 13px; min-width: 0; }
.student-name > div { min-width: 0; }
.student-name strong { font-size: .95rem; overflow-wrap: anywhere; }
.avatar { width: 40px; height: 40px; background: #eef4fa; color: #476d8d; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: .75rem; font-weight: 750; }
.row-status, .attendance-date { display: block; font-size: .75rem; color: var(--muted); overflow-wrap: anywhere; }
[data-state="present"] .row-status { color: #286447; }
.attendance-controls { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.checkbox-label { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 8px 10px; min-width: 80px; min-height: 48px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.checkbox-label input { width: 28px; height: 28px; min-height: 28px; margin: 0; accent-color: var(--blue); }
.checkbox-label span { font-size: .85rem; }
.student-row[data-state="present"] .checkbox-label { background: #edf7f0; border-color: #9dc7ac; }
.checkbox-label:has(input:disabled) { cursor: default; }
.text-button { color: var(--blue); background: transparent; border: 0; font-size: .85rem; font-weight: 650; padding: 6px 10px; border-radius: 6px; }
.text-button:hover { background: #eef5fb; }
.mark-no { font-size: .75rem; padding: 6px; }
.empty-state, .coming-soon { text-align: center; padding: 35px 20px; color: var(--muted); }
.test-score-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 20px 0 0; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--tint); }
.test-score-fields legend { font-size: .85rem; font-weight: 650; padding: 0 8px; }
.test-score-fields > div { min-width: 0; }
.test-score-fields .field-wide { grid-column: 1 / -1; }
.coming-soon h2 { color: var(--ink); margin-bottom: 12px; }
footer { color: var(--muted); font-size: .75rem; text-align: center; padding: 16px 0; }
.login-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 30px 20px; background: #f0f5fa; }
.login-card { width: min(460px, 100%); min-width: 0; overflow-wrap: anywhere; background: white; border: 1px solid var(--border); border-radius: 24px; padding: 36px; box-shadow: 0 20px 80px #173a5710; }
.login-card .brand-logo { width: 128px; margin-bottom: 20px; }
.login-card .intro { margin-bottom: 24px; }
.login-card .demo-notice { margin-bottom: 22px; }
.login-card h1 { font-size: clamp(1.75rem, 7vw, 2.35rem); }
.primary-button { background: var(--blue); color: white; border: 0; border-radius: 9px; padding: 13px 18px; width: 100%; text-align: left; font-weight: 650; margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.primary-button > span { flex-shrink: 0; }
.primary-button:hover { background: #105687; }
.fine-print { font-size: .82rem; color: var(--muted); margin-top: 18px; }
.alert { font-size: .85rem; margin-bottom: 16px; }
.validation-summary-valid { display: none; }
.login-card footer { margin-top: 20px; }
@media (max-width: 1000px) {
    .filters, body[data-action="TestScores"] .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters .filter-action, .filters .filter-date { grid-column: 1 / -1; }
    .filters .filter-student { grid-column: auto; }
    .page-heading { align-items: flex-start; flex-direction: column; gap: 18px; }
    .identity { text-align: left; flex-basis: auto; }
}
@media (max-width: 600px) {
    .workspace { width: calc(100% - 24px); margin-top: 16px; }
    .topbar { padding: 10px 12px; }
    .brand { gap: 8px; font-size: 1rem; }
    .panel { padding: 18px 14px; border-radius: 14px; }
    .filters, body[data-action="TestScores"] .filters { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .test-score-fields { grid-template-columns: 1fr; }
    .page-heading { padding: 20px 0; gap: 12px; }
    .page-heading h1 { font-size: 1.65rem; }
    .page-heading .intro { font-size: .9rem; margin-top: 8px; }
    .section-heading { align-items: flex-start; flex-direction: column; }
    .student-name { gap: 8px; }
    .avatar { display: none; }
    .student-row { gap: 12px; }
    .attendance-controls { flex-direction: column; align-items: stretch; gap: 6px; }
    .register-header { font-size: .7rem; }
    .login-card { padding: 26px 22px; }
    .test-score-fields { padding: 16px 12px; }
}
@media (max-height: 600px) { .login-page { align-items: start; padding-top: 16px; padding-bottom: 16px; } }
@media (prefers-reduced-motion: reduce) { body { transition: none; } }
