/* ==========================================================================
   JachAI — workspace component layer
   --------------------------------------------------------------------------
   Loaded by index.html after theme.css, which defines every token this file
   uses. Nothing here declares a colour; see theme.css to change the palette
   or the dark theme.

   Layer order: reset, primitives, chrome, views, overlays, responsive.
   ========================================================================== */

/* ==========================================================================
   2. Reset & base
   ========================================================================== */

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

html {
  min-width: 320px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p { margin-top: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  color: var(--ink);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-xl); letter-spacing: var(--tracking-tight); }
h3 { font-size: var(--text-lg); letter-spacing: var(--tracking-tight); }

a { color: var(--brand-ink); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }

code, pre, .code { font-family: var(--font-mono); font-size: .92em; }

::selection { background: var(--brand-200); color: var(--brand-900); }

.hidden { display: none !important; }

.muted { color: var(--muted); line-height: var(--leading-normal); }

.eyebrow {
  color: var(--brand-ink);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: .19em;
}

/* ==========================================================================
   3. Primitives
   ========================================================================== */

/* -- Button --------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 42px;
  padding: 10px var(--sp-5);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  letter-spacing: -.005em;
  white-space: nowrap;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease),
              background var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease);
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }

.button.primary {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: var(--e-1);
}
.button.primary:hover:not(:disabled) { background: var(--brand-hover); box-shadow: var(--e-2); }

.button.secondary { background: var(--mint); color: var(--mint-ink); }
.button.secondary:hover:not(:disabled) { background: var(--brand-200); }

.button.quiet {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-soft);
}
.button.quiet:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-sunk); }

.button.danger-action { background: var(--danger); color: var(--on-danger); }

.button.small { min-height: 34px; padding: 7px var(--sp-3); font-size: var(--text-sm); }

/* -- Field ---------------------------------------------------------------- */

label {
  display: grid;
  gap: var(--sp-2);
  color: var(--ink-soft);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}
label small { color: var(--muted); font-weight: var(--weight-regular); }

input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
  outline: none;
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
textarea { resize: vertical; line-height: var(--leading-normal); }
::placeholder { color: var(--neutral-400); }

input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) {
  border-color: var(--brand-300);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus-ring) 22%, transparent);
}

input[type=checkbox], input[type=radio] { width: auto; min-height: auto; accent-color: var(--brand); }

/* Password visibility toggle for workspace forms */
.password-field {
  position: relative;
  display: grid;
  gap: var(--sp-2);
}
.password-field > input[type="password"],
.password-field > input[type="text"] {
  width: 100%;
  min-width: 0;
  padding-right: 48px;
}
.password-toggle {
  position: absolute;
  right: 0;
  top: auto;
  bottom: 0;
  height: 42px;
  width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-left: 1px solid var(--line-strong);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
}
.password-toggle:hover {
  background: var(--surface-sunk);
  color: var(--ink);
}
.password-toggle:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: -3px;
  border-radius: var(--r-sm);
}
.password-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent);
}
.field-error { color: var(--danger); font-size: var(--text-sm); font-weight: var(--weight-semibold); }

fieldset {
  min-width: 0;
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
legend { padding: 0 var(--sp-1); font-size: var(--text-md); font-weight: var(--weight-semibold); }

.check {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-right: var(--sp-5);
  font-weight: var(--weight-medium);
  cursor: pointer;
}

/* One focus treatment for everything, declared after the field rules so it
   wins over a component's own focus styling. */
.button:focus-visible,
.tab:focus-visible,
.side-nav button:focus-visible,
.metric:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* -- Card ----------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--e-2);
}

/* -- Pill ----------------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px var(--sp-2);
  background: var(--neutral-100);
  color: var(--ink-soft);
  border-radius: var(--r-xs);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}
.pill.ok     { background: var(--success-surface); color: var(--success-ink); }
.pill.warn   { background: var(--warn-surface);    color: var(--warn-ink); }
.pill.danger { background: var(--danger-surface);  color: var(--danger-ink); }

/* -- Progress bar --------------------------------------------------------- */

.bar {
  height: 6px;
  margin-top: var(--sp-3);
  border-radius: var(--r-pill);
  background: var(--neutral-100);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--brand-500), var(--brand));
}

/* ==========================================================================
   4. Chrome
   ========================================================================== */

/* -- Topbar --------------------------------------------------------------- */

.topbar {
  position: relative;
  z-index: 6;
  height: var(--topbar-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: var(--sp-7);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--ink);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: -.045em;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: var(--brand);
  color: var(--accent);
  font-size: 20px;
  font-weight: var(--weight-bold);
  box-shadow: var(--e-1);
}
.brand-accent { color: var(--brand-ink); }

.topbar-note { margin-left: auto; color: var(--muted); font-size: var(--text-md); }

.topnav { display: flex; gap: var(--sp-5); font-size: var(--text-md); font-weight: var(--weight-semibold); }
.topnav a {
  position: relative;
  padding: var(--sp-1) 0;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color var(--dur-base) var(--ease);
}
.topnav a::after {
  content: '';
  position: absolute;
  inset: auto 0 -2px;
  height: 2px;
  border-radius: var(--r-pill);
  background: var(--brand);
  transform: scaleX(0);
  transition: transform var(--dur-base) var(--ease);
}
.topnav a:hover { color: var(--brand-ink); }
.topnav a:hover::after { transform: scaleX(1); }

.topbar .button { margin-left: auto; }
.account-menu { margin-left: 0; position: relative; }
.account-menu-toggle { display: inline-flex; align-items: center; gap: var(--sp-2); border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); padding: 4px 10px 4px 5px; color: var(--ink); font: inherit; cursor: pointer; }
.header-avatar, .header-avatar-fallback { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.header-avatar-fallback { display: grid; place-items: center; background: var(--brand); color: white; font-weight: var(--weight-bold); }
.account-menu-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 170px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--e-2); }
.account-menu-panel button { display: block; width: 100%; border: 0; background: transparent; padding: 10px; text-align: left; color: var(--ink); font: inherit; cursor: pointer; border-radius: var(--radius-sm); }
.account-menu-panel button:hover { background: var(--surface-sunk); }
.account-menu-panel:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }

/* -- Notice --------------------------------------------------------------- */

.notice {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: var(--sp-3) var(--gutter);
  background: var(--success-surface);
  color: var(--success-ink);
  border-bottom: 1px solid var(--success-border);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}
.notice.error {
  background: var(--danger-surface);
  color: var(--danger-ink);
  border-color: var(--danger-border);
}

