/* =============================================================================
   Prep Exames — Global Stylesheet
   Mobile-first, system fonts, CSS custom properties, no framework.
   Design system v2 (Story D.1): tokens below; components at the end of the file.
   ============================================================================= */

/* ─── Design system v2 — token layer (Story D.1) ──────────────────────────────
   Brand = the Moçambique flag, tuned for UI and WCAG AA (docs/design/design-system-v2.md).
   Layer 1: raw palette (--mz-*). Layer 2: semantic v2 tokens (--ds-*).
   Layer 3: the v1 names (--color-*, --radius-*, --shadow-*) aliased to v2, so every
   existing class keeps working and inherits the new look.
   Rules: yellow is never a text colour on light surfaces (use --mz-yellow-700 for text);
   the flag emblem is never drawn — a plain star or book motif is fine.
   ─────────────────────────────────────────────────────────────────────────── */

:root {
  /* Flag green #007168 — primary. 600 is the flag value (5.9:1 on white). */
  --mz-green-50:  #E6F3F1;
  --mz-green-100: #C7E6E2;
  --mz-green-200: #94CFC8;
  --mz-green-300: #5BB3A9;
  --mz-green-400: #2A968B;
  --mz-green-500: #00847A;
  --mz-green-600: #007168;
  --mz-green-700: #005C55;
  --mz-green-800: #004843;
  --mz-green-900: #00302C;

  /* Flag yellow #FCE100 — accent/highlight. 300 is the flag value: backgrounds and
     strokes only. Text in the yellow family uses 700 (6.4:1 on white). */
  --mz-yellow-50:  #FFFBE0;
  --mz-yellow-100: #FFF6B3;
  --mz-yellow-200: #FFEF66;
  --mz-yellow-300: #FCE100;
  --mz-yellow-400: #E5CC00;
  --mz-yellow-500: #C2AC00;
  --mz-yellow-600: #8F7F00;
  --mz-yellow-700: #6B5F00;
  --mz-yellow-800: #4A4200;
  --mz-yellow-900: #2E2900;

  /* Flag red #D21034 — danger / emphasis / alternative CTA. 500 is the flag value. */
  --mz-red-50:  #FDECEF;
  --mz-red-100: #F9CDD5;
  --mz-red-200: #F29AAB;
  --mz-red-300: #E8607A;
  --mz-red-400: #DD3355;
  --mz-red-500: #D21034;
  --mz-red-600: #B30D2C;
  --mz-red-700: #8F0A23;
  --mz-red-800: #6B081A;
  --mz-red-900: #470511;

  /* Flag black → ink; flag white → surfaces. Warm «papel» neutrals, not cold grey. */
  --mz-ink:       #111111;
  --mz-ink-2:     #1C1D1A;
  --mz-white:     #FFFFFF;
  --mz-paper:     #F7F5EF;
  --mz-sand-100:  #EFECE3;
  --mz-sand-200:  #E4E0D5;
  --mz-sand-300:  #CFCABC;
  --mz-stone-500: #6B6F69; /* 4.7:1 on paper — smallest text colour allowed */
  --mz-stone-700: #4F5450; /* 7.1:1 on paper */

  /* Leaf green: «certo» feedback, kept apart from the brand teal so a selected
     option and a correct option never look the same. */
  --mz-leaf-50:  #EAF5EC;
  --mz-leaf-700: #1E7B34;

  /* ── Semantic v2 ── */
  --ds-primary:          var(--mz-green-600);
  --ds-primary-hover:    var(--mz-green-700);
  --ds-primary-soft:     var(--mz-green-50);
  --ds-on-primary:       var(--mz-white);
  --ds-accent:           var(--mz-yellow-300);
  --ds-accent-soft:      var(--mz-yellow-50);
  --ds-accent-ink:       var(--mz-yellow-700);
  --ds-on-accent:        var(--mz-ink);
  --ds-danger:           var(--mz-red-500);
  --ds-danger-hover:     var(--mz-red-600);
  --ds-danger-soft:      var(--mz-red-50);
  --ds-ink:              var(--mz-ink-2);
  --ds-ink-muted:        var(--mz-stone-700);
  --ds-ink-subtle:       var(--mz-stone-500);
  --ds-page:             var(--mz-paper);
  --ds-surface:          var(--mz-white);
  --ds-surface-sunken:   var(--mz-sand-100);
  --ds-line:             var(--mz-sand-200);
  --ds-line-strong:      var(--mz-sand-300);
  --ds-focus:            var(--mz-green-600);

  /* Flag stripe — used as a 3–4 px rule under bars and on the brand mark. */
  --ds-flag-stripe: linear-gradient(90deg,
      var(--mz-green-600) 0 34%, var(--mz-ink) 34% 37%, var(--mz-yellow-300) 37% 63%,
      var(--mz-ink) 63% 66%, var(--mz-red-500) 66% 100%);

  /* Glass: translucent surface + blur. Fallback (no backdrop-filter, or the user asked
     for reduced transparency) = the solid --ds-glass-solid. */
  --ds-glass-bg:        rgb(255 255 255 / .72);
  --ds-glass-bg-strong: rgb(255 255 255 / .86);
  --ds-glass-solid:     var(--mz-white);
  --ds-glass-border:    rgb(255 255 255 / .6);
  --ds-glass-edge:      rgb(17 17 17 / .08);
  --ds-glass-blur:      14px;
  --ds-glass-shadow:    0 1px 0 rgb(255 255 255 / .7) inset, 0 8px 24px -12px rgb(0 48 44 / .28);

  /* Clay: soft 3D — outer drop + inner highlight + inner shade. */
  --ds-radius-clay-sm: 16px;
  --ds-radius-clay:    22px;
  --ds-radius-clay-lg: 28px;
  --ds-clay-shadow:
      0 10px 22px -12px rgb(0 48 44 / .35),
      0 2px 4px -1px rgb(17 17 17 / .06),
      inset 0 2px 0 rgb(255 255 255 / .9),
      inset 0 -3px 0 rgb(17 17 17 / .05);
  --ds-clay-shadow-pressed:
      0 3px 8px -4px rgb(0 48 44 / .3),
      inset 0 2px 4px rgb(17 17 17 / .08);
  /* Clay on a filled (coloured) button: the shade is the darker brand tone. */
  --ds-clay-fill-shadow:
      0 8px 16px -8px rgb(0 48 44 / .55),
      inset 0 2px 0 rgb(255 255 255 / .22),
      inset 0 -4px 0 rgb(0 0 0 / .2);
  --ds-clay-fill-shadow-pressed:
      0 2px 6px -3px rgb(0 48 44 / .5),
      inset 0 3px 6px rgb(0 0 0 / .22);

  /* Motion */
  --ds-ease-out:    cubic-bezier(.2, .8, .2, 1);
  --ds-ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --ds-dur-fast:    120ms;
  --ds-dur-base:    200ms;
  --ds-dur-slow:    360ms;
  --ds-dur-liquid:  14s;

  /* ── v1 names, aliased to v2 (keep every existing class working) ── */
  /* Brand colours */
  --color-primary:       var(--ds-primary);
  --color-primary-dark:  var(--ds-primary-hover);
  --color-primary-light: var(--mz-green-400);
  --color-secondary:     var(--mz-leaf-700);
  --color-secondary-strong: var(--mz-leaf-700);
  --color-accent:        var(--ds-accent);
  /* v1 used accent-dark as a text colour (upgrade links, gate price): text-safe yellow. */
  --color-accent-dark:   var(--ds-accent-ink);

  /* Semantic colours */
  --color-success:       var(--mz-leaf-700);
  --color-success-bg:    var(--mz-leaf-50);
  --color-warning:       #C27803;
  --color-warning-bg:    var(--mz-yellow-50);
  --color-warning-text:  #92400E; /* AA text on white/warning-bg; #C27803 is 3.5:1 */
  --color-danger:        var(--ds-danger);
  --color-danger-bg:     var(--ds-danger-soft);
  --color-info:          var(--ds-primary);
  --color-info-bg:       var(--ds-primary-soft);

  /* Surface */
  --color-bg:            var(--ds-page);
  --color-surface:       var(--ds-surface);
  --color-surface-2:     var(--mz-sand-100);
  --color-surface-3:     var(--mz-sand-200);

  /* Text */
  --color-text:          var(--ds-ink);
  --color-text-muted:    var(--ds-ink-muted);
  --color-text-light:    var(--ds-ink-subtle); /* v1 #9CA3AF was 2.5:1; now 4.7:1 */
  --color-text-inverse:  #FFFFFF;

  /* Border */
  --color-border:        var(--ds-line);
  --color-border-focus:  var(--ds-focus);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo,
               Consolas, monospace;

  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   0.875rem;  /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg:   1.125rem;  /* 18px */
  --text-xl:   1.25rem;   /* 20px */
  --text-2xl:  1.5rem;    /* 24px */
  --text-3xl:  1.875rem;  /* 30px */
  --text-4xl:  2.25rem;   /* 36px */

  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Spacing scale (4px base) */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Radii (v1 scale kept; clay radii above) */
  --radius-sm:   0.375rem;
  --radius-md:   0.75rem;
  --radius-lg:   1rem;
  --radius-xl:   var(--ds-radius-clay);
  --radius-2xl:  var(--ds-radius-clay-lg);
  --radius-full: 9999px;

  /* Shadows (warm, teal-tinted instead of flat grey) */
  --shadow-sm:  0 1px 2px 0 rgb(0 48 44 / .06);
  --shadow-md:  0 6px 14px -6px rgb(0 48 44 / .18), 0 2px 4px -2px rgb(17 17 17 / .06);
  --shadow-lg:  0 16px 32px -14px rgb(0 48 44 / .3), 0 4px 8px -4px rgb(17 17 17 / .08);

  /* Layout */
  --navbar-height: 56px;
  --sidebar-width: 240px;
  --container-max: 1140px;
  --container-pad: var(--space-4);

  /* Transitions */
  --transition-fast:   var(--ds-dur-fast) ease;
  --transition-base:   var(--ds-dur-base) ease;
  --transition-slow:   var(--ds-dur-slow) ease;
}

/* Dark mode: the v1 block used an invalid selector list and never applied; removed in D.2
   (shell budget). A real v2 dark theme is an open owner decision (docs/design/design-system-v2.md). */

/* ─── Reset ─────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* D.1 «liquid» page backdrop: two soft flag-colour pools fixed behind every page.
   Pure CSS, one composited layer, no images. Drawn on a pseudo-element so it never
   sits behind text inside a component (components keep solid/glass surfaces).
   Pages that set their own background (practice, sims) simply cover it. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42rem 28rem at 108% -6%, rgb(0 113 104 / .13), transparent 62%),
    radial-gradient(30rem 22rem at -12% 104%, rgb(252 225 0 / .16), transparent 64%),
    radial-gradient(18rem 14rem at 96% 98%, rgb(210 16 52 / .06), transparent 70%);
}

img, video, svg { display: block; max-width: 100%; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
ul, ol { list-style: none; }

/* ─── Utilities ──────────────────────────────────────────────────────────────── */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: 1.5px solid transparent;
  /* D.1 clay: soft rounded, tactile. Filled variants add --ds-clay-fill-shadow. */
  border-radius: var(--ds-radius-clay-sm);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast),
              transform var(--transition-fast), box-shadow var(--transition-fast);
  user-select: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
  outline: 3px solid var(--color-border-focus);
  outline-offset: 2px;
}

.btn:active { transform: translateY(2px); }

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Variants */
.btn--primary {
  background: var(--ds-primary);
  color: var(--ds-on-primary);
  border-color: var(--ds-primary);
  box-shadow: var(--ds-clay-fill-shadow);
}
.btn--primary:hover {
  background: var(--ds-primary-hover);
  border-color: var(--ds-primary-hover);
  text-decoration: none;
}
.btn--primary:active { box-shadow: var(--ds-clay-fill-shadow-pressed); }

