:root {
  --md-sys-color-primary: #396a00;
  --md-sys-color-on-primary: #fff;
  --md-sys-color-primary-container: #8cfa00;
  --md-sys-color-on-primary-container: #102000;
  --md-sys-color-secondary: #52634a;
  --md-sys-color-on-secondary: #fff;
  --md-sys-color-secondary-container: #d5e8c8;
  --md-sys-color-on-secondary-container: #101f0b;
  --md-sys-color-tertiary: #65558f;
  --md-sys-color-tertiary-container: #e9ddff;
  --md-sys-color-on-tertiary-container: #21005d;
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-error-container: #ffdad6;
  --md-sys-color-on-error-container: #410002;
  --md-sys-color-surface: #f9faef;
  --md-sys-color-surface-dim: #dadbd2;
  --md-sys-color-surface-bright: #f9faef;
  --md-sys-color-surface-container-lowest: #fff;
  --md-sys-color-surface-container-low: #f3f5ed;
  --md-sys-color-surface-container: #eef0e9;
  --md-sys-color-surface-container-high: #e8ebe4;
  --md-sys-color-surface-container-highest: #e2e5de;
  --md-sys-color-on-surface: #1a1c16;
  --md-sys-color-on-surface-variant: #43483f;
  --md-sys-color-outline: #73796e;
  --md-sys-color-outline-variant: #c3c8bb;
  --score-great: #2e7d32;
  --score-good: #4d6f00;
  --score-warn: #955f00;
  --score-bad: #ba1a1a;
  --shape-xs: 4px;
  --shape-sm: 8px;
  --shape-md: 12px;
  --shape-lg: 16px;
  --shape-xl: 28px;
  --shape-xxl: 32px;
  --shape-full: 999px;
  --motion-standard: cubic-bezier(.2, 0, 0, 1);
  --drawer-width: 264px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --md-sys-color-primary: #8cfa00;
    --md-sys-color-on-primary: #1b3700;
    --md-sys-color-primary-container: #285000;
    --md-sys-color-on-primary-container: #adff5b;
    --md-sys-color-secondary: #b9ccb0;
    --md-sys-color-on-secondary: #253423;
    --md-sys-color-secondary-container: #3b4b38;
    --md-sys-color-on-secondary-container: #d5e8c8;
    --md-sys-color-tertiary: #cfbdfe;
    --md-sys-color-tertiary-container: #4d3d75;
    --md-sys-color-on-tertiary-container: #e9ddff;
    --md-sys-color-error: #ffb4ab;
    --md-sys-color-error-container: #93000a;
    --md-sys-color-on-error-container: #ffdad6;
    --md-sys-color-surface: #11140e;
    --md-sys-color-surface-dim: #11140e;
    --md-sys-color-surface-bright: #373a32;
    --md-sys-color-surface-container-lowest: #0c0f0a;
    --md-sys-color-surface-container-low: #191c16;
    --md-sys-color-surface-container: #1d201a;
    --md-sys-color-surface-container-high: #282b24;
    --md-sys-color-surface-container-highest: #33362e;
    --md-sys-color-on-surface: #e2e4da;
    --md-sys-color-on-surface-variant: #c3c8bb;
    --md-sys-color-outline: #8d9287;
    --md-sys-color-outline-variant: #43483f;
    --score-great: #8ee08d;
    --score-good: #b5d66a;
    --score-warn: #ffba48;
    --score-bad: #ffb4ab;
  }
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--md-sys-color-surface); }
body { min-height: 100vh; margin: 0; color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface); font-family: "Roboto Flex", Arial, sans-serif; }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
svg { width: 24px; height: 24px; fill: currentColor; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
[hidden] { display: none !important; }

h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, .brand-mark, .drawer-brand strong, .auth-brand strong, .button, .nav-button, .bottom-nav-button { font-family: Fredoka, "Arial Rounded MT Bold", sans-serif; }
h1 { margin-bottom: 24px; font-size: clamp(3.6rem, 7vw, 7.2rem); line-height: .88; letter-spacing: -.065em; }
h1 span { color: var(--md-sys-color-primary); }
h2 { font-size: 1.75rem; line-height: 1.12; letter-spacing: -.025em; }
h3 { font-size: 1.15rem; }
.eyebrow { display: inline-block; margin-bottom: 18px; color: var(--md-sys-color-primary); font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

.button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; gap: 8px; padding: 0 24px; border: 0; border-radius: var(--shape-full); font-weight: 700; cursor: pointer; transition: transform .2s var(--motion-standard), background .2s, opacity .2s; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0) scale(.98); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button-filled { color: var(--md-sys-color-on-primary); background: var(--md-sys-color-primary); }
.button-tonal { color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
.button-outline { border: 1px solid var(--md-sys-color-outline); color: var(--md-sys-color-primary); background: transparent; }
.button-danger { color: var(--md-sys-color-on-error-container); background: var(--md-sys-color-error-container); }
.button-small { min-height: 40px; padding: 0 16px; font-size: .88rem; }
.full { width: 100%; }
.icon-button { display: grid; width: 48px; height: 48px; flex: none; place-items: center; border: 0; border-radius: 50%; color: var(--md-sys-color-on-surface-variant); background: transparent; cursor: pointer; transition: background .2s, transform .2s; }
.icon-button:hover { background: var(--md-sys-color-surface-container-high); }
.icon-button:active { transform: scale(.94); }
.text-link { display: inline-flex; min-height: 48px; align-items: center; gap: 8px; color: var(--md-sys-color-primary); font-weight: 700; text-decoration: none; }
.text-link svg { width: 20px; height: 20px; }

.auth-shell { min-height: 100vh; padding: 24px clamp(24px, 5vw, 72px) 40px; }
.auth-brand, .drawer-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand strong, .drawer-brand strong { display: block; font-size: 1.25rem; }
.auth-brand small, .drawer-brand small { display: block; margin-top: 1px; color: var(--md-sys-color-on-surface-variant); font-size: .72rem; }
.brand-mark { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 15px; color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); font-size: 1.3rem; font-weight: 700; transform: rotate(-4deg); }
.login-stage { display: grid; min-height: calc(100vh - 108px); grid-template-columns: minmax(0, 1.18fr) minmax(360px, 480px); align-items: center; gap: clamp(40px, 8vw, 140px); max-width: 1380px; margin: 0 auto; }
.login-copy { padding-left: clamp(0px, 5vw, 72px); }
.login-copy p { max-width: 580px; margin-bottom: 16px; color: var(--md-sys-color-on-surface-variant); font-size: 1.08rem; line-height: 1.6; }
.login-card { padding: clamp(28px, 4vw, 44px); border-radius: var(--shape-xxl); background: var(--md-sys-color-surface-container-low); }
.login-card-icon { display: grid; width: 56px; height: 56px; place-items: center; margin-bottom: 28px; border-radius: 20px; color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); }
.login-card-icon svg { width: 30px; height: 30px; }
.login-card h2 { margin-bottom: 8px; }
.login-card > p { margin-bottom: 28px; color: var(--md-sys-color-on-surface-variant); line-height: 1.45; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field > span { padding-left: 4px; color: var(--md-sys-color-on-surface-variant); font-size: .78rem; font-weight: 700; }
.field input, .field select, .field textarea, .select-control { width: 100%; min-height: 52px; padding: 0 16px; border: 1px solid transparent; outline: none; border-radius: var(--shape-md); color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-highest); transition: border-color .2s, background .2s; }
.field textarea { min-height: 96px; padding-block: 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .select-control:focus { border-color: var(--md-sys-color-primary); background: var(--md-sys-color-surface-container-high); }
.form-error { margin: -4px 0 16px !important; padding: 12px 14px; border-radius: var(--shape-md); color: var(--md-sys-color-on-error-container) !important; background: var(--md-sys-color-error-container); font-size: .85rem; }
.demo-link { display: block; min-height: 40px; margin: 16px auto -8px; padding: 10px; color: var(--md-sys-color-primary); font-size: .86rem; font-weight: 700; text-align: center; text-decoration: none; }

.app-shell { min-height: 100vh; padding-left: var(--drawer-width); }
.nav-drawer { position: fixed; z-index: 20; inset: 0 auto 0 0; display: flex; width: var(--drawer-width); flex-direction: column; padding: 20px 12px; background: var(--md-sys-color-surface-container-low); }
.drawer-brand { min-height: 64px; padding: 4px 10px 18px; }
.nav-list { display: grid; gap: 4px; margin-top: 22px; }
.nav-button { position: relative; display: grid; min-height: 56px; grid-template-columns: 32px 1fr auto; align-items: center; gap: 12px; padding: 0 18px; border: 0; border-radius: var(--shape-full); color: var(--md-sys-color-on-surface-variant); background: transparent; font-weight: 600; text-align: left; cursor: pointer; }
.studio-nav-link { display: grid; min-height: 56px; grid-template-columns: 32px 1fr; align-items: center; gap: 12px; padding: 0 18px; border-radius: var(--shape-full); color: var(--md-sys-color-on-surface-variant); font: 600 1rem Fredoka, sans-serif; text-decoration: none; }
.studio-nav-link:hover { background: var(--md-sys-color-surface-container-high); }
.nav-button:hover { background: var(--md-sys-color-surface-container-high); }
.nav-button.active { color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
.nav-button b { display: grid; min-width: 24px; height: 24px; place-items: center; padding: 0 6px; border-radius: var(--shape-full); color: var(--md-sys-color-on-error-container); background: var(--md-sys-color-error-container); font: 700 .72rem "Roboto Flex", sans-serif; }
.drawer-footer { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 16px 14px 4px; color: var(--md-sys-color-on-surface-variant); font-size: .72rem; line-height: 1.35; }
.secure-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--md-sys-color-primary); box-shadow: 0 0 0 5px color-mix(in srgb, var(--md-sys-color-primary) 14%, transparent); }
.workspace { min-width: 0; }
.topbar { position: sticky; z-index: 15; top: 0; display: flex; min-height: 80px; align-items: center; gap: 16px; padding: 12px clamp(20px, 3vw, 40px); background: color-mix(in srgb, var(--md-sys-color-surface) 92%, transparent); backdrop-filter: blur(18px); }
.class-picker-wrap { display: grid; gap: 2px; }
.class-picker-wrap label { padding-left: 4px; color: var(--md-sys-color-on-surface-variant); font-size: .68rem; font-weight: 700; }
.class-picker-wrap select { min-width: 190px; min-height: 42px; padding: 0 38px 0 13px; border: 0; outline: none; border-radius: var(--shape-full); color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container); font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.teacher-identity { display: flex; align-items: center; gap: 10px; margin: 0 8px; }
.teacher-identity strong, .teacher-identity small { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teacher-identity strong { font-size: .88rem; }
.teacher-identity small { margin-top: 2px; color: var(--md-sys-color-on-surface-variant); font-size: .7rem; }
.avatar { display: grid; width: 40px; height: 40px; flex: none; place-items: center; overflow: hidden; border-radius: 50%; color: var(--md-sys-color-on-tertiary-container); background: var(--md-sys-color-tertiary-container); font-weight: 800; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.demo-chip, .status-chip { display: inline-flex; min-height: 32px; align-items: center; padding: 0 12px; border-radius: var(--shape-full); color: var(--md-sys-color-on-tertiary-container); background: var(--md-sys-color-tertiary-container); font-size: .72rem; font-weight: 800; }
.workspace-content { max-width: 1640px; min-height: calc(100vh - 80px); margin: 0 auto; padding: 16px clamp(20px, 3vw, 40px) 48px; }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading h1 { margin: 0 0 8px; font-size: clamp(2rem, 4vw, 3.35rem); line-height: 1; letter-spacing: -.045em; }
.page-heading p { max-width: 720px; margin: 0; color: var(--md-sys-color-on-surface-variant); line-height: 1.5; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.pulse-strip { display: grid; grid-template-columns: minmax(250px, 1.25fr) repeat(3, minmax(120px, .55fr)); overflow: hidden; margin-bottom: 16px; border-radius: var(--shape-xl); background: var(--md-sys-color-surface-container-low); }
.pulse-lead { padding: 26px 28px; color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); }
.pulse-lead span { display: block; margin-bottom: 10px; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.pulse-lead strong { display: block; max-width: 380px; font: 700 clamp(1.35rem, 2vw, 1.8rem)/1.15 Fredoka, sans-serif; }
.pulse-item { display: flex; min-height: 118px; flex-direction: column; justify-content: center; padding: 20px 22px; border-left: 1px solid var(--md-sys-color-outline-variant); }
.pulse-item strong { font: 700 1.65rem Fredoka, sans-serif; }
.pulse-item span { margin-top: 3px; color: var(--md-sys-color-on-surface-variant); font-size: .76rem; }

.attention-center { overflow: hidden; margin-bottom: 16px; border-radius: var(--shape-xl); background: var(--md-sys-color-surface-container-low); }
.attention-center-head { display: flex; min-height: 88px; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 22px; }
.attention-center-head h2, .attention-section-title h3 { margin: 0 0 4px; }
.attention-center-head h2 { font-size: 1.3rem; }
.attention-center-head p, .attention-section-title p { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: .76rem; line-height: 1.4; }
.attention-homework-field { display: grid; min-width: 260px; gap: 5px; }
.attention-homework-field span { padding-left: 4px; color: var(--md-sys-color-on-surface-variant); font-size: .68rem; font-weight: 700; }
.attention-homework-field select { min-height: 44px; padding: 0 38px 0 14px; border: 0; outline: none; border-radius: var(--shape-full); color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-high); font-weight: 700; }
.attention-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--md-sys-color-outline-variant); border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.attention-filter { display: inline-flex; min-height: 40px; align-items: center; gap: 8px; padding: 0 9px 0 14px; border: 0; border-radius: var(--shape-full); color: var(--md-sys-color-on-surface-variant); background: transparent; white-space: nowrap; cursor: pointer; }
.attention-filter:hover { background: var(--md-sys-color-surface-container-high); }
.attention-filter.active { color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); font-weight: 800; }
.attention-filter b { display: grid; min-width: 24px; height: 24px; place-items: center; padding: 0 6px; border-radius: var(--shape-full); color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-highest); font-size: .68rem; }
.attention-filter.active b { color: var(--md-sys-color-on-primary); background: var(--md-sys-color-primary); }
.attention-journal-action { margin-left: auto; flex: none; }
.reminder-action { flex: none; }
.attention-center-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.topic-risk-panel { min-width: 0; border-right: 1px solid var(--md-sys-color-outline-variant); }
.attention-section-title { display: flex; min-height: 70px; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; }
.attention-section-title h3 { font-size: .95rem; }
.topic-risk-matrix { overflow-x: auto; }
.topic-risk-header, .topic-risk-row { display: grid; min-width: 560px; grid-template-columns: minmax(210px, 1fr) 58px 58px 70px 82px; align-items: center; }
.topic-risk-header { min-height: 34px; padding: 0 14px; color: var(--md-sys-color-on-surface-variant); background: var(--md-sys-color-surface-container); font-size: .65rem; font-weight: 800; text-align: center; }
.topic-risk-header span:first-child { text-align: left; }
.topic-risk-row { width: 100%; min-height: 58px; padding: 6px 14px; border: 0; border-top: 1px solid var(--md-sys-color-outline-variant); color: var(--md-sys-color-on-surface); background: transparent; text-align: center; cursor: pointer; }
.topic-risk-row:hover { background: var(--md-sys-color-surface-container); }
.topic-risk-row.active { color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
.topic-risk-name { min-width: 0; text-align: left; }
.topic-risk-name strong, .topic-risk-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-risk-name strong { font-size: .78rem; }
.topic-risk-name small { margin-top: 3px; color: var(--md-sys-color-on-surface-variant); font-size: .65rem; font-weight: 500; }
.topic-risk-value { font-size: .78rem; font-weight: 750; }
.topic-risk-total { display: grid; grid-template-columns: auto auto; align-items: baseline; justify-content: center; gap: 3px; }
.topic-risk-total b { font-size: .82rem; }
.topic-risk-total small { color: var(--md-sys-color-on-surface-variant); font-size: .6rem; }
.topic-risk-total i { display: block; width: var(--risk-width); height: 4px; grid-column: 1 / -1; margin-top: 4px; border-radius: var(--shape-full); background: var(--md-sys-color-primary); }
.attention-students-panel { min-width: 0; }
.attention-student-list { display: grid; max-height: 360px; overflow-y: auto; padding: 0 8px 10px; }
.attention-student-row { display: grid; min-height: 62px; grid-template-columns: minmax(0, 1fr) auto 40px; align-items: center; gap: 7px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.attention-student-main { display: grid; min-width: 0; min-height: 56px; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 10px; padding: 6px; border: 0; border-radius: var(--shape-md); color: inherit; background: transparent; text-align: left; cursor: pointer; }
.attention-student-main:hover, .attention-open:hover { background: var(--md-sys-color-surface-container-high); }
.attention-student-main .avatar { width: 36px; height: 36px; font-size: .7rem; }
.attention-student-main strong, .attention-student-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attention-student-main strong { font-size: .77rem; }
.attention-student-main small { margin-top: 3px; color: var(--md-sys-color-on-surface-variant); font-size: .64rem; }
.attention-issue-badge { min-height: 28px; padding: 6px 9px; border-radius: var(--shape-full); color: var(--md-sys-color-on-tertiary-container); background: var(--md-sys-color-tertiary-container); font-size: .65rem; font-weight: 800; white-space: nowrap; }
.attention-open { width: 40px; height: 40px; }
.attention-list-note { margin: 0; padding: 8px 12px 14px; color: var(--md-sys-color-on-surface-variant); font-size: .68rem; line-height: 1.4; }
.attention-compact-empty { display: grid; min-height: 190px; place-items: center; align-content: center; gap: 10px; padding: 24px; text-align: center; }
.attention-compact-empty .empty-icon { margin: 0; }
.attention-compact-empty p { max-width: 320px; margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: .78rem; line-height: 1.45; }
.reminder-schema-note { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--md-sys-color-outline-variant); color: var(--md-sys-color-on-error-container); background: var(--md-sys-color-error-container); font-size: .76rem; line-height: 1.45; }
.reminder-schema-note svg { width: 20px; height: 20px; flex: none; }
.reminder-history { border-top: 1px solid var(--md-sys-color-outline-variant); background: var(--md-sys-color-surface-container); }
.reminder-history-head { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; }
.reminder-history-head h3 { margin: 0 0 4px; font-size: .95rem; }
.reminder-history-head p { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: .72rem; line-height: 1.4; }
.reminder-history-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--md-sys-color-outline-variant); }
.reminder-history-row { display: grid; min-width: 0; min-height: 72px; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 16px; border-right: 1px solid var(--md-sys-color-outline-variant); border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.reminder-history-row:nth-child(2n) { border-right: 0; }
.reminder-history-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 13px; color: var(--md-sys-color-on-tertiary-container); background: var(--md-sys-color-tertiary-container); }
.reminder-history-icon svg { width: 19px; height: 19px; }
.reminder-history-copy, .reminder-history-meta { min-width: 0; }
.reminder-history-copy strong, .reminder-history-copy small, .reminder-history-meta b, .reminder-history-meta small { display: block; }
.reminder-history-copy strong { overflow: hidden; font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.reminder-history-copy small, .reminder-history-meta small { margin-top: 3px; color: var(--md-sys-color-on-surface-variant); font-size: .65rem; }
.reminder-history-meta { text-align: right; }
.reminder-history-meta b { font: 700 1rem Fredoka, sans-serif; }
.reminder-history-empty { margin: 0; padding: 0 20px 18px; color: var(--md-sys-color-on-surface-variant); font-size: .76rem; }
.journal-surface { margin-top: 16px; }

.command-layout { display: grid; grid-template-columns: minmax(0, 1fr) 348px; gap: 16px; align-items: start; }
.surface { overflow: hidden; border-radius: var(--shape-lg); background: var(--md-sys-color-surface-container-low); }
.surface-header { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; }
.surface-header h2 { margin: 0 0 3px; font-size: 1.25rem; }
.surface-header p { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: .78rem; }
.surface-header-actions { display: flex; align-items: center; gap: 6px; }
.search-field { position: relative; }
.search-field svg { position: absolute; top: 10px; left: 12px; width: 20px; height: 20px; color: var(--md-sys-color-on-surface-variant); pointer-events: none; }
.search-field input { width: 190px; height: 40px; padding: 0 12px 0 40px; border: 0; outline: none; border-radius: var(--shape-full); color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-high); }
.journal-scroll { overflow: auto; max-height: calc(100vh - 330px); border-top: 1px solid var(--md-sys-color-outline-variant); }
.journal { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.journal th, .journal td { height: 58px; padding: 8px 12px; border-right: 1px solid var(--md-sys-color-outline-variant); border-bottom: 1px solid var(--md-sys-color-outline-variant); text-align: center; }
.journal thead th { position: sticky; z-index: 3; top: 0; height: 76px; color: var(--md-sys-color-on-surface-variant); background: var(--md-sys-color-surface-container); font-weight: 700; }
.journal thead th:first-child { z-index: 5; left: 0; min-width: 220px; text-align: left; }
.journal tbody th { position: sticky; z-index: 2; left: 0; min-width: 220px; background: var(--md-sys-color-surface-container-low); text-align: left; }
.journal tr:last-child th, .journal tr:last-child td { border-bottom: 0; }
.student-cell { display: flex; align-items: center; gap: 10px; }
.student-cell .avatar { width: 34px; height: 34px; font-size: .75rem; }
.student-cell span { min-width: 0; }
.student-cell strong, .student-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-cell small { margin-top: 2px; color: var(--md-sys-color-on-surface-variant); font-size: .68rem; font-weight: 500; }
.student-button { width: 100%; min-width: 0; padding: 4px; border: 0; border-radius: var(--shape-md); color: inherit; background: transparent; text-align: left; cursor: pointer; }
.student-button:hover { background: var(--md-sys-color-surface-container-high); }
.teacher-label { color: var(--md-sys-color-on-surface-variant); font-weight: 600; }
.homework-head { display: block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.homework-head small { display: block; margin-top: 5px; font-weight: 500; }
.score-pill { display: inline-grid; min-width: 42px; height: 32px; place-items: center; padding: 0 8px; border: 0; border-radius: var(--shape-full); color: var(--score-color); background: color-mix(in srgb, var(--score-color) 12%, transparent); font-weight: 800; cursor: pointer; }
.score-pill:hover { outline: 2px solid color-mix(in srgb, var(--score-color) 24%, transparent); }
.score-empty { color: var(--md-sys-color-outline); font-weight: 700; }

.review-pane { position: sticky; top: 96px; overflow: hidden; border-radius: var(--shape-xl); background: var(--md-sys-color-surface-container); }
.review-pane-head { padding: 22px 22px 14px; }
.review-pane-head h2 { margin-bottom: 5px; font-size: 1.25rem; }
.review-pane-head p { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: .78rem; }
.review-queue { display: grid; gap: 2px; max-height: calc(100vh - 248px); overflow: auto; padding: 6px; }
.review-item { display: grid; min-height: 84px; grid-template-columns: 42px 1fr 24px; align-items: center; gap: 11px; padding: 10px 10px; border: 0; border-radius: var(--shape-lg); color: var(--md-sys-color-on-surface); background: transparent; text-align: left; cursor: pointer; }
.review-item:hover, .review-item.active { background: var(--md-sys-color-surface-container-high); }
.review-score { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 15px; color: var(--score-color); background: color-mix(in srgb, var(--score-color) 13%, transparent); font-weight: 800; }
.review-copy { min-width: 0; }
.review-copy strong, .review-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-copy strong { font-size: .82rem; }
.review-copy span { margin-top: 4px; color: var(--md-sys-color-on-surface-variant); font-size: .7rem; }
.review-item > svg { color: var(--md-sys-color-outline); }

.empty-state { display: grid; min-height: 320px; place-items: center; padding: 48px 24px; text-align: center; }
.empty-state > div { max-width: 430px; }
.empty-icon { display: grid; width: 64px; height: 64px; place-items: center; margin: 0 auto 20px; border-radius: 22px; color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
.empty-icon svg { width: 32px; height: 32px; }
.empty-state h2 { margin-bottom: 8px; font-size: 1.35rem; }
.empty-state p { margin-bottom: 22px; color: var(--md-sys-color-on-surface-variant); line-height: 1.5; }
.loading-state { display: grid; min-height: 420px; place-items: center; color: var(--md-sys-color-on-surface-variant); }
.spinner { width: 42px; height: 42px; margin: 0 auto 15px; border: 4px solid var(--md-sys-color-surface-container-highest); border-top-color: var(--md-sys-color-primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.class-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
.class-card { position: relative; min-height: 190px; padding: 24px; border: 0; border-radius: var(--shape-xl); color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-low); text-align: left; cursor: pointer; }
.class-card.active { outline: 2px solid var(--md-sys-color-primary); outline-offset: -2px; }
.class-card-icon { display: grid; width: 48px; height: 48px; place-items: center; margin-bottom: 24px; border-radius: 17px; color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); }
.class-card h3 { margin-bottom: 5px; font-size: 1.3rem; }
.class-card p { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: .8rem; }
.class-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; }
.invite-code { font-family: "Roboto Flex", sans-serif; font-size: .75rem; font-weight: 800; letter-spacing: .08em; }
.roster-list { display: grid; gap: 1px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.roster-row { display: grid; min-height: 68px; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 8px 16px 8px 20px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.roster-row:last-child { border-bottom: 0; }
.roster-progress { display: flex; align-items: center; gap: 12px; }
.mini-progress { width: 100px; height: 7px; overflow: hidden; border-radius: var(--shape-full); background: var(--md-sys-color-surface-container-highest); }
.mini-progress span { display: block; height: 100%; border-radius: inherit; background: var(--md-sys-color-primary); }

.review-layout { display: grid; min-height: calc(100vh - 210px); grid-template-columns: minmax(320px, .75fr) minmax(0, 1.25fr); gap: 16px; }
.review-list-panel, .attempt-panel { border-radius: var(--shape-xl); background: var(--md-sys-color-surface-container-low); }
.review-list-panel { overflow: hidden; }
.filter-row { display: flex; gap: 6px; padding: 0 16px 14px; overflow-x: auto; }
.filter-chip { min-height: 36px; padding: 0 14px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--shape-full); color: var(--md-sys-color-on-surface-variant); background: transparent; white-space: nowrap; cursor: pointer; }
.filter-chip.active { border-color: transparent; color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); font-weight: 700; }
.full-review-list { display: grid; max-height: calc(100vh - 320px); overflow-y: auto; padding: 4px 8px 10px; }
.attempt-panel { min-width: 0; padding: clamp(20px, 3vw, 34px); }
.attempt-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.attempt-panel h2 { margin-bottom: 6px; font-size: 1.65rem; }
.attempt-meta { margin-bottom: 28px; color: var(--md-sys-color-on-surface-variant); font-size: .82rem; }
.attempt-section { margin-top: 22px; }
.attempt-section h3 { margin-bottom: 10px; font-size: .88rem; }
.answer-card, .ai-card, .review-form { padding: 18px; border-radius: var(--shape-lg); background: var(--md-sys-color-surface-container); }
.answer-card + .answer-card { margin-top: 8px; }
.answer-card small { display: block; margin-bottom: 7px; color: var(--md-sys-color-on-surface-variant); }
.answer-card p, .ai-card p { margin: 0; line-height: 1.55; white-space: pre-wrap; }
.ai-card { background: color-mix(in srgb, var(--md-sys-color-tertiary-container) 55%, var(--md-sys-color-surface-container)); }
.review-form-grid { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; }
.review-form .field { margin: 0; }
.review-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.schema-note { display: flex; gap: 10px; margin-top: 16px; padding: 14px; border-radius: var(--shape-md); color: var(--md-sys-color-on-error-container); background: var(--md-sys-color-error-container); font-size: .78rem; line-height: 1.45; }
.schema-note svg { flex: none; }

.reuse-hero { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 22px; padding: clamp(24px, 4vw, 38px); border-radius: var(--shape-xxl); color: var(--md-sys-color-on-primary-container); background: color-mix(in srgb, var(--md-sys-color-primary-container) 72%, var(--md-sys-color-surface-container)); }
.reuse-hero-icon { display: grid; width: 72px; height: 72px; place-items: center; border-radius: 24px; color: var(--md-sys-color-on-primary); background: var(--md-sys-color-primary); transform: rotate(-3deg); }
.reuse-hero-icon svg { width: 34px; height: 34px; }
.reuse-hero > div > span { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.reuse-hero h2 { margin: 5px 0 7px; font-size: clamp(1.45rem, 3vw, 2.2rem); }
.reuse-hero p { max-width: 760px; margin: 0; line-height: 1.5; opacity: .82; }
.reuse-hero-count { min-width: 104px; padding-left: 24px; border-left: 1px solid color-mix(in srgb, currentColor 24%, transparent); text-align: center; }
.reuse-hero-count strong, .reuse-hero-count span { display: block; }
.reuse-hero-count strong { font: 700 2.35rem Fredoka, sans-serif; line-height: 1; }
.reuse-hero-count span { margin-top: 6px; font-size: .7rem; text-transform: none; }
.template-schema-note { margin: 16px 0 0; }
.template-section { margin-top: 32px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 14px; padding: 0 4px; }
.section-heading h2 { margin: 0 0 4px; font-size: 1.35rem; }
.section-heading p { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: .8rem; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.template-card { display: flex; min-width: 0; min-height: 284px; flex-direction: column; padding: 22px; border-radius: var(--shape-xl); background: var(--md-sys-color-surface-container-low); }
.template-card-top, .template-card-footer, .template-card-footer > div { display: flex; align-items: center; }
.template-card-top { justify-content: space-between; }
.template-mark { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 17px; color: var(--md-sys-color-on-tertiary-container); background: var(--md-sys-color-tertiary-container); }
.template-card-copy { margin-top: 20px; }
.template-card-copy h3 { margin: 0 0 7px; font-size: 1.22rem; }
.template-card-copy p { display: -webkit-box; min-height: 42px; margin: 0; overflow: hidden; color: var(--md-sys-color-on-surface-variant); font-size: .82rem; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.template-lessons { display: flex; min-width: 0; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.template-lessons span { display: block; max-width: 100%; overflow: hidden; padding: 6px 10px; border-radius: var(--shape-full); color: var(--md-sys-color-on-surface-variant); background: var(--md-sys-color-surface-container-high); font-size: .68rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.template-card-footer { justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 18px; }
.template-card-footer small { color: var(--md-sys-color-on-surface-variant); font-size: .68rem; }
.template-card-footer > div { gap: 2px; }
.template-card-footer .icon-button { width: 40px; height: 40px; }
.template-empty { display: grid; min-height: 156px; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 24px; }
.template-empty h2 { margin: 0 0 6px; font-size: 1.2rem; }
.template-empty p { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: .82rem; line-height: 1.45; }
.homework-library { margin-top: 32px; }
.homework-library-list { display: grid; padding: 0 10px 10px; }
.homework-library-row { display: grid; min-height: 76px; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.homework-library-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 15px; color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
.homework-library-copy { min-width: 0; }
.homework-library-copy strong, .homework-library-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.homework-library-copy strong { font-size: .86rem; }
.homework-library-copy small { margin-top: 4px; color: var(--md-sys-color-on-surface-variant); font-size: .7rem; }
.homework-library-actions { display: flex; align-items: center; gap: 6px; }
.modal-kicker { display: flex; align-items: center; gap: 7px; margin: 0 56px 10px 0; color: var(--md-sys-color-primary); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.modal-kicker svg { width: 18px; height: 18px; }
.modal-loading { min-height: 220px; }
.publish-main-fields { grid-template-columns: minmax(0, 1fr) 220px; }
.publish-class-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.publish-class-option { display: grid; min-width: 0; min-height: 72px; grid-template-columns: 22px 44px minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--shape-lg); background: var(--md-sys-color-surface-container); cursor: pointer; }
.publish-class-option:has(input:checked) { border-color: var(--md-sys-color-primary); background: var(--md-sys-color-secondary-container); }
.publish-class-option input { width: 20px; height: 20px; accent-color: var(--md-sys-color-primary); }
.publish-class-option .class-card-icon { width: 42px; height: 42px; border-radius: 14px; }
.publish-class-option strong, .publish-class-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.publish-class-option strong { font-size: .8rem; }
.publish-class-option small { margin-top: 3px; color: var(--md-sys-color-on-surface-variant); font-size: .65rem; }
.publish-lesson-summary { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: start; gap: 12px; margin-top: 6px; padding: 15px; border-radius: var(--shape-lg); background: var(--md-sys-color-surface-container); }
.publish-lesson-summary > span { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 14px; color: var(--md-sys-color-on-tertiary-container); background: var(--md-sys-color-tertiary-container); }
.publish-lesson-summary strong { font-size: .82rem; }
.publish-lesson-summary .template-lessons { margin-top: 8px; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settings-card { padding: 24px; border-radius: var(--shape-xl); background: var(--md-sys-color-surface-container-low); }
.settings-card-icon { display: grid; width: 48px; height: 48px; place-items: center; margin-bottom: 20px; border-radius: 17px; color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
.settings-card h2 { margin-bottom: 8px; font-size: 1.3rem; }
.settings-card p { color: var(--md-sys-color-on-surface-variant); line-height: 1.5; }
.settings-card code { display: block; overflow-x: auto; padding: 12px; border-radius: var(--shape-md); color: var(--md-sys-color-primary); background: var(--md-sys-color-surface-container); font-size: .76rem; }

.modal-layer { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 24px; }
.modal-scrim { position: absolute; inset: 0; background: rgb(0 0 0 / .48); backdrop-filter: blur(4px); }
.modal { position: relative; width: min(100%, 640px); max-height: calc(100vh - 48px); overflow-y: auto; padding: clamp(24px, 4vw, 34px); border-radius: var(--shape-xl); color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-low); box-shadow: 0 24px 80px rgb(0 0 0 / .3); }
.modal-wide { width: min(100%, 860px); }
.modal-close { position: absolute; top: 16px; right: 16px; }
.modal h2 { margin: 3px 56px 8px 0; }
.modal > p { margin-bottom: 24px; color: var(--md-sys-color-on-surface-variant); line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.class-invite-layout { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); align-items: center; gap: 24px; }
.class-invite-qr { display: grid; width: 100%; aspect-ratio: 1; place-items: center; padding: 16px; border-radius: var(--shape-xl); background: #fff; }
.class-invite-qr svg { display: block; width: 100%; height: 100%; }
.class-invite-copy { display: grid; gap: 8px; }
.class-invite-copy > span { color: var(--md-sys-color-on-surface-variant); font-size: .76rem; font-weight: 700; }
.class-invite-copy > strong { overflow-wrap: anywhere; font-size: clamp(1.5rem, 4vw, 2.2rem); letter-spacing: .08em; }
.class-invite-copy > small { color: var(--md-sys-color-on-surface-variant); line-height: 1.5; }
.qr-unavailable { display: grid; place-items: center; gap: 8px; color: var(--md-sys-color-on-surface-variant); text-align: center; }
.qr-unavailable svg { width: 64px; height: 64px; }
.reminder-controls { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(240px, .85fr); gap: 18px; }
.reminder-audience { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.reminder-audience legend { margin-bottom: 8px; padding-left: 4px; color: var(--md-sys-color-on-surface-variant); font-size: .78rem; font-weight: 700; }
.reminder-audience > div { display: grid; grid-template-columns: 1fr 1fr; min-height: 52px; gap: 4px; padding: 4px; border-radius: var(--shape-md); background: var(--md-sys-color-surface-container-highest); }
.reminder-audience-option { position: relative; display: grid; place-items: center; border-radius: calc(var(--shape-md) - 4px); cursor: pointer; }
.reminder-audience-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.reminder-audience-option span { display: grid; width: 100%; height: 100%; place-items: center; padding: 0 10px; border-radius: inherit; color: var(--md-sys-color-on-surface-variant); font-size: .76rem; font-weight: 700; text-align: center; }
.reminder-audience-option input:checked + span { color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
.reminder-audience-option input:focus-visible + span { outline: 3px solid var(--md-sys-color-primary); outline-offset: 1px; }
.reminder-presets { display: flex; flex-wrap: wrap; gap: 7px; }
.reminder-message-meta { display: flex; justify-content: space-between; gap: 12px; padding: 0 4px; color: var(--md-sys-color-on-surface-variant); font-size: .68rem; }
.reminder-recipient-panel { overflow: hidden; border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--shape-lg); background: var(--md-sys-color-surface-container); }
.reminder-recipient-head { display: flex; min-height: 60px; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.reminder-recipient-head > label { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.reminder-recipient-head strong, .reminder-recipient-head small { display: block; }
.reminder-recipient-head strong { font-size: .82rem; }
.reminder-recipient-head small { margin-top: 2px; color: var(--md-sys-color-on-surface-variant); font-size: .66rem; }
.reminder-recipient-head input, .reminder-recipient input { width: 18px; height: 18px; accent-color: var(--md-sys-color-primary); }
.reminder-recipient-list { display: grid; max-height: 244px; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow-y: auto; padding: 6px; }
.reminder-recipient { display: grid; min-width: 0; min-height: 58px; grid-template-columns: 20px 36px minmax(0, 1fr); align-items: center; gap: 9px; padding: 7px 9px; border-radius: var(--shape-md); cursor: pointer; }
.reminder-recipient:hover { background: var(--md-sys-color-surface-container-high); }
.reminder-recipient .avatar { width: 36px; height: 36px; font-size: .7rem; }
.reminder-recipient strong, .reminder-recipient small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reminder-recipient strong { font-size: .74rem; }
.reminder-recipient small { margin-top: 2px; color: var(--md-sys-color-on-surface-variant); font-size: .64rem; }
.reminder-recipient-empty { display: flex; grid-column: 1 / -1; min-height: 88px; align-items: center; justify-content: center; gap: 10px; padding: 18px; color: var(--md-sys-color-on-surface-variant); font-size: .76rem; text-align: center; }
.reminder-recipient-empty svg { color: var(--md-sys-color-primary); }
.reminder-safety { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: var(--shape-md); color: var(--md-sys-color-on-tertiary-container); background: var(--md-sys-color-tertiary-container); font-size: .72rem; line-height: 1.4; }
.reminder-safety svg { width: 20px; height: 20px; flex: none; }
.student-profile-hero { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 18px; padding-right: 48px; }
.student-profile-hero h2 { margin: 0 0 5px; }
.student-profile-hero p { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: .8rem; }
.student-avatar-large { width: 72px; height: 72px; border-radius: 24px; font: 700 1.45rem Fredoka, sans-serif; }
.label-editor { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(300px, 1.3fr); align-items: center; gap: 16px 24px; margin-top: 24px; padding: 18px; border-radius: var(--shape-lg); background: var(--md-sys-color-surface-container); }
.label-editor label { font-weight: 800; }
.label-editor p { margin: 4px 0 0; color: var(--md-sys-color-on-surface-variant); font-size: .75rem; line-height: 1.45; }
.label-editor-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.label-editor-control input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid transparent; outline: none; border-radius: var(--shape-md); color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-highest); }
.label-editor-control input:focus { border-color: var(--md-sys-color-primary); }
.label-editor .schema-note { grid-column: 1 / -1; margin: 0; }
.student-pulse { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 16px; overflow: hidden; border-radius: var(--shape-lg); background: var(--md-sys-color-surface-container); }
.student-pulse > div { min-width: 0; padding: 16px; border-right: 1px solid var(--md-sys-color-outline-variant); }
.student-pulse > div:last-child { border-right: 0; }
.student-pulse strong, .student-pulse span { display: block; }
.student-pulse strong { font: 700 1.35rem Fredoka, sans-serif; }
.student-pulse span { margin-top: 3px; color: var(--md-sys-color-on-surface-variant); font-size: .7rem; }
.student-profile-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 28px; }
.student-profile-columns h3 { margin: 0 0 10px; font-size: .92rem; }
.student-topic-list, .student-history-list { display: grid; gap: 4px; }
.student-topic-row, .student-history-row { display: grid; width: 100%; min-height: 58px; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 10px; border: 0; border-radius: var(--shape-md); color: inherit; background: transparent; text-align: left; cursor: pointer; }
.student-topic-row:hover, .student-history-row:hover { background: var(--md-sys-color-surface-container); }
.student-topic-row strong, .student-topic-row small, .student-history-row strong, .student-history-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-topic-row strong, .student-history-row strong { font-size: .8rem; }
.student-topic-row small, .student-history-row small { margin-top: 3px; color: var(--md-sys-color-on-surface-variant); font-size: .68rem; }
.student-topic-row b { color: var(--score-color); font-size: .78rem; }
.student-card-empty { margin: 0; padding: 14px 10px; color: var(--md-sys-color-on-surface-variant); font-size: .78rem; line-height: 1.45; }
.lesson-picker { display: grid; gap: 8px; max-height: 300px; overflow-y: auto; padding: 4px; }
.lesson-group-title { position: sticky; top: -4px; padding: 10px 8px 6px; color: var(--md-sys-color-primary); background: var(--md-sys-color-surface-container-low); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.lesson-option { display: grid; min-height: 52px; grid-template-columns: 24px 1fr; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--shape-md); background: var(--md-sys-color-surface-container); cursor: pointer; }
.lesson-option input { width: 20px; height: 20px; accent-color: var(--md-sys-color-primary); }
.lesson-option strong, .lesson-option small { display: block; }
.lesson-option small { margin-top: 2px; color: var(--md-sys-color-on-surface-variant); font-size: .7rem; }

.toast-region { position: fixed; z-index: 200; right: 24px; bottom: 24px; display: grid; gap: 8px; }
.toast { display: flex; min-width: 260px; max-width: 420px; align-items: center; gap: 10px; padding: 14px 18px; border-radius: var(--shape-md); color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-highest); box-shadow: 0 8px 32px rgb(0 0 0 / .2); animation: toast-in .25s var(--motion-standard); }
.toast.error { color: var(--md-sys-color-on-error-container); background: var(--md-sys-color-error-container); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
.mobile-only, .bottom-nav, .nav-scrim { display: none; }

@media (max-width: 1199px) {
  :root { --drawer-width: 88px; }
  .nav-drawer { width: 88px; align-items: center; padding-inline: 8px; }
  .drawer-brand { padding-inline: 0; }
  .drawer-brand > span:last-child, .nav-button span, .studio-nav-link span, .drawer-footer span:last-child { display: none; }
  .nav-list { width: 100%; }
  .nav-button { display: flex; min-height: 64px; justify-content: center; padding: 0; border-radius: 20px; }
  .nav-button b { position: absolute; top: 7px; right: 7px; min-width: 20px; height: 20px; }
  .drawer-footer { padding-inline: 0; }
  .command-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .pulse-strip { grid-template-columns: minmax(230px, 1.1fr) repeat(3, minmax(104px, .5fr)); }
  .attention-center-grid { grid-template-columns: minmax(0, 1fr) 330px; }
}

@media (max-width: 839px) {
  .auth-shell { padding: 18px 20px 32px; }
  .login-stage { min-height: auto; grid-template-columns: 1fr; gap: 36px; padding-top: 56px; }
  .login-copy { padding: 0; }
  .login-copy h1 { font-size: clamp(3.4rem, 15vw, 5rem); }
  .login-copy p { font-size: 1rem; }
  .app-shell { padding: 0 0 80px; }
  .nav-drawer { z-index: 80; width: 280px; align-items: stretch; padding: 20px 12px; transform: translateX(-102%); transition: transform .28s var(--motion-standard); }
  .nav-drawer.open { transform: translateX(0); }
  .drawer-brand > span:last-child, .nav-button span, .studio-nav-link span, .drawer-footer span:last-child { display: block; }
  .nav-button { display: grid; min-height: 56px; grid-template-columns: 32px 1fr auto; justify-content: initial; padding: 0 18px; border-radius: var(--shape-full); }
  .nav-button b { position: static; }
  .nav-scrim { position: fixed; z-index: 70; inset: 0; display: block; background: rgb(0 0 0 / .42); }
  .mobile-only { display: grid; }
  .topbar { min-height: 72px; padding: 10px 16px; }
  .class-picker-wrap label { display: none; }
  .class-picker-wrap select { min-width: 0; max-width: 210px; }
  .teacher-identity, #logout-button { display: none; }
  .workspace-content { padding: 12px 16px 28px; }
  .bottom-nav { position: fixed; z-index: 50; right: 10px; bottom: 10px; left: 10px; display: grid; height: 68px; grid-template-columns: repeat(5, 1fr); padding: 6px; border-radius: 24px; background: var(--md-sys-color-surface-container-high); box-shadow: 0 8px 28px rgb(0 0 0 / .16); }
  .bottom-nav-button { display: grid; min-width: 0; place-items: center; gap: 2px; padding: 4px 2px; border: 0; border-radius: 18px; color: var(--md-sys-color-on-surface-variant); background: transparent; font-size: .66rem; font-weight: 600; cursor: pointer; }
  .bottom-nav-button svg { width: 22px; height: 22px; }
  .bottom-nav-button.active { color: var(--md-sys-color-on-secondary-container); background: var(--md-sys-color-secondary-container); }
  .page-heading { align-items: start; flex-direction: column; margin-bottom: 18px; }
  .page-actions { justify-content: flex-start; }
  .pulse-strip { grid-template-columns: repeat(3, 1fr); }
  .pulse-lead { grid-column: 1 / -1; }
  .pulse-item { min-height: 84px; padding: 14px; border-top: 1px solid var(--md-sys-color-outline-variant); border-left: 0; text-align: center; }
  .attention-filter-row { flex-wrap: nowrap; overflow-x: auto; }
  .attention-center-grid { grid-template-columns: 1fr; }
  .topic-risk-panel { border-right: 0; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
  .attention-student-list { max-height: 320px; }
  .reminder-history-list { grid-template-columns: 1fr; }
  .reminder-history-row { border-right: 0; }
  .command-layout { grid-template-columns: 1fr; }
  .review-pane { position: static; }
  .review-queue { max-height: 380px; }
  .journal-scroll { max-height: 560px; }
  .review-layout { grid-template-columns: 1fr; }
  .review-list-panel { max-height: 520px; }
  .full-review-list { max-height: 390px; }
  .attempt-panel { min-height: 420px; }
  .settings-grid { grid-template-columns: 1fr; }
  .label-editor { grid-template-columns: 1fr; }
  .student-profile-columns { grid-template-columns: 1fr; gap: 22px; }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .publish-class-list { grid-template-columns: 1fr; }
}

@media (max-width: 599px) {
  .auth-brand { padding-left: 4px; }
  .login-stage { padding-top: 38px; }
  .login-card { padding: 24px 20px; border-radius: var(--shape-xl); }
  .demo-chip { display: none !important; }
  .class-picker-wrap { flex: 1; min-width: 0; }
  .class-picker-wrap select { width: 100%; max-width: none; }
  .topbar-actions { margin-left: 0; }
  .page-heading h1 { font-size: 2rem; }
  .page-heading .button span.optional-label { display: none; }
  .pulse-lead { padding: 22px; }
  .pulse-item strong { font-size: 1.3rem; }
  .pulse-item span { font-size: .65rem; }
  .attention-center-head { align-items: stretch; flex-direction: column; gap: 14px; }
  .attention-homework-field { width: 100%; min-width: 0; }
  .attention-filter-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: visible; padding-inline: 10px; }
  .attention-filter { width: 100%; min-width: 0; justify-content: space-between; }
  .attention-journal-action { width: 100%; grid-column: 1 / -1; margin-left: 0; }
  .reminder-action { width: 100%; grid-column: 1 / -1; }
  .topic-risk-matrix { overflow-x: visible; }
  .topic-risk-header, .topic-risk-row { min-width: 0; grid-template-columns: minmax(120px, 1fr) 42px 42px 64px 55px; padding-inline: 10px; }
  .topic-risk-header { font-size: .57rem; }
  .attention-student-row { grid-template-columns: minmax(0, 1fr) auto 40px; }
  .surface-header { align-items: flex-start; flex-direction: column; }
  .surface-header-actions, .search-field, .search-field input { width: 100%; }
  .reuse-hero { grid-template-columns: 56px minmax(0, 1fr); gap: 16px; padding: 22px; }
  .reuse-hero-icon { width: 56px; height: 56px; border-radius: 19px; }
  .reuse-hero-count { display: flex; grid-column: 1 / -1; align-items: baseline; gap: 8px; padding: 14px 0 0; border-top: 1px solid color-mix(in srgb, currentColor 24%, transparent); border-left: 0; text-align: left; }
  .reuse-hero-count strong { font-size: 1.8rem; }
  .reuse-hero-count span { margin: 0; }
  .template-grid { grid-template-columns: 1fr; }
  .template-empty { grid-template-columns: 52px minmax(0, 1fr); }
  .template-empty .button { width: 100%; grid-column: 1 / -1; }
  .template-card-footer { align-items: flex-start; flex-direction: column; }
  .template-card-footer > div { width: 100%; }
  .template-card-footer > div .button { margin-left: auto; }
  .homework-library-row { grid-template-columns: 44px minmax(0, 1fr); }
  .homework-library-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .publish-main-fields { grid-template-columns: 1fr; }
  .class-grid { grid-template-columns: 1fr; }
  .roster-progress { display: none; }
  .review-form-grid { grid-template-columns: 1fr; }
  .modal-layer { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: var(--shape-xl) var(--shape-xl) 0 0; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { width: 100%; }
  .class-invite-layout { grid-template-columns: 1fr; }
  .class-invite-qr { width: min(100%, 280px); margin-inline: auto; }
  .reminder-controls, .reminder-recipient-list { grid-template-columns: 1fr; }
  .reminder-audience > div { grid-template-columns: 1fr; }
  .reminder-audience-option { min-height: 44px; }
  .reminder-history-row { grid-template-columns: 36px minmax(0, 1fr); }
  .reminder-history-meta { grid-column: 2; text-align: left; }
  .reminder-history-meta b, .reminder-history-meta small { display: inline; }
  .reminder-history-meta small { margin-left: 5px; }
  .student-profile-hero { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; padding-right: 42px; }
  .student-avatar-large { width: 56px; height: 56px; border-radius: 19px; font-size: 1.1rem; }
  .label-editor { padding: 16px; }
  .label-editor-control { grid-template-columns: 1fr; }
  .student-pulse { grid-template-columns: 1fr 1fr; }
  .student-pulse > div:nth-child(2) { border-right: 0; }
  .student-pulse > div:nth-child(-n+2) { border-bottom: 1px solid var(--md-sys-color-outline-variant); }
  .toast-region { right: 12px; bottom: 92px; left: 12px; }
  .toast { width: 100%; min-width: 0; }
}

:where(button, a, input, select, textarea):focus-visible { outline: 3px solid var(--md-sys-color-primary); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