/* -- Mobile workspace navigation ------------------------------------------
   Below 900px the sidebar stacks above the content. With every section listed
   it stood 699px tall on a 375x780 phone and pushed the first card to 830px,
   so opening the app on a phone showed navigation and nothing else.

   The workspace context - which organization, which role - stays visible,
   because that is the one thing a person must not have to guess. Only the list
   of sections collapses, behind a control that names where you are. */
.nav-toggle {
  display: none;
  width: 100%;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding: 11px var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: var(--weight-semibold);
  text-align: left;
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--line-strong); }
.nav-toggle-label { flex: 1; }
/* A chevron drawn in CSS rather than shipped as an icon font for one glyph. */
.nav-toggle-mark {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .15s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-mark {
  transform: rotate(-135deg) translate(-2px, -2px);
}

.platform-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); margin: var(--sp-5) 0; }
.platform-metric { display: grid; gap: var(--sp-2); padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-sunk); min-width: 0; }
.platform-metric strong { font-size: clamp(1.25rem, 2vw, 1.8rem); overflow-wrap: anywhere; }
.platform-activity { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); }
.platform-activity h3 { margin: 0 0 var(--sp-3); }
.platform-activity p { display: flex; justify-content: space-between; gap: var(--sp-3); margin: var(--sp-2) 0; }
@media (max-width: 900px) {
  .platform-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .platform-activity { grid-template-columns: 1fr; }
  .nav-toggle { display: flex; }
  .side-nav[data-collapsed="true"] { display: none; }
  .side-nav { width: 100%; margin-top: var(--sp-3); }
}
@media (prefers-reduced-motion: reduce) {
  .nav-toggle-mark { transition: none; }
}

/* Explanatory text under a card heading. These ran to 858px on a desktop, which
   is past 110 characters, and beyond roughly 80 the eye loses the line it is on
   when it wraps. Scoped to a direct child so item metadata and flex rows, which
   are short by nature, are untouched. */
.card > p.muted { max-width: 78ch; }

/* -- React Practice pilot --------------------------------------------------
   The pilot ships no stylesheet of its own: it reuses the card, button, form and
   pill classes already here and adds only what this screen genuinely needs, so a
   pilot cannot drift into a second visual language. Every colour is a token. */

/* Work on the left, context on the right. Answering is why the screen is open,
   so it is the first thing on it; the quota and the question list are reference
   and belong beside the work rather than above it. */
