/*
  Accounting Practice Lab, design layer v2 (2026-11-23).
  Loaded last. It restyles the existing markup and the shell added by lab-shell.js.
  It changes presentation only: no accounting rule, validation or calculation lives here.
  Spec: docs/design-system.md
*/

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --v2-bg: #f4f6f9;
  --v2-surface: #ffffff;
  --v2-subtle: #f8f9fb;
  --v2-sunken: #eef1f5;
  --v2-border: #dfe4eb;
  --v2-border-strong: #c5cdd8;
  --v2-ink: #0e1726;
  --v2-ink-2: #263244;
  --v2-muted: #4e5868;
  --v2-faint: #667183;

  --v2-brand: #164578;
  --v2-brand-hover: #0f355b;
  --v2-brand-soft: #e7eef7;
  --v2-brand-ink: #123a66;

  --v2-learn: #0f6a73;
  --v2-learn-ink: #0b5259;
  --v2-learn-soft: #e7f3f2;
  --v2-learn-border: #bcdcd9;

  --v2-success: #0b6539;
  --v2-success-soft: #e5f2ea;
  --v2-warning: #8b5a12;
  --v2-warning-soft: #fbf1df;
  --v2-danger: #b3261e;
  --v2-danger-soft: #fbeceb;

  --v2-night: #12161d;
  --v2-night-2: #1a2029;
  --v2-night-3: #242c38;
  --v2-night-line: #2b3340;
  --v2-on-night: #eef3fa;
  --v2-on-night-muted: #a9b7ca;
  --v2-on-night-faint: #8a98ac;
  --v2-sky: #82c3ff;

  --v2-radius-sm: 6px;
  --v2-radius: 8px;
  --v2-radius-lg: 12px;
  --v2-shadow-sm: 0 1px 2px rgba(14, 23, 38, .06);
  --v2-shadow: 0 1px 2px rgba(14, 23, 38, .05), 0 6px 16px rgba(14, 23, 38, .06);
  --v2-shadow-lg: 0 18px 48px rgba(14, 23, 38, .22);
  --v2-ease: cubic-bezier(.2, .7, .2, 1);
  --v2-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --v2-sidebar: 256px;
  --v2-topbar: 56px;
  --v2-panel: 340px;

  /* Legacy variables used across accounting-simulator-ui.css and case-practices.css. */
  --ground: var(--v2-bg);
  --surface: var(--v2-surface);
  --raised: var(--v2-sunken);
  --active: var(--v2-brand-soft);
  --border: var(--v2-border);
  --rule: #e8ecf1;
  --control: var(--v2-border-strong);
  --ink: var(--v2-ink);
  --muted: var(--v2-muted);
  --faint: var(--v2-faint);
  --primary: var(--v2-brand);
  --accent: var(--v2-brand);
  --positive: var(--v2-success);
  --negative: var(--v2-danger);
  --warning: var(--v2-warning);
  --radius-card: 10px;
  --radius-control: 6px;
  --sidebar-width: var(--v2-sidebar);
  --font: var(--v2-font);
  --heading-font: var(--v2-font);

  /* Tailwind theme variables used by utility classes in the markup. */
  --color-primary: var(--v2-brand);
  --color-on-primary: #ffffff;
  --color-primary-container: var(--v2-brand-soft);
  --color-on-primary-container: var(--v2-brand-ink);
  --color-secondary: var(--v2-learn);
  --color-secondary-container: var(--v2-learn-soft);
  --color-on-secondary-container: var(--v2-learn-ink);
  --color-success-container: var(--v2-success-soft);
  --color-on-success-container: var(--v2-success);
  --color-surface: var(--v2-bg);
  --color-surface-container: var(--v2-sunken);
  --color-surface-container-low: var(--v2-surface);
  --color-on-surface: var(--v2-ink);
  --color-on-surface-variant: var(--v2-muted);
  --color-outline: var(--v2-border-strong);
  --color-outline-variant: var(--v2-border);
  --color-tertiary: var(--v2-warning);
  --font-body: var(--v2-font);
  --font-display: var(--v2-font);
  --font-headline: var(--v2-font);
  --font-label: var(--v2-font);
  --font-title: var(--v2-font);
  --font-mono: var(--v2-font);
}