/* D.1: secondary = white clay with ink text (was a second green fill, which competed
   with the green primary). 15.5:1 ink on white. */
.btn--secondary {
  background: var(--ds-surface);
  color: var(--ds-ink);
  border-color: var(--ds-line);
  box-shadow: var(--ds-clay-shadow);
}
.btn--secondary:hover { border-color: var(--ds-line-strong); background: var(--ds-surface); text-decoration: none; }
.btn--secondary:active { box-shadow: var(--ds-clay-shadow-pressed); }

.btn--accent {
  background: var(--ds-accent);
  color: var(--ds-on-accent);
  border-color: var(--mz-yellow-400);
  box-shadow: 0 8px 16px -8px rgb(143 127 0 / .6), inset 0 2px 0 rgb(255 255 255 / .5), inset 0 -4px 0 rgb(0 0 0 / .1);
}
.btn--accent:hover { background: var(--mz-yellow-400); text-decoration: none; }
.btn--accent:active { box-shadow: inset 0 3px 6px rgb(0 0 0 / .15); }

.btn--ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn--ghost:hover {
  background: var(--color-surface-2);
  text-decoration: none;
}

.btn--outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn--outline:hover { background: var(--color-info-bg); text-decoration: none; }

.btn--danger {
  background: var(--ds-danger);
  color: var(--color-text-inverse);
  border-color: var(--ds-danger);
  box-shadow: 0 8px 16px -8px rgb(143 10 35 / .55), inset 0 2px 0 rgb(255 255 255 / .2), inset 0 -4px 0 rgb(0 0 0 / .2);
}
.btn--danger:hover { background: var(--ds-danger-hover); border-color: var(--ds-danger-hover); text-decoration: none; }
.btn--danger:active { box-shadow: var(--ds-clay-fill-shadow-pressed); }

/* Sizes */
.btn--sm  { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
.btn--lg  { padding: var(--space-4) var(--space-8); font-size: var(--text-lg); }
.btn--block { width: 100%; }

/* ─── Navbar ──────────────────────────────────────────────────────────────────── */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--navbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding-inline: var(--space-4);
  max-width: var(--container-max);
  margin-inline: auto;
  gap: var(--space-3);
}

.navbar-left, .navbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-text);
  font-weight: var(--font-bold);
}

.navbar-brand-name {
  font-size: var(--text-base);
  letter-spacing: -0.01em;
}

@media (max-width: 480px) { .navbar-brand-name { display: none; } }

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.hamburger:focus-visible {
  outline: 3px solid var(--color-border-focus);
  outline-offset: 2px;
}
.hamburger-bar {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: var(--radius-full);
  transition: transform var(--transition-base), opacity var(--transition-base);
}
.hamburger.is-open .hamburger-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-open .hamburger-bar:nth-child(2) { opacity: 0; }
.hamburger.is-open .hamburger-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Classe badge */
.classe-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  background: var(--color-info-bg);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  white-space: nowrap;
}

/* Tier badge */
.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}
.tier-badge--premium {
  /* D.1: flag yellow with ink text (14.3:1) + a small CSS star — no emoji. */
  gap: 0.3em;
  background: var(--ds-accent);
  color: var(--ds-on-accent);
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / .12);
}
.tier-badge--premium::before {
  content: '';
  width: 0.8em;
  height: 0.8em;
  background: currentColor;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* User avatar */
.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-full);
  border: none;
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
  cursor: pointer;
}

/* User dropdown */
.user-menu { position: relative; }
.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}
.user-dropdown[hidden] { display: none; }

.dropdown-header { padding: var(--space-3) var(--space-4); }
.dropdown-nome { font-weight: var(--font-semibold); font-size: var(--text-sm); }
.dropdown-email { color: var(--color-text-muted); font-size: var(--text-xs); }
.dropdown-divider { border: none; border-top: 1px solid var(--color-border); }
.dropdown-item {
  display: block;
  padding: var(--space-3) var(--space-4);
  color: var(--color-text);
  font-size: var(--text-sm);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast);
}
.dropdown-item:hover { background: var(--color-surface-2); text-decoration: none; }
.dropdown-item--upgrade { color: var(--color-accent-dark); font-weight: var(--font-semibold); }
.dropdown-item--danger { color: var(--color-danger); }

/* Navbar auth links */
.navbar-auth-links { display: flex; align-items: center; gap: var(--space-2); }

/* ─── App Shell (sidebar + main) ─────────────────────────────────────────────── */

.layout-app { background: var(--color-bg); }

.app-shell {
  display: flex;
  min-height: calc(100dvh - var(--navbar-height));
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--navbar-height);
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
  z-index: 90;
  overscroll-behavior: contain;
}

.sidebar.is-open { transform: translateX(0); }

@media (min-width: 768px) {
  .sidebar {
    position: sticky;
    transform: translateX(0);
    flex-shrink: 0;
  }
  .sidebar-overlay { display: none !important; }
  .hamburger { display: none; }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / .4);
  z-index: 80;
}
.sidebar-overlay.is-visible { display: block; }

.sidebar-nav { padding: var(--space-4) var(--space-2); }
.sidebar-section {
  margin-bottom: var(--space-6);
}
.sidebar-section--bottom {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.sidebar-label {
  display: block;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
  margin-bottom: var(--space-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: background var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
}
.sidebar-link:hover { background: var(--color-surface-2); color: var(--color-text); text-decoration: none; }
.sidebar-link.is-active {
  background: var(--color-info-bg);
  color: var(--color-primary);
  font-weight: var(--font-semibold);
}
.sidebar-link--upgrade { color: var(--color-accent-dark); }
.sidebar-link--upgrade:hover { background: var(--color-warning-bg); }

.sidebar-icon { font-size: 1rem; flex-shrink: 0; }

/* App main */
.app-main {
  flex: 1;
  min-width: 0;
  padding: var(--space-6) var(--space-4);
}

@media (min-width: 768px) {
  .app-main { padding: var(--space-8) var(--space-6); }
}

/* ─── Cards ──────────────────────────────────────────────────────────────────── */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.card--elevated { box-shadow: var(--shadow-md); }

/* ─── Question Card ───────────────────────────────────────────────────────────── */

.question-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.question-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
}

.question-card__disciplina {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
}

.question-card__progress {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.question-card__body { padding: var(--space-5) var(--space-5) var(--space-3); }

.question-card__text {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text);
}

/* Options */
.question-card__form { padding: 0 var(--space-5) var(--space-5); }
.options-fieldset { border: none; }
.options-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.option-label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  position: relative;
}
.option-label:hover { border-color: var(--color-primary); background: var(--color-info-bg); }

.option-label.is-selected { border-color: var(--color-primary); background: var(--color-info-bg); }
.option-label.is-correct  { border-color: var(--color-success); background: var(--color-success-bg); }
.option-label.is-wrong    { border-color: var(--color-danger);  background: var(--color-danger-bg); }

.option-key {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
  color: var(--color-text);
}
.is-selected .option-key { background: var(--color-primary); color: #fff; }
.is-correct .option-key  { background: var(--color-success); color: #fff; }
.is-wrong .option-key    { background: var(--color-danger);  color: #fff; }

.option-text { flex: 1; font-size: var(--text-sm); line-height: 1.5; }

.option-indicator {
  flex-shrink: 0;
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
}
.option-indicator--correct { color: var(--color-success); }
.option-indicator--wrong   { color: var(--color-danger); }

.question-card__actions { margin-top: var(--space-4); }
.question-card__open-ended { padding: var(--space-5); }
.open-ended-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

/* ─── Answer Reveal ───────────────────────────────────────────────────────────── */

.answer-reveal {
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-top: var(--space-4);
}

.answer-reveal--correct {
  background: var(--color-success-bg);
  border: 1.5px solid var(--color-success);
}
.answer-reveal--wrong {
  background: var(--color-danger-bg);
  border: 1.5px solid var(--color-danger);
}

.answer-reveal__result {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.answer-reveal__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  flex-shrink: 0;
}
.answer-reveal--correct .answer-reveal__icon { background: var(--color-success); color: #fff; }
.answer-reveal--wrong   .answer-reveal__icon { background: var(--color-danger);  color: #fff; }

.answer-reveal__verdict-title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-1);
}
.answer-reveal--correct .answer-reveal__verdict-title { color: var(--color-success); }
.answer-reveal--wrong   .answer-reveal__verdict-title { color: var(--color-danger); }

.answer-reveal__chose { font-size: var(--text-sm); color: var(--color-text-muted); }
.answer-reveal__correct-answer { font-size: var(--text-sm); margin-top: var(--space-1); }
.answer-reveal__correct-key { color: var(--color-success); }
.answer-reveal__correct-text { color: var(--color-text-muted); }

/* Explanation toggle */
.explanation-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: background var(--transition-fast);
  text-align: left;
}
.explanation-toggle:hover { background: var(--color-surface-2); }
.explanation-toggle__chevron { margin-left: auto; transition: transform var(--transition-base); }
.explanation-toggle[aria-expanded="true"] .explanation-toggle__chevron { transform: rotate(180deg); }

.explanation-body {
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.explanation-body[hidden] { display: none; }
.explanation-body__text { font-size: var(--text-sm); line-height: 1.7; }
.explanation-body__credit { margin-top: var(--space-3); color: var(--color-text-light); }

/* FSRS rating */
.fsrs-rating { margin-top: var(--space-4); }
.fsrs-rating__label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
}
.fsrs-rating__buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}
.fsrs-btn {
  padding: var(--space-3) var(--space-2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.fsrs-btn--1 { color: var(--color-danger); }
.fsrs-btn--1:hover { border-color: var(--color-danger); background: var(--color-danger-bg); }
.fsrs-btn--2 { color: var(--color-warning-text); }
.fsrs-btn--2:hover { border-color: var(--color-warning); background: var(--color-warning-bg); }
.fsrs-btn--3 { color: var(--color-secondary); }
.fsrs-btn--3:hover { border-color: var(--color-secondary); background: var(--color-success-bg); }
.fsrs-btn--4 { color: var(--color-primary); }
.fsrs-btn--4:hover { border-color: var(--color-primary); background: var(--color-info-bg); }

.answer-reveal__nav {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}
.answer-reveal__gate { margin-top: var(--space-4); }

/* ─── Progress Ring ───────────────────────────────────────────────────────────── */

.progress-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.progress-ring__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
  max-width: 70px;
  line-height: 1.3;
}
.progress-ring-link {
  text-decoration: none;
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  transition: background var(--transition-fast);
}
.progress-ring-link:hover { background: var(--color-surface-2); }

.ring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: var(--space-4);
}

/* Achievement tile (.badge), loading skeleton and the full-screen FreemiumGate are not used by any
   page today: their rules live in /public/css/components-extra.css (D.2, offline shell budget). */

/* Inline badge */
.inline-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}
.inline-badge--default { background: var(--color-surface-3); color: var(--color-text-muted); }
.inline-badge--success { background: var(--color-success-bg); color: var(--color-success); }
.inline-badge--warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.inline-badge--danger  { background: var(--color-danger-bg);  color: var(--color-danger); }
.inline-badge--info    { background: var(--color-info-bg);    color: var(--color-primary); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

/* Gate teaser */
.gate-teaser {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
}
.gate-teaser__lock  { font-size: var(--text-lg); }
.gate-teaser__message { flex: 1; font-size: var(--text-sm); color: var(--color-text); }
.gate-teaser__cta { flex-shrink: 0; }

/* ─── Forms ──────────────────────────────────────────────────────────────────── */

.form-field { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }
.form-field--checkbox { flex-direction: row; align-items: flex-start; gap: var(--space-2); }

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}
.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-1);
}

.form-required { color: var(--color-danger); }