.practice-layout {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr);
  align-items: start;
}
.practice-work, .practice-side { display: grid; gap: var(--sp-5); align-content: start; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.practice-topic {
  margin: 0 0 var(--sp-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--brand-ink);
}
/* The question is the content of this screen, so it is set at display size and
   is the only thing on the card at that size. */
.practice-prompt {
  margin: 0 0 var(--sp-5);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: 1.35;
  letter-spacing: -.015em;
  max-width: 34ch;
}
.practice-options { border: 0; padding: 0; margin: 0; display: grid; gap: var(--sp-2); }
.practice-option {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  padding: 13px var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--text-md);
  cursor: pointer;
}
.practice-option:hover { border-color: var(--line-strong); background: var(--surface-sunk); }
.practice-option.is-chosen {
  border-color: var(--brand);
  background: var(--surface-brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.practice-actions { display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap; }

.practice-result {
  margin-top: var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--r-md);
}
.practice-result p { margin: 0 0 var(--sp-2); }
.practice-result p:last-child { margin-bottom: 0; }
.practice-result.is-correct { border-left-color: var(--success-ink); background: var(--success-surface); color: var(--success-ink); }
.practice-result.is-incorrect { border-left-color: var(--warn-ink); background: var(--warn-surface); color: var(--warn-ink); }
.practice-verdict { font-weight: var(--weight-bold); font-size: var(--text-lg); }

.practice-meters { display: grid; gap: var(--sp-4); }
.practice-meter { display: grid; grid-template-columns: 1fr auto; gap: 3px var(--sp-3); }
.practice-meter-label { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.practice-meter-value { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--brand-ink); }
.practice-meter .bar { grid-column: 1 / -1; }
.practice-meter-foot { grid-column: 1 / -1; font-size: var(--text-xs); }
.practice-private { font-size: var(--text-xs); margin: var(--sp-4) 0 var(--sp-3); }

.practice-picks { display: grid; gap: 2px; margin-top: var(--sp-3); max-height: 320px; overflow: auto; }
.practice-pick {
  display: grid;
  gap: 1px;
  width: 100%;
  padding: var(--sp-3);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.practice-pick:hover { background: var(--surface-sunk); }
.practice-pick.is-current { border-color: var(--brand); background: var(--surface-brand); }
.practice-pick-topic {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--text-xs); color: var(--muted);
}
.practice-pick-prompt {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* One dot carries "answered, and how it went". A pill on every row turned the
   list into a column of badges with the questions squeezed between them. */
.practice-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.practice-dot.is-correct { background: var(--success-ink); }
.practice-dot.is-review { background: var(--warn-ink); }

.practice-history { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: grid; gap: var(--sp-3); }
.practice-history li { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--sp-3); align-items: baseline; }
.practice-history-text {
  font-size: var(--text-sm);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.practice-history-when { grid-column: 2; font-size: var(--text-xs); }

/* Generation is the one place this screen makes someone wait, so it is the one
   place that moves. */
.practice-progress { display: flex; gap: var(--sp-3); align-items: center; margin-top: var(--sp-4); }
.practice-spinner {
  width: 15px; height: 15px; flex: 0 0 auto;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: practice-spin .7s linear infinite;
}
@keyframes practice-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .practice-spinner { animation: none; border-top-color: var(--line-strong); }
}

@media (max-width: 1100px) {
  .practice-layout { grid-template-columns: minmax(0, 1fr); }
  .practice-picks { max-height: none; }
}

/* -- Workspace shell ------------------------------------------------------ */

.workspace {
  min-height: calc(100vh - var(--topbar-h));
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: var(--sp-7) var(--sp-4);
  background: var(--surface);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.sidebar .eyebrow { margin-left: var(--sp-3); }
.sidebar select { background: var(--surface-sunk); font-weight: var(--weight-semibold); }
.sidebar-foot {
  margin-top: var(--sp-9);
  padding: var(--sp-4) var(--sp-3) 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.select-label { margin: 0 var(--sp-3) var(--sp-2); color: var(--muted); font-size: var(--text-sm); }

.role-badge {
  display: inline-block;
  margin: var(--sp-3) 0 var(--sp-6);
  padding: 5px var(--sp-3);
  background: var(--surface-brand);
  border: 1px solid var(--brand-100);
  border-radius: var(--r-pill);
  color: var(--brand-ink);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: .05em;
}

.nav-heading {
  margin: var(--sp-4) var(--sp-3) var(--sp-2);
  color: var(--muted);
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
}
.nav-heading:first-child { margin-top: var(--sp-1); }

.side-nav { display: grid; gap: 2px; }
.side-nav button {
  position: relative;
  width: 100%;
  padding: 10px var(--sp-3);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  text-align: left;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.side-nav button:hover,
.side-nav button.active { background: var(--surface-brand); color: var(--brand-ink); }
.side-nav button.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 18px;
  border-radius: var(--r-pill);
  background: var(--brand);
  transform: translateY(-50%);
}

.content {
  width: min(100%, var(--content-max));
  /* Centred in whatever space the sidebar leaves. Left-aligned, a 1920 screen
     put the cap's whole remainder - around 300px - in one dead strip down the
     right-hand side, which read as the page having failed to fill. */
  margin-inline: auto;
  padding: var(--sp-8) clamp(18px, 3.5vw, 56px) var(--sp-7);
}

.google-signin { margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--line); }
.google-signin:not(.card) { text-align: center; }
.google-signin #google-login-button, .google-signin #google-link-button { display: flex; justify-content: center; }
.google-login-help:not(.hidden) { display: block; margin-top: var(--sp-4); padding: var(--sp-3); background: var(--danger-surface); border: 1px solid var(--danger); border-radius: var(--radius-sm); color: var(--danger-ink); text-align: left; }
.demo-access { margin-top: var(--sp-6); padding-top: var(--sp-5); border-top: 1px solid var(--line); }
.demo-access h2 { font-size: var(--text-lg); }
.demo-access .muted { max-width: 48ch; font-size: var(--text-sm); }
.demo-access-roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.demo-role { min-height: 44px; white-space: normal; text-align: center; }
.google-signin .muted { margin-bottom: var(--sp-3); font-size: var(--text-sm); text-transform: lowercase; letter-spacing: 0.05em; }

/* ==========================================================================
   5. Views
   ========================================================================== */

/* -- Auth + hero ---------------------------------------------------------- */

.auth-layout {
  max-width: 1280px;
  min-height: calc(100vh - var(--topbar-h));
  margin: auto;
  display: grid;
  grid-template-columns: 1.1fr .8fr;
  /* Both columns start together. Centred, the sign-in card and the hero were
     centred independently, so the headline floated well down the page while the
     card - which grows with the demo roles and the Google notice - ran off the
     top and bottom of a 1080 screen at once. */
  align-items: start;
  gap: clamp(30px, 5vw, 88px);
  padding: var(--sp-8) var(--sp-7) var(--sp-9);
}

.hero { padding: var(--sp-3) 0 var(--sp-10); }
.hero h1 { font-size: var(--text-display); letter-spacing: -.04em; max-width: 660px; }
.hero > p:not(.eyebrow) {
  max-width: 500px;
  color: var(--muted);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}
.hero > p.hero-trust {
  margin: var(--sp-4) 0 0;
  color: var(--brand-ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}
.hero-points {
  display: flex;
  gap: var(--sp-7);
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--line-strong);
  color: var(--brand-ink);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.auth-card { padding: var(--sp-7); }
.auth-card.registering #google-login-area,
.auth-card.registering #demo-preview,
.auth-card.registering #demo-access { display: none; }

.tabs {
  display: flex;
  gap: var(--sp-1);
  padding: var(--sp-1);
  margin-bottom: var(--sp-6);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
}
.tab {
  flex: 1;
  padding: 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  transition: background var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}
.tab.active { background: var(--surface); color: var(--brand-ink); box-shadow: var(--e-1); }

.stack { display: grid; gap: var(--sp-4); }
.stack h2 { margin-bottom: 0; }
.stack .muted { margin-top: calc(var(--sp-3) * -1); font-size: var(--text-md); }

.inline-link {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hint { margin: calc(var(--sp-4) * -1) 0 var(--sp-5); font-size: var(--text-md); }

.verify-row { margin-top: var(--sp-7); max-width: 440px; }
.verify-row .muted { margin: var(--sp-2) 0 0; font-size: var(--text-sm); }
.verify-controls { display: flex; gap: var(--sp-3); align-items: center; }
.verify-controls input { flex: 1 1 auto; min-width: 0; }

/* -- Heads ---------------------------------------------------------------- */

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.page-head h1 { margin-bottom: var(--sp-2); }
.page-head .muted { margin-bottom: 0; }

.screen-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: start;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.screen-head h2 { margin-bottom: var(--sp-2); }
.screen-head .muted { margin-bottom: 0; }

.section-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: start;
  gap: var(--sp-3);
}

/* -- Panels --------------------------------------------------------------- */

.view { display: grid; gap: var(--sp-5); }

.panel {
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--e-2);
}
.panel h2 { margin-bottom: var(--sp-2); }

.subpanel {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.subpanel h4 {
  margin: 0 0 var(--sp-3);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.subpanel .item {
  padding: var(--sp-3) 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.subpanel .item:last-child { border-bottom: 0; }

.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }

.feature {
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--e-2);
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.feature:hover { transform: translateY(-2px); box-shadow: var(--e-3); }
.feature-icon { color: var(--brand-400); font-size: var(--text-sm); font-weight: var(--weight-bold); }
.feature h2 { margin: var(--sp-5) 0 var(--sp-2); }
.feature p { margin-bottom: 0; color: var(--muted); line-height: var(--leading-normal); }

/* -- Forms in panels ------------------------------------------------------ */

.form-row { display: flex; gap: var(--sp-4); flex-wrap: wrap; align-items: end; }
.form-row > label { flex: 1 1 170px; min-width: 0; }
.form-row > .button { margin-bottom: 0; }

.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.choice-list { display: grid; gap: var(--sp-2); }

.filter-row { margin: var(--sp-2) 0 var(--sp-4); max-width: 340px; }

/* -- Lists ---------------------------------------------------------------- */

.item-list { display: grid; gap: var(--sp-2); }

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}
.item:hover { border-color: var(--line-strong); background: var(--surface-sunk); }
.item-main { min-width: 0; }
.item-title {
  display: block;
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  overflow-wrap: anywhere;
}
.item-meta { margin: var(--sp-1) 0 0; color: var(--muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.item-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: end; }

.assessment-instructions .item-meta { white-space: pre-wrap; }

.empty { padding: var(--sp-4) 0; color: var(--muted); font-size: var(--text-md); }

.onboarding-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); margin-top: var(--sp-5); }
.onboarding-choice { max-width: 420px; margin-top: var(--sp-5); }
#onboarding-next-step { margin-top: var(--sp-3); }
.onboarding-path { min-width: 0; padding: var(--sp-5); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-sunk); }
.onboarding-path h3 { margin: 0 0 var(--sp-3); }
.onboarding-path p { line-height: var(--leading-normal); }
.onboarding-path .stack { margin-top: var(--sp-4); }
@media (max-width: 760px) { .onboarding-grid { grid-template-columns: 1fr; } }

[aria-busy="true"] .item { opacity: .55; }

/* -- Dashboard ------------------------------------------------------------
   The overview is two bands. The first pairs the work queue with the counts,
   because deciding what to do needs both at once; the queue gets the wider
   column because its rows carry sentences, not numbers. The second pairs
   recent activity with the workspace facts.
   ------------------------------------------------------------------------- */

.dash-primary,
.dash-secondary {
  display: grid;
  gap: var(--sp-5);
  align-items: start;
}
.dash-primary { grid-template-columns: minmax(0, 1fr); }
.dash-secondary { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }

/* The queue is the one thing on this screen that is genuinely urgent, so it
   carries a brand edge no other panel has. */
.dash-focus { border-left: 3px solid var(--brand); }
.dash-focus .item-title { letter-spacing: var(--tracking-tight); }

.dash-side .metrics { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: var(--sp-3); }
.dash-side .metric { padding: var(--sp-4); }
.dash-side .metric-value { font-size: 26px; }

#glance-note, #focus-note, #activity-note { margin-bottom: var(--sp-4); font-size: var(--text-md); }

/* -- Plan usage ----------------------------------------------------------- */

.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-5); }
.journey-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp-4); margin: var(--sp-5) 0 0; padding: 0; list-style: none; counter-reset: journey; }
.journey-step { display: grid; align-content: start; gap: var(--sp-2); padding: var(--sp-4) 0; border-top: 2px solid var(--line-strong); counter-increment: journey; }
.journey-step::before { content: counter(journey, decimal-leading-zero); color: var(--brand-ink); font-size: var(--text-xs); font-weight: var(--weight-bold); }
.journey-step .button { justify-self: start; align-self: end; }
.usage-cell { display: grid; gap: var(--sp-2); }
.usage-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.usage-label {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: capitalize;
}
.usage-figure {
  color: var(--ink);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.usage-cell .bar { margin-top: 0; height: 8px; }
.usage-note { margin: 0; color: var(--muted); font-size: var(--text-xs); }

/* Amber then red as a window fills. The share is also printed underneath, so
   the colour repeats the number rather than carrying it alone. */
.bar-fill.bar-warn { background: linear-gradient(90deg, var(--warn-ink), var(--warn-ink)); }
.bar-fill.bar-danger { background: linear-gradient(90deg, var(--danger-ink), var(--danger-ink)); }

/* -- Metrics -------------------------------------------------------------- */

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: var(--sp-4); }

