@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  /* Core palette */
  --primary: #37602c;
  --primary-container: #4f7942;
  --on-primary: #ffffff;
  --on-primary-container: #0c2005;
  /* Action-button gradient. A dedicated end token because the dark theme
     can't reuse --primary-container there: dark flips primary light and
     container deep, so the shared gradient ran light-to-dark under dark
     --on-primary text — washed/illegible on the dark end. */
  --action-gradient-start: var(--primary);
  --action-gradient-end: var(--primary-container);
  --secondary: #206393;
  --secondary-container: #90c9ff;
  --on-secondary: #ffffff;
  --tertiary: #6f5200;
  --tertiary-container: #ffdfa0;
  --on-tertiary: #ffffff;
  --on-tertiary-container: #261a00;

  /* Tonal surfaces */
  --background: #faf9f5;
  --surface: #faf9f5;
  --surface-bright: #faf9f5;
  --surface-dim: #dbdad6;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f4f4f0;
  --surface-container: #efeeea;
  --surface-container-high: #e9e8e4;
  --surface-container-highest: #e3e2df;
  --surface-variant: #e3e2df;

  /* Text + outline */
  --text-primary: #1b1c1a;
  --text-secondary: #42493e;
  --text-muted: #6b7165;
  --on-surface: #1b1c1a;
  --on-surface-variant: #42493e;
  --outline: #73796d;
  --outline-variant: #c2c9bb;

  /* Status colors */
  --status-success: #2f7d32;
  --status-success-soft: #e8f4e8;
  --status-warning: #8f6000;
  --status-warning-soft: #fff4dc;
  --status-error: #b3261e;
  --status-error-soft: #fdecea;
  --status-info: #0b5ea6;
  --status-info-soft: #e9f2fc;

  /* Subject color map */
  --subject-math: #206393;
  --subject-ela: #8e6900;
  --subject-science: #37602c;
  --subject-history: #5c4300;
  --subject-fitness: #0e766e;
  --subject-games: #7f6a00;
  --subject-life-skills: #4f7942;
  --subject-philosophy: #4b5563;
  --subject-music: #7a4c9f;
  --subject-spanish: #b45309;
  --subject-cooking: #9a3412;
  --subject-art: #be185d;
  --subject-piano: #92400e;
  --subject-technology: #4338ca;
  --subject-field-trip: #15803d;
  --subject-geography: #2f6d80;
  --subject-reading: #0b7285;

  /* Subject soft tints (pill/badge backgrounds; pair with --subject-*) */
  --subject-math-soft: #ecf4e9;
  --subject-ela-soft: #eaf3f9;
  --subject-science-soft: #f6f1e2;
  --subject-history-soft: #f7edf8;
  --subject-fitness-soft: #fff2e8;
  --subject-games-soft: #e6f6f8;
  --subject-life-skills-soft: #f1f8e3;
  --subject-philosophy-soft: #f8eefb;
  --subject-music-soft: #fdeef4;
  --subject-spanish-soft: #fff4e8;
  --subject-cooking-soft: #fff0ef;
  --subject-art-soft: #f0edfd;
  --subject-piano-soft: #fbeee0;
  --subject-technology-soft: #ecebfb;
  --subject-field-trip-soft: #e8f5ec;
  --subject-geography-soft: #edf6f8;
  --subject-reading-soft: #e8f5f7;

  /* Typography */
  --font-display: "Plus Jakarta Sans", "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --font-label: "Manrope", "Segoe UI", sans-serif;

  --font-size-display-lg: 3.5rem;
  --font-size-display-md: 2.75rem;
  --font-size-display-sm: 2.25rem;
  --font-size-headline-lg: 1.875rem;
  --font-size-headline-md: 1.5rem;
  --font-size-headline-sm: 1.25rem;
  --font-size-title-lg: 1.125rem;
  --font-size-title-md: 1rem;
  --font-size-title-sm: 0.875rem;
  --font-size-body-lg: 1rem;
  --font-size-body-md: 0.9375rem;
  --font-size-body-sm: 0.875rem;
  --font-size-label-lg: 0.875rem;
  --font-size-label-md: 0.75rem;
  --font-size-label-sm: 0.6875rem;

  --tracking-display-lg: -0.02em;
  --tracking-display-md: -0.018em;
  --tracking-display-sm: -0.015em;
  --tracking-headline: -0.012em;
  --tracking-title: -0.008em;
  --tracking-body: 0;
  --tracking-label: 0.08em;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 1.75rem;
  --space-8: 2rem;
  --space-9: 2.25rem;
  --space-10: 2.5rem;
  --space-11: 2.75rem;
  --space-12: 3rem;
  --space-13: 3.25rem;
  --space-14: 3.5rem;
  --space-15: 3.75rem;
  --space-16: 4rem;

  /* Elevation */
  --shadow-ambient: 0 12px 40px rgba(27, 28, 26, 0.05);
  --shadow-card: 0 8px 24px rgba(27, 28, 26, 0.06);
  --shadow-float: 0 18px 56px rgba(27, 28, 26, 0.12);
  --shadow-inset-soft: inset 0 1px 0 rgba(255, 255, 255, 0.8);

  /* Translucent surface scrims (blurred header / bottom nav) */
  --scrim-surface: rgba(250, 249, 245, 0.82);
  --scrim-surface-strong: rgba(250, 249, 245, 0.94);

  /* Border radii */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  --radius-full: 9999px;

  /* Layout constants */
  --layout-sidebar-width: 16rem;
  --layout-header-height: 4rem;
  --layout-bottom-nav-height: 5.5rem;
  --layout-content-max-width: 80rem;

  /* Block status */
  --block-new: #0b5ea6;
  --block-new-bg: #e9f2fc;
  --block-remediation: #b3261e;
  --block-remediation-bg: #fdecea;
  --block-reinforcement: #2f7d32;
  --block-reinforcement-bg: #e8f4e8;
  --block-carry-forward: #7d5600;
  --block-carry-forward-bg: #fff4dc;

  /* Score thresholds */
  --score-high: #2f7d32;
  --score-high-bg: #e8f4e8;
  --score-mid: #8f6000;
  --score-mid-bg: #fff4dc;
  --score-low: #b3261e;
  --score-low-bg: #fdecea;

  /* OCR status */
  --ocr-pending: #8f6000;
  --ocr-pending-bg: #fff4dc;
  --ocr-scored: #2f7d32;
  --ocr-scored-bg: #e8f4e8;
  --ocr-failed: #b3261e;
  --ocr-failed-bg: #fdecea;
}