.form-input, .form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}
.form-input::placeholder { color: var(--color-text-light); }
.form-field.is-error .form-input,
.form-field.is-error .form-select { border-color: var(--color-danger); }

.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%236B7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right var(--space-3) center; padding-right: var(--space-8); }

.form-input-wrapper { position: relative; }
.form-input-wrapper .form-input { padding-right: 2.75rem; }
.form-input-toggle {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-base);
  line-height: 1;
}

.form-hint { font-size: var(--text-xs); color: var(--color-text-muted); }
.form-error { font-size: var(--text-xs); color: var(--color-danger); }
.form-link  { color: var(--color-primary); font-weight: var(--font-medium); }
.form-link--sm { font-size: var(--text-sm); }
.form-checkbox { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; accent-color: var(--color-primary); }
.form-checkbox-label { display: flex; align-items: flex-start; gap: var(--space-2); font-size: var(--text-sm); cursor: pointer; }

/* ─── Alerts ──────────────────────────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}
.alert--danger  { background: var(--color-danger-bg);  color: var(--color-danger); border: 1px solid var(--color-danger); }
.alert--success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success); }
.alert--warning { background: var(--color-warning-bg); color: var(--color-warning-text); border: 1px solid var(--color-warning); }
.alert__icon { flex-shrink: 0; font-size: var(--text-base); }

/* ─── Auth Layout ─────────────────────────────────────────────────────────────── */

.layout-auth { background: var(--color-bg); }

.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100dvh;
  padding: var(--space-8) var(--space-4) var(--space-12);
}

.auth-brand {
  text-align: center;
  margin-bottom: var(--space-6);
}
.brand-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}
.brand-logo { display: block; }
.brand-name {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-text);
}
.brand-tagline {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}

.auth-form-wrapper {}
.auth-title { font-size: var(--text-2xl); font-weight: var(--font-bold); margin-bottom: var(--space-1); }
.auth-subtitle { font-size: var(--text-sm); color: var(--color-text-muted); margin-bottom: var(--space-6); }
.auth-form { margin-bottom: var(--space-4); }
.auth-alt-link { font-size: var(--text-sm); text-align: center; color: var(--color-text-muted); }
.auth-demo-note { font-size: var(--text-sm); text-align: center; color: var(--color-text-muted); }
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted); /* A.7 axe: --color-text-light is 2.5:1 */
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--color-border);
}
.auth-footer {
  margin-top: var(--space-8);
  font-size: var(--text-xs);
  color: var(--color-text-muted); /* A.7 axe: --color-text-light is 2.4:1 */
  text-align: center;
}
.auth-footer a { color: var(--color-text-muted); }
/* A.7 axe (link-in-text-block): links inside running text must not rely on colour alone. */
.resultado-lacunas a { text-decoration: underline; }

/* ─── Landing Page (D.2: landing-only rules live in /public/css/landing.css) ─── */

/* Sections */
.section { padding: var(--space-16) 0; }
.section--alt { background: var(--color-surface); }

.section-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  text-align: center;
  margin-bottom: var(--space-3);
  letter-spacing: -0.01em;
}
@media (min-width: 640px) { .section-title { font-size: var(--text-3xl); } }



/* Footer */
.site-footer {
  padding: var(--space-8) 0;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.footer-brand { font-size: var(--text-sm); color: var(--color-text-muted); }
.footer-links { display: flex; gap: var(--space-5); flex-wrap: wrap; }
.footer-links a { font-size: var(--text-sm); color: var(--color-text-muted); }
.footer-links a:hover { color: var(--color-text); }

/* ─── Focus visible (global) ──────────────────────────────────────────────────── */

:focus-visible {
  outline: 3px solid var(--color-border-focus);
  outline-offset: 2px;
}

/* Smooth scrolling only when the user has not asked for reduced motion (UX §9.1). */
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* ======================================================================
   Practice v2 (A.2) — card states, steps, chips, bottom sheet, badges, ficha,
   «Conceitos a rever», report page, admin review queue (A.4).
   Amber (#C27803) is used for borders only; text uses --color-warning-text.
   ============================================================================= */
.practice-body { background: var(--color-bg); }
.session-bar { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.session-bar__exit { min-height: 44px; display: inline-flex; align-items: center; font-weight: var(--font-semibold); color: var(--color-text); }
.session-bar__meta { flex: 1; font-size: var(--text-sm); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-bar__count { font-size: var(--text-sm); font-weight: var(--font-semibold); }
.session-progress { height: 4px; background: var(--color-surface-3); }
.session-progress__fill { display: block; height: 100%; background: var(--color-primary); }
.practice-main { padding-top: var(--space-4); padding-bottom: var(--space-12); max-width: 42rem; }
.practice-card { margin-bottom: var(--space-4); }
.practice-card .question-card__text { font-size: 1.0625rem; line-height: 1.5; }
.card-meta { font-size: var(--text-sm); color: var(--color-text-muted); margin-bottom: var(--space-2); }
.option-radio:focus-visible + .option-key { outline: 3px solid var(--color-border-focus); outline-offset: 2px; }
.option-label { min-height: 48px; }
.option-label:has(.option-radio:checked) { border-color: var(--color-primary); background: var(--color-info-bg); }
.options-list--readonly { list-style: none; padding: 0; }
.options-list--readonly .option-label { cursor: default; }
.options-list--readonly .option-label:hover { background: transparent; border-color: var(--color-border); }
.options-list--readonly .option-label.is-correct { border-color: var(--color-success); background: var(--color-success-bg); }
.options-list--readonly .option-label.is-wrong { border-color: var(--color-danger); background: var(--color-danger-bg); }
.texto-base { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3); margin-bottom: var(--space-3); background: var(--color-surface-2); }
.texto-base summary { cursor: pointer; font-weight: var(--font-semibold); min-height: 32px; }
.texto-base__body { white-space: pre-line; font-size: var(--text-sm); margin-top: var(--space-2); }
.open-answer { margin-bottom: var(--space-4); }
.report-link { margin: var(--space-3) 0; font-size: var(--text-sm); }
.report-link a { color: var(--color-text-muted); display: inline-flex; min-height: 44px; align-items: center; }
.card-actions { display: flex; flex-direction: column; gap: var(--space-3); margin: var(--space-4) 0; }
.btn { min-height: 48px; }

/* Figures */
.figure-block { margin: var(--space-3) 0; }
.figure-block__img { display: block; max-width: 100%; max-height: 60vh; height: auto; margin: 0 auto; border-radius: var(--radius-sm); background: var(--color-surface-2); }
.figure-block__caption { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-2); }
.figure-block__desc summary { cursor: pointer; min-height: 32px; }
.step .figure-block__img { max-height: 50vh; }

/* Verdict + distractor */
.verdict { border-radius: var(--radius-lg); padding: var(--space-4); margin-bottom: var(--space-3); background: var(--color-surface); border: 2px solid var(--color-border); }
.verdict:focus { outline: 3px solid var(--color-border-focus); outline-offset: 2px; }
.verdict--correct { border-color: var(--color-success); background: var(--color-success-bg); }
.verdict--wrong { border-color: var(--color-danger); background: var(--color-danger-bg); }
.verdict__title { font-size: var(--text-xl); font-weight: var(--font-bold); margin-bottom: var(--space-2); }
.verdict--correct .verdict__title { color: var(--color-success); }
.verdict--wrong .verdict__title { color: var(--color-danger); }
.distractor { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.distractor__title { font-size: var(--text-base); font-weight: var(--font-semibold); margin-bottom: var(--space-1); }
.criterios { border: none; margin-top: var(--space-3); }
.criterios legend { font-weight: var(--font-semibold); }
.criterios__item { display: flex; gap: var(--space-2); min-height: 44px; align-items: center; }
.legacy-expl { margin: var(--space-3) 0; }

/* Trust badges */
.trust-row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-2) 0 var(--space-3); }
.trust-badge { font-size: var(--text-xs); }
.trust-badge__label { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-full); cursor: pointer; list-style: none; font-weight: var(--font-semibold); border: 1.5px solid transparent; }
.trust-badge__label::-webkit-details-marker { display: none; }
.trust-badge--oficial .trust-badge__label, .trust-badge--professor .trust-badge__label { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success); }
.trust-badge--documento .trust-badge__label, .trust-badge--ia-conteudo .trust-badge__label { background: var(--color-info-bg); color: var(--color-primary); border-color: var(--color-info-bg); }
.trust-badge--ia-gabarito .trust-badge__label { background: var(--color-surface); color: var(--color-text); border-color: var(--color-warning); }
/* K.14: AI model answer of an open-answer practice item — amber border like the IA key, never «oficial» */
.trust-badge--ia-modelo .trust-badge__label { background: var(--color-surface); color: var(--color-text); border-color: var(--color-warning); }
.open-practice__answer { width: 100%; min-height: 8rem; margin-top: var(--space-3); }
.open-practice__reveal { margin-top: var(--space-3); }
.open-practice__reveal > summary { cursor: pointer; }
.open-practice__rate { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-3); }
.open-practice__rate button { flex: 1 1 8rem; min-height: 44px; }
.disc-picker-open { display: block; margin-top: var(--space-2); text-align: center; }
.trust-badge__text { max-width: 36rem; margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-text); }

/* Steps */
.steps { margin: var(--space-4) 0; }
.steps__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-3); }
.steps__title { font-size: var(--text-lg); font-weight: var(--font-bold); }
.steps__counter { font-size: var(--text-sm); color: var(--color-text-muted); }
.steps__list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.step { background: var(--color-surface); border: 1.5px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.step[hidden] { display: none; }
.step--newest { border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.step__title { font-size: var(--text-base); font-weight: var(--font-semibold); display: flex; gap: var(--space-2); align-items: baseline; }
.step__title:focus { outline: 3px solid var(--color-border-focus); outline-offset: 2px; }
.step__n { display: inline-flex; justify-content: center; align-items: center; min-width: 1.75rem; height: 1.75rem; border-radius: var(--radius-full); background: var(--color-info-bg); color: var(--color-primary); font-size: var(--text-sm); }
.step__detalhe { margin-top: var(--space-2); }
.step__erro { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-warning-text); background: var(--color-warning-bg); border: 2px solid var(--color-warning); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); }
.eq { margin: var(--space-2) 0; }
.eq--block { overflow-x: auto; }
.eq code { font-family: var(--font-mono); font-size: 0.95rem; white-space: pre-wrap; }
.steps__final { margin-top: var(--space-3); font-weight: var(--font-semibold); color: var(--color-success); }
.steps__nav { display: flex; gap: var(--space-3); margin-top: var(--space-3); }
.steps__nav .btn { flex: 1; }
.steps__final[hidden], .steps__nav [hidden], .steps__links [hidden] { display: none; }
.steps__links { display: flex; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-2); font-size: var(--text-sm); }
.steps__links a { min-height: 44px; display: inline-flex; align-items: center; }
.steps .gate-teaser { margin-top: var(--space-3); }

/* Concept chips */
.chip-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.concept-chip { display: inline-flex; align-items: center; min-height: 44px; padding: var(--space-1) var(--space-3); border: 1.5px solid var(--color-primary); border-radius: var(--radius-full); font-size: var(--text-sm); color: var(--color-primary); background: var(--color-surface); text-decoration: none; }
.concept-chip:hover { background: var(--color-info-bg); text-decoration: none; }
.concept-chip--mastered { border-color: var(--color-success); color: var(--color-success); }
.chip-list__more { align-self: center; font-size: var(--text-sm); color: var(--color-text-muted); }