/* A count that could not be read shows a dash and says why, because a zero
   would be a claim the server never made. */
.metric-unknown .metric-value { color: var(--muted); }
.metric-note { color: var(--warn-ink); font-size: var(--text-2xs); font-weight: var(--weight-semibold); }

.metric {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-5);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--e-1);
  transition: transform var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease);
}
.metric:hover { transform: translateY(-2px); border-color: var(--brand-200); box-shadow: var(--e-3); }
.metric-value {
  color: var(--brand-ink);
  font-size: 30px;
  font-weight: var(--weight-bold);
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.metric-label { color: var(--muted); font-size: var(--text-sm); font-weight: var(--weight-semibold); }

/* -- Comparison ----------------------------------------------------------- */

.compare-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-md);
}
.compare-row:last-child { border-bottom: 0; }
.compare-row span { overflow-wrap: anywhere; }
.compare-head {
  color: var(--muted);
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* -- Attempt -------------------------------------------------------------- */

.attempt-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.attempt-head .muted { flex: 1 1 100%; margin: 0; font-size: var(--text-sm); }

.attempt-rules { margin: 0; padding-left: var(--sp-5); color: var(--muted); line-height: var(--leading-relaxed); }
.attempt-rules li { margin-bottom: var(--sp-1); }

.question-block { padding: var(--sp-5) 0; border-top: 1px solid var(--line); }
.question-block:first-of-type { border-top: 0; }
.question-block h3 { font-size: var(--text-lg); }

.question-options { display: grid; gap: var(--sp-2); }
.question-options label {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-weight: var(--weight-regular);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.question-options label:hover { border-color: var(--brand-300); background: var(--surface-brand); }
.question-options label:has(:checked) {
  border-color: var(--brand);
  background: var(--surface-brand);
  font-weight: var(--weight-semibold);
}

.question-actions { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-3); }

/* -- Results & tutor ------------------------------------------------------ */

.result-box {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--success-surface);
  color: var(--success-ink);
  line-height: var(--leading-normal);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.tutor-thread { display: grid; gap: var(--sp-3); max-height: 360px; overflow: auto; }
.tutor-turn {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.tutor-turn p { margin: var(--sp-2) 0 0; }
.tutor-learner { background: var(--info-surface); color: var(--info-ink); }
.tutor-reply { background: var(--success-surface); color: var(--success-ink); }

#overview-actions { justify-content: flex-start; margin-top: var(--sp-4); }

/* ==========================================================================
   6. Overlays
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: var(--scrim);
  backdrop-filter: blur(3px);
}
.modal {
  width: min(100%, 30rem);
  max-height: 80vh;
  overflow: auto;
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--e-4);
}
.modal h2 { margin-bottom: var(--sp-3); }
.modal p { margin: 0 0 var(--sp-2); color: var(--ink-soft); white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-3); margin-top: var(--sp-5); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 30;
  padding: var(--sp-3) var(--sp-4);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: var(--weight-semibold);
}
.skip-link:focus { left: 0; }

/* ==========================================================================
   7. Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .dash-primary, .dash-secondary { grid-template-columns: 1fr; }
  .workspace-foot .inner { flex-direction: column; align-items: flex-start; }
  .workspace-foot nav { margin-left: 0; }

  .auth-layout { grid-template-columns: 1fr; max-width: 620px; }
  .hero { padding: 0; }
  .hero h1 { font-size: 46px; }
  .hero-points { margin-top: var(--sp-5); }

  /* minmax(0, …), not a bare 1fr. A bare 1fr is minmax(auto, 1fr), so any item
     with a wide min-content size pushes the track past the viewport and the whole
     page scrolls sideways — measured at 322px inside a 320px viewport. The
     desktop rule above already guards this; the override dropped the guard. */
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar .eyebrow, .sidebar-foot { display: none; }
  .sidebar .select-label { margin: 0; }
  .sidebar select { width: auto; max-width: 210px; }
  .role-badge { margin: 0; }
  .side-nav { display: flex; flex: 1 1 100%; overflow-x: auto; }
  .side-nav button { width: auto; white-space: nowrap; }
  .side-nav button.active::before { display: none; }

  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  :root { --topbar-h: 66px; }

  .usage-grid { grid-template-columns: 1fr; }
  .dash-side .metrics { grid-template-columns: 1fr 1fr; }
  .dash-side .metrics .metric:last-child:nth-child(odd) { grid-column: 1 / -1; }

  .topbar {
    height: auto;
    min-height: 66px;
    flex-wrap: wrap;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-5);
  }
  .topbar-note { display: none; }
  .topnav { margin-left: auto; }
  .topbar .button { margin-left: auto; }
  .account-menu { margin-left: auto; }
  #header-account-name { display: none; }

  .auth-layout { min-height: calc(100vh - 66px); padding: var(--sp-6) var(--sp-5) var(--sp-9); }
  .hero h1 { font-size: 38px; }
  .hero-points { gap: var(--sp-4); font-size: var(--text-2xs); }

  .auth-card, .panel { padding: var(--sp-5); }
  .content { padding: var(--sp-6) var(--sp-4) var(--sp-10); }

  .option-grid { grid-template-columns: 1fr; }

  .item { flex-direction: column; align-items: start; }
  .item-actions { justify-content: start; }

  /* Touch targets: every compact action reaches 44px on a phone. */
  .button.small { min-height: 44px; padding: var(--sp-3) var(--sp-4); }

  .side-nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-1); overflow: visible; }
  .side-nav[data-collapsed="true"] { display: grid; }
  .side-nav button { width: 100%; white-space: normal; }
  .nav-heading { grid-column: 1 / -1; margin: var(--sp-3) 2px 2px; }

  .form-row > label { flex: 1 1 100%; }
  .result-box { max-height: 340px; overflow: auto; }
  .modal { padding: var(--sp-5); }
  .filter-row { max-width: none; }

  .compare-row { grid-template-columns: 1fr; gap: var(--sp-1); }
  .compare-head { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .button:hover:not(:disabled),
  .feature:hover,
  .metric:hover { transform: none; }
}