/* ------------------------------------------------------------------ */
/* Token reconciliation (Decision 32, Phase 7).                        */
/* The `--color-*` namespace is a Stitch-era convention referenced     */
/* ~365 times across the views but never defined — every reference     */
/* silently rendered its hardcoded fallback, so token changes did not  */
/* restyle the app. These aliases make the namespace resolve to the    */
/* canonical tokens above. New code uses the canonical names.          */
:root {
  /* Accent tokens that previously existed only as fallback hex */
  --primary-fixed: #c0f0ad;
  --secondary-fixed: #d2eca2;
  --tertiary-fixed: #ffdfa0;
  --on-tertiary-fixed: #261a00;
  --on-tertiary-fixed-variant: #5c4300;

  /* Aliases — keep in lockstep with the canonical definitions above */
  --color-primary: var(--primary);
  --color-on-primary: var(--on-primary);
  --color-primary-container: var(--primary-container);
  --color-secondary: var(--secondary);
  --color-secondary-container: var(--secondary-container);
  --color-secondary-fixed: var(--secondary-fixed);
  --color-tertiary: var(--tertiary);
  --color-tertiary-container: var(--tertiary-container);
  --color-on-tertiary-container: var(--on-tertiary-container);
  --color-tertiary-fixed: var(--tertiary-fixed);
  --color-on-tertiary-fixed: var(--on-tertiary-fixed);
  --color-on-tertiary-fixed-variant: var(--on-tertiary-fixed-variant);
  --color-surface: var(--surface);
  --color-surface-dim: var(--surface-dim);
  --color-surface-container-lowest: var(--surface-container-lowest);
  --color-surface-container-low: var(--surface-container-low);
  --color-surface-container: var(--surface-container);
  --color-surface-container-high: var(--surface-container-high);
  --color-surface-container-highest: var(--surface-container-highest);
  --color-on-surface: var(--on-surface);
  --color-on-surface-variant: var(--on-surface-variant);
  --color-outline-variant: var(--outline-variant);
  --color-error: var(--status-error);
  --color-error-container: var(--status-error-soft);
}

:root {
  color-scheme: light;
}