/* Bottom sheet */
.sheet[hidden] { display: none; }
.sheet { position: fixed; inset: 0; z-index: 100; }
.sheet__backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / .45); }
.sheet__panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 70vh; overflow-y: auto; background: var(--color-surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: var(--space-4) var(--space-4) var(--space-6); box-shadow: 0 -4px 12px rgb(0 0 0 / .15); animation: sheet-in .15s ease-out; }
.sheet__handle { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--color-border); margin: 0 auto var(--space-3); }
.sheet__x { position: absolute; top: var(--space-2); right: var(--space-2); width: 44px; height: 44px; border: none; background: transparent; font-size: var(--text-lg); cursor: pointer; color: var(--color-text); }
.sheet__title { font-size: var(--text-lg); font-weight: var(--font-bold); padding-right: 44px; }
.sheet__meta { font-size: var(--text-sm); color: var(--color-text-muted); display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: var(--space-1) 0 var(--space-3); }
.sheet__resumo { margin-bottom: var(--space-3); }
.sheet__prereq { margin-bottom: var(--space-3); display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.sheet__body .btn { margin-top: var(--space-2); }
.sheet__prev { border: none; background: none; color: var(--color-primary); min-height: 44px; cursor: pointer; }
body.sheet-open { overflow: hidden; }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .sheet__panel { animation: none; } }

/* Ficha + return bar */
.ficha-body { background: var(--color-surface); }
.return-bar { position: sticky; top: 0; z-index: 50; background: var(--color-info-bg); border-bottom: 1px solid var(--color-border); }
.return-bar a { display: flex; align-items: center; min-height: 48px; padding: 0 var(--space-4); font-weight: var(--font-semibold); }
.ficha { max-width: 42rem; padding-top: var(--space-4); padding-bottom: var(--space-12); }
.ficha .section-title { text-align: left; font-size: var(--text-lg); margin: var(--space-6) 0 var(--space-2); }
.ficha p, .ficha li { line-height: 1.6; max-width: 65ch; }
.ficha ul, .ficha ol { padding-left: var(--space-5); }
.ficha__crumb { font-size: var(--text-sm); color: var(--color-text-muted); }
.ficha__title { font-size: var(--text-2xl); font-weight: var(--font-bold); margin: var(--space-2) 0; }
.ficha__badges { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.ficha__prereq { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: var(--space-3) 0; }
.ficha__resumo { background: var(--color-info-bg); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin: var(--space-3) 0; }
.ficha__fontes { margin-top: var(--space-8); padding-top: var(--space-4); border-top: 1px solid var(--color-border); font-size: var(--text-sm); }

/* Conceitos a rever + mastery dot */
.ctr { margin: var(--space-6) 0; }
.ctr .section-title { text-align: left; font-size: var(--text-lg); }
.ctr__helper, .ctr__empty { font-size: var(--text-sm); color: var(--color-text-muted); margin-bottom: var(--space-3); }
.ctr__list { list-style: none; padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.ctr__item + .ctr__item { border-top: 1px solid var(--color-border); }
.ctr__link { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); min-height: 56px; color: var(--color-text); text-decoration: none; }
.ctr__n { font-weight: var(--font-bold); color: var(--color-text-muted); }
.ctr__body { flex: 1; display: flex; flex-direction: column; }
.ctr__titulo { font-weight: var(--font-semibold); }
.ctr__motivo { font-size: var(--text-sm); color: var(--color-text-muted); }
.ctr__more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.mastery-dot { display: inline-block; width: 1rem; text-align: center; color: var(--color-primary); }

/* Report + admin */
.report-form__tipos { border: none; margin-bottom: var(--space-3); }
.report-form__tipos legend { font-weight: var(--font-semibold); margin-bottom: var(--space-2); }
.report-form__tipo { display: flex; gap: var(--space-2); align-items: center; min-height: 48px; }
.admin-main { max-width: 64rem; padding-top: var(--space-4); padding-bottom: var(--space-12); }
.admin-filters { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; margin: var(--space-3) 0; }
.admin-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); background: var(--color-surface); }
.admin-table th, .admin-table td { text-align: left; padding: var(--space-2); border-bottom: 1px solid var(--color-border); vertical-align: top; }
.admin-pages { display: flex; gap: var(--space-4); margin-top: var(--space-3); }
.admin-alvo { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin: var(--space-3) 0; }
.admin-json, .admin-nota { font-family: var(--font-mono); font-size: var(--text-xs); white-space: pre-wrap; overflow-x: auto; }
.admin-decision { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin: var(--space-3) 0; display: flex; flex-direction: column; gap: var(--space-2); }
.admin-audit { font-size: var(--text-sm); padding-left: var(--space-5); }
.admin-logout { margin-left: auto; }

/* ==========================================================================
   Content browser, ficha extras, search (A.3) and mock exams (A.5)
   ========================================================================== */