/* ==========================================================================
   8. Workspace footer
   --------------------------------------------------------------------------
   The signed-in shell had no footer, so the public pages' links back into
   verification and plans were unreachable once a person signed in, and the
   build had nowhere to say what it is.
   ========================================================================== */

.workspace-foot {
  grid-column: 1 / -1;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.workspace-foot .inner {
  width: min(100%, var(--content-max));
  margin: 0 auto;
  padding: var(--sp-5) clamp(18px, 3.5vw, 56px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4);
  color: var(--muted);
  font-size: var(--text-sm);
}
.workspace-foot strong { color: var(--ink-soft); font-weight: var(--weight-semibold); }
.workspace-foot nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.workspace-foot a { color: var(--muted); text-decoration: none; }
.workspace-foot a:hover { color: var(--brand-ink); text-decoration: underline; }
.workspace-foot .foot-note { flex: 1 1 100%; margin: 0; font-size: var(--text-xs); }

/* ==========================================================================
   9. Cohort funnel
   --------------------------------------------------------------------------
   Every bar is a count the analytics endpoint reported, as a share of active
   learners. The count and the share are printed beside each bar, so the width
   is a second reading of the number and never the only one.
   ========================================================================== */

.funnel { display: grid; gap: var(--sp-3); }

.funnel-row {
  display: grid;
  grid-template-columns: minmax(96px, 128px) minmax(0, 1fr) minmax(74px, auto);
  align-items: center;
  gap: var(--sp-3);
}
.funnel-label { color: var(--ink-soft); font-size: var(--text-md); font-weight: var(--weight-semibold); }
.funnel-track {
  height: 12px;
  border-radius: var(--r-pill);
  background: var(--neutral-100);
  overflow: hidden;
}
.funnel-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--brand);
  transition: width var(--dur-base) var(--ease);
}
/* The widest bar is context, not an achievement, so it is quieter. Passing is
   the outcome the product exists to report, so it gets the success colour. */
.funnel-fill.funnel-base { background: var(--line-strong); }
.funnel-fill.funnel-pass { background: var(--success-ink); }
.funnel-value {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.funnel-notes {
  display: grid;
  gap: var(--sp-1);
  margin-top: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
}
.funnel-note { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.funnel-note.warn-note { color: var(--warn-ink); font-weight: var(--weight-semibold); }

@media (max-width: 560px) {
  .funnel-row { grid-template-columns: 1fr auto; row-gap: var(--sp-1); }
  .funnel-track { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .funnel-fill { transition: none; }
}

/* ==========================================================================
   10. Candidate comparison
   ========================================================================== */

.score-cell { display: grid; gap: var(--sp-1); align-content: center; min-width: 0; }
.score-figure {
  color: var(--ink);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
}
.score-bar { height: 7px; margin-top: 0; }
/* Pass and fail are the comparison's point, so the bar carries the outcome
   colour; the pill beside it says the same thing in words. */
.bar-fill.bar-pass { background: var(--success-ink); }
.bar-fill.bar-fail { background: var(--danger-ink); }
.score-absent { color: var(--muted); font-size: var(--text-sm); }

.compare-cell { display: flex; align-items: center; min-width: 0; }

@media (max-width: 560px) {
  .compare-row { grid-template-columns: 1fr; }
  .score-cell { gap: var(--sp-2); }
}

/* ==========================================================================
   11. Released result
   --------------------------------------------------------------------------
   The one screen a learner came for. The score leads; the verdict is in
   words beside it; the topic breakdown is ordered weakest first because its
   purpose is finding where to work, not celebrating what is already done.
   ========================================================================== */

.result-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-5);
  margin: var(--sp-4) 0 var(--sp-6);
  padding: var(--sp-5) var(--sp-6);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-sunk);
}
.result-hero.is-pass { border-left-color: var(--success-ink); background: var(--success-surface); }
.result-hero.is-fail { border-left-color: var(--danger-ink); background: var(--danger-surface); }