/* 2. Base ------------------------------------------------------------------ */
html, body { background: var(--v2-bg) !important; color: var(--v2-ink); }
html body { font-family: var(--v2-font) !important; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html body :where(h1, h2, h3, h4, button, input, select, textarea, label, p, li, td, th, caption, small, summary, span, div, a, kbd, code) { font-family: var(--v2-font) !important; }
html body .material-symbols-outlined { font-family: "Material Symbols Outlined" !important; font-weight: normal; font-style: normal; display: inline-block; width: 1em; height: 1em; overflow: hidden; line-height: 1; letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr; font-feature-settings: "liga"; flex-shrink: 0; vertical-align: middle; }
html body :where(.tabular-nums, .font-numeric, .num, td.r, th.r, .kpi-value, [id^="lab-"][id$="bank"], #lab-ar, #lab-ap, #lab-profit, #topic-bank, #topic-ar, #topic-ap, #topic-profit) { font-variant-numeric: tabular-nums; }
html body :focus-visible { outline: 2px solid var(--v2-brand) !important; outline-offset: 2px !important; }
html body #topic-shell #topic-top :focus-visible { outline-color: var(--v2-sky) !important; }
/* Keep a focused or scrolled-to element clear of the sticky top bar (WCAG 2.4.11). */
html:not(.embedded-simulator) { scroll-padding-top: 72px; }
html body #topic-shell #topic-title:focus, html body #topic-shell #hub-title:focus, html body #topic-shell #lab-stage:focus{ outline: none !important; }
html body #topic-shell #topic-title:focus-visible, html body #topic-shell #hub-title:focus-visible{ outline: none !important; box-shadow: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
html body kbd { white-space: nowrap; display: inline-flex; align-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--v2-border); border-bottom-width: 2px; border-radius: 4px; background: var(--v2-surface); color: var(--v2-muted); font: 500 11px/1 var(--v2-font) !important; }

/* Shared buttons */
html body .lab-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--v2-border-strong); border-radius: var(--v2-radius); background: var(--v2-surface); color: var(--v2-ink); font: 500 14px/1.2 var(--v2-font); cursor: pointer; transition: background-color .15s var(--v2-ease), border-color .15s var(--v2-ease), transform .1s var(--v2-ease), box-shadow .15s var(--v2-ease); }
html body .lab-button:hover { background: var(--v2-subtle); border-color: #aab4c2; }
html body .lab-button:active { transform: scale(.98); }
html body .lab-button .material-symbols-outlined { font-size: 18px; }
html body .lab-button-primary { border-color: var(--v2-brand); background: var(--v2-brand); color: #fff; }
html body .lab-button-primary:hover { border-color: var(--v2-brand-hover); background: var(--v2-brand-hover); }
html body .lab-button-danger { border-color: var(--v2-danger); background: var(--v2-danger); color: #fff; }
html body .lab-button-danger:hover { border-color: #8f1e18; background: #8f1e18; }
html body .lab-button-quiet { border-color: transparent; background: transparent; color: var(--v2-brand); }
html body .lab-button-quiet:hover { background: var(--v2-brand-soft); border-color: transparent; }

/* 3. Shell grid ------------------------------------------------------------ */
html body #topic-shell { display: grid !important; grid-template-columns: var(--v2-sidebar) minmax(0, 1fr) !important; grid-template-rows: auto minmax(0, 1fr) !important; min-height: 100svh; background: var(--v2-bg) !important; }
html.embedded-simulator body #topic-shell { min-height: 0 !important; grid-template-rows: auto auto !important; }

/* Sidebar */
html body #topic-shell #topic-top { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 0; z-index: 30; display: flex; flex-direction: column; gap: 18px; align-self: start; width: var(--v2-sidebar); height: 100svh; min-width: 0; padding: 20px 12px 14px !important; overflow-x: clip !important; overflow-y: auto; border: 0 !important; border-right: 1px solid var(--v2-night-line) !important; background: var(--v2-night) !important; color: var(--v2-on-night); scrollbar-width: thin; scrollbar-color: var(--v2-night-3) transparent; }
html.embedded-simulator body #topic-shell #topic-top { position: relative; align-self: stretch; height: auto; max-height: none; }
@media (min-width: 921px) {
  html.lab-follow-sidebar body #topic-shell #topic-top > * { transform: translateY(var(--v2-follow, 0px)); }
  html.lab-follow-sidebar body #topic-shell #topic-top .sidebar-foot { margin-top: 6px !important; }
}
html body #topic-shell #topic-top .hub-top-line{ display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 0 6px !important; margin: 0; }
html body #topic-shell #hub-brand{ display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--v2-on-night) !important; text-decoration: none; border-radius: var(--v2-radius); }
html body #topic-shell #hub-brand .brand-mark{ display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 9px; background: var(--v2-brand) !important; color: #fff !important; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
html body #topic-shell #hub-brand .brand-mark .material-symbols-outlined{ font-size: 20px; }
html body #topic-shell #hub-brand .brand-text{ display: flex; flex-direction: column; min-width: 0; }
html body #topic-shell #hub-brand .brand-text > span:first-child{ color: var(--v2-on-night) !important; font: 600 14px/19px var(--v2-font) !important; letter-spacing: -.005em; }
html body #topic-shell #hub-brand .brand-text > span:last-child{ color: var(--v2-on-night-muted) !important; font: 400 12px/17px var(--v2-font) !important; }
html body #topic-shell #topic-top .hub-top-tools{ display: none; }
html body #topic-shell #topic-top > nav{ flex: 0 0 auto; min-height: 0; width: 100%; max-height: none; overflow: visible !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
html body #topic-shell #topic-top .hub-topic-nav{ display: flex !important; flex-direction: column; gap: 2px; width: 100%; padding: 0 !important; margin: 0; overflow: visible !important; }
html body #topic-shell #topic-top .nav-group-label{ margin: 14px 10px 4px; color: var(--v2-on-night-faint); font: 500 12px/16px var(--v2-font) !important; letter-spacing: .01em; }
html body #topic-shell #topic-top .nav-group-label:first-child{ margin-top: 2px; }
html body #topic-shell #topic-top #topic-menu{ display: flex !important; flex-direction: column; gap: 2px; width: 100%; overflow: visible !important; }
html body #topic-shell #topic-top :is(#nav-all-topics, .nav-shell-item, #topic-menu button){ position: relative; display: flex !important; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-width: 0; min-height: 36px; padding: 7px 10px !important; border: 0 !important; border-radius: var(--v2-radius-sm) !important; background: transparent !important; color: var(--v2-on-night-muted) !important; font: 450 13px/18px var(--v2-font) !important; text-align: left; white-space: normal !important; cursor: pointer; transition: background-color .15s var(--v2-ease), color .15s var(--v2-ease); }
html body #topic-shell #topic-top :is(#nav-all-topics, .nav-shell-item, #topic-menu button) .material-symbols-outlined{ flex: 0 0 18px; width: 18px; height: 18px; color: var(--v2-on-night-faint); font-size: 18px; transition: color .15s var(--v2-ease); }
html body #topic-shell #topic-top :is(#nav-all-topics, .nav-shell-item, #topic-menu button):hover{ background: var(--v2-night-2) !important; color: var(--v2-on-night) !important; }
html body #topic-shell #topic-top :is(#nav-all-topics, .nav-shell-item, #topic-menu button):hover .material-symbols-outlined{ color: var(--v2-on-night-muted); }
html body #topic-shell #topic-top :is(#nav-all-topics, #topic-menu button)[aria-current="page"]{ background: var(--v2-night-3) !important; color: #fff !important; font-weight: 550 !important; }
html body #topic-shell #topic-top :is(#nav-all-topics, #topic-menu button)[aria-current="page"] .material-symbols-outlined{ color: var(--v2-sky); }
html body #topic-shell #topic-top :is(#nav-all-topics, #topic-menu button)[aria-current="page"]::before{ content: ""; position: absolute; inset: 9px auto 9px -12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--v2-sky); }
html body #topic-shell #topic-top #topic-menu button > span:last-child{ flex: 1 1 auto; min-width: 0; }
html body #topic-shell #topic-top #topic-menu button[data-done="true"]::after{ content: ""; flex: 0 0 8px; width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: #3fb57a; box-shadow: 0 0 0 3px rgba(63,181,122,.18); }
html body #topic-shell #topic-top .sidebar-foot{ display: flex; margin-top: auto !important; align-items: flex-start; gap: 8px; margin: 0; padding: 12px 10px 2px; border-top: 1px solid var(--v2-night-line); color: var(--v2-on-night-faint); font: 400 12px/17px var(--v2-font) !important; }
html body #topic-shell #topic-top .sidebar-foot .material-symbols-outlined{ font-size: 16px; margin-top: 1px; }

/* Top bar */
html body #topic-shell > header#lab-topbar { grid-column: 2; grid-row: 1; position: sticky; top: 0; z-index: 25; display: flex; flex-wrap: nowrap !important; align-items: center; gap: 12px; min-width: 0; min-height: var(--v2-topbar); padding: 8px clamp(16px, 2.4vw, 32px) !important; border: 0 !important; border-bottom: 1px solid var(--v2-border) !important; background: rgba(255,255,255,.94) !important; backdrop-filter: saturate(1.4) blur(8px); }
html.embedded-simulator body #topic-shell > header#lab-topbar { position: relative; background: #fff !important; backdrop-filter: none; }
html body #topic-shell #lab-breadcrumb{ flex: 1 1 auto; min-width: 0; }
html body #topic-shell #lab-breadcrumb ol{ display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; padding: 0; list-style: none; }
html body #topic-shell #lab-breadcrumb li{ display: flex; flex-shrink: 0; align-items: center; gap: 6px; min-width: 0; color: var(--v2-muted); font: 400 13px/18px var(--v2-font); white-space: nowrap; }
html body #topic-shell #lab-breadcrumb li + li::before{ content: "/"; margin-right: 6px; color: #a3adbb; }
html body #topic-shell #lab-breadcrumb li[hidden]{ display: none; }
html body #topic-shell #lab-breadcrumb #crumb-current{ display: block; flex-shrink: 1; overflow: hidden; color: var(--v2-ink); font-weight: 550; text-overflow: ellipsis; }
html body #topic-shell #lab-breadcrumb a{ color: var(--v2-muted); text-decoration: none; border-radius: 4px; }
html body #topic-shell #lab-breadcrumb a:hover{ color: var(--v2-brand); text-decoration: underline; text-underline-offset: 3px; }
html body #topic-shell #lab-search{ display: flex; align-items: center; gap: 8px; flex: 0 1 260px; min-width: 150px; height: 38px !important; min-height: 38px !important; padding: 0 8px 0 10px !important; border: 1px solid var(--v2-border); border-radius: var(--v2-radius); background: var(--v2-subtle); color: var(--v2-faint); font: 400 13px/1 var(--v2-font); cursor: pointer; transition: border-color .15s var(--v2-ease), background-color .15s var(--v2-ease); }
html body #topic-shell #lab-search:hover{ border-color: var(--v2-border-strong); background: #fff; }
html body #topic-shell #lab-search .material-symbols-outlined{ font-size: 18px; }
html body #topic-shell #lab-search .lab-search-label{ flex: 1 1 auto; min-width: 0; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
html body #topic-shell .lab-topbar-actions{ display: flex; flex-wrap: nowrap !important; align-items: center; gap: 6px; flex: 0 0 auto; }
html body #topic-shell .lab-topbar-actions > button{ box-shadow: none !important; display: inline-flex; align-items: center; gap: 6px; min-height: 38px !important; height: 38px; padding: 0 10px !important; border: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius) !important; background: #fff !important; color: var(--v2-ink-2) !important; font: 500 13px/1 var(--v2-font) !important; white-space: nowrap; cursor: pointer; transition: background-color .15s var(--v2-ease), border-color .15s var(--v2-ease), transform .1s var(--v2-ease); }
html body #topic-shell .lab-topbar-actions > button:hover{ border-color: var(--v2-border-strong) !important; background: var(--v2-subtle) !important; }
html body #topic-shell .lab-topbar-actions > button:active{ transform: scale(.97); }
html body #topic-shell .lab-topbar-actions > button .material-symbols-outlined{ font-size: 18px; color: var(--v2-muted); }
html body #topic-shell .lab-topbar-actions > button[hidden]{ display: none !important; }
html body #topic-shell #lab-panel-toggle[aria-expanded="true"]{ border-color: var(--v2-learn-border) !important; background: var(--v2-learn-soft) !important; color: var(--v2-learn-ink) !important; }
html body #topic-shell #lab-panel-toggle[aria-expanded="true"] .material-symbols-outlined{ color: var(--v2-learn); }
html body #topic-shell #hub-reset:hover{ border-color: #e3b5b1 !important; background: var(--v2-danger-soft) !important; color: var(--v2-danger) !important; }
html body #topic-shell #hub-reset:hover .material-symbols-outlined{ color: var(--v2-danger); }
html body #topic-shell .lab-mode-badge{ display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border: 1px solid var(--v2-learn-border); border-radius: 999px; background: var(--v2-learn-soft); color: var(--v2-learn-ink); font: 500 12px/1 var(--v2-font); white-space: nowrap; }
html body #topic-shell .lab-topbar-progress{ display: inline-flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 84px; padding: 0 4px; color: var(--v2-muted); font: 400 12px/1 var(--v2-font); }
html body #topic-shell .lab-topbar-progress-text{ white-space: nowrap; }
html body #topic-shell .lab-topbar-progress-text b{ color: var(--v2-ink); font-weight: 600; }
html body #topic-shell .lab-topbar-progress-track{ display: block; height: 4px; overflow: hidden; border-radius: 4px; background: var(--v2-sunken); }
html body #topic-shell #lab-progress-fill{ display: block; width: 0; height: 100%; border-radius: inherit; background: var(--v2-learn); transition: width .5s var(--v2-ease); }
/* Session file opener inserted before #hub-reset by practice-session-file.js. */
html body #topic-shell .lab-topbar-actions > :not(button):not(span){ display: inline-flex; }
html body #topic-shell .lab-topbar-actions .session-file-open, html body #topic-shell .lab-topbar-actions [class*="session-file"] button{ min-height: 36px; }

/* Main columns */
html body #topic-shell > main#hub-landing, html body #topic-shell > main#topic-detail { grid-column: 2 !important; grid-row: 2 !important; width: 100% !important; max-width: 1560px !important; min-width: 0; margin: 0 auto !important; padding: 28px clamp(16px, 2.4vw, 32px) 56px !important; }
html body #topic-shell > main#hub-landing { display: flex !important; flex-direction: column; gap: 24px !important; }
html body #topic-shell > main[hidden] { display: none !important; }
html body > footer { margin: 0; padding: 18px clamp(16px, 2.4vw, 32px) 26px; border-top: 1px solid var(--v2-border); background: var(--v2-bg); color: var(--v2-faint); font: 400 12px/1.5 var(--v2-font) !important; text-align: left; }
@media (min-width: 921px) { html body > footer { margin-left: var(--v2-sidebar); } }

/* 4. Dashboard ------------------------------------------------------------- */
html body #topic-shell #hub-landing .dash-head{ display: flex !important; align-items: flex-end !important; justify-content: space-between; gap: 24px !important; padding: 4px 0 22px !important; border: 0 !important; border-bottom: 1px solid var(--v2-border) !important; border-radius: 0 !important; background: transparent !important; }
html body #topic-shell #hub-landing .dash-head-copy{ display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 760px; }
html body #topic-shell #hub-landing #hub-title{ margin: 0; color: var(--v2-ink) !important; font: 650 28px/1.2 var(--v2-font) !important; letter-spacing: -.022em !important; text-wrap: balance; }
html body #topic-shell #hub-landing .dash-company{ margin: 0; color: var(--v2-ink-2) !important; font: 500 13px/1.4 var(--v2-font) !important; }
html body #topic-shell #hub-landing .dash-intro{ margin: 2px 0 0; max-width: 68ch; color: var(--v2-muted) !important; font: 400 14px/1.55 var(--v2-font) !important; }
html body #topic-shell #hub-landing .dash-head-actions{ display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: 0 0 auto; }
html body #topic-shell #hub-landing #hub-start, html body #topic-shell #hub-landing #hub-case-start{ min-height: 40px !important; padding: 0 14px !important; border-radius: var(--v2-radius) !important; font: 500 14px/1.2 var(--v2-font) !important; }
html body #topic-shell #hub-landing #hub-start{ border: 1px solid var(--v2-border-strong) !important; background: #fff !important; color: var(--v2-ink) !important; }
html body #topic-shell #hub-landing #hub-start:hover{ background: var(--v2-subtle) !important; }
html body #topic-shell #hub-landing #hub-case-start{ border: 1px solid var(--v2-brand) !important; background: var(--v2-brand) !important; color: #fff !important; }
html body #topic-shell #hub-landing #hub-case-start:hover{ background: var(--v2-brand-hover) !important; }

html body #topic-shell .dash-kpis{ display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
html body #topic-shell .dash-kpis .kpi{ display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px 13px; border: 1px solid var(--v2-border); border-radius: var(--v2-radius-lg); background: var(--v2-surface); box-shadow: var(--v2-shadow-sm); }
html body #topic-shell .dash-kpis .kpi-label{ color: var(--v2-muted); font: 500 12px/16px var(--v2-font); }
html body #topic-shell .dash-kpis .kpi-value{ overflow: hidden; color: var(--v2-ink) !important; font: 600 22px/1.25 var(--v2-font) !important; letter-spacing: -.015em; text-overflow: ellipsis; white-space: nowrap; transition: color .3s var(--v2-ease); }
html body #topic-shell .dash-kpis .kpi-value.is-negative{ color: var(--v2-danger) !important; }
html body #topic-shell .dash-kpis .kpi-value.is-changed{ animation: v2-value-flash 1.2s var(--v2-ease); }
html body #topic-shell .dash-kpis .kpi-note{ color: var(--v2-faint); font: 400 12px/16px var(--v2-font); }
@keyframes v2-value-flash { 0% { background: var(--v2-learn-soft); } 100% { background: transparent; } }

html body #topic-shell .dash-grid{ display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
html body #topic-shell .dash-card{ display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 18px 20px 20px; border: 1px solid var(--v2-border); border-radius: var(--v2-radius-lg); background: var(--v2-surface); box-shadow: var(--v2-shadow-sm); }
html body #topic-shell .dash-pl{ grid-column: span 7; }
html body #topic-shell .dash-position{ grid-column: span 5; }
html body #topic-shell .dash-learning{ grid-column: span 4; }
html body #topic-shell .dash-actions{ grid-column: span 4; }
html body #topic-shell .dash-recent{ grid-column: span 4; }
html body #topic-shell .dash-card-head{ display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
html body #topic-shell #hub-landing .dash-card h2{ margin: 0; color: var(--v2-ink) !important; font: 600 15px/1.35 var(--v2-font) !important; letter-spacing: -.005em; }
html body #topic-shell .dash-card-meta{ color: var(--v2-faint); font: 400 12px/16px var(--v2-font); text-align: right; }

/* Bar charts */
html body #topic-shell .v2-bars{ display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
html body #topic-shell .v2-bar{ display: grid; grid-template-columns: minmax(84px, 128px) minmax(0, 1fr) auto; align-items: center; gap: 12px; }
html body #topic-shell .v2-bar-label{ color: var(--v2-ink-2); font: 500 13px/1.3 var(--v2-font); }
html body #topic-shell .v2-bar-label small{ display: block; color: var(--v2-faint); font: 400 12px/1.3 var(--v2-font); }
html body #topic-shell .v2-bar-track{ position: relative; height: 12px; overflow: hidden; border-radius: 6px; background: var(--v2-sunken); }
html body #topic-shell .v2-bar-fill{ position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); border-radius: inherit; background: var(--c, var(--v2-brand)); transform-origin: left; animation: v2-grow .6s var(--v2-ease) both; }
html body #topic-shell .v2-bar-value{ min-width: 88px; color: var(--v2-ink); font: 600 13px/1.3 var(--v2-font); font-variant-numeric: tabular-nums; text-align: right; }
@keyframes v2-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
html body #topic-shell .v2-bars-sub{ padding-top: 12px; border-top: 1px dashed var(--v2-border); }
html body #topic-shell .v2-bars-sub .v2-bar-track{ height: 8px; }
html body #topic-shell .v2-bars-sub .v2-bar-value{ font-weight: 500; color: var(--v2-ink-2); }
html body #topic-shell .v2-chart-foot{ display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0; color: var(--v2-muted); font: 400 12px/1.45 var(--v2-font); }
html body #topic-shell .v2-chart-foot b{ color: var(--v2-ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Stacked position bars */
html body #topic-shell .v2-stack-row{ display: grid; gap: 6px; }
html body #topic-shell .v2-stack-row + .v2-stack-row{ margin-top: 14px; }
html body #topic-shell .v2-stack-head{ display: flex; justify-content: space-between; gap: 8px; color: var(--v2-ink-2); font: 500 13px/1.3 var(--v2-font); }
html body #topic-shell .v2-stack-head b{ color: var(--v2-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
html body #topic-shell .v2-stack{ display: flex; height: 14px; overflow: hidden; border-radius: 7px; background: var(--v2-sunken); gap: 2px; }
html body #topic-shell .v2-stack > span{ display: block; flex: 0 0 var(--w); min-width: 3px; background: var(--c); animation: v2-grow .6s var(--v2-ease) both; transform-origin: left; }
html body #topic-shell .v2-legend{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 4px 0 0; padding: 0; list-style: none; }
html body #topic-shell .v2-legend li{ display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--v2-muted); font: 400 12px/1.4 var(--v2-font); }
html body #topic-shell .v2-legend li i{ flex: 0 0 10px; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
html body #topic-shell .v2-legend li span{ flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body #topic-shell .v2-legend li b{ color: var(--v2-ink); font-weight: 500; font-variant-numeric: tabular-nums; }
html body #topic-shell .v2-check{ display: flex; align-items: center; gap: 8px; margin: 2px 0 0; padding: 9px 12px; border-radius: var(--v2-radius); background: var(--v2-success-soft); color: var(--v2-success); font: 500 12px/1.4 var(--v2-font); }
html body #topic-shell .v2-check.is-off{ background: var(--v2-warning-soft); color: var(--v2-warning); }
html body #topic-shell .v2-check .material-symbols-outlined{ font-size: 18px; }

/* Empty states */
html body #topic-shell .v2-empty{ display: grid; justify-items: start; gap: 6px; padding: 18px; border: 1px dashed var(--v2-border-strong); border-radius: var(--v2-radius); background: var(--v2-subtle); }
html body #topic-shell .v2-empty .material-symbols-outlined{ color: var(--v2-faint); font-size: 22px; }
html body #topic-shell .v2-empty strong{ color: var(--v2-ink); font: 600 14px/1.35 var(--v2-font); }
html body #topic-shell .v2-empty p{ margin: 0; max-width: 52ch; color: var(--v2-muted); font: 400 13px/1.5 var(--v2-font); }
html body #topic-shell .v2-empty .lab-button{ margin-top: 6px; min-height: 36px; font-size: 13px; }

/* Learning card */
html body #topic-shell .v2-learn-meter{ display: grid; gap: 8px; }
html body #topic-shell .v2-learn-meter-top{ display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
html body #topic-shell .v2-learn-meter-top strong{ color: var(--v2-ink); font: 650 26px/1 var(--v2-font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
html body #topic-shell .v2-learn-meter-top span{ color: var(--v2-muted); font: 400 12px/1.3 var(--v2-font); }
html body #topic-shell .v2-track{ height: 8px; overflow: hidden; border-radius: 4px; background: var(--v2-sunken); }
html body #topic-shell .v2-track > span{ display: block; width: var(--w, 0%); height: 100%; border-radius: inherit; background: var(--v2-learn); transition: width .6s var(--v2-ease); }
html body #topic-shell .v2-next{ display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--v2-learn-border); border-radius: var(--v2-radius); background: var(--v2-learn-soft); }
html body #topic-shell .v2-next small{ color: var(--v2-learn-ink); font: 500 12px/1.3 var(--v2-font); }
html body #topic-shell .v2-next strong{ color: var(--v2-ink); font: 600 14px/1.35 var(--v2-font); }
html body #topic-shell .v2-next p{ margin: 0; color: var(--v2-muted); font: 400 12px/1.45 var(--v2-font); }
html body #topic-shell .v2-learn-actions{ display: flex; flex-wrap: wrap; gap: 8px; }
html body #topic-shell .v2-learn-actions .lab-button{ min-height: 36px; font-size: 13px; }
html body .lab-button-learn { border-color: var(--v2-learn); background: var(--v2-learn); color: #fff; }
html body .lab-button-learn:hover { border-color: var(--v2-learn-ink); background: var(--v2-learn-ink); }

/* Quick actions */
html body #topic-shell .dash-quick{ display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
html body #topic-shell .dash-quick button{ display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 48px; padding: 7px 10px; border: 1px solid var(--v2-border); border-radius: var(--v2-radius); background: #fff; color: var(--v2-ink); text-align: left; cursor: pointer; transition: border-color .15s var(--v2-ease), background-color .15s var(--v2-ease), transform .1s var(--v2-ease); }
html body #topic-shell .dash-quick button:hover{ border-color: #9fb4cc; background: var(--v2-subtle); }
html body #topic-shell .dash-quick button:active{ transform: scale(.98); }
html body #topic-shell .dash-quick button > .material-symbols-outlined{ display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--v2-brand-soft); color: var(--v2-brand); font-size: 18px; line-height: 32px; text-align: center; }
html body #topic-shell .dash-quick button b{ display: block; color: var(--v2-ink); font: 550 13px/1.3 var(--v2-font); }
html body #topic-shell .dash-quick button small{ display: block; color: var(--v2-faint); font: 400 12px/1.3 var(--v2-font); }

/* Recent journals */
html body #topic-shell .v2-table{ width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
html body #topic-shell .v2-table th{ padding: 0 8px 8px 0; border-bottom: 1px solid var(--v2-border); color: var(--v2-faint); font: 500 12px/1.3 var(--v2-font); text-align: left; }
html body #topic-shell .v2-table td{ padding: 9px 8px 9px 0; border-bottom: 1px solid #edf0f4; color: var(--v2-ink-2); font: 400 13px/1.35 var(--v2-font); vertical-align: top; }
html body #topic-shell .v2-table tr:last-child td{ border-bottom: 0; }
html body #topic-shell .v2-table .num{ text-align: right; padding-right: 0; white-space: nowrap; }
html body #topic-shell .v2-table td:first-child{ color: var(--v2-faint); white-space: nowrap; }
html body #topic-shell .v2-link{ display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--v2-brand); font: 500 13px/1.3 var(--v2-font); cursor: pointer; }
html body #topic-shell .v2-link:hover{ text-decoration: underline; text-underline-offset: 3px; }
html body #topic-shell .v2-link .material-symbols-outlined{ font-size: 16px; }

/* Learning path */
html body #topic-shell .dash-section-head{ display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--v2-border); }
html body #topic-shell #hub-landing .dash-section-head h2{ margin: 0; color: var(--v2-ink) !important; font: 600 18px/1.3 var(--v2-font) !important; letter-spacing: -.01em; }
html body #topic-shell #hub-landing .dash-section-head p{ margin: 4px 0 0; max-width: 72ch; color: var(--v2-muted) !important; font: 400 13px/1.5 var(--v2-font) !important; }
html body #topic-shell #hub-landing .dash-section-head .lesson-format{ margin: 0; color: var(--v2-faint) !important; font: 400 12px/1.4 var(--v2-font) !important; white-space: nowrap; }
html body #topic-shell .dash-path, html body #topic-shell .dash-cases{ display: flex; flex-direction: column; gap: 16px; min-width: 0; }
html body #topic-shell .dash-cases[hidden]{ display: none !important; }
html body #topic-shell #hub-landing #hub-cards{ display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; border: 0 !important; }
html body #topic-shell #hub-cards .path-stage{ grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; margin: 10px 0 0; color: var(--v2-ink); font: 600 14px/1.3 var(--v2-font); }
html body #topic-shell #hub-cards .path-stage:first-child{ margin-top: 0; }
html body #topic-shell #hub-cards .path-stage span{ color: var(--v2-faint); font: 400 12px/1.3 var(--v2-font); }
html body #topic-shell #hub-landing #hub-cards > article{ position: relative; display: flex !important; flex-direction: column; gap: 10px; min-height: 0; height: auto !important; padding: 16px !important; border: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius-lg) !important; background: #fff !important; box-shadow: var(--v2-shadow-sm) !important; cursor: pointer; transition: border-color .15s var(--v2-ease), box-shadow .2s var(--v2-ease), transform .2s var(--v2-ease); }
html body #topic-shell #hub-landing #hub-cards > article:hover{ border-color: #9fb4cc !important; box-shadow: var(--v2-shadow) !important; transform: translateY(-1px); }
html body #topic-shell #hub-landing #hub-cards > article > div:first-child{ display: flex !important; flex-direction: column; gap: 6px; }
html body #topic-shell #hub-landing #hub-cards > article header{ display: flex !important; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 2px; }
html body #topic-shell #hub-landing #hub-cards > article header > div{ display: grid !important; place-items: center; width: 34px !important; height: 34px !important; border-radius: 9px !important; background: var(--v2-brand-soft) !important; color: var(--v2-brand) !important; }
html body #topic-shell #hub-landing #hub-cards > article header > div .material-symbols-outlined{ font-size: 19px !important; }
html body #topic-shell #hub-landing #hub-cards .topic-status{ position: static !important; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px !important; border-radius: 999px !important; background: var(--v2-sunken) !important; color: var(--v2-muted) !important; font: 500 12px/1 var(--v2-font) !important; }
html body #topic-shell #hub-landing #hub-cards .topic-status[class*="bg-success-container"]{ background: var(--v2-success-soft) !important; color: var(--v2-success) !important; }
html body #topic-shell #hub-landing #hub-cards .topic-status .material-symbols-outlined{ font-size: 14px !important; }
html body #topic-shell #hub-landing #hub-cards > article h3{ margin: 0; color: var(--v2-ink) !important; font: 600 14px/1.35 var(--v2-font) !important; }
html body #topic-shell #hub-landing #hub-cards > article p{ margin: 0; color: var(--v2-muted) !important; font: 400 13px/1.5 var(--v2-font) !important; }
html body #topic-shell #hub-landing #hub-cards > article > div:first-child > div:last-child{ display: flex !important; flex-wrap: wrap; gap: 12px; padding-top: 2px !important; color: var(--v2-faint) !important; font: 400 12px/1.3 var(--v2-font) !important; }
html body #topic-shell #hub-landing #hub-cards > article > div:first-child > div:last-child .material-symbols-outlined{ font-size: 15px !important; }
html body #topic-shell #hub-landing #hub-cards > article > footer{ position: static !important; margin-top: auto; padding: 10px 0 0 !important; border: 0 !important; border-top: 1px solid #edf0f4 !important; transform: none !important; }
html body #topic-shell #hub-landing #hub-cards > article > footer button{ display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 !important; border: 0 !important; background: none !important; color: var(--v2-brand) !important; font: 550 13px/1.2 var(--v2-font) !important; }
html body #topic-shell #hub-landing #hub-cards > article > footer button .material-symbols-outlined{ font-size: 16px !important; transition: transform .2s var(--v2-ease); }
html body #topic-shell #hub-landing #hub-cards > article:hover > footer button .material-symbols-outlined{ transform: translateX(2px); }
html body #topic-shell #hub-landing #hub-cards > article .path-num{ color: var(--v2-faint); font: 500 12px/1 var(--v2-font); font-variant-numeric: tabular-nums; }

/* Practice-case bank inside the dashboard */
html body #topic-shell #dash-cases-slot .case-practice-bank{ margin: 0 !important; }

/* Practice-case bank (rendered by case-practices.js) */
html body #topic-shell #dash-cases-slot #case-practice-bank { margin: 0 !important; padding: 0 !important; border: 0 !important; }
html body #topic-shell #dash-cases-slot #case-practice-bank > p { margin: 0 0 14px; max-width: 72ch; color: var(--v2-muted) !important; font: 400 13px/1.55 var(--v2-font) !important; }
html body #topic-shell #dash-cases-slot .case-progress-summary { display: flex; align-items: center; gap: 16px; margin: 0 0 16px !important; padding: 14px 16px !important; border: 1px solid var(--v2-learn-border) !important; border-radius: var(--v2-radius-lg); background: var(--v2-learn-soft); }
html body #topic-shell #dash-cases-slot #case-practice-bank.is-case-active .case-progress-summary { display: none !important; }
html body #topic-shell #dash-cases-slot .case-progress-summary p { color: var(--v2-ink-2) !important; font: 400 13px/1.5 var(--v2-font) !important; }
html body #topic-shell #dash-cases-slot .case-progress-summary strong { color: var(--v2-ink); font-weight: 600; }
html body #topic-shell #dash-cases-slot .case-practice-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)) !important; gap: 12px !important; margin-top: 0 !important; }
html body #topic-shell #dash-cases-slot .case-practice-card { gap: 8px !important; padding: 16px !important; border: 1px solid var(--v2-border) !important; border-top: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius-lg) !important; background: #fff !important; box-shadow: var(--v2-shadow-sm) !important; transition: border-color .15s var(--v2-ease), box-shadow .2s var(--v2-ease) !important; }
html body #topic-shell #dash-cases-slot .case-practice-card:hover { border-color: #9fb4cc !important; box-shadow: var(--v2-shadow) !important; }
html body #topic-shell #dash-cases-slot .case-practice-card .case-meta { order: -1; margin: 0 !important; color: var(--v2-faint) !important; font: 500 12px/1.4 var(--v2-font) !important; letter-spacing: 0 !important; text-transform: none !important; }
html body #topic-shell #dash-cases-slot .case-practice-card h3 { color: var(--v2-ink) !important; font: 600 15px/1.35 var(--v2-font) !important; }
html body #topic-shell #dash-cases-slot .case-practice-card p { flex: 1 1 auto; color: var(--v2-muted) !important; font: 400 13px/1.5 var(--v2-font) !important; }
html body #topic-shell #dash-cases-slot :is(.case-practice-card button, .case-practice-action) { min-height: 36px !important; margin-top: 4px; padding: 0 14px !important; border: 1px solid var(--v2-brand) !important; border-radius: var(--v2-radius) !important; background: var(--v2-brand) !important; color: #fff !important; font: 500 13px/1.2 var(--v2-font) !important; box-shadow: none !important; transition: background-color .15s var(--v2-ease), transform .1s var(--v2-ease) !important; }
html body #topic-shell #dash-cases-slot .case-practice-card button { border-color: var(--v2-border-strong) !important; background: #fff !important; color: var(--v2-brand) !important; }
html body #topic-shell #dash-cases-slot .case-practice-card button:hover { border-color: var(--v2-brand) !important; background: var(--v2-brand-soft) !important; }
html body #topic-shell #dash-cases-slot .case-practice-action:hover { background: var(--v2-brand-hover) !important; }
html body #topic-shell #dash-cases-slot :is(.case-practice-card button, .case-practice-action):active { transform: scale(.98); }
html body #topic-shell #dash-cases-slot :is(#case-practice-work, .case-focus-bar) { border-radius: var(--v2-radius-lg); }

/* 5. Topic workspace ------------------------------------------------------- */
html body #topic-shell #topic-detail > div:first-child{ display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 0 18px !important; padding: 0 0 18px !important; border-bottom: 1px solid var(--v2-border) !important; }
html body #topic-shell #topic-detail > div:first-child > div{ display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
html body #topic-shell #topic-detail > div:first-child > div > span:first-child{ display: grid !important; place-items: center; flex: 0 0 44px; width: 44px !important; height: 44px !important; border-radius: 11px !important; background: var(--v2-brand-soft) !important; color: var(--v2-brand) !important; }
html body #topic-shell #topic-icon{ display: inline-block !important; color: var(--v2-brand) !important; font-size: 22px !important; }
html body #topic-shell #topic-eyebrow{ display: block; color: var(--v2-muted) !important; font: 500 13px/1.4 var(--v2-font) !important; text-transform: none !important; letter-spacing: 0 !important; }
html body #topic-shell #topic-title{ margin: 2px 0 0 !important; color: var(--v2-ink) !important; font: 650 24px/1.25 var(--v2-font) !important; letter-spacing: -.02em !important; }
html body #topic-shell #topic-subtitle{ margin: 6px 0 0 !important; max-width: 72ch; color: var(--v2-muted) !important; font: 400 14px/1.55 var(--v2-font) !important; }
html body #topic-shell #hub-back{ display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; min-height: 36px; padding: 0 12px !important; border: 1px solid var(--v2-border-strong) !important; border-radius: var(--v2-radius) !important; background: #fff !important; color: var(--v2-ink) !important; font: 500 13px/1 var(--v2-font) !important; }
html body #topic-shell #hub-back:hover{ background: var(--v2-subtle) !important; }
html body #topic-shell #hub-back .material-symbols-outlined{ font-size: 16px !important; }

/* Process flow chips */
html body #topic-shell #topic-flow{ display: flex; flex-wrap: wrap; align-items: center; gap: 6px !important; min-height: 0; margin: 0 0 4px !important; }
html body #topic-shell #topic-flow > span:not(.material-symbols-outlined){ display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px !important; border: 1px solid var(--v2-border) !important; border-radius: 999px !important; background: #fff !important; color: var(--v2-ink-2) !important; font: 500 12px/1.3 var(--v2-font) !important; }
html body #topic-shell #topic-flow > .material-symbols-outlined{ color: #a3adbb !important; font-size: 16px !important; }

/* Workspace + learning panel */
html body #topic-shell #topic-detail > .grid{ display: grid !important; grid-template-columns: minmax(0, 1fr) var(--v2-panel) !important; align-items: start !important; gap: 20px !important; }
html body #topic-shell #topic-detail > .grid > *{ grid-column: auto !important; }
html body #topic-shell #topic-detail > .grid > section{ display: flex; flex-direction: column; gap: 14px !important; min-width: 0; }
html body #topic-shell.panel-collapsed #topic-detail > .grid { grid-template-columns: minmax(0, 1fr) !important; }
html body #topic-shell.panel-collapsed #topic-learning-panel { display: none !important; }
html body #topic-shell #topic-learning-panel{ display: flex !important; flex-direction: column; gap: 12px !important; min-width: 0; }
html:not(.embedded-simulator) body #topic-shell #topic-learning-panel{ position: sticky; top: calc(var(--v2-topbar) + 16px); max-height: calc(100svh - var(--v2-topbar) - 32px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 2px; }
html body #topic-shell #topic-detail #topic-learning-panel > section{ display: flex !important; flex-direction: column; gap: 8px !important; padding: 16px !important; border: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius-lg) !important; background: #fff !important; box-shadow: var(--v2-shadow-sm); }
html body #topic-shell #topic-detail #topic-learning-panel > section:first-child{ border-color: var(--v2-learn-border) !important; background: var(--v2-learn-soft) !important; box-shadow: none; }
html body #topic-shell #topic-detail #topic-learning-panel > section:first-child > div:first-child{ color: var(--v2-learn-ink) !important; font: 600 12px/1.3 var(--v2-font) !important; }
html body #topic-shell #topic-detail #topic-learning-panel > section:first-child > div:first-child :is(span, b){ color: var(--v2-learn-ink) !important; }
html body #topic-shell #topic-detail #topic-learning-panel > section:first-child .material-symbols-outlined{ color: var(--v2-learn) !important; }
html body #topic-shell #topic-detail #topic-learning-panel h2{ margin: 0; color: var(--v2-ink) !important; font: 600 15px/1.4 var(--v2-font) !important; }
html body #topic-shell #topic-detail #topic-learning-panel p{ color: var(--v2-ink-2) !important; font-size: 13px !important; line-height: 1.55 !important; }
html body #topic-shell #topic-detail #topic-learning-panel #guide-why{ color: var(--v2-muted) !important; }
html body #topic-shell #topic-detail #topic-learning-panel button{ min-height: 36px; padding: 0 12px; border: 1px solid var(--v2-border-strong); border-radius: var(--v2-radius); background: #fff; color: var(--v2-ink); font: 500 13px/1.2 var(--v2-font); cursor: pointer; transition: background-color .15s var(--v2-ease), border-color .15s var(--v2-ease), transform .1s var(--v2-ease); }
html body #topic-shell #topic-detail #topic-learning-panel button:hover{ background: var(--v2-subtle); }
html body #topic-shell #topic-detail #topic-learning-panel button:active{ transform: scale(.98); }
html body #topic-shell #topic-detail #topic-learning-panel #guide-next{ border-color: var(--v2-learn) !important; background: var(--v2-learn) !important; color: #fff !important; }
html body #topic-shell #topic-detail #topic-learning-panel #guide-next:hover{ background: var(--v2-learn-ink) !important; }
html body #topic-shell #topic-detail #topic-learning-panel #guide-next:disabled, html body #topic-shell #topic-detail #topic-learning-panel #guide-prev:disabled{ opacity: .45; cursor: not-allowed; }
html body #topic-shell #topic-detail #topic-learning-panel #topic-trivia > div:first-child{ color: var(--v2-warning) !important; font: 600 12px/1.3 var(--v2-font) !important; }
html body #topic-shell #topic-detail #topic-learning-panel #topic-trivia > div:first-child :is(span){ color: var(--v2-warning) !important; }
html body #topic-shell #topic-detail #topic-learning-panel #trivia-options{ display: flex; flex-direction: column; gap: 6px; }
html body #topic-shell #topic-detail #topic-learning-panel #trivia-options button{ justify-content: flex-start; width: 100%; min-height: 40px; padding: 8px 12px; text-align: left; white-space: normal; line-height: 1.4; }
html body #topic-shell #topic-detail #topic-learning-panel #trivia-options button[aria-pressed="true"], html body #topic-shell #topic-detail #topic-learning-panel #trivia-options button.correct, html body #topic-shell #topic-detail #topic-learning-panel #trivia-options button[class*="success"]{ border-color: var(--v2-success) !important; background: var(--v2-success-soft) !important; color: var(--v2-success) !important; }
html body #topic-shell #topic-detail #topic-learning-panel #trivia-feedback{ font-size: 13px !important; }
html body #topic-shell #topic-detail #topic-learning-panel > section:last-child .grid > div{ padding: 10px !important; border-radius: var(--v2-radius) !important; background: var(--v2-subtle) !important; border: 1px solid #edf0f4; }
html body #topic-shell #topic-detail #topic-learning-panel > section:last-child .grid > div > span:last-child{ color: var(--v2-ink) !important; font: 600 15px/1.3 var(--v2-font) !important; font-variant-numeric: tabular-nums; }
html body #topic-shell #topic-detail #topic-learning-panel > section:last-child .grid > div > span:first-child{ color: var(--v2-muted) !important; font: 400 12px/1.3 var(--v2-font) !important; }
html body #topic-shell #topic-detail #topic-learning-panel > section:last-child > div:first-child > span:first-child{ color: var(--v2-ink) !important; font: 600 14px/1.3 var(--v2-font) !important; }
html body #topic-shell #topic-completion-gate{ border-radius: var(--v2-radius) !important; border-color: var(--v2-learn-border) !important; background: #fff !important; }

html body #topic-shell #topic-completion-gate{ display: flex !important; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px !important; border: 1px solid var(--v2-learn-border) !important; border-left-width: 1px !important; box-shadow: none !important; }
html body #topic-shell #topic-completion-gate .topic-completion-state{ color: var(--v2-learn-ink) !important; font: 600 12px/1.3 var(--v2-font) !important; letter-spacing: 0 !important; text-transform: none !important; }
html body #topic-shell #topic-completion-gate #topic-completion-copy{ color: var(--v2-ink-2) !important; font: 400 13px/1.5 var(--v2-font) !important; }
html body #topic-shell #topic-completion-gate .topic-completion-open{ min-height: 36px !important; padding: 0 12px !important; border: 1px solid var(--v2-learn) !important; border-radius: var(--v2-radius) !important; background: var(--v2-learn) !important; color: #fff !important; font: 500 13px/1.2 var(--v2-font) !important; box-shadow: none !important; }
html body #topic-shell #topic-completion-gate .topic-completion-open:hover{ background: var(--v2-learn-ink) !important; }
html body #topic-shell #topic-completion-gate .topic-completion-secondary{ border-color: var(--v2-border-strong) !important; background: #fff !important; color: var(--v2-ink) !important; }
html body #topic-shell #topic-completion-gate .topic-completion-open[hidden]{ display: none !important; }
html body #topic-shell #topic-detail #topic-learning-panel #guide-prev{ border: 1px solid var(--v2-border-strong) !important; background: #fff !important; color: var(--v2-ink) !important; box-shadow: none !important; }
html body #topic-shell #topic-detail #topic-learning-panel #guide-next{ box-shadow: none !important; }

/* Lab stage (workspace screens) */
html body #topic-shell #topic-app #practice-lab .lab-stage{ padding: 24px !important; border: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius-lg) !important; background: #fff !important; box-shadow: var(--v2-shadow-sm); }
html body #topic-shell #topic-app #practice-lab .lab-stage :where(h2){ color: var(--v2-ink) !important; font: 650 19px/1.3 var(--v2-font) !important; letter-spacing: -.012em !important; }
html body #topic-shell #topic-app #practice-lab .lab-stage :where(h3, h4){ color: var(--v2-ink) !important; font: 600 15px/1.35 var(--v2-font) !important; letter-spacing: 0 !important; }
html body #topic-shell #topic-app #practice-lab .lab-stage :where(p, li){ color: var(--v2-ink-2); font-size: 14px; line-height: 1.55; }
html body #topic-shell #topic-app #practice-lab .lab-stage .lab-form{ gap: 16px 18px !important; }
html body #topic-shell #topic-app #practice-lab .lab-stage .lab-field{ display: flex; flex-direction: column; gap: 6px; }
html body #topic-shell #topic-app #practice-lab .lab-stage .lab-field label{ color: var(--v2-ink) !important; font: 550 13px/1.35 var(--v2-font) !important; }
html body #topic-shell #topic-app #practice-lab .lab-stage .lab-field :where(input, select, textarea), html body #topic-shell #practice-lab .lab-stage :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea){ min-height: 40px; padding: 8px 11px !important; border: 1px solid var(--v2-border-strong) !important; border-radius: var(--v2-radius-sm) !important; background: #fff !important; color: var(--v2-ink) !important; font: 400 14px/1.4 var(--v2-font) !important; box-shadow: inset 0 1px 1px rgba(14,23,38,.03); transition: border-color .15s var(--v2-ease), box-shadow .15s var(--v2-ease); }
html body #topic-shell #practice-lab .lab-stage :where(input, select, textarea):hover{ border-color: #a6b1c0 !important; }
html body #topic-shell #practice-lab .lab-stage :where(input, select, textarea):focus{ border-color: var(--v2-brand) !important; box-shadow: 0 0 0 3px rgba(22,69,120,.16) !important; outline: none !important; }
html body #topic-shell #practice-lab .lab-stage :where(input, select, textarea):focus-visible{ outline: none !important; }
html body #topic-shell #practice-lab .lab-stage :where(input, select, textarea)[aria-invalid="true"]{ border-color: var(--v2-danger) !important; box-shadow: 0 0 0 3px rgba(179,38,30,.12) !important; }
html body #topic-shell #practice-lab .lab-stage input[type="number"], html body #topic-shell #practice-lab .lab-stage input[inputmode="decimal"]{ font-variant-numeric: tabular-nums; }
html body #topic-shell #practice-lab .lab-stage .lab-hint{ color: var(--v2-muted) !important; font: 400 12px/1.45 var(--v2-font) !important; }
html body #topic-shell #practice-lab .lab-stage :where(button, .lab-btn){ display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px !important; border: 1px solid var(--v2-border-strong) !important; border-radius: var(--v2-radius) !important; background: #fff !important; color: var(--v2-ink) !important; font: 500 13px/1.25 var(--v2-font) !important; cursor: pointer; transition: background-color .15s var(--v2-ease), border-color .15s var(--v2-ease), transform .1s var(--v2-ease) !important; }
html body #topic-shell #practice-lab .lab-stage :where(button, .lab-btn):hover{ border-color: #a6b1c0 !important; background: var(--v2-subtle) !important; }
html body #topic-shell #practice-lab .lab-stage :where(button, .lab-btn):active{ transform: scale(.98) !important; }
html body #topic-shell #practice-lab .lab-stage :where(button, .lab-btn).primary, html body #topic-shell #practice-lab .lab-stage .relationship-primary-action{ border-color: var(--v2-brand) !important; background: var(--v2-brand) !important; color: #fff !important; }
html body #topic-shell #practice-lab .lab-stage :where(button, .lab-btn).primary:hover{ border-color: var(--v2-brand-hover) !important; background: var(--v2-brand-hover) !important; }
html body #topic-shell #practice-lab .lab-stage :where(button, .lab-btn):disabled{ opacity: .5; cursor: not-allowed; }
html body #topic-shell #practice-lab .lab-stage .lab-table-wrap{ border: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius) !important; background: #fff; }
html body #topic-shell #practice-lab .lab-stage table{ background: #fff !important; font-variant-numeric: tabular-nums; }
html body #topic-shell #practice-lab .lab-stage thead{ background: var(--v2-subtle) !important; }
html body #topic-shell #practice-lab .lab-stage th{ color: var(--v2-ink-2) !important; font: 600 12px/1.35 var(--v2-font) !important; }
html body #topic-shell #practice-lab .lab-stage :where(th, td){ padding: 10px 12px !important; border-bottom: 1px solid #edf0f4 !important; }
html body #topic-shell #practice-lab .lab-stage td{ color: var(--v2-ink) !important; font: 400 13px/1.45 var(--v2-font) !important; }
html body #topic-shell #practice-lab .lab-stage tbody tr:hover td{ background: #fafbfc; }
html body #topic-shell #practice-lab .lab-stage :where(td.num, th.num, td.r, th.r){ text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
html body #topic-shell #practice-lab .lab-stage tfoot :where(td, th){ border-top: 2px solid var(--v2-border-strong) !important; font-weight: 600 !important; }
html body #topic-shell #practice-lab .lab-stage .lab-note, html body #topic-shell #practice-lab .lab-stage .practice-session-note{ padding: 12px 14px !important; border: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius) !important; background: var(--v2-subtle) !important; color: var(--v2-ink-2) !important; font: 400 13px/1.55 var(--v2-font) !important; }
html body #topic-shell #practice-lab .lab-stage .lab-good{ border-color: #b8d9c5 !important; background: var(--v2-success-soft) !important; color: #0a4d2c !important; }
html body #topic-shell #practice-lab .lab-stage .lab-guide{ border: 1px solid var(--v2-learn-border) !important; border-radius: var(--v2-radius) !important; background: var(--v2-learn-soft) !important; color: var(--v2-ink-2) !important; }
html body #topic-shell #practice-lab .lab-stage #txn-result, html body #topic-shell #practice-lab .lab-stage #lab-status, html body #topic-shell #practice-lab .lab-stage .lab-status{ border-radius: var(--v2-radius); font-size: 13px; }
html body #topic-shell #practice-lab .lab-stage details{ border: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius) !important; background: #fff; }
html body #topic-shell #practice-lab .lab-stage summary{ cursor: pointer; font-weight: 550; }
html body #topic-shell #practice-lab .lab-stage .lab-card, html body #topic-shell #practice-lab .lab-stage .master-record{ border: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius) !important; background: #fff !important; }

/* 6. Case study (Acacia) --------------------------------------------------- */
html body.topic-case #topic-shell #case-host #intro{ padding: 0 !important; background: transparent !important; border: 0 !important; }
html body.topic-case #topic-shell #case-host #intro > h2{ margin: 0 0 4px !important; color: var(--v2-ink) !important; font: 650 20px/1.3 var(--v2-font) !important; letter-spacing: -.015em; }
html body.topic-case #topic-shell #case-host #intro .lead{ margin: 0 0 16px !important; color: var(--v2-muted) !important; font: 400 14px/1.55 var(--v2-font) !important; }
html body.topic-case #topic-shell #case-host :is(#intro, #sim) .card{ padding: 16px !important; border: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius-lg) !important; background: #fff !important; box-shadow: var(--v2-shadow-sm) !important; color: var(--v2-ink-2) !important; font: 400 13px/1.55 var(--v2-font) !important; }
html body.topic-case #topic-shell #case-host #intro .card h3{ margin: 0 0 6px !important; color: var(--v2-ink) !important; font: 600 14px/1.35 var(--v2-font) !important; }
html body.topic-case #topic-shell #case-host #intro .card-mark{ display: inline-grid !important; place-items: center; width: 24px; height: 24px; margin-bottom: 8px; border-radius: 7px; background: var(--v2-brand-soft) !important; color: var(--v2-brand) !important; font: 600 12px/1 var(--v2-font) !important; }
html body.topic-case #topic-shell #case-host #intro .scenario-grid > .card{ display: flex !important; flex-direction: column; gap: 8px; transition: border-color .15s var(--v2-ease), box-shadow .2s var(--v2-ease); }
html body.topic-case #topic-shell #case-host #intro .scenario-grid > .card:hover{ border-color: #9fb4cc !important; box-shadow: var(--v2-shadow) !important; }
html body.topic-case #topic-shell #case-host #intro .scenario-grid > .card .btns{ margin-top: auto !important; }
html body.topic-case #topic-shell #case-host #intro .scenario-grid table.j{ margin: 4px 0 !important; border: 1px solid #edf0f4; border-radius: var(--v2-radius); border-collapse: separate; border-spacing: 0; overflow: hidden; }
html body.topic-case #topic-shell #case-host :is(#intro, #sim) table.j :is(td, th){ padding: 7px 10px !important; border-bottom: 1px solid #edf0f4 !important; color: var(--v2-ink-2) !important; font: 400 13px/1.35 var(--v2-font) !important; font-variant-numeric: tabular-nums; }
html body.topic-case #topic-shell #case-host :is(#intro, #sim) table.j th{ color: var(--v2-ink) !important; font-weight: 600 !important; background: var(--v2-subtle) !important; }
html body.topic-case #topic-shell #case-host :is(#intro, #sim) table.j tr:last-child :is(td, th){ border-bottom: 0 !important; }
html body.topic-case #topic-shell #case-host :is(#intro, #sim) :is(button.b, button.btn){ display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px !important; border: 1px solid var(--v2-border-strong) !important; border-radius: var(--v2-radius) !important; background: #fff !important; color: var(--v2-ink) !important; font: 500 13px/1.25 var(--v2-font) !important; box-shadow: none !important; cursor: pointer; transition: background-color .15s var(--v2-ease), transform .1s var(--v2-ease) !important; }
html body.topic-case #topic-shell #case-host #intro .scenario-grid button.b{ border-color: var(--v2-brand) !important; background: var(--v2-brand) !important; color: #fff !important; }
html body.topic-case #topic-shell #case-host #intro .scenario-grid button.b:hover{ background: var(--v2-brand-hover) !important; }
html body.topic-case #topic-shell #case-host :is(#intro, #sim) :is(button.b, button.btn):active{ transform: scale(.98); }
html body.topic-case #topic-shell #case-host #intro .mode-picker{ display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px !important; padding: 12px 14px !important; border: 1px solid var(--v2-learn-border) !important; border-radius: var(--v2-radius-lg) !important; background: var(--v2-learn-soft) !important; }
html body.topic-case #topic-shell #case-host #intro .mode-picker legend{ float: left; margin-right: 6px; padding: 0 !important; color: var(--v2-learn-ink) !important; font: 600 13px/1.3 var(--v2-font) !important; }
html body.topic-case #topic-shell #case-host #intro .mode-picker label{ display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 1px solid var(--v2-learn-border); border-radius: 999px; background: #fff; color: var(--v2-ink); font: 500 13px/1 var(--v2-font) !important; cursor: pointer; }
html body.topic-case #topic-shell #case-host #intro .mode-picker label:has(input:checked){ border-color: var(--v2-learn); box-shadow: inset 0 0 0 1px var(--v2-learn); color: var(--v2-learn-ink); }
html body.topic-case #topic-shell #case-host #intro .mode-picker input{ accent-color: var(--v2-learn); }
html body.topic-case #topic-shell #case-host #intro .primer{ margin: 0 0 14px !important; border: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius-lg) !important; background: #fff !important; }
html body.topic-case #topic-shell #case-host #intro .primer summary{ padding: 12px 14px !important; color: var(--v2-ink) !important; font: 600 14px/1.35 var(--v2-font) !important; }
html body.topic-case #topic-shell #case-host #intro .say{ padding: 12px 14px !important; border: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius) !important; background: var(--v2-subtle) !important; color: var(--v2-ink-2) !important; font: 400 13px/1.5 var(--v2-font) !important; }

/* Process map: lanes, nodes and states */
html body.topic-case #topic-shell #sim #tl{ height: 6px !important; border-radius: 3px !important; background: var(--v2-sunken) !important; overflow: hidden; }
html body.topic-case #topic-shell #sim #map .pan{ border: 1px solid var(--v2-border) !important; border-radius: var(--v2-radius-lg) !important; background: #fff !important; box-shadow: var(--v2-shadow-sm) !important; }
html body.topic-case #topic-shell #sim #map .pan > h3{ color: var(--v2-ink) !important; font: 600 14px/1.3 var(--v2-font) !important; }
html body.topic-case #topic-shell #sim #map .pan > p{ color: var(--v2-muted) !important; font: 400 12px/1.4 var(--v2-font) !important; }
html body.topic-case #topic-shell #sim .nd{ border: 1px solid var(--v2-border-strong) !important; border-radius: var(--v2-radius) !important; background: #fff !important; color: var(--v2-ink) !important; box-shadow: none !important; transition: border-color .15s var(--v2-ease), background-color .15s var(--v2-ease), box-shadow .2s var(--v2-ease), transform .1s var(--v2-ease) !important; }
html body.topic-case #topic-shell #sim .nd:hover:not([aria-disabled="true"]){ border-color: var(--v2-brand) !important; box-shadow: var(--v2-shadow) !important; }
html body.topic-case #topic-shell #sim .nd:active:not([aria-disabled="true"]){ transform: scale(.98); }
html body.topic-case #topic-shell #sim .nd .ic{ background: var(--v2-sunken) !important; color: var(--v2-ink-2) !important; font-variant-numeric: tabular-nums; }
html body.topic-case #topic-shell #sim .nd .l{ color: var(--v2-ink) !important; font-weight: 600 !important; }
html body.topic-case #topic-shell #sim .nd .w{ color: var(--v2-muted) !important; }
html body.topic-case #topic-shell #sim .nd.hint{ border-color: var(--v2-learn) !important; background: var(--v2-learn-soft) !important; box-shadow: 0 0 0 3px rgba(15,106,115,.18) !important; }
html body.topic-case #topic-shell #sim .nd.hint .ic{ background: var(--v2-learn) !important; color: #fff !important; }
html body.topic-case #topic-shell #sim .nd.done{ border-color: #a9d3bb !important; background: var(--v2-success-soft) !important; }
html body.topic-case #topic-shell #sim .nd.done .ic{ background: var(--v2-success) !important; color: #fff !important; }
html body.topic-case #topic-shell #sim .nd.off, html body.topic-case #topic-shell #sim .nd[aria-disabled="true"]:not(.done){ opacity: .62; background: var(--v2-subtle) !important; }
html body.topic-case #topic-shell #sim :is(#mission, #recap, #led){ border-radius: var(--v2-radius-lg) !important; }

/* 7. Dialogs and command palette ------------------------------------------ */
html body .lab-dialog { width: min(520px, calc(100vw - 32px)); max-width: calc(100vw - 32px); padding: 0; border: 0; border-radius: var(--v2-radius-lg); background: #fff; color: var(--v2-ink); box-shadow: var(--v2-shadow-lg); }
html body .lab-dialog::backdrop { background: rgba(14, 23, 38, .48); }
html body .lab-dialog[open] { animation: v2-dialog-in .18s var(--v2-ease); }
@keyframes v2-dialog-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
html body .lab-dialog-inner { display: grid; gap: 12px; margin: 0; padding: 22px 22px 18px; }
html body .lab-dialog h2 { margin: 0; color: var(--v2-ink); font: 650 18px/1.3 var(--v2-font) !important; letter-spacing: -.01em; }
html body .lab-dialog h3 { margin: 6px 0 0; color: var(--v2-ink); font: 600 14px/1.3 var(--v2-font) !important; }
html body .lab-dialog p { margin: 0; color: var(--v2-ink-2); font: 400 14px/1.55 var(--v2-font); }
html body .lab-dialog .lab-dialog-tip { padding: 10px 12px; border-radius: var(--v2-radius); background: var(--v2-subtle); color: var(--v2-muted); font-size: 13px; }
html body .lab-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 6px; }
html body .lab-help-steps { display: grid; gap: 8px; margin: 0; padding-left: 20px; color: var(--v2-ink-2); font: 400 14px/1.5 var(--v2-font); }
html body .lab-help-keys { display: grid; gap: 6px; margin: 0; }
html body .lab-help-keys > div { display: flex; align-items: center; gap: 12px; }
html body .lab-help-keys dt { display: flex; gap: 4px; min-width: 88px; }
html body .lab-help-keys dd { margin: 0; color: var(--v2-ink-2); font: 400 13px/1.4 var(--v2-font); }
html body .lab-command { width: min(620px, calc(100vw - 24px)); max-height: min(560px, calc(100dvh - 48px)); }
html body .lab-command-inner { display: flex; flex-direction: column; max-height: inherit; }
html body .lab-command-field { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--v2-border); }
html body .lab-command-field .material-symbols-outlined { color: var(--v2-faint); font-size: 20px; }
html body #lab-command-input { flex: 1 1 auto; min-width: 0; height: 52px; padding: 0; border: 0; background: transparent; color: var(--v2-ink); font: 400 15px/1 var(--v2-font) !important; outline: none !important; box-shadow: none !important; }
html body #lab-command-list { flex: 1 1 auto; margin: 0; padding: 6px; overflow-y: auto; list-style: none; }
html body #lab-command-list .cmd-group { padding: 10px 10px 4px; color: var(--v2-faint); font: 500 12px/1.3 var(--v2-font); }
html body #lab-command-list [role="option"] { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 8px 10px; border-radius: var(--v2-radius); color: var(--v2-ink); cursor: pointer; }
html body #lab-command-list [role="option"] .material-symbols-outlined { color: var(--v2-faint); font-size: 18px; }
html body #lab-command-list [role="option"] span.cmd-text { flex: 1 1 auto; min-width: 0; font: 500 14px/1.3 var(--v2-font); }
html body #lab-command-list [role="option"] small { color: var(--v2-muted); font: 400 12px/1.3 var(--v2-font); white-space: nowrap; }
html body #lab-command-list [role="option"][aria-selected="true"] { background: var(--v2-brand-soft); }
html body #lab-command-list [role="option"][aria-selected="true"] .material-symbols-outlined { color: var(--v2-brand); }
html body .lab-command-empty { margin: 0; padding: 18px 16px 22px; color: var(--v2-muted); font: 400 14px/1.5 var(--v2-font); }

/* Existing dialogs: consistent radius, shadow and backdrop. */
html body :is(#topic-milestone-dialog, #session-file-dialog, #relationship-practice-dialog, #dlg) { border: 0 !important; border-radius: var(--v2-radius-lg) !important; box-shadow: var(--v2-shadow-lg) !important; }
html body :is(#topic-milestone-dialog, #session-file-dialog, #relationship-practice-dialog, #dlg)::backdrop { background: rgba(14, 23, 38, .48); }
html body .topic-milestone-kicker { color: var(--v2-success) !important; font: 600 12px/1.3 var(--v2-font) !important; letter-spacing: 0 !important; text-transform: none !important; }
html body #topic-milestone-dialog .relationship-primary-action { border-color: var(--v2-brand) !important; background: var(--v2-brand) !important; color: #fff !important; }

/* 8. Responsive ------------------------------------------------------------ */
@media (max-width: 1440px) { :root { --v2-panel: 320px; } }
@media (max-width: 1280px) {
  html body #topic-shell .dash-kpis{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1599px) {
  html body #topic-shell .lab-mode-badge{ display: none; }
  html body #topic-shell #lab-breadcrumb #crumb-group{ display: none; }
}
@media (max-width: 1360px) {
  html body #topic-shell .lab-topbar-actions .lab-btn-label{ position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
  html body #topic-shell .lab-topbar-actions > button{ width: 36px; justify-content: center; padding: 0 !important; }
}
@media (max-width: 1180px) {
  :root { --v2-sidebar: 232px; --v2-panel: 300px; }
  html body #topic-shell .dash-pl, html body #topic-shell .dash-position{ grid-column: span 6; }
  html body #topic-shell .dash-learning, html body #topic-shell .dash-actions{ grid-column: span 6; }
  html body #topic-shell .dash-recent{ grid-column: span 12; }
  html body #topic-shell #hub-landing #hub-cards{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html body #topic-shell #lab-search{ flex-basis: 220px; }
}
@media (max-width: 1080px) {
  html body #topic-shell #topic-detail > .grid{ grid-template-columns: minmax(0, 1fr) !important; }
  html body #topic-shell #topic-learning-panel{ display: contents !important; }
  html:not(.embedded-simulator) body #topic-shell #topic-learning-panel{ position: static; max-height: none; overflow: visible; }
  html body #topic-shell #topic-detail > .grid > section{ order: 1; }
  html body #topic-shell #topic-learning-panel > section:first-child{ order: 0; }
  html body #topic-shell #topic-learning-panel > section:not(:first-child){ order: 2; }
  html body #topic-shell.panel-collapsed #topic-learning-panel { display: none !important; }
}
@media (max-width: 920px) {
  html body #topic-shell { display: flex !important; flex-direction: column; }
  html body #topic-shell #topic-top { position: sticky; top: 0; z-index: 40; display: block; width: 100%; height: auto; max-height: none; padding: 0 !important; overflow: visible !important; border-right: 0 !important; border-bottom: 1px solid var(--v2-night-line) !important; }
  html.embedded-simulator body #topic-shell #topic-top { position: relative; }
  html body #topic-shell #topic-top .hub-top-line{ flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important; min-height: 56px; padding: 8px 12px 8px 16px !important; }
  html body #topic-shell #topic-top .hub-top-tools{ display: flex; flex: 0 0 auto; width: auto !important; align-items: center; gap: 6px; }
  html body #topic-shell #mobile-topics-toggle{ display: inline-flex !important; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px !important; border: 1px solid var(--v2-night-line) !important; border-radius: var(--v2-radius) !important; background: var(--v2-night-2) !important; color: var(--v2-on-night) !important; font: 500 13px/1 var(--v2-font) !important; }
  html body #topic-shell #mobile-topics-toggle .menu-mark{ width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
  html body #topic-shell #mobile-topics-toggle .menu-line{ transition: transform .2s var(--v2-ease), opacity .2s var(--v2-ease); transform-origin: 12px 12px; }
  html body #topic-shell #mobile-topics-toggle[aria-expanded="true"] .menu-line-top{ transform: translateY(6px) rotate(45deg); }
  html body #topic-shell #mobile-topics-toggle[aria-expanded="true"] .menu-line-middle{ opacity: 0; }
  html body #topic-shell #mobile-topics-toggle[aria-expanded="true"] .menu-line-bottom{ transform: translateY(-6px) rotate(-45deg); }
  html body #topic-shell #topic-top > nav{ display: none !important; padding: 4px 12px 14px !important; border-top: 1px solid var(--v2-night-line) !important; }
  html body #topic-shell.mobile-topics-open #topic-top > nav { display: block !important; animation: v2-drawer .2s var(--v2-ease); }
  html:not(.embedded-simulator) body #topic-shell.mobile-topics-open #topic-top > nav { max-height: calc(100svh - 57px); overflow-y: auto !important; overscroll-behavior: contain; }
  html body #topic-shell #topic-top #topic-menu{ display: flex !important; flex-direction: column; }
  html body #topic-shell #topic-top :is(#nav-all-topics, .nav-shell-item, #topic-menu button){ min-height: 44px; }
  html body #topic-shell #topic-top :is(#nav-all-topics, #topic-menu button)[aria-current="page"]::before{ left: -4px; }
  html body #topic-shell #topic-top .sidebar-foot{ display: none; }
  html body #topic-shell > header#lab-topbar { position: relative; top: auto; z-index: 1; align-self: stretch !important; width: 100% !important; gap: 8px; padding: 8px 14px !important; background: #fff !important; backdrop-filter: none; }
  html body #topic-shell #lab-search{ position: relative; flex: 0 0 auto; width: 40px; min-width: 40px; height: 40px; justify-content: center; padding: 0 !important; }
  html body #topic-shell #lab-search kbd{ display: none; }
  html body #topic-shell #lab-search .lab-search-label{ position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  html body #topic-shell > main#hub-landing, html body #topic-shell > main#topic-detail { padding: 20px 16px 40px !important; }
  html body > footer { margin-left: 0; }
}
@keyframes v2-drawer { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) {
  html body #topic-shell #hub-landing .dash-head{ flex-direction: column; align-items: stretch !important; gap: 16px !important; }
  html body #topic-shell #hub-landing .dash-head-actions{ justify-content: stretch; }
  html body #topic-shell #hub-landing .dash-head-actions > button{ flex: 1 1 200px; }
  html body #topic-shell .dash-kpis{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  html body #topic-shell .dash-kpis .kpi{ padding: 12px 13px; }
  html body #topic-shell .dash-kpis .kpi-value{ font-size: 19px !important; }
  html body #topic-shell .dash-grid > *{ grid-column: 1 / -1 !important; }
  html body #topic-shell #hub-landing #hub-cards{ grid-template-columns: minmax(0, 1fr); }
  html body #topic-shell .dash-section-head{ flex-direction: column; align-items: flex-start; gap: 6px; }
  html body #topic-shell .lab-topbar-actions .lab-btn-label, html body #topic-shell .lab-topbar-progress-word{ position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
  html body #topic-shell .lab-topbar-actions > button{ width: 40px; min-height: 40px; justify-content: center; padding: 0 !important; }
  html body #topic-shell .lab-topbar-progress{ min-width: 0; }
  html body #topic-shell #topic-detail > div:first-child{ flex-direction: column; gap: 12px; }
  html body #topic-shell #topic-detail > div:first-child > div > span:first-child{ display: none !important; }
  html body #topic-shell #topic-title{ font-size: 21px !important; }
  html body #topic-shell #topic-app #practice-lab .lab-stage{ padding: 16px !important; }
  html body #topic-shell .v2-bar{ grid-template-columns: minmax(72px, 96px) minmax(0, 1fr) auto; gap: 8px; }
  html body #topic-shell .v2-bar-value{ min-width: 0; }
}
@media (max-width: 480px) {
  html body #topic-shell > header#lab-topbar{ flex-wrap: wrap !important; row-gap: 6px; padding: 8px 12px !important; }
  html body #topic-shell #lab-breadcrumb{ flex: 1 0 100%; }
  html body #topic-shell .lab-topbar-actions{ flex: 1 1 auto; min-width: 0; flex-wrap: wrap !important; justify-content: flex-end; gap: 4px; }
  html body #topic-shell #lab-search{ order: 0; width: 38px; min-width: 38px; height: 38px !important; min-height: 38px !important; }
  html body #topic-shell #hub-brand .brand-text > span:last-child{ display: none; }
  html body #topic-shell #mobile-topics-toggle span:not(.menu-mark){ font-size: 13px; }
  html body #topic-shell .dash-quick{ grid-template-columns: minmax(0, 1fr); }
  html body #topic-shell .v2-legend{ grid-template-columns: minmax(0, 1fr); }
  html body #topic-shell #lab-breadcrumb li:not(:last-child){ display: none; }
  html body #topic-shell #lab-breadcrumb li + li::before{ content: none; }
  html body #topic-shell .lab-topbar-progress-track{ display: none; }
  html body .lab-dialog-actions > * { flex: 1 1 auto; }
}

/* 9. Motion preferences ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html body *, html body *::before, html body *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  html body #topic-shell .v2-bar-fill, html body #topic-shell .v2-stack > span{ animation: none !important; }
}

/* 10. Print ---------------------------------------------------------------- */
@media print {
  body:not(:has(#student-report-sheet:not([hidden]))) #topic-top,
  body:not(:has(#student-report-sheet:not([hidden]))) #lab-topbar,
  body:not(:has(#student-report-sheet:not([hidden]))) #topic-learning-panel,
  body:not(:has(#student-report-sheet:not([hidden]))) #hub-back,
  body:not(:has(#student-report-sheet:not([hidden]))) #topic-flow,
  body:not(:has(#student-report-sheet:not([hidden]))) .practice-session-note { display: none !important; }
  body:not(:has(#student-report-sheet:not([hidden]))) #topic-shell { display: block !important; background: #fff !important; }
  body:not(:has(#student-report-sheet:not([hidden]))) #topic-shell > main { max-width: none !important; padding: 0 !important; }
  body:not(:has(#student-report-sheet:not([hidden]))) #topic-detail > .grid { display: block !important; }
  body:not(:has(#student-report-sheet:not([hidden]))) #topic-app #practice-lab .lab-stage { padding: 0 !important; border: 0 !important; box-shadow: none !important; }
  body:not(:has(#student-report-sheet:not([hidden]))) #practice-lab .lab-stage :is(button, .lab-btn, form:not(#report-form) .lab-field) { display: none !important; }
  body:not(:has(#student-report-sheet:not([hidden]))) #practice-lab .lab-stage table { min-width: 0 !important; font-size: 9.5pt; }
  body:not(:has(#student-report-sheet:not([hidden]))) #practice-lab .lab-stage tr { break-inside: avoid; }
  body:not(:has(#student-report-sheet:not([hidden]))) .dash-quick, body:not(:has(#student-report-sheet:not([hidden]))) .dash-head-actions { display: none !important; }
  /* A generated report prints on its own: the topic header stays, the controls and teaching notes above it do not. */
  body:not(:has(#student-report-sheet:not([hidden]))):has(#report-output table) #practice-lab :not(:has(#report-output)):not(#report-output):not(#report-output *) { display: none !important; }
  body:not(:has(#student-report-sheet:not([hidden]))):has(#report-output table) #topic-app > :not(:has(#report-output)) { display: none !important; }
  body:not(:has(#student-report-sheet:not([hidden]))) #report-output { padding: 0 !important; border: 0 !important; background: #fff !important; box-shadow: none !important; }
  html, body { background: #fff !important; }
}