/* ------------------------------------------------------------------ */
/* Dark theme (Decision 33). Token-level only: components read the     */
/* same names; this block re-maps every color-bearing token. Values    */
/* follow MD3 dark tonal logic on a green-tinted neutral ramp and are  */
/* gated by the WCAG-AA contrast test in frontend-tokens.test.ts.      */
/* The *-fixed accent family is theme-invariant by definition.         */
html[data-theme="dark"] {
  color-scheme: dark;

  /* Core palette */
  --primary: #9cd789;
  --primary-container: #2a4a21;
  --on-primary: #143a0d;
  --on-primary-container: #c0f0ad;
  /* Keep the action gradient in the light-green family so dark --on-primary
     text stays legible across the whole button (start inherits --primary). */
  --action-gradient-end: #7cb36a;
  --secondary: #8ec7f0;
  --secondary-container: #1d4d75;
  --on-secondary: #06314e;
  --tertiary: #eec148;
  --tertiary-container: #544000;
  --on-tertiary: #3a2e00;
  --on-tertiary-container: #ffdfa0;

  /* Tonal surfaces */
  --background: #11140f;
  --surface: #11140f;
  --surface-bright: #373a34;
  --surface-dim: #0c0f0a;
  --surface-container-lowest: #0c0f0a;
  --surface-container-low: #191c17;
  --surface-container: #1d201b;
  --surface-container-high: #272a25;
  --surface-container-highest: #32352f;
  --surface-variant: #42493e;

  /* Text + outline */
  --text-primary: #e2e3dc;
  --text-secondary: #c2c9bb;
  --text-muted: #969c90;
  --on-surface: #e2e3dc;
  --on-surface-variant: #c2c9bb;
  --outline: #8c9286;
  --outline-variant: #42493e;

  /* Status colors */
  --status-success: #8fd694;
  --status-success-soft: #1d3320;
  --status-warning: #e0c36c;
  --status-warning-soft: #3a2f12;
  --status-error: #ffb4ab;
  --status-error-soft: #4a1a16;
  --status-info: #8ec7f0;
  --status-info-soft: #16314a;

  /* Subject color map (lightened for AA on dark surfaces) */
  --subject-math: #7fc1ee;
  --subject-ela: #e3c04b;
  --subject-science: #9cd789;
  --subject-history: #d9b35c;
  --subject-fitness: #5fd4c9;
  --subject-games: #d9c14a;
  --subject-life-skills: #a4cf95;
  --subject-philosophy: #aab6c5;
  --subject-music: #c79ae8;
  --subject-spanish: #f0a05c;
  --subject-cooking: #f0926c;
  --subject-art: #f57da8;
  --subject-piano: #e09a64;
  --subject-technology: #a4a0f5;
  --subject-field-trip: #6fd194;
  --subject-geography: #7cc3da;
  --subject-reading: #62c4d8;

  /* Subject soft tints */
  --subject-math-soft: #152430;
  --subject-ela-soft: #2a2412;
  --subject-science-soft: #1c2818;
  --subject-history-soft: #292113;
  --subject-fitness-soft: #12302d;
  --subject-games-soft: #282412;
  --subject-life-skills-soft: #1e2a18;
  --subject-philosophy-soft: #232931;
  --subject-music-soft: #2b1d33;
  --subject-spanish-soft: #321f10;
  --subject-cooking-soft: #331b12;
  --subject-art-soft: #331723;
  --subject-piano-soft: #2e2012;
  --subject-technology-soft: #1f1d33;
  --subject-field-trip-soft: #143020;
  --subject-geography-soft: #142a31;
  --subject-reading-soft: #122b31;

  /* Elevation — dark relies on outlines + deeper, larger shadows */
  --shadow-ambient: 0 12px 40px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-float: 0 18px 56px rgba(0, 0, 0, 0.55);
  --shadow-inset-soft: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --scrim-surface: rgba(17, 20, 15, 0.85);
  --scrim-surface-strong: rgba(17, 20, 15, 0.95);

  /* Block status */
  --block-new: #8ec7f0;
  --block-new-bg: #16314a;
  --block-remediation: #ffb4ab;
  --block-remediation-bg: #4a1a16;
  --block-reinforcement: #8fd694;
  --block-reinforcement-bg: #1d3320;
  --block-carry-forward: #e0c36c;
  --block-carry-forward-bg: #3a2f12;

  /* Score thresholds */
  --score-high: #8fd694;
  --score-high-bg: #1d3320;
  --score-mid: #e0c36c;
  --score-mid-bg: #3a2f12;
  --score-low: #ffb4ab;
  --score-low-bg: #4a1a16;

  /* OCR status */
  --ocr-pending: #e0c36c;
  --ocr-pending-bg: #3a2f12;
  --ocr-scored: #8fd694;
  --ocr-scored-bg: #1d3320;
  --ocr-failed: #ffb4ab;
  --ocr-failed-bg: #4a1a16;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--background);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  color: var(--text-primary);
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Shared component classes */
.btn-primary {
  border: 0;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--action-gradient-start), var(--action-gradient-end));
  color: var(--on-primary);
  font-family: var(--font-display);
  font-size: var(--font-size-title-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-title);
  padding: var(--space-3) var(--space-6);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-float);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-card);
}