.result-figure { display: flex; align-items: baseline; gap: 2px; }
.result-score {
  font-size: clamp(38px, 5vw, 52px);
  font-weight: var(--weight-bold);
  letter-spacing: -.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.result-unit { font-size: var(--text-xl); font-weight: var(--weight-bold); opacity: .65; }
.is-pass .result-score, .is-pass .result-unit { color: var(--success-ink); }
.is-fail .result-score, .is-fail .result-unit { color: var(--danger-ink); }

.result-verdict { display: grid; gap: var(--sp-2); min-width: 0; }
.result-stamps { margin: 0; color: var(--ink-soft); font-size: var(--text-sm); }

.result-section { margin: var(--sp-6) 0 var(--sp-2); }

/* Personal practice: one active question, with history kept secondary. */
.practice-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(260px, 1fr); gap: var(--sp-4); align-items: start; }
.practice-main { display: grid; gap: var(--sp-4); }
.practice-main .section-heading { margin-bottom: 0; }
.practice-context { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-3) 0; border-block: 1px solid var(--line); font-size: var(--text-sm); }
.practice-context span:first-child { color: var(--ink); font-weight: var(--weight-bold); }
.practice-context span:last-child { color: var(--muted); }
.practice-main > label { font-weight: var(--weight-semibold); }
.practice-main fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.practice-main legend { margin-bottom: var(--sp-4); color: var(--ink); font-size: clamp(1.15rem, 2vw, 1.5rem); font-weight: var(--weight-semibold); line-height: 1.35; }
.practice-option { display: flex; gap: var(--sp-3); align-items: flex-start; margin-bottom: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.practice-option:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.practice-option input { margin-top: .2rem; flex: 0 0 auto; }
.practice-feedback { padding: var(--sp-4); border-inline-start: 3px solid var(--accent); background: var(--surface-sunk); }
.practice-feedback p { margin: var(--sp-2) 0 0; }
.practice-history { min-width: 0; }
@media (max-width: 760px) { .practice-layout { grid-template-columns: 1fr; } }

.topic-list { display: grid; gap: var(--sp-4); margin-top: var(--sp-4); }
.topic-row { display: grid; gap: var(--sp-2); }
.topic-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.topic-name { color: var(--ink); font-size: var(--text-md); font-weight: var(--weight-semibold); }
.topic-count {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
}
.topic-bar { height: 8px; margin-top: 0; }
/* A topic answered in full is the success colour; anything with gaps is amber,
   which is where the next attempt should go. The count says the same thing. */
.bar-fill.bar-gap { background: var(--warn-ink); }
.topic-note { margin: 0; color: var(--muted); font-size: var(--text-xs); }

@media (max-width: 560px) {
  .result-hero { padding: var(--sp-4); gap: var(--sp-3); }
}

/* A credential has its own paper hierarchy; the dashboard chrome stays quiet. */
.certificate-paper {
  position: relative;
  width: min(100%, 900px);
  min-height: 500px;
  margin: var(--sp-5) auto 0;
  padding: clamp(28px, 5vw, 62px);
  border: 1px solid var(--credential-rule);
  outline: 8px solid var(--credential-paper);
  outline-offset: -17px;
  background: var(--credential-paper);
  color: var(--credential-ink);
  text-align: center;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .12);
}
.certificate-paper::before {
  content: '';
  position: absolute;
  inset: 16px;
  border: 1px solid var(--credential-rule);
  pointer-events: none;
}
.certificate-paper > * { position: relative; }
.certificate-logo { display: block; max-width: 140px; max-height: 72px; object-fit: contain; margin: 0 auto 22px; }
.certificate-issuer { margin: 0 0 20px; color: var(--credential-seal); font-weight: 700; }
.certificate-heading { margin: 0 0 18px; color: var(--credential-ink); font-family: Georgia, 'Times New Roman', serif; font-size: clamp(30px, 4.3vw, 48px); font-weight: 400; letter-spacing: -.03em; }
.certificate-message { max-width: 58ch; margin: 0 auto 16px; color: var(--credential-muted); }
.certificate-holder { margin: 0 auto 10px; color: var(--credential-ink); font-family: Georgia, 'Times New Roman', serif; font-size: clamp(25px, 3.2vw, 38px); }
.certificate-assessment { margin: 0 auto 36px; font-weight: 700; }
.certificate-footer { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-top: 35px; text-align: left; }
.certificate-date, .certificate-signer { display: grid; gap: 5px; min-width: 130px; border-top: 1px solid var(--credential-rule); padding-top: 8px; }
.certificate-date span { color: var(--credential-muted); font-size: .8rem; }
.certificate-signer img { max-width: 180px; max-height: 58px; object-fit: contain; }
.certificate-code { margin: 36px 0 0; color: var(--credential-muted); font-size: .8rem; overflow-wrap: anywhere; }
.certificate-revoked { margin: 16px 0 0; color: var(--credential-revoked); font-weight: 700; }
.certificate-paper.is-revoked { border-color: var(--credential-revoked); }
@media (max-width: 560px) {
  .certificate-paper { min-height: 0; padding: 36px 28px; }
  .certificate-footer { flex-wrap: wrap; }
}
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body * { visibility: hidden !important; }
  #certificate-display-panel, #certificate-display-panel * { visibility: visible !important; }
  #certificate-display-panel { position: absolute; inset: 0; width: 100%; margin: 0; padding: 0; border: 0; box-shadow: none; }
  #certificate-display-panel > .section-heading { display: none; }
  #certificate-display { width: 100%; min-height: 175mm; margin: 0; box-shadow: none; print-color-adjust: exact; }
}

/* 2026 product surface: a reading-first assessment desk, not a grid of tiles. */
.topbar { gap: var(--sp-5); box-shadow: 0 1px 0 var(--line-soft); }
.topbar-note { font-size: var(--text-sm); letter-spacing: .01em; }
.brand { gap: 10px; letter-spacing: -.055em; }
.brand-mark { border-radius: 10px 10px 10px 3px; font-size: 19px; }
.topnav { align-items: center; gap: var(--sp-6); }
.topnav a { font-size: var(--text-sm); }

.auth-layout { max-width: 1280px; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .75fr); gap: clamp(48px, 7vw, 120px); }
.hero { position: relative; isolation: isolate; padding-bottom: var(--sp-7); }
.hero::before {
  content: ''; position: absolute; z-index: -1; width: min(45vw, 530px); aspect-ratio: 1;
  left: -16%; top: -16%; border-radius: 50%; opacity: .7;
  background: radial-gradient(circle, var(--surface-brand) 0, transparent 69%);
  pointer-events: none;
}
.hero h1 { max-width: 770px; margin: var(--sp-5) 0 var(--sp-6); font-size: clamp(46px, 5.5vw, 76px); line-height: 1.02; letter-spacing: -.065em; }
.hero > p:not(.eyebrow) { max-width: 570px; }
.hero-points { max-width: 540px; justify-content: space-between; gap: var(--sp-3); letter-spacing: .06em; }
.hero .verify-row { max-width: 510px; margin-top: var(--sp-8); padding: var(--sp-5); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.hero .verify-row label { margin-bottom: var(--sp-2); color: var(--ink); }
.auth-card { padding: clamp(28px, 3vw, 46px); border-radius: var(--r-2xl); box-shadow: var(--e-3); }
.auth-card h2 { font-size: var(--text-2xl); }
.auth-card .tabs { margin-bottom: var(--sp-7); }
.auth-card .stack { gap: var(--sp-5); }
.auth-card .button.primary { min-height: 48px; }
.auth-card .inline-link { text-align: left; }

/* Keep account recovery adjacent to the sign-in action, not as two extra rows. */
.auth-recovery-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-2) var(--sp-4); }
.auth-recovery-links .inline-link { font-size: var(--text-sm); }
.auth-layout { padding-block: clamp(20px, 3vh, 32px); gap: clamp(28px, 5vw, 72px); }
.hero { padding-bottom: 0; }
.hero h1 { font-size: clamp(42px, 4.6vw, 64px); margin: var(--sp-3) 0 var(--sp-4); }
.hero .verify-row { margin-top: var(--sp-5); padding: var(--sp-4); }
.auth-card { padding: clamp(22px, 2.3vw, 34px); }
.auth-card .tabs { margin-bottom: var(--sp-4); }
.auth-card .stack { gap: var(--sp-3); }
.auth-card .hint { margin-bottom: var(--sp-4); }
.auth-card .google-signin { margin-top: var(--sp-4); padding-top: var(--sp-4); }