.site-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-4); background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.site-bar__brand { font-weight: var(--font-bold); color: var(--color-primary); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.site-bar__nav { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.site-bar__nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 var(--space-2); font-size: var(--text-sm); color: var(--color-text); text-decoration: none; }
.site-bar__nav a[aria-current="page"] { color: var(--color-primary); font-weight: var(--font-semibold); }
.browse { max-width: 42rem; padding-top: var(--space-4); padding-bottom: var(--space-12); }
.browse__title { font-size: var(--text-2xl); font-weight: var(--font-bold); margin: var(--space-2) 0 var(--space-3); }
.browse__count, .browse__hint, .browse__jump { font-size: var(--text-sm); color: var(--color-text-muted); margin: var(--space-2) 0; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; font-size: var(--text-sm); color: var(--color-text-muted); }
.crumbs li { display: inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14rem; }
.crumbs a { color: var(--color-text-muted); }
.search-form { margin: var(--space-3) 0; }
.search-form__row { display: flex; gap: var(--space-2); }
.search-form__row .form-input { flex: 1; min-height: 44px; }
.search-form__row .btn { min-width: 44px; min-height: 44px; }
.search-form__filter { margin-top: var(--space-2); font-size: var(--text-sm); display: flex; align-items: center; gap: var(--space-2); }
.search-form__select { width: auto; min-height: 44px; }
.disc-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin: var(--space-4) 0; }
.disc-grid__card { display: flex; flex-direction: column; gap: var(--space-1); min-height: 72px; padding: var(--space-3); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); color: var(--color-text); text-decoration: none; }
.disc-grid__card--soon { opacity: 0.6; }
.disc-grid__glyph { font-size: var(--text-lg); }
.disc-grid__nome { font-weight: var(--font-semibold); }
.disc-grid__count { font-size: var(--text-sm); color: var(--color-text-muted); }
.classe-tabs { display: flex; gap: var(--space-2); overflow-x: auto; padding: var(--space-2) 0; }
.classe-tabs__tab { flex: none; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-full); color: var(--color-text); text-decoration: none; background: var(--color-surface); }
.classe-tabs__tab.is-active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.tema-group__h, .subtema__h { font-size: var(--text-base); font-weight: var(--font-semibold); color: var(--color-text-muted); margin: var(--space-5) 0 var(--space-2); }
.tema-list, .concept-cards, .question-hits, .ficha__questoes { list-style: none; padding: 0; }
.tema-list { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.tema-list li + li { border-top: 1px solid var(--color-border); }
.tema-list__row { display: flex; align-items: center; gap: var(--space-2); min-height: 56px; padding: var(--space-2) var(--space-4); color: var(--color-text); text-decoration: none; }
.tema-list__nome { flex: 1; font-weight: var(--font-semibold); }
.tema-list__meta { font-size: var(--text-sm); color: var(--color-text-muted); }
.concept-card { margin-bottom: var(--space-2); }
.concept-card__link { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3) var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); color: var(--color-text); text-decoration: none; }
.concept-card__title { font-weight: var(--font-semibold); display: flex; gap: var(--space-2); align-items: baseline; }
.concept-card__dot { display: inline-block; width: 12px; flex: none; }
.concept-card__resumo { font-size: var(--text-sm); color: var(--color-text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.concept-card__meta { font-size: var(--text-sm); color: var(--color-text-muted); display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.question-hits li, .ficha__questoes li { display: flex; flex-direction: column; padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
.ficha__q-excerto { font-size: var(--text-sm); color: var(--color-text-muted); }
mark { background: #FEF3C7; color: inherit; padding: 0 1px; }
.empty-state { margin: var(--space-4) 0; color: var(--color-text-muted); }
.notice--error { color: var(--color-danger); }
.eq-mathml { display: none; }
@supports (math-depth: 1) { .eq-mathml { display: inline; } math.eq-mathml[display="block"] { display: block; } .eq-img { display: none; } }
.ficha__html h2 { font-size: var(--text-lg); margin: var(--space-6) 0 var(--space-2); }
.ficha__html .eq-bloco { overflow-x: auto; }

/* Mock exams (A.5) */
.exam-page { max-width: 42rem; padding-top: var(--space-4); padding-bottom: var(--space-12); }
.exam-provas { list-style: none; padding: 0; }
.exam-provas li + li { margin-top: var(--space-2); }
.exam-prova { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3) var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.exam-prova button { align-self: flex-start; }
.exam-bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.exam-bar__timer { font-variant-numeric: tabular-nums; font-weight: var(--font-bold); }
.exam-bar__timer.is-low { color: var(--color-danger); }
.exam-q { padding: var(--space-3) 0; border: none; border-bottom: 1px solid var(--color-border); scroll-margin-top: 4rem; }
.exam-q legend { font-weight: var(--font-semibold); margin-bottom: var(--space-2); }
.exam-q__opt { display: flex; gap: var(--space-2); align-items: flex-start; min-height: 44px; padding: var(--space-2); border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: var(--space-2); background: var(--color-surface); }
.exam-q__texto-base { font-size: var(--text-sm); background: var(--color-surface-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); }
.exam-score { font-size: var(--text-2xl); font-weight: var(--font-bold); }
.exam-review { list-style: none; padding: 0; }
.exam-review li { padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); font-size: var(--text-sm); }
.exam-temas { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.exam-temas th, .exam-temas td { text-align: left; padding: var(--space-2); border-bottom: 1px solid var(--color-border); }

/* Exam result + review (F.9, modelled on the driving-school result C.7). Colour is never the only cue. */
.exr-veredicto { margin: var(--space-3) 0; padding: var(--space-4); border-radius: var(--radius-lg); border: 2px solid; color: #1F2937; }
.exr-veredicto.is-pass { background: var(--color-success-bg); border-color: var(--color-success); }
.exr-veredicto.is-fail { background: var(--color-danger-bg); border-color: var(--color-danger); }
.exr-veredicto__h { margin: 0 0 var(--space-2); font-size: var(--text-xl); }
.exr-veredicto.is-pass .exr-veredicto__h { color: #14532D; }
.exr-veredicto.is-fail .exr-veredicto__h { color: #7F1D1D; }
.exr-veredicto p { margin: var(--space-1) 0; }
.exr-veredicto .browse__hint { color: #374151; }
.exr-placar { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: var(--space-2); margin: var(--space-2) 0 var(--space-3); }
.exr-placar div { padding: var(--space-2); border-radius: var(--radius-md); background: rgba(255, 255, 255, .7); }
.exr-placar dt { font-size: var(--text-sm); color: #374151; }
.exr-placar dd { margin: 0; font-size: var(--text-xl); font-weight: var(--font-bold); color: #111827; }
.exr-placar__de { font-size: var(--text-sm); font-weight: normal; color: #374151; }
.exr-accoes { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: var(--space-3) 0; }
.exr-accoes form { margin: 0; }
.exr-filtro__in { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.exr-filtro { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-3); }
.exr-filtro label { min-height: 44px; display: inline-flex; align-items: center; padding: 0 var(--space-3); border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-surface); cursor: pointer; }
#exr-f-todas:checked ~ .exr-filtro label[for="exr-f-todas"],
#exr-f-erradas:checked ~ .exr-filtro label[for="exr-f-erradas"],
#exr-f-certas:checked ~ .exr-filtro label[for="exr-f-certas"],
#exr-f-branco:checked ~ .exr-filtro label[for="exr-f-branco"] { background: var(--color-primary); border-color: var(--color-primary); color: #fff; font-weight: var(--font-semibold); }
#exr-f-todas:focus-visible ~ .exr-filtro label[for="exr-f-todas"],
#exr-f-erradas:focus-visible ~ .exr-filtro label[for="exr-f-erradas"],
#exr-f-certas:focus-visible ~ .exr-filtro label[for="exr-f-certas"],
#exr-f-branco:focus-visible ~ .exr-filtro label[for="exr-f-branco"] { outline: 3px solid var(--color-primary); outline-offset: 2px; }
#exr-f-erradas:checked ~ .exr-lista .exr-q:not(.is-wrong),
#exr-f-certas:checked ~ .exr-lista .exr-q:not(.is-right),
#exr-f-branco:checked ~ .exr-lista .exr-q:not(.is-blank) { display: none; }
.exr-filtro__vazio { display: none; }
#exr-f-erradas:checked ~ .exr-filtro__vazio--erradas, #exr-f-certas:checked ~ .exr-filtro__vazio--certas, #exr-f-branco:checked ~ .exr-filtro__vazio--branco { display: block; }
.exr-lista { list-style: none; padding: 0; margin: 0; }
.exr-q { padding: var(--space-4) 0; border-bottom: 1px solid var(--color-border); }
.exr-q__h { font-size: var(--text-base); margin: 0 0 var(--space-2); }
.exr-q.is-right .exr-q__estado { color: #15803D; }
.exr-q.is-wrong .exr-q__estado { color: #B91C1C; }
.exr-q.is-blank .exr-q__estado { color: var(--color-warning-text); }
.exr-ops { list-style: none; padding: 0; margin: 0 0 var(--space-3); display: grid; gap: var(--space-2); }
.exr-op { padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); overflow-wrap: anywhere; }
.exr-op--certa { border: 2px solid var(--color-success); background: var(--color-success-bg); color: #14532D; }
.exr-op--errada { border: 2px solid var(--color-danger); background: var(--color-danger-bg); color: #7F1D1D; }
.exr-op__tag { font-weight: var(--font-semibold); white-space: nowrap; }
.exr-res { margin: 0 0 var(--space-2); padding: 0 var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.exr-res summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: var(--font-semibold); }
.exr-passos { margin: 0 0 var(--space-3); padding-left: 1.25rem; }
.exr-passos li { margin: var(--space-2) 0; }
.exr-passo__accao { margin: 0; }
.exr-q__link { margin: var(--space-1) 0 0; font-size: var(--text-sm); }
.exr-q__link a { text-decoration: underline; }

/* ─── Adaptive (U.1) ─────────────────────────────────────────────────────────────
   Components in src/views/components/adaptive/**. Design: docs/ux/adaptive-and-interactive-ux.md.
   Uses existing tokens only; no new tokens. */

/* ProgressBar */
.pbar { margin: var(--space-2) 0; }
.pbar__track {
  height: 8px;
  background: var(--color-surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.pbar__fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}
.pbar--done .pbar__fill, .pbar--goal .pbar__fill { background: var(--color-success); }
.pbar__meta { margin: var(--space-1) 0 0; font-size: var(--text-sm); color: var(--color-text-muted); }

/* ReadinessGauge */
.readiness { margin: 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.readiness__svg { max-width: 100%; height: auto; }
.readiness__svg text { font-family: var(--font-sans); }
.readiness__caption { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--space-2); text-align: center; }
.readiness__label { font-weight: var(--font-semibold); }
.readiness__nota { flex-basis: 100%; font-size: var(--text-sm); color: var(--color-text-muted); }
.readiness--pronto .readiness__label { color: var(--color-success); }
.readiness--quase .readiness__label { color: var(--color-primary); }
.readiness--ainda_nao .readiness__label,
.readiness--sem_dados .readiness__label { color: var(--color-text-muted); }
.readiness--compact { flex-direction: row; gap: var(--space-3); }
.readiness--compact .readiness__caption { justify-content: flex-start; text-align: left; }

/* PlanCard */
.plan-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}
.plan-card--next { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary); }
.plan-card--feito, .plan-card--saltado { background: var(--color-surface-2); }
.plan-card--feito .plan-card__title, .plan-card--saltado .plan-card__title { color: var(--color-text-muted); }
.plan-card__eyebrow { margin: 0 0 var(--space-1); font-size: var(--text-xs); font-weight: var(--font-bold); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-primary); }
.plan-card__meta { margin: 0; font-size: var(--text-sm); color: var(--color-text-muted); }
.plan-card__tipo { font-weight: var(--font-semibold); color: var(--color-text); }
.plan-card__title { margin: var(--space-1) 0; font-size: var(--text-base); }
.plan-card__desc { margin: 0 0 var(--space-3); font-size: var(--text-sm); color: var(--color-text-muted); }
.plan-card__form { margin: 0; }
.plan-card__form .btn { min-height: 44px; }

/* TemaChips */
.tema-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tema-chips--list { flex-direction: column; gap: 0; }
.tema-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
}
a.tema-chip:hover { background: var(--color-surface-2); text-decoration: none; }
.tema-chips--list .tema-chip {
  display: flex;
  width: 100%;
  border-radius: 0;
  border-width: 0 0 1px;
  padding: var(--space-3) 0;
}
.tema-chip__nome { font-weight: var(--font-medium); }
.tema-chips--list .tema-chip__nome { flex: 1; }
.tema-chip__peso { color: var(--color-text-muted); font-size: var(--text-xs); }
.tema-chip__estado { font-weight: var(--font-semibold); white-space: nowrap; }
.tema-chip--pronto { border-color: var(--color-success); }
.tema-chip--pronto .tema-chip__estado { color: var(--color-success); }
.tema-chip--quase { border-color: var(--color-primary); }
.tema-chip--quase .tema-chip__estado { color: var(--color-primary); }
.tema-chip--ainda_nao .tema-chip__estado,
.tema-chip--por_avaliar .tema-chip__estado { color: var(--color-text-muted); }
.tema-chip--por_avaliar { border-style: dashed; }
.tema-chips--list .tema-chip--pronto,
.tema-chips--list .tema-chip--quase { border-color: var(--color-border); }

/* SimEmbed */
.sim-embed {
  margin: var(--space-4) 0;
  padding: var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.sim-embed__eyebrow { margin: 0 0 var(--space-2); font-size: var(--text-xs); font-weight: var(--font-bold); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-primary); }
.sim-embed__stage { width: 100%; background: var(--color-surface-2); border-radius: var(--radius-md); overflow: hidden; }
.sim-embed__poster { display: block; width: 100%; height: 100%; object-fit: contain; }
.sim-embed__placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 120px; }
.sim-embed__placeholder-glyph { font-size: var(--text-4xl); color: var(--color-text-muted); }
.sim-embed__caption { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.sim-embed__legenda { flex-basis: 100%; font-size: var(--text-sm); color: var(--color-text-muted); }
.sim-embed__desc { margin-top: var(--space-2); font-size: var(--text-sm); }
.sim-embed__desc summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--color-primary); }
.sim-embed__poupanca { margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--color-text-muted); }
.sim-embed__open { margin-top: var(--space-2); min-height: 44px; width: 100%; }
.sim-embed__open[hidden] { display: none; }
.sim-embed__status:empty { display: none; }

/* Interactive artifacts wired into fichas, steps and the practice card */
.ficha__sims .sim-embed { margin-top: var(--space-2); }
.step__sim,
.sim-pratica { margin-top: var(--space-2); }
.step__sim > summary,
.sim-pratica > summary {
  min-height: 44px; display: inline-flex; align-items: center; gap: var(--space-2);
  cursor: pointer; color: var(--color-primary); font-weight: var(--font-bold);
}
.sim-pratica { margin: var(--space-3) 0; padding: var(--space-2) var(--space-3); border: 1.5px dashed var(--color-border); border-radius: var(--radius-lg); }
.sim-pratica__ajuda { margin: 0 0 var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); }
.sim-abrir[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .pbar__fill { transition: none; }
}

/* ─── B.2 adaptive pages (caminho, prontidão, diagnóstico) ─────────────────── */
.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-surface-2); margin: var(--space-3) 0; }
.notice--success { border: 2px solid var(--color-success); background: var(--color-success-bg); }
.notice--info { border: 2px solid var(--color-primary); background: var(--color-info-bg); }
.caminho-exames { color: var(--color-text-muted); font-size: var(--text-sm); margin: 0; }
.caminho-topo { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.streak-badge { min-height: 44px; display: inline-flex; align-items: center; gap: var(--space-1); text-decoration: none; color: var(--color-text); font-weight: var(--font-semibold); }
.plan-cards { display: flex; flex-direction: column; gap: var(--space-3); margin: var(--space-3) 0; }
.week-strip__dias { display: grid; grid-template-columns: repeat(7, 1fr); list-style: none; padding: 0; margin: 0; text-align: center; }
.week-strip__dia { display: flex; flex-direction: column; gap: 2px; min-height: 44px; }
.week-strip__dia--hoje { font-weight: var(--font-semibold); color: var(--color-primary); }
.week-strip__dia--feito { color: var(--color-success); }
.week-strip__letra { font-size: var(--text-sm); color: var(--color-text-muted); }
.mastery-map__tema { border-top: 1px solid var(--color-border); }
.mastery-map__tema summary { min-height: 44px; display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; cursor: pointer; padding: var(--space-2) 0; }
.mastery-map__nome { flex: 1; font-weight: var(--font-semibold); }
.mastery-map__faixa, .mastery-map__legenda, .mastery-stars__inf { font-size: var(--text-sm); color: var(--color-text-muted); }
.mastery-map__conceitos { list-style: none; padding: 0 0 var(--space-2); margin: 0; }
.mastery-map__conceitos li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2); min-height: 44px; align-items: center; }
.mastery-map__conceitos li.is-locked { color: var(--color-text-muted); }
.mastery-stars__glyph { color: #B45309; letter-spacing: 1px; }
.readiness-card { display: flex; flex-direction: column; gap: var(--space-2); }
.readiness-card__link { min-height: 44px; display: inline-flex; align-items: center; }
.prescricao__lista, .temas-em-falta__lista, .diag-familias { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.prescricao__item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-2); }
.sparkline { margin: var(--space-2) 0; }
.sparkline figcaption { font-size: var(--text-sm); color: var(--color-text-muted); }
.diag-actions { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.diag-actions .btn, .diag-guess { min-height: 48px; }
.diag-guess { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-3); }
.diag-guess input { width: 24px; height: 24px; }
.diag-topo { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }

/* ─── U.1 adaptive views at 360 px (gate G4-2) ─────────────────────────────── */
/* Buttons wrap instead of widening the page; selects never exceed their column. */
.btn { white-space: normal; max-width: 100%; text-align: center; line-height: 1.25; overflow-wrap: anywhere; }
select, input, textarea { max-width: 100%; }
.text-muted { color: var(--color-text-muted); }
.notice--warn { border: 2px solid var(--color-warning); background: var(--color-warning-bg); color: var(--color-warning-text); }
.form-stack { display: flex; flex-direction: column; gap: var(--space-2); }
.form-stack > label { font-weight: var(--font-medium); font-size: var(--text-sm); margin-top: var(--space-2); }
.form-stack select, .form-stack input:not([type="radio"]):not([type="checkbox"]) {
  width: 100%; min-height: 48px; padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text);
}
.form-stack fieldset { border: none; display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.form-stack legend { flex-basis: 100%; font-weight: var(--font-medium); font-size: var(--text-sm); margin-bottom: var(--space-2); }
.form-stack .btn { margin-top: var(--space-3); }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--color-border); border-radius: var(--radius-full); background: var(--color-surface); cursor: pointer;
}
.chip:has(input:checked) { border-color: var(--color-primary); background: var(--color-info-bg); }
.mcq-options { border: none; display: flex; flex-direction: column; gap: var(--space-3); margin: var(--space-3) 0; min-width: 0; }
.question-text { font-size: var(--text-base); line-height: 1.5; margin-bottom: var(--space-3); overflow-wrap: anywhere; }
.mcq-option {
  display: flex; align-items: flex-start; gap: var(--space-3); min-height: 48px; padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border); border-radius: var(--radius-md); cursor: pointer; background: var(--color-surface);
}
.mcq-option:hover, .mcq-option:has(input:checked) { border-color: var(--color-primary); background: var(--color-info-bg); }
.mcq-option input { margin-top: 6px; flex-shrink: 0; }
.mcq-key {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  background: var(--color-surface-2); border-radius: var(--radius-sm); font-weight: var(--font-bold); font-size: var(--text-sm);
}
.mcq-option:has(input:checked) .mcq-key { background: var(--color-primary); color: #fff; }
.mcq-text { flex: 1; min-width: 0; font-size: var(--text-sm); line-height: 1.5; overflow-wrap: anywhere; }
.prontidao-item { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.prontidao-item form .btn { width: 100%; }

/* ─── Legacy app pages: dashboard, practice home, progress, practice result (G4-10, story F.7) ───
   These views predate the BEM layouts; their structural classes had no rules, so at 360 px the
   nav links ran together and stat strips read «0Para rever hoje». Mobile-first, no new tokens. */
.app-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-4); background: var(--color-surface); border-bottom: 1px solid var(--color-border);
}
.app-header .brand { font-weight: var(--font-bold); color: var(--color-text); text-decoration: none; margin-right: auto; }
.app-nav { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); order: 3; flex-basis: 100%; }
.app-nav .nav-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-1); font-size: var(--text-sm); }
.app-nav .nav-link.active, .app-nav .nav-link[aria-current="page"] { font-weight: var(--font-semibold); text-decoration: underline; text-underline-offset: 4px; }
.logout-form { margin: 0; }
@media (min-width: 640px) { .app-nav { order: 0; flex-basis: auto; } }
.app-footer { padding: var(--space-6) var(--space-4); text-align: center; font-size: var(--text-sm); color: var(--color-text-muted); }
.page-title, .dashboard-title { font-size: var(--text-2xl); line-height: 1.25; margin: var(--space-5) 0 var(--space-3); overflow-wrap: anywhere; }
.dashboard-hero { margin-bottom: var(--space-4); }
.streak-zero { color: var(--color-text-muted); font-size: var(--text-sm); }
.adaptive-cards { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
.adaptive-cards .card { display: flex; flex-direction: column; gap: var(--space-2); }

.summary-strip, .stats-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin: var(--space-4) 0; }
@media (min-width: 640px) { .summary-strip, .stats-strip { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); } }
.summary-card, .stat-card {
  display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3);
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
}
.summary-value, .stat-value { font-size: var(--text-2xl); font-weight: var(--font-bold); line-height: 1.1; }
.summary-label, .stat-label { font-size: var(--text-xs); color: var(--color-text-muted); }
.stat-due { color: var(--color-primary); }
.stat-mature { color: var(--color-success); }
.due-cta, .quota-notice, .resume-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); margin: var(--space-3) 0; border-radius: var(--radius-md); background: var(--color-info-bg);
}
.resume-banner > div { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.resume-progress { font-size: var(--text-sm); color: var(--color-text-muted); }
.disciplinas-section, .chart-section, .mastery-section { margin: var(--space-6) 0; }

.disc-card, .disc-picker-card {
  display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); margin: 0;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); min-width: 0;
}
.disc-header, .disc-picker-header { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.disc-badge, .disc-code-badge {
  display: inline-flex; align-items: center; padding: 2px var(--space-2); border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: var(--font-bold); background: var(--color-surface-2);
}
.disc-name, .disc-picker-name { font-size: var(--text-lg); margin: 0; overflow-wrap: anywhere; }
.disc-class-range, .disc-reviews { font-size: var(--text-sm); color: var(--color-text-muted); }
.disc-picker-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-3); margin: var(--space-4) 0; }
@media (min-width: 640px) { .disc-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mastery-ring { display: inline-flex; align-items: center; gap: var(--space-2); }
.ring-label { font-size: var(--text-sm); color: var(--color-text-muted); }

.chart-wrap { overflow-x: auto; max-width: 100%; }
.chart-wrap svg { max-width: 100%; height: auto; }
.disc-tema-group { margin-bottom: var(--space-4); }
.disc-tema-heading { font-size: var(--text-base); margin: var(--space-3) 0 var(--space-2); }
.mastery-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); table-layout: fixed; }
.mastery-table th, .mastery-table td { padding: var(--space-2); border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: middle; }
.mastery-table th:last-child, .tema-revisoes { width: 5.5rem; text-align: right; }
.tema-nome { overflow-wrap: anywhere; }
.mastery-bar-wrap { display: flex; align-items: center; gap: var(--space-2); }
.mastery-bar-track { flex: 1; height: 8px; border-radius: var(--radius-full); background: var(--color-surface-2); overflow: hidden; min-width: 40px; }
.mastery-bar-fill { height: 100%; border-radius: inherit; }
.mastery-bar-label { font-size: var(--text-xs); min-width: 2.5rem; text-align: right; }