.btn-secondary {
  border: 0;
  border-radius: var(--radius-full);
  background: var(--surface-container-highest);
  color: var(--text-primary);
  font-family: var(--font-label);
  font-size: var(--font-size-label-lg);
  font-weight: 700;
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.btn-secondary:hover {
  background: var(--surface-container-high);
  transform: translateY(-1px);
}

.card {
  background: var(--surface-container-lowest);
  border: 0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card), var(--shadow-inset-soft);
  padding: var(--space-6);
}

.ghost-border {
  outline: 1px solid rgba(115, 121, 109, 0.15);
  outline-offset: 0;
}

.subject-badge {
  --badge-color: var(--secondary);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.65rem;
  font-family: var(--font-label);
  font-size: var(--font-size-label-md);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--badge-color);
  background: color-mix(in srgb, var(--badge-color) 14%, var(--surface-container-lowest, #ffffff));
}

.subject-badge::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--badge-color);
}

.status-badge {
  --status-color: var(--status-info);
  --status-bg: var(--status-info-soft);
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  padding: 0.2rem 0.6rem;
  font-family: var(--font-label);
  font-size: var(--font-size-label-sm);
  font-weight: 800;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--status-color);
  background: var(--status-bg);
}

.status-badge[data-block-status="new"] {
  --status-color: var(--block-new);
  --status-bg: var(--block-new-bg);
}

.status-badge[data-block-status="remediation"] {
  --status-color: var(--block-remediation);
  --status-bg: var(--block-remediation-bg);
}

.status-badge[data-block-status="reinforcement"] {
  --status-color: var(--block-reinforcement);
  --status-bg: var(--block-reinforcement-bg);
}

.status-badge[data-block-status="carry-forward"] {
  --status-color: var(--block-carry-forward);
  --status-bg: var(--block-carry-forward-bg);
}

.status-badge[data-score-band="high"] {
  --status-color: var(--score-high);
  --status-bg: var(--score-high-bg);
}

.status-badge[data-score-band="mid"] {
  --status-color: var(--score-mid);
  --status-bg: var(--score-mid-bg);
}

.status-badge[data-score-band="low"] {
  --status-color: var(--score-low);
  --status-bg: var(--score-low-bg);
}

.status-badge[data-ocr-status="pending"] {
  --status-color: var(--ocr-pending);
  --status-bg: var(--ocr-pending-bg);
}

.status-badge[data-ocr-status="scored"] {
  --status-color: var(--ocr-scored);
  --status-bg: var(--ocr-scored-bg);
}

.status-badge[data-ocr-status="failed"] {
  --status-color: var(--ocr-failed);
  --status-bg: var(--ocr-failed-bg);
}

/* Shared app shell styles */
.homeroom-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--layout-sidebar-width);
  background: var(--scrim-surface-strong, rgba(250, 249, 245, 0.94));
  backdrop-filter: blur(18px);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  box-shadow: var(--shadow-card);
  z-index: 40;
}

.shell-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.shell-brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--action-gradient-start), var(--action-gradient-end));
  color: var(--on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: var(--shadow-ambient);
}

.shell-brand-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: var(--tracking-title);
}

.shell-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-1);
}

.shell-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.75rem;
  color: var(--text-secondary);
  background: transparent;
  font-family: var(--font-label);
  font-size: var(--font-size-label-lg);
  font-weight: 650;
  letter-spacing: 0.01em;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.shell-nav-link:hover {
  background: var(--surface-container-high);
  color: var(--text-primary);
}

.shell-nav-link.is-active {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface-container-lowest, #ffffff));
  color: var(--primary);
}

.shell-nav-main {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.shell-nav-badge {
  min-width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tertiary) 20%, var(--surface-container-lowest, #ffffff));
  color: var(--tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-1);
  font-size: 0.62rem;
  font-weight: 800;
}

.shell-student {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-ambient);
}

.shell-student-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--secondary) 18%, var(--surface-container-lowest, #ffffff));
  color: var(--secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-label-md);
  font-weight: 800;
}