.workspace { min-height: calc(100dvh - var(--topbar-h)); background: linear-gradient(to right, var(--surface-sunk) var(--sidebar-w), var(--canvas) var(--sidebar-w)); }
.sidebar { min-height: calc(100dvh - var(--topbar-h)); padding: var(--sp-7) var(--sp-4) var(--sp-5); background: var(--surface-sunk); }
.sidebar .eyebrow { margin-bottom: var(--sp-5); }
.sidebar .select-label { margin-bottom: var(--sp-2); }
.sidebar select { min-height: 46px; background: var(--surface); }
.role-badge { border-radius: var(--r-sm); letter-spacing: 0; }
.side-nav { gap: 4px; }
.side-nav button { min-height: 43px; padding-left: var(--sp-4); font-weight: var(--weight-medium); }
.side-nav button.active { background: var(--surface); color: var(--ink); box-shadow: var(--e-1); font-weight: var(--weight-bold); }
.side-nav button.active::before { top: 8px; bottom: 8px; height: auto; transform: none; }
.nav-heading { margin-top: var(--sp-7); }
.sidebar-foot { margin-top: var(--sp-8); font-size: var(--text-sm); }
.content { max-width: 1480px; padding-top: clamp(32px, 4vw, 60px); padding-bottom: var(--sp-10); }
.page-head { align-items: center; padding-bottom: var(--sp-6); margin-bottom: var(--sp-7); border-bottom: 1px solid var(--line); }
.page-head .eyebrow { margin-bottom: var(--sp-2); }
.page-head h1 { margin-bottom: 5px; font-size: clamp(30px, 3.2vw, 44px); letter-spacing: -.055em; }
.page-head .muted { max-width: 68ch; }
.page-role-context { display: inline-block; margin: var(--sp-3) 0 0; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--brand-200); border-radius: var(--r-sm); background: var(--surface-brand); color: var(--brand-ink); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.view { gap: var(--sp-6); }
.panel { padding: clamp(24px, 2.5vw, 36px); border-radius: var(--r-lg); box-shadow: var(--e-1); }
.panel h2 { font-size: var(--text-2xl); }
.screen-head { padding-bottom: var(--sp-4); border-bottom: 1px solid var(--line); }
.section-heading { align-items: center; }

#start-view { max-width: 970px; border-top: 4px solid var(--brand); }
#start-view > h2 { max-width: 16ch; font-size: clamp(28px, 3vw, 42px); letter-spacing: -.055em; }
#start-view > .muted { max-width: 62ch; }
.home-role { display: inline-block; margin: var(--sp-3) 0 var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--surface-brand); color: var(--brand-ink); font-size: var(--text-sm); font-weight: var(--weight-bold); }
.home-explore-title { margin-top: var(--sp-6); font-size: var(--text-lg); }
.home-next { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--sp-5); margin-top: var(--sp-6); padding: var(--sp-6); background: var(--surface-brand); border-left: 4px solid var(--brand); border-radius: var(--r-md); }
.home-next h3 { margin: 0 0 var(--sp-2); font-size: clamp(22px, 2.3vw, 31px); letter-spacing: -.04em; }
.home-next .muted { max-width: 60ch; margin: 0; }
.home-kicker { margin: 0 0 var(--sp-2); color: var(--brand-ink); font-size: var(--text-sm); font-weight: var(--weight-bold); }
.home-context { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.home-fact { margin: 0; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: var(--text-sm); }
.home-work { margin-top: var(--sp-6); padding-top: var(--sp-5); border-top: 1px solid var(--line); }
.home-work-heading { display: flex; justify-content: space-between; align-items: end; gap: var(--sp-4); margin-bottom: var(--sp-3); }
.home-work-heading h3 { margin: 0; font-size: var(--text-xl); }
.home-work-heading p { margin: var(--sp-2) 0 0; }
.home-work-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.home-work-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--sp-4); min-height: 86px; padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
.home-work-copy { min-width: 0; }
.home-work-copy strong { display: block; color: var(--ink); font-size: var(--text-md); }
.home-work-copy p { margin: 4px 0 0; line-height: var(--leading-snug); }
.home-work-status { color: var(--ink-soft); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.home-work-empty { margin: 0; padding: var(--sp-5) 0; color: var(--muted); border-bottom: 1px solid var(--line); }
.home-work-action { white-space: nowrap; }
.start-details summary { cursor: pointer; color: var(--brand-ink); font-weight: var(--weight-bold); }
.start-details summary:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.start-details[open] summary { margin-bottom: var(--sp-5); }
.start-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); margin: var(--sp-5) 0 var(--sp-6); }
.start-action {
  position: relative; min-height: 175px; display: flex; flex-direction: column; align-items: flex-start;
  gap: var(--sp-3); padding: var(--sp-5); text-align: left;
  background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: transform var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}
.start-action:hover { transform: translateY(-3px); border-color: var(--brand); background: var(--surface-brand); }
.start-action:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.start-action-number { color: var(--brand-ink); font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: .11em; }
.start-action strong { max-width: 11ch; color: var(--ink); font-size: var(--text-xl); line-height: var(--leading-tight); letter-spacing: -.035em; }
.start-action > span:nth-last-child(2) { max-width: 24ch; color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-snug); }
.start-action-arrow { position: absolute; right: var(--sp-4); top: var(--sp-4); color: var(--brand-ink); font-size: 22px; }
.start-details { padding-top: var(--sp-6); border-top: 1px solid var(--line); }
.start-details h3 { margin-bottom: var(--sp-2); }
.start-details > .muted { max-width: 66ch; }
.onboarding-grid { gap: var(--sp-5); }
.onboarding-path { border-radius: var(--r-md); }