.result-hero { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center; margin: var(--space-6) 0 var(--space-4); }
.result-title { font-size: var(--text-2xl); margin: 0; }
.result-detail { color: var(--color-text-muted); font-size: var(--text-sm); }
.result-message { font-weight: var(--font-semibold); }
.result-pass { color: var(--color-success); }
.result-warn { color: var(--color-warning-text); }
.result-fail { color: var(--color-danger); }
.result-actions { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-4) 0; }
.result-actions form { margin: 0; }
.result-actions .btn { width: 100%; }
.review-section { margin: var(--space-6) 0; }
.review-card { padding: var(--space-4); margin-bottom: var(--space-3); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.review-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); }
.review-num { font-weight: var(--font-bold); color: var(--color-text-muted); }
.review-question { margin-bottom: var(--space-3); overflow-wrap: anywhere; }
.review-open-note { font-size: var(--text-sm); color: var(--color-text-muted); }
.review-options { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.review-options li { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.opt-key { font-weight: var(--font-bold); flex-shrink: 0; }
.opt-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt-tick { color: var(--color-success); font-weight: var(--font-bold); }
.opt-cross { color: var(--color-danger); font-weight: var(--font-bold); }
.review-correct { border: 2px solid var(--color-success); }
.review-wrong { border: 2px solid var(--color-danger); }
.review-badge { font-size: var(--text-xs); font-weight: var(--font-bold); padding: 2px var(--space-2); border-radius: var(--radius-full); }
.badge-correct { background: var(--color-success-bg); color: var(--color-success); }
.badge-wrong { background: var(--color-danger-bg); color: var(--color-danger); }
.review-options li.opt-correct { border-color: var(--color-success); background: var(--color-success-bg); }
.review-options li.opt-wrong { border-color: var(--color-danger); background: var(--color-danger-bg); }
.score-circle-wrap { display: inline-flex; }

/* ─── PWA / offline practice (Story U.2) ─────────────────────────────────── */
.offline-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; padding: var(--space-3) var(--space-4);
  background: var(--color-warning-bg); color: var(--color-warning-text); border-top: 2px solid var(--color-warning);
  font-size: var(--text-sm); line-height: 1.4; text-align: center;
}
.offline-banner[hidden] { display: none; }
.offline-page { padding-top: var(--space-4); padding-bottom: var(--space-8); max-width: 720px; }
.offline-page__intro { color: var(--color-text-muted); margin-bottom: var(--space-4); }
.offline-card {
  border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface);
  padding: var(--space-4); margin-bottom: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3);
}
.offline-card[hidden] { display: none; }
.offline-card__titulo { font-size: var(--text-lg); margin: 0; }
.offline-card__nota, .offline-card__msg, .offline-verdict__nota, .offline-player__meta { font-size: var(--text-sm); color: var(--color-text-muted); margin: 0; }
.offline-card select { min-height: 44px; max-width: 100%; }
.offline-toggle { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); }
.offline-toggle input { margin-top: 4px; flex-shrink: 0; }
.offline-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.offline-pack { display: flex; flex-direction: column; gap: var(--space-1); padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-border); }
.offline-pack:last-child { border-bottom: 0; }
.offline-pack__meta { font-size: var(--text-sm); color: var(--color-text-muted); }
.offline-pack__accoes, .offline-player__accoes { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.offline-player__titulo { font-size: var(--text-lg); margin: 0; }
.offline-player__texto, .offline-player__base { line-height: 1.5; overflow-wrap: anywhere; margin: 0; }
.offline-player__base { padding: var(--space-3); background: var(--color-surface-2); border-radius: var(--radius-sm); }
.offline-player__img { max-width: 100%; height: auto; }
.offline-player__passos { padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); overflow-wrap: anywhere; }
.offline-player__formula { display: block; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--text-sm); }
.offline-player__erro { font-size: var(--text-sm); color: var(--color-warning-text); }
.offline-player__ficha summary { cursor: pointer; font-weight: var(--font-bold); min-height: 44px; display: flex; align-items: center; }
.offline-verdict { font-weight: var(--font-bold); margin: 0; padding: var(--space-3); border-radius: var(--radius-sm); border: 2px solid; }
.offline-verdict--certo { border-color: var(--color-success); background: var(--color-success-bg); }
.offline-verdict--errado { border-color: var(--color-danger); background: var(--color-danger-bg); }
html[data-poupanca] img:not([data-ver]) { cursor: pointer; }

/* =============================================================================
   Design system v2 — shell + core components (Story D.1)
   Spec: docs/design/design-system-v2.md · living style page: /estilo
   Glass  = translucent + blur, ONLY inside @supports; solid fallback otherwise, and
            solid again under prefers-reduced-transparency and «modo poupança».
   Clay   = 16–28 px radii, outer drop + inner highlight/shade, pressed = sunk.
   Liquid = CSS-only blobs / flowing fills, frozen under prefers-reduced-motion.
   ============================================================================= */

/* ─── Shell: bars, sidebar, footer ─────────────────────────────────────────── */
.navbar, .site-bar, .app-header {
  background: var(--ds-glass-solid);
  border-bottom: 1px solid var(--ds-glass-edge);
  box-shadow: none;
}
.site-bar, .app-header { position: relative; }
/* Flag rule under every top bar: green · black · yellow · black · red. */
.navbar::after, .site-bar::after, .app-header::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 3px;
  background: var(--ds-flag-stripe);
  pointer-events: none;
}
.navbar-brand-name { font-weight: 800; letter-spacing: -0.02em; }
.site-bar__brand { color: var(--ds-ink); font-weight: 800; letter-spacing: -0.02em; }
.site-bar__nav a[aria-current="page"] { color: var(--ds-primary); box-shadow: inset 0 -3px 0 var(--ds-accent); }

.sidebar { background: var(--ds-glass-solid); border-right: 1px solid var(--ds-glass-edge); }
.sidebar-link { border-radius: var(--ds-radius-clay-sm); min-height: 44px; }
.sidebar-link.is-active {
  background: var(--ds-surface);
  color: var(--ds-primary);
  box-shadow: var(--ds-clay-shadow);
}
.sidebar-link--upgrade { color: var(--ds-accent-ink); }
.sidebar-icon { width: 1.75rem; text-align: center; font-weight: var(--font-bold); }
.sidebar-icon--mono {
  display: inline-grid; place-items: center; height: 1.75rem;
  border-radius: 9px; font-size: var(--text-xs); letter-spacing: -0.02em;
  background: var(--mz-green-50); color: var(--mz-green-800);
}
.sidebar-link.is-active .sidebar-icon--mono { background: var(--ds-primary); color: var(--ds-on-primary); }