.shell-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--layout-header-height);
  margin-left: var(--layout-sidebar-width);
  padding: 0 var(--space-6);
  background: var(--scrim-surface);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.shell-header-search {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 32rem;
  background: var(--surface-container-low, #f4f4f0);
  border-radius: var(--radius-full, 9999px);
  padding: 0;
  color: var(--text-muted, #6b7165);
}

.shell-header-search svg {
  display: none;
}

.shell-search-input {
  flex: 1;
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  font-family: var(--font-body, Manrope, sans-serif);
  font-size: var(--font-size-body-sm, 0.875rem);
  color: var(--text-primary, #1b1c1a);
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border-radius: var(--radius-full, 9999px);
}

.shell-search-input::placeholder {
  color: var(--text-muted, #6b7165);
}

.shell-student-switcher {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.7rem 0.3rem 0.35rem;
  background: color-mix(in srgb, var(--secondary) 10%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--secondary) 20%, transparent);
  pointer-events: none;
}

.shell-switcher-avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--secondary) 22%, var(--surface-container-lowest, #ffffff));
  color: var(--secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-label-sm);
  font-weight: 800;
}

.shell-switcher-name {
  font-family: var(--font-label);
  font-size: var(--font-size-label-lg);
  font-weight: 700;
  color: var(--text-secondary);
}

.shell-header-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.shell-icon-button {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease;
}

.shell-icon-button:hover {
  color: var(--primary);
}

.shell-count {
  position: absolute;
  top: -0.2rem;
  right: -0.2rem;
  min-width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: var(--status-error);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.2rem;
}

.shell-avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--primary) 15%, var(--surface-container-lowest, #ffffff));
  color: var(--primary);
  font-family: var(--font-label);
  font-size: var(--font-size-label-md);
  font-weight: 800;
}

.shell-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--layout-bottom-nav-height) + env(safe-area-inset-bottom));
  padding: var(--space-2) var(--space-4)
    calc(var(--space-2) + env(safe-area-inset-bottom));
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--scrim-surface-strong);
  backdrop-filter: blur(18px);
  box-shadow: 0 -8px 24px rgba(27, 28, 26, 0.06);
  z-index: 50;
}

.shell-bottom-link {
  /* labels ("SCHEDULE", "PROGRESS") must not clip at 390px — width tracks
     content; min 3rem keeps the 48px tap target */
  min-width: 3rem;
  width: auto;
  padding: 0 0.5rem;
  height: 3rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.shell-bottom-link.is-active {
  background: linear-gradient(135deg, var(--action-gradient-start), var(--action-gradient-end));
  color: var(--on-primary);
  transform: translateY(-2px);
}

.shell-more-sheet {
  position: fixed;
  right: var(--space-3);
  bottom: calc(
    var(--layout-bottom-nav-height) + env(safe-area-inset-bottom) +
      var(--space-2)
  );
  min-width: 13rem;
  max-width: min(21rem, calc(100vw - var(--space-6)));
  border-radius: var(--radius-xl);
  background: var(--surface-container-lowest);
  box-shadow: var(--shadow-float);
  padding: var(--space-3);
  display: none;
  z-index: 55;
}

.shell-more-sheet.is-open {
  display: grid;
  gap: var(--space-1);
}

.shell-more-link {
  border-radius: var(--radius-md);
  padding: 0.6rem 0.7rem;
  font-size: var(--font-size-body-sm);
  color: var(--text-secondary);
  font-weight: 650;
}

.shell-more-link:hover {
  background: var(--surface-container-high);
  color: var(--text-primary);
}

.shell-toast-root {
  position: fixed;
  right: var(--space-4);
  bottom: calc(
    var(--layout-bottom-nav-height) + env(safe-area-inset-bottom) +
      var(--space-3)
  );
  display: grid;
  gap: var(--space-2);
  z-index: 60;
}

.shell-toast {
  min-width: 13rem;
  max-width: min(24rem, calc(100vw - var(--space-8)));
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  color: #fff;
  font-size: var(--font-size-body-sm);
  font-weight: 700;
  box-shadow: var(--shadow-float);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.shell-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.shell-toast.success {
  background: linear-gradient(135deg, #2f7d32, #4aa34f);
}

.shell-toast.error {
  background: linear-gradient(135deg, #b3261e, #d54a41);
}

.shell-toast.info {
  background: linear-gradient(135deg, #0b5ea6, #2578bf);
}

@media (max-width: 820px) {
  .homeroom-sidebar {
    display: none;
  }

  .shell-header {
    margin-left: 0;
    padding: 0 var(--space-4);
  }

  .shell-bottom-nav {
    display: flex;
  }

  .shell-toast-root {
    left: var(--space-3);
    right: var(--space-3);
    bottom: calc(
      var(--layout-bottom-nav-height) + env(safe-area-inset-bottom) +
        var(--space-2)
    );
  }
}