.dash-primary { gap: var(--sp-5); }
.dash-focus { border-top: 4px solid var(--brand); }
.dash-side { background: var(--surface-sunk); box-shadow: none; }
.dash-side .metrics { gap: var(--sp-3); }
#journey-panel { border-top: 4px solid var(--accent); }
.practice-layout { grid-template-columns: minmax(0, 1.8fr) minmax(270px, .85fr); gap: var(--sp-5); }
.practice-main { border-top: 4px solid var(--brand); gap: var(--sp-5); }
.practice-main fieldset { background: transparent; }
.practice-empty { padding: var(--sp-5); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-sunk); }
.practice-empty h3 { margin-bottom: var(--sp-2); font-size: var(--text-xl); }
.practice-empty p { max-width: 55ch; margin-bottom: var(--sp-4); color: var(--muted); }
#app:has(#practice-view:not(.hidden)) .content { padding-bottom: var(--sp-5); }
.practice-generator { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(130px, .6fr); gap: var(--sp-3); padding: var(--sp-5); border-radius: var(--r-md); background: var(--surface-sunk); }
.practice-generator-focus { grid-column: 1 / -1; }
.practice-generator .button { justify-self: start; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.practice-generation-status { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-4); min-height: 92px; padding: var(--sp-4); border: 1px solid var(--brand-200); border-left: 4px solid var(--brand); background: var(--surface-brand); border-radius: var(--r-md); }
.practice-generation-copy strong { display: block; color: var(--ink); font-size: var(--text-md); }
.practice-generation-copy p { margin: 4px 0 0; color: var(--ink-soft); font-size: var(--text-sm); line-height: var(--leading-snug); }
.practice-generation-visual { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; gap: 4px; border-radius: var(--r-sm); background: var(--surface); color: var(--brand-ink); font-weight: var(--weight-bold); }
.practice-generation-visual span { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.practice-generation-status.is-busy .practice-generation-visual span { animation: practice-pulse 1s ease-in-out infinite alternate; }
.practice-generation-status.is-busy .practice-generation-visual span:nth-child(2) { animation-delay: .18s; }
.practice-generation-status.is-busy .practice-generation-visual span:nth-child(3) { animation-delay: .36s; }
.practice-generation-status.is-success { border-color: var(--success-border); border-left-color: var(--success-ink); background: var(--success-surface); }
.practice-generation-status.is-error { border-color: var(--danger-border); border-left-color: var(--danger); background: var(--danger-surface); }
@keyframes practice-pulse { to { transform: translateY(-7px) scale(1.25); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .practice-generation-status.is-busy .practice-generation-visual span { animation: none; } }
@media (max-width: 600px) { .practice-generation-status { grid-template-columns: 40px minmax(0, 1fr); } .practice-generation-status .button { grid-column: 2; justify-self: start; } }
.practice-main .section-heading h2 { font-size: clamp(25px, 2.4vw, 33px); }
.practice-main .section-heading .muted { max-width: 62ch; }
.practice-main legend { font-size: clamp(19px, 2vw, 25px); }
.practice-option { min-height: 54px; align-items: center; background: var(--surface); border-radius: var(--r-sm); transition: background var(--dur-base), border-color var(--dur-base); }
.practice-option:hover, .practice-option:focus-within { border-color: var(--brand); background: var(--surface-brand); }
.practice-history { background: var(--surface-sunk); box-shadow: none; }
.practice-history h3 { margin-top: var(--sp-6); padding-top: var(--sp-5); border-top: 1px solid var(--line); }
.practice-history > input { width: 100%; margin: var(--sp-2) 0 var(--sp-4); }
.practice-question-list { display: grid; gap: var(--sp-2); max-height: 560px; overflow-y: auto; padding-right: var(--sp-2); }
.practice-question-item { display: grid; width: 100%; gap: 4px; padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); text-align: left; }
.practice-question-item:hover, .practice-question-item.selected { border-color: var(--brand); background: var(--surface-brand); }
.practice-question-item.selected { box-shadow: inset 3px 0 0 var(--brand); }
.practice-question-item:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.practice-question-topic, .practice-question-state { color: var(--brand-ink); font-size: var(--text-xs); font-weight: var(--weight-bold); }
.practice-question-preview { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: var(--text-sm); line-height: var(--leading-snug); }
.practice-question-state { color: var(--muted); font-weight: normal; }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: var(--sp-5); }
.account-grid .panel { min-width: 0; }
.account-identity { margin: var(--sp-5) 0; padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface-sunk); overflow-wrap: anywhere; }
.account-identity p { margin: 0; }
.account-identity .account-name { color: var(--ink); font-size: var(--text-xl); font-weight: var(--weight-bold); }
.account-identity .account-email { color: var(--ink-soft); }
.account-identity .account-verification { margin-top: var(--sp-2); color: var(--brand-ink); font-size: var(--text-sm); }
.account-plan { grid-column: 1 / -1; }
#account-plan h3 { margin: var(--sp-5) 0 var(--sp-2); }
#account-plan progress { width: min(100%, 560px); height: 14px; accent-color: var(--brand); }

@media (max-width: 900px) {
  .account-grid { grid-template-columns: 1fr; }
  .auth-layout { grid-template-columns: 1fr; max-width: 740px; gap: var(--sp-5); }
  .hero { padding-bottom: 0; }
  .hero h1 { font-size: clamp(42px, 7vw, 62px); }
  .topbar-note { display: none; }
  .practice-layout { grid-template-columns: 1fr; }
  .workspace { background: var(--canvas); }
  .sidebar { min-height: 0; }
}
@media (max-width: 600px) {
  .platform-metrics { grid-template-columns: 1fr; }
  .home-work-row { grid-template-columns: minmax(0, 1fr) auto; }
  .home-work-copy { grid-column: 1 / -1; }
  .home-work-action { justify-self: end; }
  .auth-layout { padding: var(--sp-7) var(--sp-4); }
  .hero h1 { font-size: clamp(39px, 11vw, 52px); }
  .hero-points { flex-wrap: wrap; }
  .hero .verify-row { padding: var(--sp-4); }
  .auth-card { padding: var(--sp-5); }
  .content { padding: var(--sp-6) var(--sp-4) var(--sp-8); }
  .panel { padding: var(--sp-5); }
  #screen-tabs { flex-wrap: wrap; }
  #screen-tabs .tab { flex: 1 1 140px; min-width: 0; white-space: normal; }
  .start-actions { grid-template-columns: 1fr; }
  .home-next { align-items: stretch; flex-direction: column; }
  .home-next .button { align-self: flex-start; }
  .start-action { min-height: 125px; }
  .practice-generator { grid-template-columns: 1fr; }
  .practice-generator-focus { grid-column: auto; }
}
