/*
 * Speakway application shell — graphite / acid redesign variant.
 * The visual layer is intentionally isolated from application behaviour.
 */

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-raised: #ffffff;
  --surface-tint: #eef5ff;
  --control: #ffffff;
  --text: #17202a;
  --muted: #637083;
  --border: #d9e0ea;
  --border-soft: #edf1f6;
  --accent: #175cd3;
  --accent-hover: #164cac;
  --accent-soft: #e9f1ff;
  --accent-ink: #ffffff;
  --primary: #175cd3;
  --ok: #137a4b;
  --ok-soft: #e8f7ef;
  --warn: #a45b00;
  --warn-soft: #fff4e3;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --info: #175cd3;
  --info-soft: #e9f1ff;
  --nav-bg: #ffffff;
  --nav-text: #455269;
  --nav-muted: #98a2b3;
  --nav-hover: #f3f7fd;
  --nav-active: #175cd3;
  --nav-active-text: #ffffff;
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, .05);
  --shadow-panel: 0 12px 34px rgba(15, 23, 42, .06);
  --radius: 8px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #111c2e;
  --surface-soft: #17233a;
  --surface-raised: #1b2942;
  --surface-tint: #172b4d;
  --control: #0f1a2c;
  --text: #f8fafc;
  --muted: #9aa8bc;
  --border: #2b3a52;
  --border-soft: #223149;
  --accent: #6ea8ff;
  --accent-hover: #8abbff;
  --accent-soft: rgba(79, 140, 255, .16);
  --accent-ink: #0c1830;
  --primary: #6ea8ff;
  --ok: #6dd7aa;
  --ok-soft: rgba(40, 179, 119, .13);
  --warn: #f3bd5d;
  --warn-soft: rgba(221, 150, 38, .13);
  --danger: #ff7b83;
  --danger-soft: rgba(230, 73, 84, .14);
  --info: #8abbff;
  --info-soft: rgba(79, 140, 255, .16);
  --nav-bg: #111c2e;
  --nav-text: #aebbd0;
  --nav-muted: #6f7f96;
  --nav-hover: #17233a;
  --nav-active: #6ea8ff;
  --nav-active-text: #0c1830;
  --shadow-soft: none;
  --shadow-panel: none;
}

html {
  background: var(--bg);
}

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
  transition: background-color .22s ease, color .22s ease;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

* {
  scrollbar-color: var(--border) transparent;
}

h1,
h2,
h3,
h4,
.section-head h3,
.dashboard-band h3,
.admin-workspace-head h3,
.admin-inspector-head h3 {
  color: var(--text);
  letter-spacing: 0;
}

a {
  color: inherit;
}

.muted,
small,
label,
.admin-record-meta,
.lesson-selected-summary {
  color: var(--muted);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 17px;
  font-weight: 850;
  letter-spacing: 0;
  box-shadow: none;
}

.brand-name {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

header h1 {
  color: var(--text);
  font-size: 16px;
  letter-spacing: 0;
}

header p {
  color: var(--muted);
}

button,
.button-like,
input,
select,
textarea {
  border-radius: 8px;
}

textarea {
  border-radius: 12px;
}

input,
select,
textarea {
  border-color: var(--border);
  background: var(--control);
  color: var(--text);
  box-shadow: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: .74;
}

button,
.button-like {
  border-color: var(--border);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: none;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, transform .16s ease;
}

button:hover,
.button-like:hover {
  border-color: var(--text);
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: none;
  transform: translateY(-1px);
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: none;
}

button.primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: var(--accent-ink);
}

button.active,
.tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: none;
}