.user-avatar { box-shadow: var(--ds-clay-fill-shadow); }
.classe-badge { background: var(--ds-primary-soft); color: var(--mz-green-800); }
.user-dropdown { border-radius: var(--ds-radius-clay-sm); border-color: var(--ds-line); box-shadow: var(--shadow-lg); }

.site-footer { background: var(--ds-surface-sunken); border-top: 0; position: relative; }
.site-footer::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--ds-flag-stripe);
}
.auth-card {
  border-radius: var(--ds-radius-clay-lg);
  border-color: rgb(255 255 255 / .8);
  box-shadow: var(--ds-clay-shadow), var(--shadow-lg);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .navbar, .site-bar, .app-header, .user-dropdown {
    background: var(--ds-glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--ds-glass-blur)) saturate(1.4);
    backdrop-filter: blur(var(--ds-glass-blur)) saturate(1.4);
  }
  @media (max-width: 767px) {
    .sidebar {
      background: var(--ds-glass-bg-strong);
      -webkit-backdrop-filter: blur(var(--ds-glass-blur)) saturate(1.4);
      backdrop-filter: blur(var(--ds-glass-blur)) saturate(1.4);
    }
  }
}

/* ─── Cards: default softened; glass + clay variants ───────────────────────── */
.card { border-radius: var(--ds-radius-clay-sm); }
.card--clay {
  background: var(--ds-surface);
  border: 1px solid rgb(255 255 255 / .9);
  border-radius: var(--ds-radius-clay);
  box-shadow: var(--ds-clay-shadow);
}
.card--clay-lg { border-radius: var(--ds-radius-clay-lg); padding: var(--space-6); }
.card--glass {
  background: var(--ds-glass-solid);
  border: 1px solid var(--ds-glass-edge);
  border-radius: var(--ds-radius-clay);
  box-shadow: var(--ds-glass-shadow);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card--glass {
    background: var(--ds-glass-bg);
    border-color: var(--ds-glass-border);
    -webkit-backdrop-filter: blur(var(--ds-glass-blur)) saturate(1.3);
    backdrop-filter: blur(var(--ds-glass-blur)) saturate(1.3);
  }
}
/* Pressable clay (a card that is a link/button) */
.card--press {
  display: block; color: inherit; text-decoration: none;
  transition: transform var(--ds-dur-fast) var(--ds-ease-out), box-shadow var(--ds-dur-fast) var(--ds-ease-out);
}
.card--press:hover { text-decoration: none; transform: translateY(-2px); }
.card--press:active { transform: translateY(1px); box-shadow: var(--ds-clay-shadow-pressed); }
/* Accent edge — the whole card is outlined in the accent colour (no one-sided stripe) */
.card--edge-green  { border: 2px solid var(--ds-primary); background: var(--ds-primary-soft); }
.card--edge-yellow { border: 2px solid var(--ds-accent); background: var(--ds-accent-soft); }
.card--edge-red    { border: 2px solid var(--ds-danger); background: var(--ds-danger-soft); }

/* ─── Inputs: sunken clay ──────────────────────────────────────────────────── */
.form-input, .form-select {
  min-height: 48px;
  border-radius: var(--ds-radius-clay-sm);
  border-color: var(--ds-line-strong);
  box-shadow: inset 0 2px 4px rgb(17 17 17 / .06);
}
.form-input:focus, .form-select:focus {
  border-color: var(--ds-focus);
  box-shadow: inset 0 2px 4px rgb(17 17 17 / .04), 0 0 0 4px rgb(0 113 104 / .22);
}
.form-field.is-error .form-input, .form-field.is-error .form-select { box-shadow: 0 0 0 4px rgb(210 16 52 / .14); }

/* ─── Chip ─────────────────────────────────────────────────────────────────── */
.ds-chip {
  position: relative;
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 36px; padding: var(--space-1) var(--space-4);
  border: 1px solid var(--ds-line); border-radius: var(--radius-full);
  background: var(--ds-surface); color: var(--ds-ink);
  font-size: var(--text-sm); font-weight: var(--font-semibold); line-height: 1.2;
  box-shadow: inset 0 -2px 0 rgb(17 17 17 / .05);
  text-decoration: none;
}
a.ds-chip, button.ds-chip, label.ds-chip { min-height: 44px; cursor: pointer; font: inherit; font-size: var(--text-sm); font-weight: var(--font-semibold); }
a.ds-chip:hover, button.ds-chip:hover, label.ds-chip:hover { border-color: var(--ds-primary); text-decoration: none; }
.ds-chip[aria-pressed="true"], .ds-chip.is-active, .ds-chip:has(input:checked) {
  background: var(--ds-primary); border-color: var(--ds-primary); color: var(--ds-on-primary);
  box-shadow: var(--ds-clay-fill-shadow);
}
.ds-chip--accent { background: var(--ds-accent); border-color: var(--mz-yellow-400); color: var(--ds-on-accent); }
.ds-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ds-chip:has(input:focus-visible) { outline: 3px solid var(--ds-focus); outline-offset: 2px; }

/* ─── Badge (label pill; .badge stays the achievement tile) ────────────────── */
.ds-badge {
  display: inline-flex; align-items: center; gap: 0.35em;
  padding: 0.15rem 0.6rem; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: var(--font-bold); letter-spacing: .01em; line-height: 1.5;
  background: var(--ds-surface-sunken); color: var(--ds-ink);
}
.ds-badge--green  { background: var(--mz-green-50);  color: var(--mz-green-800); }
.ds-badge--yellow { background: var(--ds-accent);    color: var(--ds-on-accent); }
.ds-badge--red    { background: var(--mz-red-50);    color: var(--mz-red-700); }
.ds-badge--ink    { background: var(--mz-ink);       color: var(--mz-white); }

/* ─── Segmented nav (tabs) ─────────────────────────────────────────────────── */
.ds-tabs {
  display: flex; gap: var(--space-1); padding: var(--space-1);
  background: var(--ds-surface-sunken); border-radius: var(--ds-radius-clay-sm);
  box-shadow: inset 0 2px 4px rgb(17 17 17 / .07);
  overflow-x: auto; scrollbar-width: none;
}
.ds-tabs a, .ds-tabs button {
  flex: 1 0 auto; min-height: 44px; padding: 0 var(--space-4);
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; background: transparent;
  color: var(--ds-ink-muted); font-size: var(--text-sm); font-weight: var(--font-semibold);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.ds-tabs a:hover, .ds-tabs button:hover { color: var(--ds-ink); text-decoration: none; }
.ds-tabs [aria-current="page"], .ds-tabs [aria-selected="true"] {
  background: var(--ds-surface); color: var(--ds-primary); box-shadow: var(--ds-clay-shadow);
}

/* ─── Liquid progress bar ──────────────────────────────────────────────────── */
/* <div class="progress-liquid" role="progressbar" aria-valuenow="62" …>
     <span class="progress-liquid__fill" style="--p:62%"></span></div> */
.progress-liquid {
  position: relative; height: 14px; overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--ds-surface-sunken);
  box-shadow: inset 0 2px 4px rgb(17 17 17 / .1);
}
.progress-liquid--lg { height: 22px; }
.progress-liquid__fill {
  position: absolute; inset: 0 auto 0 0; width: var(--p, 0%);
  border-radius: inherit;
  background-image: linear-gradient(90deg, var(--mz-green-700), var(--mz-green-500) 40%, var(--mz-green-400) 55%, var(--mz-green-600) 80%, var(--mz-green-700));
  background-size: 220% 100%;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / .35), inset 0 -2px 0 rgb(0 0 0 / .15);
  transition: width var(--ds-dur-slow) var(--ds-ease-out);
}
/* The «liquid» surface: a soft highlight riding on the fill. */
.progress-liquid__fill::after {
  content: ''; position: absolute; top: 2px; left: 6px; right: 6px; height: 35%;
  border-radius: inherit; background: rgb(255 255 255 / .28);
}
.progress-liquid--accent .progress-liquid__fill { background-image: linear-gradient(90deg, var(--mz-yellow-400), var(--mz-yellow-200) 50%, var(--mz-yellow-400)); }
.progress-liquid--danger .progress-liquid__fill { background-image: linear-gradient(90deg, var(--mz-red-600), var(--mz-red-400) 50%, var(--mz-red-600)); }
@media (prefers-reduced-motion: no-preference) {
  .progress-liquid__fill { animation: ds-liquid-flow 6s linear infinite; }
}
@keyframes ds-liquid-flow { from { background-position: 0% 0; } to { background-position: -220% 0; } }

/* ─── Toast (app.js window.prepToast) ──────────────────────────────────────── */
.toast-stack {
  position: fixed; z-index: 9999;
  left: var(--space-4); right: var(--space-4); bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-2);
  pointer-events: none;
}
.toast {
  position: relative; overflow: hidden;
  pointer-events: auto; max-width: 340px;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--ds-accent); border-radius: var(--ds-radius-clay-sm);
  font-size: var(--text-sm); font-weight: var(--font-semibold); line-height: 1.4;
  background: var(--mz-ink-2); color: var(--mz-white);
  box-shadow: 0 14px 28px -14px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .12);
}
.toast--success { background: var(--mz-leaf-700); }
.toast--success { border-color: var(--mz-white); }
.toast--danger  { background: var(--mz-red-600); }
.toast--danger { border-color: var(--mz-ink); }
.toast--warning { background: var(--color-warning-text); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: ds-toast-in var(--ds-dur-base) var(--ds-ease-spring); }
}
@keyframes ds-toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ─── Liquid backdrop (heroes, empty states) ───────────────────────────────── */
/* <section class="liquid"><span class="liquid__blob liquid__blob--green"></span> … </section>
   Blobs sit behind content (z-index -1 inside an isolated stacking context). Put text
   on a solid or glass surface, never directly over a blob. */
.liquid { position: relative; isolation: isolate; overflow: hidden; }
.liquid__blob {
  position: absolute; z-index: -1; pointer-events: none;
  width: var(--blob-size, 18rem); aspect-ratio: 1;
  border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
  opacity: .55;
}
.liquid__blob--green  { background: radial-gradient(circle at 35% 35%, var(--mz-green-300), var(--mz-green-600) 70%); top: -6rem; right: -5rem; }
.liquid__blob--yellow { --blob-size: 15rem; background: radial-gradient(circle at 40% 40%, var(--mz-yellow-200), var(--mz-yellow-300) 70%); bottom: -7rem; left: -6rem; }
.liquid__blob--red    { --blob-size: 7rem; background: radial-gradient(circle at 50% 50%, var(--mz-red-300), var(--mz-red-500) 70%); bottom: -4rem; right: 18%; opacity: .35; }
@media (prefers-reduced-motion: no-preference) {
  .liquid__blob { animation: ds-blob var(--ds-dur-liquid) ease-in-out infinite alternate; }
  .liquid__blob--yellow { animation-duration: 18s; animation-delay: -4s; }
  .liquid__blob--red { animation-duration: 11s; }
}
@keyframes ds-blob {
  0%   { border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; transform: translate(0, 0) rotate(0deg); }
  50%  { border-radius: 58% 42% 38% 62% / 55% 61% 39% 45%; transform: translate(-1.5rem, 1rem) rotate(18deg); }
  100% { border-radius: 36% 64% 55% 45% / 62% 38% 62% 38%; transform: translate(1rem, -1rem) rotate(-12deg); }
}
/* Wave divider: <svg class="wave" viewBox="0 0 1440 48" preserveAspectRatio="none" aria-hidden="true"><path d="…"/></svg> */
.wave { display: block; width: 100%; height: 32px; fill: currentColor; color: var(--ds-surface); }

/* ─── Editorial type helpers (asymmetric, left-aligned, human) ─────────────── */
.ds-eyebrow {
  display: inline-block; padding-bottom: 4px;
  font-size: var(--text-xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--mz-green-800);
  background: linear-gradient(var(--ds-accent), var(--ds-accent)) left bottom / 2.25rem 3px no-repeat;
}
.ds-display { font-size: clamp(1.875rem, 7vw, 3rem); font-weight: 800; line-height: 1.05; letter-spacing: -0.035em; color: var(--ds-ink); }
.ds-display em { font-style: normal; color: var(--ds-primary); }
.ds-num { font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: -0.03em; }
/* Star bullets instead of emoji bullets */
.ds-list-star { list-style: none; padding: 0; display: grid; gap: var(--space-2); }
.ds-list-star li { position: relative; padding-left: 1.6em; }
.ds-list-star li::before {
  content: ''; position: absolute; left: 0; top: .3em; width: 1em; height: 1em; background: var(--ds-primary);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* ─── Fallbacks: reduced transparency, «modo poupança», reduced motion ─────── */
@media (prefers-reduced-transparency: reduce) {
  .navbar, .site-bar, .app-header, .user-dropdown, .sidebar, .card--glass {
    background: var(--ds-glass-solid) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  body::before, .liquid__blob { display: none; }
}
html[data-poupanca] .navbar, html[data-poupanca] .site-bar, html[data-poupanca] .app-header,
html[data-poupanca] .user-dropdown, html[data-poupanca] .sidebar, html[data-poupanca] .card--glass {
  background: var(--ds-glass-solid);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html[data-poupanca] .liquid__blob, html[data-poupanca] .progress-liquid__fill { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .liquid__blob, .progress-liquid__fill, .toast { animation: none !important; }
  .btn:active, .card--press:hover, .card--press:active { transform: none; }
}

/* /estilo living style page styles: /public/css/estilo.css (D.2, loaded only by /estilo). */

/* =============================================================================
   Design system v2 — page rollout (Story D.2)
   Applies docs/design/design-system-v2.md page by page. Tokens only (no new hex),
   CSS/SVG only, every motion frozen under prefers-reduced-motion (rules above).
   ============================================================================= */

/* ─── Shared marks (replace emoji icons) ───────────────────────────────────── */
/* Subject monogram tile (src/views/components/subject-mark.tsx). Tones are AA pairs. */
.subject-mark {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 2.5rem; height: 2.5rem; border-radius: 12px;
  font-size: var(--text-sm); font-weight: 800; letter-spacing: -0.03em; line-height: 1;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / .22), inset 0 -3px 0 rgb(0 0 0 / .14);
}
.subject-mark--sm { width: 2rem; height: 2rem; border-radius: 10px; font-size: var(--text-xs); }
.subject-mark--lg { width: 3rem; height: 3rem; border-radius: 14px; font-size: var(--text-base); }
.subject-mark--green  { background: var(--mz-green-600); color: var(--mz-white); }
.subject-mark--ink    { background: var(--mz-ink);       color: var(--mz-white); }
.subject-mark--red    { background: var(--mz-red-500);   color: var(--mz-white); }
.subject-mark--yellow { background: var(--mz-yellow-300); color: var(--mz-ink); }
.subject-mark--sand   { background: var(--mz-sand-200);  color: var(--mz-ink); }

/* Streak «sun» (yellow → red), freeze diamond, padlock: CSS marks instead of emoji. */
.streak-mark {
  display: inline-block; width: .85em; height: .85em; border-radius: 50%; vertical-align: -0.05em;
  background: radial-gradient(circle at 50% 60%, var(--mz-red-500) 0 30%, var(--mz-yellow-300) 32% 100%);
  box-shadow: 0 0 0 2px var(--mz-yellow-100);
}
.freeze-mark {
  display: inline-block; width: .65em; height: .65em; margin: 0 .1em; vertical-align: .05em;
  transform: rotate(45deg); border: 2px solid var(--mz-green-600); background: var(--mz-green-50); border-radius: 2px;
}
.lock-mark {
  position: relative; display: inline-block; width: .8em; height: .6em; margin-top: .35em; vertical-align: -0.05em;
  background: currentColor; border-radius: 2px;
}
.lock-mark::before {
  content: ''; position: absolute; left: .15em; right: .15em; bottom: 100%; height: .38em;
  border: .12em solid currentColor; border-bottom: 0; border-radius: .3em .3em 0 0;
}
.icon-search { display: block; }
.btn .icon-search { margin: 0 auto; }

/* Tick list (replaces «✓ text» bullets); .ds-list-star lives in D.1. */
.ds-list-check { list-style: none; padding: 0; }
.ds-list-check li { position: relative; padding-left: 1.75em; }
.ds-list-check li::before {
  content: ''; position: absolute; left: .1em; top: .3em; width: 1.05em; height: 1.05em; border-radius: 50%;
  background: var(--mz-leaf-50);
  box-shadow: inset 0 0 0 1.5px var(--mz-leaf-700);
}
.ds-list-check li::after {
  content: ''; position: absolute; left: .45em; top: .48em; width: .32em; height: .56em;
  border: solid var(--mz-leaf-700); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Password eye (inline SVG); a slash is drawn when the text is visible (app.js toggles .is-visible). */
.form-input-toggle {
  display: inline-grid; place-items: center; width: 44px; height: 44px; right: 2px; padding: 0;
  border-radius: var(--ds-radius-clay-sm); color: var(--ds-ink-muted);
}
.form-input-toggle:hover { color: var(--ds-primary); }
.form-input-toggle.is-visible::after {
  content: ''; position: absolute; width: 24px; height: 2px; background: currentColor; transform: rotate(-40deg); border-radius: 2px;
}
.form-input-wrapper .form-input { padding-right: 3.25rem; }

/* ─── Legacy app pages (dashboard, practice, progress): v2 header, clay surfaces ── */
.app-header .brand { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; font-weight: 800; letter-spacing: -0.02em; }
.app-nav {
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; gap: var(--space-1);
  padding: var(--space-1); background: var(--ds-surface-sunken); border-radius: var(--ds-radius-clay-sm);
  box-shadow: inset 0 2px 4px rgb(17 17 17 / .07);
}
.app-nav::-webkit-scrollbar { display: none; }
.app-nav .nav-link { flex: 0 0 auto; padding: 0 var(--space-3); border-radius: 12px; color: var(--ds-ink-muted); font-weight: var(--font-semibold); text-decoration: none; white-space: nowrap; }
.app-nav .nav-link:hover { color: var(--ds-ink); text-decoration: none; }
.app-nav .nav-link.active, .app-nav .nav-link[aria-current="page"] {
  text-decoration: none; background: var(--ds-surface); color: var(--ds-primary); box-shadow: var(--ds-clay-shadow);
}
.page-title, .dashboard-title { font-weight: 800; letter-spacing: -0.03em; }
.dashboard-title { font-size: clamp(1.75rem, 7vw, 2.25rem); }
.page-lede { color: var(--ds-ink-muted); max-width: 52ch; margin: calc(-1 * var(--space-1)) 0 var(--space-4); }
.section-title--left { text-align: left; }
.app-body .card, .adaptive-cards .card { border-radius: var(--ds-radius-clay); }
.summary-card, .stat-card {
  border: 1px solid rgb(255 255 255 / .9); border-radius: var(--ds-radius-clay-sm); box-shadow: var(--ds-clay-shadow);
}
.summary-value, .stat-value { font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.summary-strip .summary-card:first-child { background: var(--ds-primary-soft); }
.disc-card, .disc-picker-card, .review-card {
  border: 1px solid rgb(255 255 255 / .9); border-radius: var(--ds-radius-clay); box-shadow: var(--ds-clay-shadow);
}
.disc-code-badge { padding: 4px var(--space-2); border-radius: 9px; font-weight: 800; }
.quota-notice { background: var(--ds-accent-soft); border: 2px solid var(--ds-accent); border-radius: var(--ds-radius-clay-sm); }
.resume-banner, .due-cta { background: var(--ds-primary-soft); border: 2px solid var(--ds-primary); border-radius: var(--ds-radius-clay-sm); }
.dashboard-hero .streak-badge { min-height: 0; padding: .3rem .75rem; font-size: var(--text-sm); }

/* ─── Question cards / options: solid (no glass behind reading text), clay touch ── */
.question-card { border-radius: var(--ds-radius-clay); box-shadow: var(--ds-clay-shadow); border-color: rgb(255 255 255 / .9); }
.question-card__header { background: var(--ds-surface-sunken); border-bottom-color: var(--ds-line); }
.option-label, .mcq-option { border-radius: var(--ds-radius-clay-sm); box-shadow: inset 0 -2px 0 rgb(17 17 17 / .05); }
.option-label:active, .mcq-option:active { box-shadow: var(--ds-clay-shadow-pressed); }
.option-key { border-radius: 9px; }
.answer-reveal { border-radius: var(--ds-radius-clay); }
.explanation-toggle__icon {
  display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--mz-green-50); color: var(--mz-green-800); font-weight: 800; font-size: var(--text-sm);
}

.gate-teaser { background: var(--ds-accent-soft); border: 2px solid var(--ds-accent); border-radius: var(--ds-radius-clay-sm); flex-wrap: wrap; }
.gate-teaser__lock { color: var(--ds-accent-ink); font-size: var(--text-base); }

/* ─── Content browser ──────────────────────────────────────────────────────── */
.disc-grid__card { border-radius: var(--ds-radius-clay-sm); }
a.disc-grid__card { border-color: rgb(255 255 255 / .9); box-shadow: var(--ds-clay-shadow); }
a.disc-grid__card:active { box-shadow: var(--ds-clay-shadow-pressed); }
/* «Em breve»: flat and sunken instead of faded (opacity broke AA contrast). */
.disc-grid__card--soon { opacity: 1; background: var(--ds-surface-sunken); border-style: dashed; color: var(--ds-ink-muted); }
.disc-grid__card--soon .subject-mark { background: var(--mz-sand-200); color: var(--ds-ink); box-shadow: none; }
.disc-grid__glyph.subject-mark { width: 2rem; height: 2rem; border-radius: 10px; font-size: var(--text-xs); }

/* ─── Driving school shell mark ────────────────────────────────────────────── */
.cd-brand-sign { display: inline-block; margin-right: var(--space-2); vertical-align: middle; }
/* WCAG 1.4.1 (axe link-in-text-block): a plain link inside running text is underlined, not colour-only. */
p a:not([class]) { text-decoration: underline; text-underline-offset: 2px; }

/* ─── CT.12: «PT | EN» language switch (src/views/components/idioma-switch.tsx) ─── */
.idioma-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}
.idioma-switch__a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0 0.375rem;
  border-radius: 999px;
  color: var(--color-text-muted);
  text-decoration: none;
}
.idioma-switch__a:hover { color: var(--color-text); text-decoration: underline; }
.idioma-switch__a[aria-current='true'] { color: var(--color-text); background: color-mix(in srgb, currentColor 10%, transparent); }
.idioma-switch__sep { color: var(--color-text-light); }
.idioma-switch--escuro .idioma-switch__a { color: rgba(255, 255, 255, 0.72); }
.idioma-switch--escuro .idioma-switch__a:hover,
.idioma-switch--escuro .idioma-switch__a[aria-current='true'] { color: #fff; }
.idioma-switch--escuro .idioma-switch__sep { color: rgba(255, 255, 255, 0.4); }
/* CT.12: legal text kept in Portuguese on English pages — «(Portuguese original)» note */
.original-pt__nota { display: inline-block; font-size: 0.75rem; font-style: normal; color: var(--color-text-muted); }
.original-pt__nota--bloco { display: block; margin: 0.25rem 0 0.75rem; }
.navbar-idioma { margin-right: 0.25rem; }
.auth-footer .idioma-switch, .footer-inner .idioma-switch { margin-top: 0.5rem; }