.danger-button,
button.danger-button {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.button-like:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 38%, transparent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.badge {
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: none;
}

.badge.ok {
  border-color: color-mix(in srgb, var(--ok) 24%, transparent);
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.warn {
  border-color: color-mix(in srgb, var(--warn) 24%, transparent);
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.danger {
  border-color: color-mix(in srgb, var(--danger) 24%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.message,
.auth-message,
.modal-message {
  border-radius: 12px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.theme-glyph {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  line-height: 1;
  transition: transform .24s ease;
}

:root[data-theme="light"] .theme-glyph {
  transform: rotate(180deg);
}

.dashboard-shell,
.teacher-dashboard,
.admin-overview,
.students-workspace,
.finance-workspace,
.knowledge-base,
.workspace {
  animation: graphiteSurfaceIn .34s cubic-bezier(.2, .7, .2, 1) both;
}

.panel,
.dashboard-band,
.metric-card,
.prep-task,
.planner-item,
.admin-entity-card,
.student-class-row,
.student-list-row,
.prep-hierarchy-row,
.prep-lesson-row,
.calendar-event,
.calendar-day,
.lesson-planner,
.prep-lesson-manager,
.live-stage-panel,
.knowledge-lesson,
.admin-list,
.admin-inspector,
.ops-hero,
.ops-kpi,
.ops-table,
.finance-toolbar,
.finance-rate-form,
.finance-payment-form,
.lesson-picker,
.lesson-session-strip,
.live-stage-primary,
.live-stage-monitor,
.lesson-flow-step,
.lesson-flow-session,
.ui-state,
.prep-tile,
.student-profile,
.student-fullscreen,
.student-homework-card,
.modal-window {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

.dashboard-band.primary {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--accent);
}

.dashboard-band.primary::before {
  content: "";
  width: 8px;
  height: 8px;
  display: block;
  margin-bottom: 12px;
  border-radius: 3px;
  background: var(--accent);
}

.metric-grid,
.admin-entity-grid,
.ops-scoreboard {
  gap: 10px;
  border: 0;
}

.metric-card,
.admin-entity-card,
.ops-kpi {
  min-height: 104px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric-card:last-child {
  border-right: 1px solid var(--border);
}

.metric-card:hover,
.admin-entity-card:hover,
.ops-kpi:hover,
.prep-task:hover,
.prep-tile:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  background: var(--surface-raised);
  box-shadow: none;
}

.metric-card.ok,
.metric-card.warn,
.metric-card.danger,
.ops-kpi.ok,
.ops-kpi.warn,
.ops-kpi.danger {
  background: var(--surface);
}

.metric-card strong,
.dashboard-stat strong,
.student-metric strong,
.ops-kpi strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.progress-meter-track,
.upload-progress-track {
  background: var(--surface-soft);
}

.progress-meter-fill,
.progress-meter.warn .progress-meter-fill,
.progress-meter.danger .progress-meter-fill,
.upload-progress-bar {
  background: var(--accent);
}

.insight-row,
.dashboard-action-row,
.finance-confirmation-row,
.row,
.admin-record-row,
.knowledge-material {
  border-bottom-color: var(--border-soft);
  transition: background-color .16s ease, padding .16s ease;
}

.insight-row:hover,
.dashboard-action-row:hover,
.finance-confirmation-row:hover,
.row:hover,
.admin-record-row:hover,
.knowledge-material:hover {
  background: var(--surface-soft);
}

.admin-tabs,
.tabs {
  border-color: var(--border);
  background: var(--surface-soft);
}

.admin-tabs .tab,
.tabs .tab {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.admin-tabs .tab.active,
.tabs .tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: none;
}

.admin-list-head,
.admin-inspector,
.ops-table-row.header {
  background: var(--surface);
}

.ops-table-row,
.admin-record-row {
  border-bottom-color: var(--border-soft);
}

.ops-table-row.header {
  color: var(--muted);
}

.library-level,
.library-section,
.prep-tile {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

.library-level.active,
.library-section.active,
.prep-tile.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}

.week-calendar {
  gap: 8px;
}

.calendar-day.today {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.calendar-event {
  border-left-color: var(--accent);
}

.lesson-flow-step.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lesson-plan-index,
.admin-record-index {
  background: var(--accent-soft);
  color: var(--text);
}

.pdf,
iframe,
.jitsi-frame {
  border-color: var(--border);
  background: var(--control);
}

.modal-backdrop {
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(5px);
}

.modal-window {
  box-shadow: 0 30px 100px rgba(0, 0, 0, .34);
}

.modal-actions {
  border-top-color: var(--border);
}

.auth-shell {
  background: var(--bg);
}

.auth-hero {
  background: #0b0b0d;
}

.auth-hero::before {
  filter: saturate(.58) contrast(1.08) brightness(.7);
}

.auth-hero::after {
  background:
    linear-gradient(118deg, rgba(5, 5, 6, .96), rgba(12, 13, 11, .78) 52%, rgba(5, 5, 6, .58));
}

.auth-hero h1 {
  color: #f7f8f3;
  letter-spacing: 0;
}

.auth-hero p,
.auth-preview-row span {
  color: #b8bbb3;
}

.auth-preview {
  border-top-color: rgba(184, 255, 61, .28);
}

.auth-preview-row strong {
  color: #f5f6f2;
}

.auth-preview-row .badge {
  background: rgba(184, 255, 61, .13);
  color: #d5ff91;
}

.auth-motion-layer span {
  border-color: rgba(184, 255, 61, .18);
  background: rgba(184, 255, 61, .07);
  box-shadow: none;
}

.auth-login-side {
  background: var(--bg);
}

.auth-panel {
  width: min(420px, 100%);
}

.auth-panel h2 {
  color: var(--text);
  letter-spacing: 0;
}

.auth-tabs {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.auth-tabs button,
.auth-tabs button.active {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.auth-tabs button.active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.auth-note {
  border-top-color: var(--border);
}

@media (min-width: 1180px) {
  body.is-authenticated header {
    width: 248px;
    height: 100svh;
    min-height: 0;
    position: fixed;
    inset: 0 auto 0 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 24px;
    padding: 24px 16px 18px;
    overflow: hidden;
    border: 0;
    border-right: 1px solid var(--border);
    background: var(--nav-bg);
    box-shadow: var(--shadow-panel);
    backdrop-filter: none;
    transition: background-color .22s ease, border-color .22s ease;
  }

  body.is-authenticated header .brand {
    padding: 0 7px;
  }

  body.is-authenticated header .brand-mark {
    background: var(--accent);
    color: var(--accent-ink);
  }

  body.is-authenticated header .brand-name,
  body.is-authenticated header h1 {
    color: var(--text);
  }

  body.is-authenticated header p {
    max-width: none;
    margin-top: 13px;
    color: var(--muted);
    line-height: 1.45;
    white-space: normal;
  }

  body.is-authenticated .top-nav {
    min-height: 0;
    display: grid;
    grid-auto-rows: min-content;
    align-content: start;
    justify-content: stretch;
    gap: 5px;
    overflow-y: auto;
    padding: 4px 0;
  }

  body.is-authenticated .top-nav .nav-item {
    width: 100%;
    min-height: 44px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    justify-content: start;
    gap: 9px;
    padding: 8px 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--nav-text);
    font-size: 13px;
    font-weight: 650;
    text-align: left;
    box-shadow: none;
    transform: none;
  }

  body.is-authenticated .top-nav .nav-item::before {
    content: attr(data-nav-order);
    color: var(--nav-muted);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0;
  }

  body.is-authenticated .top-nav .nav-item:hover {
    border: 0;
    background: var(--nav-hover);
    color: var(--text);
  }

  body.is-authenticated .top-nav .nav-item.active {
    border: 0;
    background: var(--nav-active);
    color: var(--nav-active-text);
    box-shadow: none;
  }

  body.is-authenticated .top-nav .nav-item.active::before {
    color: var(--accent);
  }

  :root[data-theme="dark"] body.is-authenticated .top-nav .nav-item.active::before {
    color: var(--accent-ink);
  }

  body.is-authenticated .authbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 14px 7px 0;
    border-top: 1px solid var(--border);
  }

  body.is-authenticated .authbar > div {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    padding-bottom: 4px;
  }

  body.is-authenticated .authbar .user-chip {
    max-width: none;
    color: var(--text);
    text-align: left;
  }

  body.is-authenticated .authbar .theme-toggle {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }

  body.is-authenticated .authbar .logout-button {
    grid-column: 2;
    grid-row: 2;
  }

  body.is-authenticated .authbar .theme-toggle,
  body.is-authenticated .authbar .logout-button {
    min-height: 34px;
    padding: 0 10px;
    border-color: var(--border);
    background: var(--surface-soft);
    color: var(--text);
    font-size: 12px;
  }

  body.is-authenticated main,
  body.is-authenticated main.sidebar-hidden {
    width: auto;
    max-width: none;
    margin: 0 0 0 248px;
    padding: 28px clamp(24px, 3vw, 48px) 44px;
  }

  body.is-authenticated main {
    grid-template-columns: 268px minmax(0, 1fr);
    gap: 24px;
  }

  body.is-authenticated main.sidebar-hidden {
    grid-template-columns: minmax(0, 1fr);
  }

  body.is-authenticated .left-sidebar {
    height: calc(100svh - 56px);
    top: 28px;
    padding: 15px;
    border-color: var(--border);
    background: var(--surface);
    box-shadow: none;
  }

  body.is-authenticated .layout {
    gap: 24px;
  }

  body.is-authenticated .layout > section {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.is-authenticated .layout > section > .section-head {
    min-height: 52px;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
  }

  body.is-authenticated #roleTitle {
    font-size: 24px;
    letter-spacing: 0;
  }

  body.is-authenticated .lesson-rail {
    position: sticky;
    top: 28px;
    max-height: calc(100svh - 56px);
    overflow-y: auto;
  }
}

@media (max-width: 1179px) {
  header {
    border-bottom-color: var(--border);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: none;
    backdrop-filter: blur(14px);
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 9px;
    font-size: 15px;
  }

  .top-nav .nav-item::before {
    display: none;
  }

  .top-nav .nav-item {
    border-radius: 8px;
    color: var(--muted);
  }

  .top-nav .nav-item.active {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: none;
  }

  .authbar .theme-toggle,
  .authbar .logout-button {
    background: var(--surface-raised);
    color: var(--text);
  }
}

@media (max-width: 720px) {
  .brand-name,
  header .brand > p,
  .theme-toggle #themeLabel {
    display: none;
  }

  header h1 {
    font-size: 14px;
  }

  .brand-lockup {
    gap: 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .theme-toggle {
    width: 34px;
    min-width: 34px;
    padding: 0;
  }

  .theme-glyph {
    width: 22px;
    height: 22px;
  }

  main,
  main.sidebar-hidden {
    background: var(--bg);
  }

  section,
  .panel,
  .dashboard-band {
    border-color: var(--border);
    background: var(--surface);
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric-card,
  .metric-card:last-child {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-raised);
  }

  .auth-shell {
    background: var(--bg);
  }
}

/* Operational UI v3: one compact component scale for every authenticated role. */
body.is-authenticated {
  --font-xs: 12px;
  --font-sm: 13px;
  --font-base: 14px;
  --font-md: 16px;
  --font-lg: 20px;
  --font-xl: 24px;
  --control-sm: 32px;
  --control-md: 36px;
  --control-lg: 40px;
  --control-radius: 8px;
  --control-pad-x: 10px;
  --space-md: 10px;
  --space-lg: 14px;
  --space-xl: 18px;
  font-size: var(--font-base);
}

body.is-authenticated * {
  letter-spacing: 0;
}

body.is-authenticated h1,
body.is-authenticated h2,
body.is-authenticated h3,
body.is-authenticated h4,
body.is-authenticated .section-head h3,
body.is-authenticated .dashboard-band h3,
body.is-authenticated .admin-workspace-head h3,
body.is-authenticated .admin-inspector-head h3,
body.is-authenticated .lesson-plan-head h3,
body.is-authenticated .ops-hero h3 {
  letter-spacing: 0;
  overflow-wrap: break-word;
  word-break: normal;
}

body.is-authenticated #roleTitle {
  font-size: var(--font-xl);
  line-height: 1.25;
  font-weight: 700;
}

body.is-authenticated h2 {
  font-size: var(--font-lg);
}

body.is-authenticated h3,
body.is-authenticated .section-head h3,
body.is-authenticated .dashboard-band h3,
body.is-authenticated .admin-workspace-head h3,
body.is-authenticated .admin-inspector-head h3,
body.is-authenticated .lesson-plan-head h3,
body.is-authenticated .ops-hero h3 {
  font-size: var(--font-md);
  line-height: 1.3;
  font-weight: 700;
}

body.is-authenticated h4,
body.is-authenticated .admin-record-title,
body.is-authenticated .prep-lesson-main strong,
body.is-authenticated .knowledge-material strong {
  font-size: var(--font-base);
  line-height: 1.35;
  font-weight: 700;
}

body.is-authenticated .muted,
body.is-authenticated small,
body.is-authenticated .admin-record-meta,
body.is-authenticated .lesson-selected-summary,
body.is-authenticated .section-head p {
  font-size: var(--font-sm);
  line-height: 1.4;
}

body.is-authenticated label {
  font-size: var(--font-xs);
  line-height: 1.25;
  font-weight: 650;
}

body.is-authenticated button,
body.is-authenticated .button-like,
body.is-authenticated input,
body.is-authenticated select {
  min-height: var(--control-md);
  border-radius: var(--control-radius);
  font-size: var(--font-base);
}

body.is-authenticated button,
body.is-authenticated .button-like {
  padding-inline: var(--control-pad-x);
  font-weight: 650;
}

body.is-authenticated textarea {
  border-radius: var(--control-radius);
  font-size: var(--font-base);
}

body.is-authenticated .top-nav .nav-item,
body.is-authenticated .authbar button,
body.is-authenticated .toolbar button,
body.is-authenticated .dashboard-actions button,
body.is-authenticated .admin-quick-actions button,
body.is-authenticated .prep-lesson-row-actions button,
body.is-authenticated .lesson-flow-actions button,
body.is-authenticated .ops-table-actions button,
body.is-authenticated .dashboard-v2 .dashboard-command-bar button,
body.is-authenticated .dashboard-v2 .dashboard-section-action,
body.is-authenticated .dashboard-v2 .dashboard-action-row button,
body.is-authenticated .dashboard-v2 .schedule-item-actions button {
  min-height: var(--control-sm);
  border-radius: var(--control-radius);
  padding-inline: 9px;
  font-size: var(--font-sm);
}

body.is-authenticated .icon-button,
body.is-authenticated .calendar-event-tools button,
body.is-authenticated .lesson-plan-step .lesson-plan-step-actions .icon-button,
body.is-authenticated .lesson-plan-step .lesson-plan-step-actions .danger-button {
  width: var(--control-sm);
  min-width: var(--control-sm);
  height: var(--control-sm);
  min-height: var(--control-sm);
  padding: 0;
  border-radius: var(--control-radius);
  font-size: var(--font-base);
}

body.is-authenticated .lesson-plan-step input,
body.is-authenticated .lesson-plan-step select,
body.is-authenticated .lesson-plan-status select,
body.is-authenticated .lesson-plan-resource-pill,
body.is-authenticated .lesson-plan-resource-actions,
body.is-authenticated .lesson-plan-resource-actions button,
body.is-authenticated .planner-reference-actions button {
  height: var(--control-lg);
  min-height: var(--control-lg);
}

body.is-authenticated .badge {
  min-height: 22px;
  padding: 3px 8px;
  font-size: var(--font-xs);
  font-weight: 650;
}

body.is-authenticated section,
body.is-authenticated aside,
body.is-authenticated .panel,
body.is-authenticated .dashboard-band,
body.is-authenticated .metric-card,
body.is-authenticated .admin-entity-card,
body.is-authenticated .prep-task,
body.is-authenticated .prep-tile,
body.is-authenticated .planner-item,
body.is-authenticated .calendar-day,
body.is-authenticated .calendar-event,
body.is-authenticated .student-class-row,
body.is-authenticated .student-list-row,
body.is-authenticated .prep-hierarchy-row,
body.is-authenticated .prep-lesson-row,
body.is-authenticated .lesson-planner,
body.is-authenticated .lesson-plan-step,
body.is-authenticated .live-stage-panel,
body.is-authenticated .knowledge-lesson,
body.is-authenticated .admin-list,
body.is-authenticated .admin-inspector,
body.is-authenticated .ops-hero,
body.is-authenticated .ops-kpi,
body.is-authenticated .ops-table,
body.is-authenticated .finance-toolbar,
body.is-authenticated .finance-rate-form,
body.is-authenticated .finance-payment-form,
body.is-authenticated .modal-window {
  border-radius: var(--radius);
}

body.is-authenticated section,
body.is-authenticated .panel,
body.is-authenticated .dashboard-band,
body.is-authenticated .lesson-planner,
body.is-authenticated .prep-lesson-manager,
body.is-authenticated .live-stage-panel,
body.is-authenticated .knowledge-lesson,
body.is-authenticated .admin-list,
body.is-authenticated .admin-inspector {
  padding: var(--space-lg);
}

body.is-authenticated .section-head,
body.is-authenticated .admin-workspace-head,
body.is-authenticated .prep-drilldown-head,
body.is-authenticated .prep-lesson-head,
body.is-authenticated .lesson-plan-head,
body.is-authenticated .live-stage-head {
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

body.is-authenticated .dashboard-v2 .dashboard-band {
  padding: var(--space-lg);
}

body.is-authenticated .finance-command-grid > *,
body.is-authenticated .finance-side-stack,
body.is-authenticated .finance-side-stack > *,
body.is-authenticated .ops-split > *,
body.is-authenticated .ops-stack,
body.is-authenticated .ops-stack > * {
  min-width: 0;
  max-width: 100%;
}

body.is-authenticated .finance-side-stack .ops-table {
  max-width: 100%;
  overflow-x: auto;
}

body.is-authenticated .finance-side-stack .ops-table-row {
  min-width: 560px;
}

body.is-authenticated .finance-side-stack .finance-breakdown-table .ops-table-row {
  min-width: 0;
}

body.is-authenticated .metric-card,
body.is-authenticated .admin-entity-card,
body.is-authenticated .ops-kpi {
  min-height: 88px;
}

body.is-authenticated .metric-card strong,
body.is-authenticated .dashboard-stat strong,
body.is-authenticated .student-metric strong,
body.is-authenticated .ops-kpi strong,
body.is-authenticated .dashboard-v2 .dashboard-kpi-strip .ops-kpi strong {
  font-size: var(--font-lg);
  line-height: 1.15;
  font-weight: 700;
}

body.is-authenticated .dashboard-v2 .next-lesson-title {
  font-size: var(--font-lg);
  line-height: 1.3;
}

body.is-authenticated .lesson-plan-step {
  min-height: 92px;
  padding: var(--space-lg);
  gap: var(--space-lg);
}

body.is-authenticated .lesson-plan-index {
  width: 34px;
  height: 34px;
  font-size: var(--font-md);
}

body.is-authenticated .prep-lesson-row,
body.is-authenticated .admin-record-row,
body.is-authenticated .ops-table-row {
  min-height: 56px;
  padding: 10px 12px;
}

body.is-authenticated .ops-table-row.header {
  min-height: 36px;
  font-size: var(--font-xs);
  font-weight: 700;
  letter-spacing: 0;
}

body.is-authenticated .ops-table-row strong,
body.is-authenticated .admin-record-title,
body.is-authenticated .student-list-row strong,
body.is-authenticated .student-class-row strong {
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

body.is-authenticated .modal-window .section-head h3 {
  font-size: var(--font-md);
}

@media (min-width: 1180px) {
  body.is-authenticated header {
    gap: 18px;
    padding: 20px 14px 16px;
  }

  body.is-authenticated .top-nav .nav-item {
    min-height: 38px;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--control-radius);
  }

  body.is-authenticated main,
  body.is-authenticated main.sidebar-hidden {
    padding-top: 24px;
  }

  body.is-authenticated .layout > section > .section-head {
    min-height: 44px;
    margin-bottom: 16px;
    padding-bottom: 12px;
  }

  body.is-authenticated .layout > section {
    padding: 0;
  }
}

@media (max-width: 720px) {
  body.is-authenticated {
    --font-lg: 18px;
    --font-xl: 20px;
  }

  body.is-authenticated .metric-card,
  body.is-authenticated .admin-entity-card,
  body.is-authenticated .ops-kpi {
    min-height: 80px;
  }
}

/* Classic blue shell: horizontal global navigation on every viewport. */
body.is-authenticated .top-nav .nav-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: none;
}

body.is-authenticated .top-nav .nav-item.active::before {
  color: var(--accent);
}

@media (min-width: 1180px) {
  body.is-authenticated header {
    width: 100%;
    height: auto;
    min-height: 64px;
    position: sticky;
    inset: auto;
    display: grid;
    grid-template-columns: minmax(240px, 340px) minmax(0, 1fr) minmax(260px, auto);
    grid-template-rows: none;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(12px);
  }

  body.is-authenticated header .brand {
    padding: 0;
  }

  body.is-authenticated header p {
    max-width: none;
    margin: 3px 0 0;
    line-height: 1.35;
    white-space: normal;
  }

  body.is-authenticated .top-nav {
    min-height: 0;
    display: flex;
    grid-auto-rows: unset;
    align-content: normal;
    align-items: center;
    justify-content: center;
    gap: 5px;
    overflow: visible;
    padding: 0;
  }

  body.is-authenticated .top-nav .nav-item {
    width: auto;
    min-height: 36px;
    display: inline-flex;
    grid-template-columns: none;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: var(--control-radius);
    background: transparent;
    color: var(--nav-text);
    font-size: var(--font-sm);
    text-align: center;
  }

  body.is-authenticated .top-nav .nav-item::before {
    display: none;
  }

  body.is-authenticated .top-nav .nav-item:hover {
    border: 1px solid var(--border);
    background: var(--nav-hover);
    color: var(--text);
  }

  body.is-authenticated .top-nav .nav-item.active {
    border: 1px solid var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
  }

  body.is-authenticated .authbar {
    min-width: 0;
    display: flex;
    grid-template-columns: none;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 0;
    border: 0;
  }

  body.is-authenticated .authbar > div {
    min-width: 0;
    grid-column: auto;
    grid-row: auto;
    order: 3;
    padding: 0;
  }

  body.is-authenticated .authbar .theme-toggle,
  body.is-authenticated .authbar .logout-button {
    grid-column: auto;
    grid-row: auto;
    justify-self: auto;
  }

  body.is-authenticated .authbar .theme-toggle {
    order: 1;
  }

  body.is-authenticated .authbar .logout-button {
    order: 2;
  }

  body.is-authenticated .authbar .user-chip {
    max-width: 180px;
    text-align: right;
  }

  body.is-authenticated main,
  body.is-authenticated main.sidebar-hidden {
    width: 100%;
    max-width: 1780px;
    margin: 0 auto;
    padding: 16px 20px 28px;
  }

  body.is-authenticated main {
    grid-template-columns: 268px minmax(0, 1fr);
    gap: 16px;
  }

  body.is-authenticated main.sidebar-hidden {
    grid-template-columns: minmax(0, 1fr);
  }

  body.is-authenticated .left-sidebar {
    height: calc(100svh - 96px);
    top: 80px;
  }

  body.is-authenticated .layout {
    gap: 16px;
  }

  body.is-authenticated .layout > section > .section-head {
    min-height: 44px;
    margin-bottom: 16px;
    padding-bottom: 12px;
  }
}

@keyframes graphiteSurfaceIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .dashboard-shell,
  .teacher-dashboard,
  .admin-overview,
  .students-workspace,
  .finance-workspace,
  .knowledge-base,
  .workspace {
    animation: none;
  }
}
