/* =========================================================================
   DataPath — Design System v2
   -------------------------------------------------------------------------
   Arquitetura:
     @layer reset       → base / normalize
     @layer tokens      → variáveis (cores, tipografia, espaços, motion)
     @layer layout      → container, header, hero, bento grid, footer
     @layer components  → cards, quizzes, flashcards, dashboards, roleplay…
     @layer utilities   → helpers (anima, a11y, skeleton)
   ========================================================================= */

@layer reset, tokens, layout, components, utilities;

/* ===================== RESET ============================================ */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body, h1, h2, h3, h4, p, ul, ol, figure, dl, dd { margin: 0; }
  ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
  img, svg, video { display: block; max-width: 100%; }
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; background: none; border: 0; padding: 0; }
  a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
  :where(details) summary { cursor: pointer; }

  :focus:not(:focus-visible) { outline: none; }
  :focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 6px;
  }

  ::selection { background: hsl(180 52% 52% / 0.35); color: #fff; }
}

/* ===================== TOKENS =========================================== */
@layer tokens {
  :root {
    /* Brand (HSL para escalas controladas) */
    --hue-navy:    210;
    --hue-blue:    205;
    --hue-teal:    172;
    --hue-amber:    36;
    --hue-coral:     2;

    /* Superfícies (escala de profundidade) */
    --surface-0:   hsl(var(--hue-navy) 55% 7%);    /* bg base  */
    --surface-1:   hsl(var(--hue-navy) 48% 11%);   /* painel   */
    --surface-2:   hsl(var(--hue-navy) 42% 15%);   /* card     */
    --surface-3:   hsl(var(--hue-navy) 38% 20%);   /* elevated */
    --surface-4:   hsl(var(--hue-navy) 34% 26%);   /* border-hi*/

    /* Compat com v1 (mantém referências legadas) */
    --deep-navy:    var(--surface-0);
    --ocean:        var(--surface-2);
    --ocean-muted:  var(--surface-3);

    /* Acentos */
    --power-blue:   hsl(var(--hue-blue)  66% 52%);
    --power-blue-2: hsl(var(--hue-blue)  80% 62%);
    --flow-teal:    hsl(var(--hue-teal)  52% 55%);
    --flow-teal-2:  hsl(var(--hue-teal)  62% 68%);
    --signal-amber: hsl(var(--hue-amber) 78% 58%);
    --error:        hsl(var(--hue-coral) 65% 62%);
    --focus-ring:   hsl(var(--hue-teal)  72% 58%);

    /* Texto */
    --text-primary: hsl(210 30% 98%);
    --text-strong:  hsl(210 25% 100%);
    --text-dim:     hsl(210 20% 82%);
    --text-muted:   hsl(210 14% 66%);
    --text-ghost:   hsl(210 12% 52%);

    /* Gradientes de marca */
    --grad-brand:      linear-gradient(135deg, var(--power-blue) 0%, var(--flow-teal) 100%);
    --grad-warm:       linear-gradient(135deg, var(--signal-amber) 0%, hsl(14 82% 62%) 100%);
    --grad-surface:    linear-gradient(180deg, hsl(var(--hue-navy) 46% 14%) 0%, hsl(var(--hue-navy) 52% 9%) 100%);
    --grad-glow:       radial-gradient(1200px 600px at 10% -10%, hsl(var(--hue-blue) 70% 35% / 0.35), transparent 60%),
                       radial-gradient(900px 500px  at 100% 0%,  hsl(var(--hue-teal) 55% 30% / 0.22), transparent 55%),
                       radial-gradient(700px 600px  at 50% 100%, hsl(var(--hue-amber) 70% 40% / 0.10), transparent 60%);

    /* Tipografia */
    --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

    --fs-xs:   0.75rem;
    --fs-sm:   0.8125rem;
    --fs-base: 0.9375rem;
    --fs-md:   1rem;
    --fs-lg:   1.125rem;
    --fs-xl:   clamp(1.25rem, 1.05rem + 0.8vw, 1.5rem);
    --fs-2xl:  clamp(1.5rem,  1.2rem + 1.5vw, 2rem);
    --fs-3xl:  clamp(1.75rem, 1.3rem + 2.2vw, 2.75rem);
    --fs-hero: clamp(2rem,    1.4rem + 3vw,   3.5rem);

    --lh-tight: 1.15;
    --lh-snug:  1.35;
    --lh-body:  1.55;
    --lh-loose: 1.7;

    /* Spacing (escala 4) */
    --sp-1:  4px;
    --sp-2:  8px;
    --sp-3:  12px;
    --sp-4:  16px;
    --sp-5:  20px;
    --sp-6:  24px;
    --sp-7:  32px;
    --sp-8:  40px;
    --sp-9:  56px;
    --sp-10: 72px;

    /* compat */
    --spacing: 8px;

    /* Bordas e raios */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius:    14px;      /* default */
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-pill: 999px;

    /* Bordas sutis */
    --border-soft: 1px solid hsl(var(--hue-navy) 38% 24% / 0.85);
    --border-hi:   1px solid hsl(var(--hue-navy) 30% 38% / 0.6);

    /* Sombras (dark-friendly) */
    --shadow-1: 0 1px 0 hsl(0 0% 100% / 0.02) inset,
                0 1px 2px hsl(0 0% 0% / 0.45);
    --shadow-2: 0 1px 0 hsl(0 0% 100% / 0.03) inset,
                0 8px 24px -8px hsl(0 0% 0% / 0.55),
                0 2px 6px -2px hsl(0 0% 0% / 0.3);
    --shadow-glow: 0 0 0 1px hsl(var(--hue-teal) 60% 55% / 0.35),
                   0 10px 40px -12px hsl(var(--hue-teal) 70% 50% / 0.45);

    /* Layout */
    --max-width: 1200px;
    --header-h: 64px;

    /* Motion */
    --dur-fast: 120ms;
    --dur-med:  220ms;
    --dur-slow: 420ms;
    --ease:     cubic-bezier(.2,.8,.2,1);

    color-scheme: dark;
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important;
      scroll-behavior: auto !important;
    }
  }
}

/* ===================== LAYOUT =========================================== */
@layer layout {

  html, body { height: 100%; }

  body {
    min-height: 100vh;
    background:
      var(--grad-glow),
      var(--grad-surface),
      var(--surface-0);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: var(--lh-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    padding: 0;
    overflow-x: hidden;
  }

  body::before {
    /* textura sutil de ruído */
    content: "";
    position: fixed; inset: 0;
    pointer-events: none;
    background-image: radial-gradient(hsl(0 0% 100% / 0.025) 1px, transparent 1px);
    background-size: 3px 3px;
    mix-blend-mode: overlay;
    opacity: 0.35;
    z-index: 0;
  }

  .container {
    position: relative;
    z-index: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 clamp(var(--sp-4), 2vw, var(--sp-7));
    padding-bottom: var(--sp-10);
  }

  /* ---------- Skip link ---------- */
  .skip-link {
    position: absolute;
    left: -9999px; top: 0;
    background: var(--surface-2);
    color: var(--text-primary);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
    z-index: 100;
  }
  .skip-link:focus { left: var(--sp-4); top: var(--sp-4); }

  /* ---------- Header (glass, sticky) ---------- */
  header.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    min-height: var(--header-h);
    padding: var(--sp-3) clamp(var(--sp-4), 2vw, var(--sp-7));
    margin: 0 calc(-1 * clamp(var(--sp-4), 2vw, var(--sp-7))) var(--sp-6);
    background: hsl(var(--hue-navy) 50% 9% / 0.72);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
    border-bottom: 1px solid hsl(var(--hue-navy) 30% 26% / 0.7);
  }

  .brand {
    display: flex; align-items: center; gap: var(--sp-3);
    min-width: 0;
  }
  .brand-mark {
    width: 36px; height: 36px; flex-shrink: 0;
    border-radius: 10px;
    background: var(--grad-brand);
    display: grid; place-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    color: hsl(var(--hue-navy) 55% 7%);
    box-shadow: 0 4px 20px -6px hsl(var(--hue-teal) 60% 50% / 0.55),
                inset 0 1px 0 hsl(0 0% 100% / 0.2);
    letter-spacing: -0.04em;
    font-size: 18px;
  }
  .brand-text { min-width: 0; }

  h1.app-title {
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    margin: 0 0 2px;
    background: linear-gradient(90deg, #fff 0%, hsl(var(--hue-teal) 50% 85%) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
  }
  .app-subtitle {
    color: var(--text-muted);
    font-size: var(--fs-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
  }

  .user-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: hsl(var(--hue-navy) 40% 18% / 0.6);
    border: 1px solid hsl(var(--hue-navy) 30% 28% / 0.7);
  }
  .user-badge:empty { display: none; }
  .user-badge .nome {
    font-weight: 600;
    font-size: var(--fs-xs);
    line-height: 1.1;
  }
  .user-badge .stats {
    color: var(--text-muted);
    font-size: 10px;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
  }

  /* ---------- Hero strip (XP ring + streak + level + meta) ---------- */
  .hero {
    margin-bottom: var(--sp-7);
  }
  .hero:empty { display: none; }

  .hero-card {
    position: relative;
    overflow: hidden;
    padding: clamp(var(--sp-5), 2vw, var(--sp-7));
    border-radius: var(--radius-lg);
    background:
      radial-gradient(800px 240px at 85% -30%, hsl(var(--hue-teal) 50% 40% / 0.35), transparent 70%),
      radial-gradient(600px 200px at 10% 120%, hsl(var(--hue-blue) 60% 35% / 0.35), transparent 70%),
      linear-gradient(180deg, hsl(var(--hue-navy) 44% 14%) 0%, hsl(var(--hue-navy) 50% 11%) 100%);
    border: 1px solid hsl(var(--hue-navy) 30% 28% / 0.75);
    box-shadow: var(--shadow-2);
  }
  .hero-card::before {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, hsl(0 0% 100% / 0.02) 50%, transparent 100%);
    pointer-events: none;
  }
  .hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: clamp(var(--sp-4), 2vw, var(--sp-7));
    align-items: center;
  }
  @media (max-width: 720px) {
    .hero-grid {
      grid-template-columns: auto 1fr;
      grid-template-areas:
        "ring title"
        "meta meta";
      row-gap: var(--sp-5);
    }
    .hero-ring-wrap { grid-area: ring; }
    .hero-title-wrap { grid-area: title; }
    .hero-meta { grid-area: meta; }
  }

  .hero-ring-wrap { position: relative; width: 96px; height: 96px; }
  .hero-ring { transform: rotate(-90deg); width: 100%; height: 100%; }
  .hero-ring circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
  }
  .hero-ring .track { stroke: hsl(var(--hue-navy) 30% 28% / 0.9); }
  .hero-ring .fill  {
    stroke: url(#xpGrad);
    stroke-dasharray: var(--ring-circum, 251.2);
    stroke-dashoffset: var(--ring-off, 251.2);
    transition: stroke-dashoffset var(--dur-slow) var(--ease);
    filter: drop-shadow(0 0 6px hsl(var(--hue-teal) 60% 55% / 0.5));
  }
  .hero-ring-label {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    text-align: center;
  }
  .hero-ring-level {
    font-size: 26px; line-height: 1; letter-spacing: -0.04em;
    color: var(--text-strong);
  }
  .hero-ring-sub {
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 2px;
  }

  .hero-title-wrap { min-width: 0; }
  .hero-greeting {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin: 0 0 6px;
  }
  .hero-name {
    font-family: var(--font-display);
    font-size: var(--fs-3xl);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1;
    margin: 0;
    background: linear-gradient(90deg, #fff 0%, hsl(var(--hue-teal) 60% 82%) 55%, hsl(var(--hue-amber) 70% 75%) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
  }
  .hero-progress {
    margin-top: var(--sp-4);
    display: flex; align-items: center; gap: var(--sp-3);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-muted);
  }
  .hero-bar {
    flex: 1;
    height: 8px;
    background: hsl(var(--hue-navy) 32% 22% / 0.9);
    border-radius: var(--radius-pill);
    overflow: hidden;
    position: relative;
  }
  .hero-bar::after {
    /* sheen */
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, hsl(0 0% 100% / 0.08), transparent);
    transform: translateX(-100%);
    animation: shimmer 2.6s var(--ease) infinite;
  }
  .hero-bar-fill {
    display: block;
    height: 100%;
    width: var(--xp-pct, 0%);
    background: var(--grad-brand);
    border-radius: inherit;
    box-shadow: 0 0 18px hsl(var(--hue-teal) 60% 55% / 0.55);
    transition: width var(--dur-slow) var(--ease);
  }

  .hero-meta {
    display: flex;
    gap: var(--sp-3);
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .stat-pill {
    display: flex; flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 14px;
    min-width: 100px;
    background: hsl(var(--hue-navy) 38% 18% / 0.75);
    border: 1px solid hsl(var(--hue-navy) 30% 30% / 0.7);
    border-radius: var(--radius-md);
    backdrop-filter: blur(4px);
  }
  .stat-pill-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
  }
  .stat-pill-value {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 700;
    line-height: 1;
    color: var(--text-strong);
    letter-spacing: -0.02em;
  }
  .stat-pill--streak .stat-pill-value {
    background: var(--grad-warm);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
  }
  .stat-pill-value .flame {
    font-size: 0.85em;
    filter: drop-shadow(0 0 6px hsl(var(--hue-amber) 80% 55% / 0.6));
  }

  /* ---------- Bento grid ---------- */
  .view {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--sp-5);
  }
  .view > [data-slot] { min-width: 0; }

  /* Default: cada slot 12 cols (mobile first) */
  .view > [data-slot] { grid-column: span 12; }

  @media (min-width: 820px) {
    .view > [data-slot="dashboard"]  { grid-column: span 12; }
    .view > [data-slot="artigo"]     { grid-column: span 8; }
    .view > [data-slot="curiosity"]  { grid-column: span 4; }
    .view > [data-slot="quizzes"]    { grid-column: span 12; }
    .view > [data-slot="flashcards"] { grid-column: span 6; }
    .view > [data-slot="roleplay"]   { grid-column: span 6; }
    .view > [data-slot="jobs"]       { grid-column: span 7; }
    .view > [data-slot="badges"]     { grid-column: span 5; }
    .view > [data-slot="diario"]     { grid-column: span 7; }
    .view > [data-slot="dicionario"] { grid-column: span 5; }
    .view > [data-slot="exports"]    { grid-column: span 12; }
  }

  .view > [data-slot]:empty { display: none; }

  /* entrance stagger */
  .view > [data-slot] > * {
    animation: fade-up var(--dur-slow) var(--ease) both;
  }
  .view > [data-slot]:nth-child(1) > * { animation-delay: 0ms; }
  .view > [data-slot]:nth-child(2) > * { animation-delay: 30ms; }
  .view > [data-slot]:nth-child(3) > * { animation-delay: 60ms; }
  .view > [data-slot]:nth-child(4) > * { animation-delay: 90ms; }
  .view > [data-slot]:nth-child(5) > * { animation-delay: 120ms; }
  .view > [data-slot]:nth-child(n+6) > * { animation-delay: 150ms; }

  /* Install button flutuante */
  #install-btn {
    position: fixed;
    right: clamp(var(--sp-4), 3vw, var(--sp-7));
    bottom: clamp(var(--sp-4), 3vw, var(--sp-7));
    z-index: 30;
    padding: 12px 18px;
    background: var(--grad-brand);
    color: hsl(var(--hue-navy) 55% 7%);
    border: none;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: 700;
    box-shadow: 0 16px 40px -12px hsl(var(--hue-teal) 60% 50% / 0.55),
                0 4px 10px -2px hsl(0 0% 0% / 0.45);
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  }
  #install-btn:hover { transform: translateY(-2px); }
  #install-btn:active { transform: translateY(0); }
  #install-btn:disabled { opacity: 0.6; cursor: wait; }

  footer.app-footer {
    margin-top: var(--sp-9);
    padding: var(--sp-5) 0;
    border-top: 1px solid hsl(var(--hue-navy) 26% 22% / 0.7);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-family: var(--font-mono);
    text-align: center;
    letter-spacing: 0.05em;
  }
}

/* ===================== COMPONENTS ======================================= */
@layer components {

  /* ---------- Card base ---------- */
  .card {
    position: relative;
    padding: clamp(var(--sp-4), 1.6vw, var(--sp-6));
    background: linear-gradient(180deg,
      hsl(var(--hue-navy) 42% 15% / 0.95) 0%,
      hsl(var(--hue-navy) 48% 12% / 0.95) 100%);
    border: var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-1);
    transition: transform var(--dur-med) var(--ease),
                border-color var(--dur-med) var(--ease),
                box-shadow var(--dur-med) var(--ease);
    overflow: hidden;
    height: 100%;
  }
  .card::before {
    /* linha de acento no topo */
    content: "";
    position: absolute; inset: 0 0 auto 0;
    height: 2px;
    background: var(--grad-brand);
    opacity: 0.85;
  }
  .card.success::before { background: linear-gradient(90deg, var(--flow-teal), var(--flow-teal-2)); }
  .card.primary::before { background: var(--grad-brand); }
  .card.error::before   { background: linear-gradient(90deg, var(--error), hsl(14 70% 60%)); }
  .card:hover {
    border-color: hsl(var(--hue-navy) 30% 34% / 0.9);
    box-shadow: var(--shadow-2);
  }

  .card h2 {
    margin: 0 0 var(--sp-3);
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: var(--lh-snug);
  }
  .card .eyebrow {
    display: inline-flex; align-items: center; gap: 6px;
    text-transform: uppercase;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: var(--sp-2);
  }
  .card .eyebrow::before {
    content: "";
    width: 14px; height: 1px;
    background: var(--flow-teal);
    opacity: 0.7;
  }
  .card .lead {
    color: var(--text-dim);
    margin: 0 0 var(--sp-4);
    font-size: var(--fs-md);
    line-height: var(--lh-body);
  }
  .card .meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3) var(--sp-4);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
  }
  .card .meta span { display: inline-flex; align-items: center; gap: 6px; }
  .card .meta span::before {
    content: '';
    width: 4px; height: 4px; border-radius: 999px;
    background: var(--flow-teal);
    opacity: 0.7;
  }

  /* ---------- Lições (artigo) ---------- */
  .licoes {
    list-style: none;
    padding: 0;
    margin: var(--sp-4) 0 0;
    display: grid;
    gap: var(--sp-2);
  }
  .licoes li {
    padding: 10px 14px 10px 28px;
    background: hsl(var(--hue-teal) 40% 30% / 0.10);
    border-radius: 10px;
    border-left: 2px solid var(--flow-teal);
    font-size: var(--fs-base);
    line-height: var(--lh-body);
    position: relative;
  }
  .licoes li::before {
    content: "✓";
    position: absolute;
    left: 9px; top: 9px;
    color: var(--flow-teal);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 12px;
  }

  /* ---------- Loading / empty / error ---------- */
  .loading,
  .empty,
  .error-banner {
    padding: var(--sp-5);
    border-radius: var(--radius-md);
    text-align: center;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    border: 1px dashed hsl(var(--hue-navy) 28% 30% / 0.8);
  }
  .loading {
    background: hsl(var(--hue-navy) 44% 14% / 0.6);
    color: var(--text-muted);
    position: relative;
    overflow: hidden;
  }
  .loading::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, hsl(var(--hue-teal) 50% 50% / 0.12), transparent);
    transform: translateX(-100%);
    animation: shimmer 1.6s linear infinite;
  }
  .empty {
    background: hsl(var(--hue-navy) 32% 18% / 0.5);
    color: var(--text-muted);
  }
  .error-banner {
    background: hsl(var(--hue-coral) 60% 30% / 0.18);
    color: hsl(var(--hue-coral) 80% 80%);
    border: 1px solid hsl(var(--hue-coral) 60% 50% / 0.4);
    text-align: left;
    border-style: solid;
  }
  .error-banner strong { display: block; margin-bottom: 4px; color: var(--text-strong); }
  .error-banner code {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-dim);
  }

  /* ---------- Curiosidade ---------- */
  .curiosity-card {
    background:
      radial-gradient(200px 140px at 100% 0%, hsl(var(--hue-amber) 75% 45% / 0.22), transparent 70%),
      linear-gradient(180deg, hsl(var(--hue-navy) 42% 15%) 0%, hsl(var(--hue-navy) 48% 12%) 100%);
  }
  .curiosity-card::before {
    background: linear-gradient(90deg, var(--signal-amber), hsl(14 82% 62%));
  }
  .curiosity-titulo {
    font-size: var(--fs-lg);
    margin: 0 0 var(--sp-3);
    line-height: var(--lh-snug);
  }
  .curiosity-conteudo {
    margin: 0;
    color: var(--text-dim);
    font-size: var(--fs-base);
    line-height: var(--lh-body);
  }
  .curiosity-fonte {
    margin: var(--sp-4) 0 0;
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
  }

  /* ---------- Dicionário (accordion) ---------- */
  .termos-list {
    display: flex; flex-direction: column;
    gap: 6px;
    margin-top: var(--sp-4);
  }
  .termo {
    background: hsl(var(--hue-navy) 50% 10% / 0.7);
    border: 1px solid hsl(var(--hue-navy) 28% 20% / 0.6);
    border-radius: 10px;
    padding: 10px 14px;
    transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  }
  .termo[open] {
    background: hsl(var(--hue-navy) 42% 16% / 0.95);
    border-color: hsl(var(--hue-teal) 40% 45% / 0.5);
  }
  .termo:hover { border-color: hsl(var(--hue-navy) 32% 30% / 0.9); }
  .termo summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
    list-style: none;
  }
  .termo summary::-webkit-details-marker { display: none; }
  .termo summary::before {
    content: '▸';
    color: var(--flow-teal);
    transition: transform var(--dur-fast) var(--ease);
    flex-shrink: 0;
    font-size: 12px;
  }
  .termo[open] summary::before { transform: rotate(90deg); }
  .termo-nome {
    font-weight: 600;
    font-size: var(--fs-base);
    flex: 1;
    margin-left: 4px;
  }
  .termo-cat {
    padding: 3px 10px;
    background: hsl(var(--hue-blue) 50% 40% / 0.18);
    color: var(--power-blue-2);
    border-radius: var(--radius-pill);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    flex-shrink: 0;
    border: 1px solid hsl(var(--hue-blue) 60% 50% / 0.3);
  }
  .termo-def {
    margin: var(--sp-3) 0 0 22px;
    color: var(--text-dim);
    font-size: var(--fs-sm);
    line-height: var(--lh-body);
  }
  .termo-relacionados {
    display: flex; flex-wrap: wrap;
    gap: 4px;
    margin: var(--sp-3) 0 0 22px;
  }

  /* ---------- Ações de card ---------- */
  .card-actions {
    margin-top: var(--sp-5);
    display: flex;
    gap: var(--sp-3);
    align-items: center;
    flex-wrap: wrap;
  }

  .mark-read-btn {
    background: var(--grad-brand);
    color: hsl(var(--hue-navy) 55% 7%);
    border: none;
    border-radius: var(--radius-pill);
    padding: 10px 18px;
    font-weight: 700;
    font-size: var(--fs-sm);
    letter-spacing: 0.01em;
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
    box-shadow: 0 6px 20px -8px hsl(var(--hue-teal) 60% 50% / 0.55);
  }
  .mark-read-btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); }
  .mark-read-btn:active { transform: translateY(0); }
  .mark-read-btn:disabled { opacity: 0.6; cursor: wait; }

  .read-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    background: hsl(var(--hue-teal) 50% 30% / 0.2);
    border: 1px solid hsl(var(--hue-teal) 50% 50% / 0.4);
    color: var(--flow-teal-2);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 600;
  }

  /* ---------- Diário ---------- */
  .diario-list {
    display: flex; flex-direction: column;
    gap: var(--sp-3);
    margin-top: var(--sp-4);
  }
  .diario-entry {
    background: hsl(var(--hue-navy) 48% 10% / 0.7);
    border-radius: 10px;
    padding: var(--sp-4);
    border-left: 3px solid var(--flow-teal);
    transition: transform var(--dur-fast) var(--ease);
  }
  .diario-entry:hover { transform: translateX(2px); }
  .diario-head {
    display: flex;
    gap: var(--sp-3);
    align-items: baseline;
    margin-bottom: var(--sp-2);
    flex-wrap: wrap;
  }
  .diario-date {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
  }
  .diario-titulo {
    font-weight: 600;
    font-size: var(--fs-base);
    color: var(--text-strong);
  }

  /* ---------- Quizzes ---------- */
  .quiz-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--sp-3);
    margin-top: var(--sp-4);
  }
  .quiz-item {
    background: hsl(var(--hue-navy) 48% 10% / 0.6);
    border-radius: 12px;
    padding: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    border: 1px solid hsl(var(--hue-navy) 26% 22% / 0.7);
    border-left: 3px solid hsl(var(--hue-navy) 26% 30% / 0.9);
    transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  }
  .quiz-item:hover { border-color: hsl(var(--hue-teal) 40% 40% / 0.4); }
  .quiz-item--ok      { border-left-color: var(--flow-teal); }
  .quiz-item--partial { border-left-color: var(--signal-amber); }

  .quiz-head {
    display: flex; justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
  }
  .quiz-level {
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    border: 1px solid transparent;
  }
  .quiz-level--easy   { background: hsl(var(--hue-teal) 50% 35% / 0.18); color: var(--flow-teal-2); border-color: hsl(var(--hue-teal) 50% 50% / 0.3); }
  .quiz-level--medium { background: hsl(var(--hue-blue) 60% 35% / 0.18); color: var(--power-blue-2); border-color: hsl(var(--hue-blue) 60% 50% / 0.3); }
  .quiz-level--hard   { background: hsl(var(--hue-amber) 70% 40% / 0.18); color: var(--signal-amber); border-color: hsl(var(--hue-amber) 70% 50% / 0.35); }

  .quiz-tema {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-family: var(--font-mono);
  }
  .quiz-pergunta {
    margin: 0;
    font-size: var(--fs-md);
    line-height: var(--lh-body);
    color: var(--text-strong);
  }
  .quiz-resposta {
    width: 100%;
    resize: vertical;
    background: hsl(var(--hue-navy) 40% 14%);
    color: var(--text-primary);
    border: 1px solid hsl(var(--hue-navy) 28% 24% / 0.8);
    border-radius: 10px;
    padding: 12px 14px;
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: var(--lh-body);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
    min-height: 88px;
  }
  .quiz-resposta::placeholder { color: var(--text-ghost); }
  .quiz-resposta:focus {
    outline: none;
    border-color: var(--power-blue);
    box-shadow: 0 0 0 3px hsl(var(--hue-blue) 70% 50% / 0.18);
  }
  .quiz-resposta:disabled { opacity: 0.6; cursor: wait; }

  .quiz-submit {
    align-self: flex-start;
    background: var(--power-blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    padding: 8px 18px;
    font-weight: 700;
    font-size: var(--fs-sm);
    transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
    box-shadow: 0 6px 18px -8px hsl(var(--hue-blue) 70% 55% / 0.5);
  }
  .quiz-submit:hover:not(:disabled) { background: var(--power-blue-2); transform: translateY(-1px); }
  .quiz-submit:active { transform: translateY(0); }
  .quiz-submit:disabled { opacity: 0.6; cursor: wait; }

  .quiz-score {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--flow-teal-2);
    letter-spacing: 0.02em;
  }
  .quiz-item--partial .quiz-score { color: var(--signal-amber); }
  .quiz-feedback {
    margin: 0;
    font-size: var(--fs-base);
    color: var(--text-dim);
    font-style: italic;
    line-height: var(--lh-body);
  }

  /* ---------- Chips ---------- */
  .chips {
    display: flex; flex-wrap: wrap;
    gap: 6px; align-items: center;
    font-size: var(--fs-xs);
  }
  .chips-label {
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-right: 4px;
    letter-spacing: 0.04em;
  }
  .chip {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    font-size: 11px;
    background: hsl(var(--hue-navy) 30% 24% / 0.8);
    border: 1px solid hsl(var(--hue-navy) 28% 30% / 0.6);
  }
  .chip--ok   {
    background: hsl(var(--hue-teal) 50% 30% / 0.2);
    color: var(--flow-teal-2);
    border-color: hsl(var(--hue-teal) 50% 50% / 0.4);
  }
  .chip--miss {
    background: hsl(var(--hue-coral) 60% 35% / 0.16);
    color: hsl(var(--hue-coral) 75% 78%);
    border-color: hsl(var(--hue-coral) 60% 55% / 0.35);
  }

  /* ---------- Dashboard ---------- */
  .dashboard-card::before { background: var(--grad-brand); }

  .dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--sp-4);
    margin-top: var(--sp-4);
  }
  .dash-block {
    background: hsl(var(--hue-navy) 48% 10% / 0.7);
    padding: var(--sp-4);
    border-radius: 12px;
    border: 1px solid hsl(var(--hue-navy) 28% 22% / 0.65);
  }
  .dash-label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--sp-3);
  }

  /* Sparkline */
  .spark-wrap { display: flex; flex-direction: column; gap: 8px; }
  .sparkline { width: 100%; height: 64px; }
  .sparkline polyline {
    stroke: url(#sparkGrad, var(--flow-teal));
    filter: drop-shadow(0 2px 6px hsl(var(--hue-teal) 60% 45% / 0.5));
  }
  .spark-legend {
    display: flex; justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
  }

  /* Heatmap */
  .heatmap-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-flow: column;
    gap: 3px;
    grid-template-rows: repeat(7, 1fr);
  }
  .heat-cell {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 3px;
    background: hsl(var(--hue-navy) 28% 22% / 0.6);
    min-height: 10px;
    transition: transform var(--dur-fast) var(--ease);
  }
  .heat-cell:hover { transform: scale(1.4); z-index: 2; position: relative; }
  .heat-0 { background: hsl(var(--hue-navy) 28% 22% / 0.45); }
  .heat-1 { background: hsl(var(--hue-teal) 45% 35% / 0.45); }
  .heat-2 { background: hsl(var(--hue-teal) 50% 42% / 0.7); }
  .heat-3 { background: hsl(var(--hue-teal) 55% 50% / 0.9); }
  .heat-4 { background: var(--flow-teal); box-shadow: 0 0 6px hsl(var(--hue-teal) 55% 55% / 0.5); }
  .heat-legend {
    display: flex; align-items: center; gap: 4px;
    margin-top: var(--sp-3);
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
  }
  .heat-legend .heat-cell { width: 10px; height: 10px; aspect-ratio: 1; min-height: 10px; }

  /* Top tags */
  .tags-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
  .tag-row {
    display: grid; grid-template-columns: 110px 1fr 70px;
    gap: 10px; align-items: center;
    font-size: var(--fs-xs);
  }
  .tag-name {
    font-family: var(--font-mono);
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tag-bar-wrap {
    background: hsl(var(--hue-navy) 30% 22% / 0.8);
    height: 10px;
    border-radius: var(--radius-pill);
    overflow: hidden;
    box-shadow: inset 0 1px 0 hsl(0 0% 0% / 0.3);
  }
  .tag-bar {
    display: block;
    height: 100%;
    background: var(--grad-brand);
    border-radius: inherit;
    box-shadow: 0 0 8px hsl(var(--hue-teal) 60% 50% / 0.4);
  }
  .tag-score {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
  }
  .tag-score small { opacity: 0.7; }

  /* Totais */
  .totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: var(--sp-3);
  }
  .totals-grid div {
    display: flex; flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 8px;
    background: hsl(var(--hue-navy) 42% 14% / 0.6);
    border-radius: 10px;
    border: 1px solid hsl(var(--hue-navy) 28% 22% / 0.6);
  }
  .totals-grid strong {
    font-family: var(--font-display);
    font-size: var(--fs-2xl);
    font-weight: 700;
    color: var(--flow-teal-2);
    letter-spacing: -0.02em;
    line-height: 1;
  }
  .totals-grid span {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-family: var(--font-mono);
  }

  /* ---------- Buttons base ---------- */
  .btn-primary {
    background: var(--grad-brand);
    color: hsl(var(--hue-navy) 55% 7%);
    border: none;
    border-radius: var(--radius-pill);
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: 700;
    transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
    box-shadow: 0 6px 22px -10px hsl(var(--hue-teal) 60% 50% / 0.55);
    letter-spacing: 0.01em;
  }
  .btn-primary:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); }
  .btn-primary:active { transform: translateY(0); }
  .btn-primary:disabled { opacity: 0.6; cursor: wait; }

  .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: transparent;
    color: var(--flow-teal-2);
    border: 1px solid hsl(var(--hue-teal) 50% 50% / 0.5);
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--dur-fast) var(--ease);
  }
  .btn-secondary:hover { background: hsl(var(--hue-teal) 50% 45% / 0.15); border-color: var(--flow-teal); color: var(--flow-teal); }
  .btn-secondary:disabled { opacity: 0.5; cursor: wait; }

  .btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid hsl(var(--hue-navy) 30% 30% / 0.7);
    border-radius: var(--radius-pill);
    padding: 7px 14px;
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    font-weight: 600;
    transition: all var(--dur-fast) var(--ease);
  }
  .btn-ghost:hover:not(:disabled) {
    color: var(--flow-teal-2);
    border-color: hsl(var(--hue-teal) 50% 50% / 0.5);
    background: hsl(var(--hue-teal) 50% 40% / 0.1);
  }
  .push-btn--on {
    color: var(--flow-teal-2);
    border-color: hsl(var(--hue-teal) 50% 50% / 0.55);
    background: hsl(var(--hue-teal) 50% 40% / 0.12);
  }
  .push-status { font-size: var(--fs-xs); color: var(--text-muted); }

  /* ---------- Roleplay card + dialog ---------- */
  .roleplay-history {
    margin-top: var(--sp-5);
    padding-top: var(--sp-4);
    border-top: 1px dashed hsl(var(--hue-navy) 28% 28% / 0.7);
  }
  .roleplay-history-label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--sp-3);
  }
  .roleplay-item {
    display: grid;
    grid-template-columns: 64px 1fr;
    align-items: center;
    gap: var(--sp-3);
    padding: 10px 0;
    border-bottom: 1px solid hsl(var(--hue-navy) 28% 22% / 0.7);
  }
  .roleplay-item:last-child { border-bottom: none; }
  .roleplay-score {
    font-family: var(--font-mono);
    font-size: var(--fs-md);
    font-weight: 700;
    color: var(--flow-teal-2);
    background: hsl(var(--hue-teal) 50% 30% / 0.18);
    padding: 6px 10px;
    border-radius: 8px;
    text-align: center;
  }
  .roleplay-sub { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

  .rp-dialog {
    width: min(760px, 94vw);
    max-height: 92vh;
    border: 1px solid hsl(var(--hue-navy) 28% 30% / 0.7);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, hsl(var(--hue-navy) 46% 13%) 0%, hsl(var(--hue-navy) 52% 9%) 100%);
    color: var(--text-primary);
    padding: clamp(var(--sp-4), 2vw, var(--sp-6));
    font-family: var(--font-body);
    box-shadow: 0 40px 80px -20px hsl(0 0% 0% / 0.7),
                0 0 0 1px hsl(var(--hue-teal) 40% 40% / 0.12);
  }
  .rp-dialog::backdrop {
    background: hsl(var(--hue-navy) 55% 5% / 0.85);
    backdrop-filter: blur(6px);
  }

  .rp-header {
    display: flex; justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-4);
    border-bottom: 1px solid hsl(var(--hue-navy) 28% 24% / 0.7);
  }
  .rp-header h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--fs-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  .rp-sub { color: var(--text-muted); font-size: var(--fs-xs); font-family: var(--font-mono); margin-top: 4px; }

  .rp-timer {
    font-family: var(--font-mono);
    font-size: var(--fs-2xl);
    font-weight: 700;
    color: var(--flow-teal-2);
    background: hsl(var(--hue-navy) 50% 9%);
    padding: 8px 18px;
    border-radius: 10px;
    letter-spacing: 0.06em;
    border: 1px solid hsl(var(--hue-teal) 50% 45% / 0.35);
    box-shadow: 0 0 20px -8px hsl(var(--hue-teal) 60% 50% / 0.5);
  }
  .rp-timer--warn {
    color: var(--error);
    border-color: hsl(var(--hue-coral) 60% 55% / 0.5);
    animation: pulse 1s infinite;
  }

  .rp-questions {
    display: flex; flex-direction: column;
    gap: var(--sp-3);
    max-height: 62vh;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--hue-navy) 28% 30%) transparent;
  }

  .rp-q {
    border: 1px solid hsl(var(--hue-navy) 28% 24% / 0.7);
    border-radius: 12px;
    padding: var(--sp-4);
    background: hsl(var(--hue-navy) 48% 10% / 0.8);
    margin: 0;
  }
  .rp-q legend {
    display: flex; gap: 8px;
    align-items: center;
    padding: 0 8px;
  }
  .rp-q-num { font-weight: 700; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
  .rp-q-cat { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
  .rp-q-text { margin: 8px 0 10px; font-size: var(--fs-md); line-height: var(--lh-body); }
  .rp-q textarea {
    width: 100%;
    resize: vertical;
    background: hsl(var(--hue-navy) 40% 14%);
    color: var(--text-primary);
    border: 1px solid hsl(var(--hue-navy) 28% 24% / 0.7);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: var(--fs-base);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  }
  .rp-q textarea:focus {
    outline: none;
    border-color: var(--power-blue);
    box-shadow: 0 0 0 3px hsl(var(--hue-blue) 70% 50% / 0.18);
  }

  .rp-footer {
    display: flex; gap: var(--sp-3);
    justify-content: flex-end;
    margin-top: var(--sp-5);
    padding-top: var(--sp-4);
    border-top: 1px solid hsl(var(--hue-navy) 28% 24% / 0.7);
  }

  .rp-results {
    display: flex; flex-direction: column;
    gap: var(--sp-3);
    max-height: 62vh;
    overflow-y: auto;
    padding-right: 8px;
  }
  .rp-result-item {
    background: hsl(var(--hue-navy) 48% 10% / 0.8);
    border-radius: 12px;
    padding: var(--sp-4);
    border: 1px solid hsl(var(--hue-navy) 28% 22% / 0.7);
    border-left: 3px solid hsl(var(--hue-navy) 28% 30%);
  }
  .rp-result--ok      { border-left-color: var(--flow-teal); }
  .rp-result--partial { border-left-color: var(--signal-amber); }
  .rp-result-head {
    display: flex; justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-bottom: 6px;
  }

  .rp-badges {
    display: flex; flex-wrap: wrap;
    gap: 8px;
    margin-bottom: var(--sp-4);
  }

  /* ---------- Empty hint ---------- */
  .empty-hint {
    color: var(--text-muted);
    font-size: var(--fs-base);
    margin: var(--sp-4) 0 0;
    line-height: var(--lh-body);
  }

  /* ---------- Flashcards ---------- */
  .flashcard {
    background:
      radial-gradient(400px 200px at 100% -20%, hsl(var(--hue-blue) 55% 40% / 0.20), transparent 70%),
      hsl(var(--hue-navy) 48% 10% / 0.7);
    border-radius: 12px;
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    margin-top: var(--sp-4);
    border: 1px solid hsl(var(--hue-navy) 28% 22% / 0.7);
    border-left: 3px solid var(--power-blue);
    min-height: 180px;
    justify-content: space-between;
  }
  .flash-tema {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
  }
  .flash-frente {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: var(--lh-snug);
    color: var(--text-strong);
  }
  .flash-verso {
    color: var(--text-dim);
    padding-top: var(--sp-3);
    border-top: 1px dashed hsl(var(--hue-navy) 28% 28% / 0.8);
    font-size: var(--fs-base);
    line-height: var(--lh-body);
  }
  .flash-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
  .btn-show {
    background: var(--power-blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    padding: 8px 18px;
    font-weight: 700;
    font-size: var(--fs-xs);
    transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  }
  .btn-show:hover { background: var(--power-blue-2); transform: translateY(-1px); }
  .flash-quality { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
  .flash-quality-label { font-size: var(--fs-xs); color: var(--text-muted); margin-right: 6px; font-family: var(--font-mono); }
  .btn-q {
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    border: none;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
  }
  .btn-q:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.1); }
  .btn-q-0 { background: var(--error); }
  .btn-q-3 { background: var(--signal-amber); color: hsl(var(--hue-navy) 55% 10%); }
  .btn-q-4 { background: var(--power-blue); }
  .btn-q-5 { background: var(--flow-teal); color: hsl(var(--hue-navy) 55% 10%); }
  .btn-q:disabled { opacity: 0.5; cursor: wait; }
  .flash-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); letter-spacing: 0.04em; }

  /* ---------- Badges ---------- */
  .badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--sp-2);
    margin-top: var(--sp-4);
  }
  .badge-chip {
    display: flex; align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: hsl(var(--hue-navy) 48% 10% / 0.7);
    border: 1px solid hsl(var(--hue-navy) 28% 22% / 0.7);
    font-size: var(--fs-xs);
    transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  }
  .badge-chip:hover { transform: translateY(-1px); }
  .badge-chip--on {
    border-color: hsl(var(--hue-teal) 50% 50% / 0.55);
    background: linear-gradient(135deg, hsl(var(--hue-navy) 48% 10% / 0.7) 0%, hsl(var(--hue-teal) 40% 30% / 0.15) 100%);
  }
  .badge-chip--off { opacity: 0.4; filter: grayscale(0.5); }
  .badge-chip--raro.badge-chip--on {
    border-color: hsl(var(--hue-amber) 70% 55% / 0.6);
    background: linear-gradient(135deg, hsl(var(--hue-navy) 48% 10% / 0.7) 0%, hsl(var(--hue-amber) 70% 40% / 0.18) 100%);
    box-shadow: 0 0 20px -6px hsl(var(--hue-amber) 75% 55% / 0.4);
  }
  .badge-icon { font-size: 20px; filter: drop-shadow(0 1px 3px hsl(0 0% 0% / 0.5)); }
  .badge-name { font-weight: 600; }

  /* ---------- Jobs ---------- */
  .jobs-list { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-4); }
  .job-item {
    background: hsl(var(--hue-navy) 48% 10% / 0.7);
    border-radius: 12px;
    padding: var(--sp-4);
    border: 1px solid hsl(var(--hue-navy) 28% 22% / 0.7);
    border-left: 3px solid var(--power-blue);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  }
  .job-item:hover { transform: translateY(-1px); border-color: hsl(var(--hue-blue) 55% 50% / 0.45); }
  .job-head { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: flex-start; }
  .job-empresa {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: var(--font-mono);
  }
  .job-titulo {
    font-weight: 600;
    font-size: var(--fs-md);
    margin-top: 3px;
    color: var(--text-strong);
  }
  .job-score {
    font-family: var(--font-display);
    font-size: var(--fs-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    background: var(--grad-brand);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
  }
  .job-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
  }

  /* ---------- Exports ---------- */
  .exports-actions {
    display: flex; flex-wrap: wrap;
    gap: var(--sp-3);
    margin-top: var(--sp-4);
  }
}

/* ===================== UTILITIES ======================================== */
@layer 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;
  }

  /* Scrollbar custom (webkit) */
  *::-webkit-scrollbar { width: 10px; height: 10px; }
  *::-webkit-scrollbar-track { background: transparent; }
  *::-webkit-scrollbar-thumb {
    background: hsl(var(--hue-navy) 28% 26% / 0.7);
    border-radius: var(--radius-pill);
    border: 2px solid transparent;
    background-clip: padding-box;
  }
  *::-webkit-scrollbar-thumb:hover { background-color: hsl(var(--hue-navy) 28% 34% / 0.9); }
}

/* ===================== KEYFRAMES ======================================== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================== PRINT ============================================ */
@media print {
  body { background: #fff; color: #000; }
  body::before { display: none; }
  header.app-header, .hero, #install-btn, .rp-dialog, .welcome-banner { display: none !important; }
  .card { page-break-inside: avoid; border: 1px solid #ccc; box-shadow: none; background: #fff; color: #000; }
}

/* ===================== WELCOME BANNER =================================== */
.welcome-banner {
  margin: 16px 0 20px;
  padding: 18px 22px;
  border-radius: var(--radius-lg, 14px);
  background: linear-gradient(135deg,
    hsl(205 72% 22% / 0.85),
    hsl(172 55% 22% / 0.85));
  border: 1px solid hsl(205 60% 55% / 0.35);
  box-shadow: 0 6px 24px -8px hsl(205 80% 10% / 0.6);
  color: #eaf4ff;
  animation: fade-up 0.4s ease-out;
}
.welcome-banner[hidden] { display: none; }
.welcome-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.welcome-title {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.welcome-close {
  background: transparent;
  border: 1px solid hsl(205 60% 65% / 0.4);
  color: inherit;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: background 120ms ease, border-color 120ms ease;
}
.welcome-close:hover {
  background: hsl(205 60% 65% / 0.18);
  border-color: hsl(205 60% 75% / 0.6);
}
.welcome-steps {
  margin: 0;
  padding: 0 0 0 4px;
  list-style: none;
  display: grid;
  gap: 6px;
  font-size: 0.94rem;
  line-height: 1.45;
}
.welcome-steps li { color: #dbeaf7; }
.welcome-steps code {
  background: hsl(205 30% 18% / 0.6);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85em;
  color: #f4c16a;
}
.welcome-foot {
  margin-top: 10px;
  font-size: 0.78rem;
  color: hsl(205 25% 75% / 0.75);
  font-style: italic;
}

/* ===================== ARTIGO BODY (TTS target) ========================= */
.artigo-body {
  margin: 14px 0 4px;
  max-width: 68ch;
  line-height: 1.7;
  color: hsl(205 18% 88%);
}
.artigo-body p,
.artigo-body li,
.artigo-body blockquote {
  margin: 0 0 12px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 240ms ease, color 240ms ease;
}
.artigo-body h3, .artigo-body h4 { margin: 18px 0 8px; color: hsl(172 52% 70%); }
.artigo-body code { font-family: 'JetBrains Mono', ui-monospace, monospace; background: hsl(205 30% 18% / 0.6); padding: 1px 6px; border-radius: 4px; font-size: 0.88em; }
.artigo-body strong { color: #f4f8ff; }
.artigo-body blockquote {
  border-left: 3px solid hsl(205 70% 55%);
  padding-left: 14px;
  font-style: italic;
  color: hsl(205 18% 80%);
}
.artigo-body .tts-speaking {
  background: linear-gradient(90deg, hsl(172 60% 30% / 0.28), hsl(205 70% 35% / 0.28));
  box-shadow: inset 0 0 0 1px hsl(172 55% 55% / 0.35);
  color: #f4fbff;
}

/* ===================== TTS PLAYER ======================================== */
.tts-player {
  position: sticky;
  bottom: 12px;
  margin: 16px -4px 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg,
    hsl(205 62% 18% / 0.94),
    hsl(172 48% 18% / 0.94));
  backdrop-filter: blur(10px);
  border: 1px solid hsl(205 60% 55% / 0.28);
  box-shadow: 0 8px 28px -10px hsl(205 80% 5% / 0.8);
  color: #e8f1f8;
  display: grid;
  gap: 10px;
  z-index: 3;
}
.tts-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tts-btn {
  appearance: none;
  background: hsl(205 60% 28% / 0.85);
  color: inherit;
  border: 1px solid hsl(205 60% 55% / 0.4);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 120ms ease, transform 120ms ease;
}
.tts-btn:hover { background: hsl(205 60% 36% / 0.95); }
.tts-btn:active { transform: scale(0.96); }
.tts-btn--play {
  width: 44px; height: 44px; padding: 0;
  justify-content: center;
  background: linear-gradient(135deg, hsl(205 70% 48%), hsl(172 55% 48%));
  border-color: transparent;
  font-size: 1.15rem;
}
.tts-progress {
  flex: 1;
  min-width: 120px;
  height: 6px;
  background: hsl(205 30% 22% / 0.7);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.tts-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, hsl(205 80% 62%), hsl(172 62% 68%));
  transition: width 280ms ease-out;
}
.tts-meta {
  font-size: 0.78rem;
  color: hsl(205 18% 75%);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tts-rate-group {
  display: inline-flex;
  background: hsl(205 30% 18% / 0.6);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.tts-rate {
  appearance: none;
  background: transparent;
  color: hsl(205 20% 80%);
  border: none;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.tts-rate:hover { color: #f4fbff; }
.tts-rate.is-active {
  background: hsl(172 55% 50% / 0.28);
  color: #f4fbff;
  box-shadow: inset 0 0 0 1px hsl(172 55% 55% / 0.45);
}
.tts-voice {
  appearance: none;
  background: hsl(205 30% 18% / 0.6);
  color: inherit;
  border: 1px solid hsl(205 60% 55% / 0.28);
  border-radius: 999px;
  padding: 5px 30px 5px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  max-width: 220px;
  text-overflow: ellipsis;
}
.tts-autoscroll {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: hsl(205 18% 82%);
  cursor: pointer;
  user-select: none;
}
.tts-autoscroll input { accent-color: hsl(172 55% 55%); }

.tts-player[data-state="playing"] .tts-btn--play { box-shadow: 0 0 0 3px hsl(172 55% 55% / 0.35); }

/* ===================== STT MIC ========================================== */
.stt-wrap {
  position: relative;
  display: block;
}
.stt-wrap > textarea { width: 100%; padding-right: 100px; }
.stt-mic {
  position: absolute;
  right: 10px;
  bottom: 10px;
  appearance: none;
  background: hsl(205 45% 22% / 0.9);
  color: #eaf4ff;
  border: 1px solid hsl(205 60% 55% / 0.4);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 160ms ease, transform 120ms ease, box-shadow 160ms ease;
  z-index: 2;
}
.stt-mic:hover:not(:disabled) { background: hsl(205 50% 32% / 0.95); }
.stt-mic:active { transform: scale(0.96); }
.stt-mic .stt-icon { font-size: 1rem; line-height: 1; }
.stt-mic.is-listening {
  background: linear-gradient(135deg, hsl(172 62% 45%), hsl(205 70% 50%));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 0 0 hsl(172 62% 55% / 0.6);
  animation: mic-pulse 1.3s ease-out infinite;
}
.stt-mic--unsupported,
.stt-mic--denied {
  opacity: 0.55;
  cursor: not-allowed;
}
@keyframes mic-pulse {
  0%   { box-shadow: 0 0 0 0 hsl(172 62% 55% / 0.55); }
  70%  { box-shadow: 0 0 0 14px hsl(172 62% 55% / 0); }
  100% { box-shadow: 0 0 0 0 hsl(172 62% 55% / 0); }
}
.stt-tooltip {
  position: absolute;
  right: 10px;
  bottom: calc(100% + 8px);
  max-width: 280px;
  padding: 8px 12px;
  background: hsl(205 35% 14% / 0.96);
  border: 1px solid hsl(172 55% 55% / 0.35);
  color: #eaf4ff;
  font-size: 0.82rem;
  border-radius: 10px;
  box-shadow: 0 8px 22px -8px hsl(205 80% 5% / 0.7);
  z-index: 3;
  animation: fade-up 0.35s ease-out;
}
.stt-tooltip::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 100%;
  border: 6px solid transparent;
  border-top-color: hsl(205 35% 14% / 0.96);
}
.stt-tooltip.is-leaving { opacity: 0; transform: translateY(4px); transition: opacity 300ms, transform 300ms; }

/* ===================== MARK-READ (dormant/active) ======================= */
.mark-read-btn[data-ready="0"] {
  opacity: 0.55;
  background: transparent;
  border: 1px dashed hsl(205 40% 55% / 0.45);
  color: hsl(205 18% 78%);
  cursor: not-allowed;
}
.mark-read-btn[data-ready="0"]:hover { background: transparent; }
.mark-read-hint {
  display: block;
  font-size: 0.78rem;
  color: hsl(205 18% 70%);
  margin-top: 4px;
}

@media (max-width: 640px) {
  .tts-player { position: static; }
  .stt-mic .stt-label { display: none; }
  .stt-mic { padding: 8px; }
  .stt-wrap > textarea { padding-right: 48px; }
}

/* ===================== QUIZ — RESPOSTA DE REFERÊNCIA ==================== */
.quiz-ref {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: hsl(40 50% 20% / 0.35);
  border: 1px solid hsl(40 55% 55% / 0.28);
  color: hsl(40 30% 88%);
}
.quiz-ref > summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: hsl(40 75% 75%);
  list-style: none;
  padding: 2px 0;
  user-select: none;
}
.quiz-ref > summary::-webkit-details-marker { display: none; }
.quiz-ref > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 180ms ease;
}
.quiz-ref[open] > summary::before { transform: rotate(90deg); }
.quiz-ref > p {
  margin: 8px 0 2px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: hsl(40 25% 92%);
  font-style: italic;
}

/* ===================== ROLEPLAY — RESUMO & PERGUNTA ===================== */
.rp-result-cat {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: hsl(205 18% 70%);
  padding: 2px 8px;
  border-radius: 999px;
  background: hsl(205 30% 18% / 0.6);
  border: 1px solid hsl(205 40% 40% / 0.3);
}
.rp-result-pergunta {
  margin: 6px 0 10px;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 0.95rem;
  color: hsl(205 20% 92%);
  font-weight: 500;
}
.chips-label {
  display: inline-block;
  font-size: 0.78rem;
  color: hsl(205 18% 72%);
  margin-right: 6px;
  font-weight: 500;
}

.rp-resumo {
  margin: 14px 0 18px;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg,
    hsl(205 55% 18% / 0.9),
    hsl(172 45% 18% / 0.9));
  border: 1px solid hsl(172 55% 55% / 0.3);
  box-shadow: 0 6px 22px -8px hsl(205 80% 5% / 0.6);
  color: #eaf4ff;
  display: grid;
  gap: 10px;
}
.rp-resumo h3 {
  margin: 0;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: hsl(172 55% 72%);
}
.rp-resumo-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  text-align: center;
}
.rp-resumo-stats > div {
  display: flex;
  flex-direction: column;
  padding: 8px 6px;
  border-radius: 10px;
  background: hsl(205 30% 14% / 0.55);
  border: 1px solid hsl(205 40% 40% / 0.25);
}
.rp-resumo-stats strong {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.1rem;
  color: #f4fbff;
}
.rp-resumo-stats span {
  font-size: 0.72rem;
  color: hsl(205 18% 72%);
  margin-top: 2px;
}
.rp-resumo-rec {
  margin: 4px 0 0;
  padding: 10px 12px;
  background: hsl(40 40% 20% / 0.3);
  border-left: 3px solid hsl(40 70% 60%);
  border-radius: 6px;
  font-size: 0.9rem;
  color: hsl(40 30% 92%);
}
@media (max-width: 640px) {
  .rp-resumo-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ===================== APP SHELL (sidebar + content) ==================== */
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  gap: 0;
}
.app-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 20px;
  background: linear-gradient(180deg,
    hsl(205 40% 10% / 0.98),
    hsl(205 45% 8% / 0.98));
  border-right: 1px solid hsl(205 45% 25% / 0.35);
  z-index: 5;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 12px;
  border-bottom: 1px solid hsl(205 40% 25% / 0.25);
}
.sidebar-brand .brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, hsl(205 70% 50%), hsl(172 55% 55%));
  border-radius: 10px;
  color: #0b1f33;
  font-weight: 700;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
}
.sidebar-brand .app-title { font-size: 1rem; margin: 0; line-height: 1.2; }
.sidebar-brand .app-subtitle { font-size: 0.72rem; color: hsl(205 18% 70%); margin-top: 2px; }
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.nav-btn {
  appearance: none;
  background: transparent;
  color: hsl(205 18% 82%);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.92rem;
  font-family: inherit;
  text-align: left;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  position: relative;
}
.nav-btn:hover { background: hsl(205 40% 20% / 0.45); color: #f4fbff; }
.nav-btn.is-active {
  background: linear-gradient(90deg, hsl(205 65% 30% / 0.55), hsl(172 50% 28% / 0.25));
  color: #f4fbff;
  border-color: hsl(172 55% 55% / 0.35);
  box-shadow: inset 2px 0 0 hsl(172 60% 60%);
}
.nav-icon { font-size: 1.05rem; width: 20px; text-align: center; }
.nav-label { flex: 1; }
.nav-badge {
  font-size: 0.7rem;
  background: hsl(172 60% 50%);
  color: #0b1f33;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 700;
}
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid hsl(205 40% 25% / 0.25);
}
.sidebar-toggle {
  display: none;
  appearance: none;
  background: transparent;
  color: inherit;
  border: 1px solid hsl(205 40% 40% / 0.4);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1rem;
}

/* Content area */
.app-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 24px 90px;
}
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 14px;
  margin-bottom: 8px;
  backdrop-filter: blur(8px);
  background: linear-gradient(180deg,
    hsl(205 60% 8% / 0.88),
    hsl(205 60% 8% / 0.5));
}
.topbar-title {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: #eaf4ff;
  letter-spacing: 0.01em;
  flex: 1;
}

/* ===================== NEXT ACTION CARD ================================= */
.next-action {
  margin: 10px 0 18px;
}
.next-action:empty { display: none; }
.na-card {
  padding: 22px 24px;
  border-radius: 18px;
  background: linear-gradient(135deg,
    hsl(205 70% 32% / 0.9),
    hsl(172 55% 30% / 0.88));
  border: 1px solid hsl(172 55% 55% / 0.35);
  box-shadow: 0 14px 40px -14px hsl(205 80% 5% / 0.7);
  color: #f4fbff;
  display: grid;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.na-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(1200px 200px at 90% -20%, hsl(172 70% 60% / 0.22), transparent);
  pointer-events: none;
}
.na-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: hsl(172 55% 80%);
  font-weight: 600;
}
.na-title {
  margin: 2px 0;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.5rem;
  line-height: 1.2;
}
.na-sub {
  font-size: 0.95rem;
  color: hsl(205 15% 88%);
  max-width: 60ch;
}
.na-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.na-cta {
  appearance: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  background: #f4fbff;
  color: #0b1f33;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 120ms ease, box-shadow 160ms ease;
}
.na-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px -6px hsl(172 60% 40% / 0.6); }
.na-cta--ghost {
  background: transparent;
  color: #f4fbff;
  border: 1px solid hsl(205 40% 70% / 0.4);
}
.na-mini-timeline {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  align-items: center;
  font-size: 0.78rem;
  color: hsl(205 15% 80%);
}
.na-mini-timeline .dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: hsl(205 30% 40% / 0.6);
}
.na-mini-timeline .dot.is-done { background: hsl(172 60% 60%); }
.na-mini-timeline .dot.is-current { background: hsl(40 70% 60%); box-shadow: 0 0 0 3px hsl(40 70% 60% / 0.22); }

/* Pulse de foco aplicado ao slot alvo quando Next Action CTA é clicado */
[data-slot].na-focus-pulse > * {
  animation: na-focus 1.6s ease-out;
  border-radius: 14px;
}
@keyframes na-focus {
  0%   { box-shadow: 0 0 0 0 hsl(172 60% 55% / 0.55); }
  30%  { box-shadow: 0 0 0 10px hsl(172 60% 55% / 0.35); }
  100% { box-shadow: 0 0 0 0 hsl(172 60% 55% / 0); }
}

/* ===================== CURIOSIDADE — actions =========================== */
.curiosity-actions { margin-top: 10px; display: flex; justify-content: flex-end; }

/* ===================== JOBS — nova card + tabs + modal ================== */
.jobs-card { display: flex; flex-direction: column; }
.jobs-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.jobs-all-btn {
  white-space: nowrap;
  font-size: 0.88rem;
}

.jobs-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid hsl(205 40% 30% / 0.35);
  margin: 4px 0 14px;
  padding-bottom: 0;
}
.jobs-tab {
  appearance: none;
  background: transparent;
  color: hsl(205 18% 78%);
  border: none;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 120ms ease, border-color 120ms ease;
  position: relative;
  top: 1px;
}
.jobs-tab:hover { color: #f4fbff; }
.jobs-tab.is-active {
  color: #f4fbff;
  border-bottom-color: hsl(172 60% 58%);
}
.jobs-tab-count {
  background: hsl(205 40% 24% / 0.8);
  color: hsl(205 18% 90%);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.jobs-tab.is-active .jobs-tab-count { background: hsl(172 55% 40% / 0.55); color: #f4fbff; }

.jobs-panel { display: grid; gap: 10px; }

.job-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: hsl(205 35% 12% / 0.5);
  border: 1px solid hsl(205 35% 26% / 0.4);
  display: grid;
  gap: 8px;
  transition: border-color 120ms ease, transform 120ms ease;
}
.job-item:hover { border-color: hsl(172 50% 45% / 0.45); transform: translateY(-1px); }
.job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.job-head-left { min-width: 0; flex: 1; }
.job-empresa {
  font-size: 0.76rem;
  color: hsl(205 18% 72%);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.job-empresa .job-remoto {
  color: hsl(172 50% 68%);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.72rem;
  background: hsl(172 50% 35% / 0.2);
  padding: 1px 8px;
  border-radius: 999px;
}
.job-flag { font-size: 0.95rem; }
.job-titulo {
  font-size: 1rem;
  font-weight: 600;
  color: #eaf4ff;
  margin-top: 2px;
  line-height: 1.35;
}
.job-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 80px;
}
.job-score-num {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: hsl(205 20% 92%);
  font-variant-numeric: tabular-nums;
}
.job-score-bar {
  width: 72px;
  height: 5px;
  background: hsl(205 30% 22% / 0.7);
  border-radius: 999px;
  overflow: hidden;
}
.job-score-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(205 70% 55%), hsl(172 60% 58%));
}
.job-score--high .job-score-num { color: hsl(172 60% 70%); }
.job-score--mid .job-score-num { color: hsl(40 70% 68%); }
.job-score--low .job-score-num { color: hsl(205 25% 78%); }
.job-score--mid .job-score-bar-fill { background: linear-gradient(90deg, hsl(40 70% 55%), hsl(28 65% 55%)); }
.job-score--low .job-score-bar-fill { background: hsl(205 35% 45%); }

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.82rem;
  color: hsl(205 15% 80%);
}
.job-chips { flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.job-actions { display: flex; justify-content: flex-end; }
.job-actions .btn-ghost { font-size: 0.82rem; padding: 4px 10px; }

/* Modal Ver todas */
.jobs-dialog {
  width: min(960px, 96vw);
  max-height: 92vh;
  padding: 22px 24px;
  border-radius: 18px;
  border: 1px solid hsl(205 50% 35% / 0.4);
  background: linear-gradient(180deg,
    hsl(205 55% 10% / 0.98),
    hsl(205 55% 8% / 0.98));
  color: #eaf4ff;
  box-shadow: 0 30px 80px -20px hsl(205 80% 3% / 0.7);
}
.jobs-dialog::backdrop {
  background: hsl(205 55% 5% / 0.7);
  backdrop-filter: blur(4px);
}
.jobs-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid hsl(205 30% 25% / 0.4);
}
.jobs-modal-header h2 { margin: 0; font-size: 1.25rem; font-family: 'Space Grotesk', Inter, system-ui, sans-serif; }
.jobs-modal-sub { margin: 4px 0 0; font-size: 0.82rem; color: hsl(205 15% 72%); }
.rp-close-x {
  appearance: none;
  background: transparent;
  border: 1px solid hsl(205 40% 40% / 0.4);
  color: inherit;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}
.rp-close-x:hover { background: hsl(205 45% 22% / 0.6); }

.jobs-modal-filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid hsl(205 30% 25% / 0.3);
}
.jobs-filter-input, .jobs-filter-select {
  appearance: none;
  background: hsl(205 40% 18% / 0.6);
  color: #eaf4ff;
  border: 1px solid hsl(205 40% 35% / 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-family: inherit;
}
.jobs-filter-input:focus, .jobs-filter-select:focus {
  outline: none;
  border-color: hsl(172 55% 55% / 0.6);
  background: hsl(205 40% 22% / 0.75);
}
.jobs-modal-list {
  padding: 14px 0;
  max-height: 52vh;
  overflow-y: auto;
  display: grid;
  gap: 10px;
}
.jobs-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid hsl(205 30% 25% / 0.3);
}
.jobs-pager-info {
  font-size: 0.82rem;
  color: hsl(205 15% 75%);
}
@media (max-width: 720px) {
  .jobs-modal-filters { grid-template-columns: 1fr 1fr; }
  .jobs-modal-filters .jobs-filter-input { grid-column: 1 / -1; }
  .jobs-header { flex-direction: column; align-items: flex-start; }
  .jobs-all-btn { align-self: flex-end; }
  .job-score { min-width: 64px; }
  .job-score-bar { width: 56px; }
}

/* ===================== ARTIGO — topbar com botão modo foco ============== */
.artigo-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.artigo-focus-btn {
  font-size: 0.78rem;
  padding: 4px 10px;
  flex-shrink: 0;
}

/* ===================== MODO FOCO (dialog fullscreen) ==================== */
.focus-dialog {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: none;
  background: hsl(210 40% 6%);
  color: hsl(210 20% 92%);
  overflow-y: auto;
}
.focus-dialog::backdrop { background: hsl(210 40% 4% / 0.98); }
.focus-topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: hsl(210 40% 6% / 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid hsl(205 25% 20% / 0.4);
  z-index: 2;
}
.focus-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: hsl(172 40% 60%);
  font-weight: 600;
}
.focus-article {
  max-width: 68ch;
  margin: 42px auto 80px;
  padding: 0 24px;
  font-family: Inter, system-ui, sans-serif;
  font-size: 1.08rem;
  line-height: 1.75;
}
.focus-article h1 {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 2.1rem;
  line-height: 1.2;
  margin: 0 0 14px;
  color: #f4f8ff;
}
.focus-lead {
  font-size: 1.18rem;
  color: hsl(205 18% 78%);
  margin: 0 0 28px;
  font-style: italic;
}
.focus-body {
  color: hsl(210 15% 88%);
}
.focus-body > * + * { margin-top: 16px; }
.focus-body p { margin: 0; }
.focus-body strong { color: #f4f8ff; }
.focus-body code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: hsl(205 30% 14%);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.9em;
}
.focus-body blockquote {
  border-left: 3px solid hsl(205 60% 55%);
  padding: 2px 0 2px 18px;
  font-style: italic;
  color: hsl(205 15% 78%);
  margin: 0;
}
.focus-licoes {
  margin-top: 40px;
  padding: 22px 24px;
  border-radius: 14px;
  background: hsl(205 40% 12% / 0.7);
  border: 1px solid hsl(172 40% 40% / 0.35);
}
.focus-licoes h3 {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1rem;
  color: hsl(172 50% 70%);
  margin: 0 0 12px;
}
.focus-licoes ul { margin: 0; padding-left: 20px; }
.focus-licoes li + li { margin-top: 8px; }

/* ===================== SETTINGS DIALOG ================================== */
.settings-btn {
  appearance: none;
  background: transparent;
  color: hsl(205 18% 80%);
  border: 1px solid hsl(205 40% 40% / 0.35);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 120ms ease;
}
.settings-btn:hover { background: hsl(205 40% 20% / 0.4); color: #f4fbff; }

.settings-dialog {
  width: min(520px, 94vw);
  max-height: 88vh;
  padding: 24px 26px;
  border-radius: 18px;
  border: 1px solid hsl(205 45% 35% / 0.4);
  background: linear-gradient(180deg,
    hsl(205 55% 10%),
    hsl(205 55% 8%));
  color: #eaf4ff;
}
.settings-dialog::backdrop { background: hsl(205 55% 5% / 0.7); backdrop-filter: blur(4px); }
.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid hsl(205 30% 24% / 0.4);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.settings-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
}
.settings-section { margin-bottom: 20px; }
.settings-section h3 {
  margin: 0 0 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: hsl(205 18% 72%);
  font-weight: 600;
}
.settings-hint { font-size: 0.82rem; color: hsl(205 15% 72%); margin: 0 0 10px; }
.settings-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.settings-stats > div {
  padding: 10px 8px;
  border-radius: 10px;
  background: hsl(205 40% 14% / 0.55);
  border: 1px solid hsl(205 35% 28% / 0.35);
  text-align: center;
}
.settings-stats strong {
  display: block;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.05rem;
  color: #f4fbff;
}
.settings-stats span {
  font-size: 0.68rem;
  color: hsl(205 15% 72%);
  margin-top: 2px;
  display: block;
}
.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-about p { margin: 4px 0; font-size: 0.88rem; }

/* ===================== STREAK PULSE ===================================== */
.stat-pill--streak.streak-pulsing {
  animation: streak-pop 2.4s ease-out;
}
.stat-pill--streak.streak-pulsing .flame {
  display: inline-block;
  animation: flame-flicker 2.4s ease-out;
}
@keyframes streak-pop {
  0%   { transform: scale(1);   box-shadow: 0 0 0 0 hsl(40 85% 58% / 0.6); }
  30%  { transform: scale(1.12); box-shadow: 0 0 0 14px hsl(40 85% 58% / 0.2); }
  60%  { transform: scale(1.04); box-shadow: 0 0 0 24px hsl(40 85% 58% / 0); }
  100% { transform: scale(1);   box-shadow: 0 0 0 0 hsl(40 85% 58% / 0); }
}
@keyframes flame-flicker {
  0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 0 hsl(40 90% 60% / 0)); }
  25%      { transform: scale(1.25) rotate(-6deg); filter: drop-shadow(0 0 8px hsl(40 90% 60% / 0.9)); }
  50%      { transform: scale(1.15) rotate(4deg); filter: drop-shadow(0 0 10px hsl(28 95% 58% / 0.85)); }
  75%      { transform: scale(1.2) rotate(-3deg); filter: drop-shadow(0 0 6px hsl(40 90% 60% / 0.7)); }
}

/* ===================== FLASHCARDS — listas por status =================== */
.fl-groups { margin-top: 14px; display: grid; gap: 8px; }
.fl-group {
  border-radius: 10px;
  background: hsl(205 35% 14% / 0.5);
  border: 1px solid hsl(205 40% 30% / 0.35);
  overflow: hidden;
}
.fl-group > summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: hsl(205 20% 88%);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.fl-group > summary::-webkit-details-marker { display: none; }
.fl-group > summary::before {
  content: "▸";
  transition: transform 180ms ease;
  color: hsl(205 35% 65%);
}
.fl-group[open] > summary::before { transform: rotate(90deg); }
.fl-group-count {
  background: hsl(205 45% 28% / 0.8);
  color: hsl(205 18% 90%);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.fl-group--learning .fl-group-count { background: hsl(40 55% 45% / 0.7); color: #fff9ec; }
.fl-group--mastered .fl-group-count { background: hsl(172 45% 35% / 0.7); color: #e6fbf5; }

.fl-list {
  margin: 0;
  padding: 4px 10px 10px;
  list-style: none;
  display: grid;
  gap: 6px;
}
.fl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: hsl(205 30% 10% / 0.45);
  border: 1px solid hsl(205 30% 22% / 0.35);
}
.fl-row-text { flex: 1; min-width: 0; }
.fl-row-frente {
  font-size: 0.92rem;
  color: hsl(205 15% 92%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fl-row-meta {
  font-size: 0.72rem;
  color: hsl(205 18% 68%);
  margin-top: 2px;
}
.fl-force {
  flex-shrink: 0;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 999px;
  background: hsl(40 60% 45% / 0.25);
  border: 1px solid hsl(40 65% 55% / 0.5);
  color: hsl(40 55% 85%);
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms ease;
}
.fl-force:hover:not(:disabled) { background: hsl(40 60% 45% / 0.5); color: #fff9ec; }
.fl-cta-row { display: flex; justify-content: center; padding: 6px 0 2px; }
@media (max-width: 640px) {
  .fl-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .fl-force { align-self: flex-end; }
}

/* ===================== TAB PANELS ======================================== */
.app-shell .view { display: contents; /* fallback: deixa slots diretos */ }
[data-slot] { display: block; }

/* Quando a aba ativa é X, esconde slots que não pertencem a ela.
   Mapeamento por data-slot → tab primária. */
.app-shell[data-active-tab="hoje"] [data-slot="badges"],
.app-shell[data-active-tab="hoje"] [data-slot="jobs"],
.app-shell[data-active-tab="hoje"] [data-slot="diario"],
.app-shell[data-active-tab="hoje"] [data-slot="dicionario"],
.app-shell[data-active-tab="hoje"] [data-slot="exports"],
.app-shell[data-active-tab="hoje"] [data-slot="dashboard"] { display: none; }

.app-shell[data-active-tab="revisao"] [data-slot]:not([data-slot="flashcards"]):not([data-slot="relampago"]) { display: none; }
.app-shell[data-active-tab="revisao"] #next-action,
.app-shell[data-active-tab="revisao"] #hero { display: none; }

.app-shell[data-active-tab="vagas"] [data-slot]:not([data-slot="jobs"]) { display: none; }
.app-shell[data-active-tab="vagas"] #next-action { display: none; }

.app-shell[data-active-tab="progresso"] [data-slot="artigo"],
.app-shell[data-active-tab="progresso"] [data-slot="curiosity"],
.app-shell[data-active-tab="progresso"] [data-slot="quizzes"],
.app-shell[data-active-tab="progresso"] [data-slot="flashcards"],
.app-shell[data-active-tab="progresso"] [data-slot="roleplay"],
.app-shell[data-active-tab="progresso"] [data-slot="jobs"],
.app-shell[data-active-tab="progresso"] [data-slot="dicionario"],
.app-shell[data-active-tab="progresso"] [data-slot="exports"] { display: none; }
.app-shell[data-active-tab="progresso"] #next-action { display: none; }

.app-shell[data-active-tab="biblioteca"] [data-slot="artigo"],
.app-shell[data-active-tab="biblioteca"] [data-slot="quizzes"],
.app-shell[data-active-tab="biblioteca"] [data-slot="flashcards"],
.app-shell[data-active-tab="biblioteca"] [data-slot="roleplay"],
.app-shell[data-active-tab="biblioteca"] [data-slot="jobs"],
.app-shell[data-active-tab="biblioteca"] [data-slot="badges"],
.app-shell[data-active-tab="biblioteca"] [data-slot="diario"],
.app-shell[data-active-tab="biblioteca"] [data-slot="dashboard"],
.app-shell[data-active-tab="biblioteca"] [data-slot="cases"],
.app-shell[data-active-tab="biblioteca"] [data-slot="rajada"],
.app-shell[data-active-tab="biblioteca"] [data-slot="relampago"] { display: none; }
.app-shell[data-active-tab="biblioteca"] #next-action,
.app-shell[data-active-tab="biblioteca"] #hero { display: none; }

/* Aba Casos: só o slot cases visível */
.app-shell[data-active-tab="casos"] [data-slot]:not([data-slot="cases"]) { display: none; }
.app-shell[data-active-tab="casos"] #next-action,
.app-shell[data-active-tab="casos"] #hero { display: none; }
/* Demais abas: esconde cases por padrão */
.app-shell:not([data-active-tab="casos"]) [data-slot="cases"] { display: none; }
/* entrevista só em biblioteca */
.app-shell:not([data-active-tab="biblioteca"]) [data-slot="entrevista"] { display: none; }
/* relampago só em revisao */
.app-shell:not([data-active-tab="revisao"]) [data-slot="relampago"] { display: none; }

/* ===================== MOBILE TABBAR ==================================== */
.app-mobilebar {
  display: none;
}
.mbtn {
  appearance: none;
  background: transparent;
  border: none;
  color: hsl(205 18% 72%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.65rem;
  flex: 1;
  transition: color 120ms ease;
}
.mbtn-icon { font-size: 1.15rem; }
.mbtn.is-active { color: hsl(172 55% 70%); }
.mbtn.is-active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 28px;
  height: 3px;
  background: hsl(172 55% 60%);
  border-radius: 0 0 3px 3px;
}

/* ===================== TOAST STACK ======================================= */
.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 14px;
  padding-right: 36px;
  border-radius: 12px;
  background: hsl(205 40% 14% / 0.96);
  color: #eaf4ff;
  font-size: 0.88rem;
  line-height: 1.4;
  border: 1px solid hsl(205 50% 40% / 0.35);
  box-shadow: 0 10px 32px -10px hsl(205 80% 4% / 0.8);
  animation: fade-up 280ms ease-out;
  position: relative;
  backdrop-filter: blur(10px);
}
.toast.is-leaving { opacity: 0; transform: translateX(20px); transition: opacity 240ms, transform 240ms; }
.toast--success { border-left: 3px solid hsl(172 60% 55%); }
.toast--error { border-left: 3px solid hsl(0 65% 60%); }
.toast--warning { border-left: 3px solid hsl(40 70% 60%); }
.toast--info { border-left: 3px solid hsl(205 70% 60%); }
.toast-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  color: inherit;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.6;
  line-height: 1;
}
.toast-close:hover { opacity: 1; }
.toast-title { font-weight: 600; margin-bottom: 2px; font-family: 'Space Grotesk', Inter, system-ui, sans-serif; }

/* ===================== MOBILE RESPONSIVE ================================ */
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 240px;
    transform: translateX(-100%);
    transition: transform 220ms ease-out;
    box-shadow: 12px 0 32px -12px hsl(0 0% 0% / 0.5);
  }
  .app-shell.is-sidebar-open .app-sidebar { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
  .app-content { padding: 12px 16px 96px; }
  .app-mobilebar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: hsl(205 50% 8% / 0.97);
    border-top: 1px solid hsl(205 40% 30% / 0.4);
    z-index: 10;
    backdrop-filter: blur(12px);
  }
  .na-title { font-size: 1.25rem; }
  .toast-stack { top: auto; bottom: 100px; right: 12px; left: 12px; max-width: none; }
}
@media (min-width: 961px) {
  .app-shell.is-sidebar-open .app-sidebar { /* n/a */ }
}

/* ===================== COMPARATIVO SEMANAL =============================== */
.cmp-card {
  background: linear-gradient(140deg,
    hsl(205 45% 14% / 0.75),
    hsl(205 40% 12% / 0.55));
  border: 1px solid hsl(205 40% 30% / 0.35);
  margin-top: 14px;
}
.cmp-card h3 {
  margin: 2px 0 2px;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.05rem;
  color: #f4fbff;
}
.cmp-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.cmp-metric {
  padding: 12px 14px;
  border-radius: 10px;
  background: hsl(205 40% 12% / 0.5);
  border: 1px solid hsl(205 35% 26% / 0.35);
  border-left: 3px solid hsl(205 30% 40%);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cmp-metric.is-up { border-left-color: hsl(172 60% 55%); }
.cmp-metric.is-down { border-left-color: hsl(0 60% 58%); }
.cmp-metric.is-flat { border-left-color: hsl(205 30% 55%); }
.cmp-metric.is-new { border-left-color: hsl(40 70% 58%); }

.cmp-metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cmp-metric-ico { font-size: 1rem; }
.cmp-metric-label {
  flex: 1;
  font-size: 0.82rem;
  color: hsl(205 18% 82%);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.cmp-metric-delta {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: hsl(205 30% 20% / 0.7);
}
.cmp-metric.is-up .cmp-metric-delta {
  background: hsl(172 55% 35% / 0.35);
  color: hsl(172 70% 75%);
}
.cmp-metric.is-down .cmp-metric-delta {
  background: hsl(0 55% 35% / 0.35);
  color: hsl(0 70% 75%);
}
.cmp-metric.is-new .cmp-metric-delta {
  background: hsl(40 55% 35% / 0.35);
  color: hsl(40 70% 75%);
}
.cmp-metric-body { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cmp-atual strong {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #f4fbff;
  display: block;
  line-height: 1;
}
.cmp-atual span {
  font-size: 0.72rem;
  color: hsl(205 15% 72%);
  display: block;
  margin-top: 2px;
}
.cmp-anterior {
  font-size: 0.76rem;
  color: hsl(205 15% 66%);
  text-align: right;
}

/* ===================== META XP + FREEZES ================================ */
.stat-pill--meta {
  min-width: 160px;
}
.meta-bar {
  margin-top: 6px;
  height: 4px;
  background: hsl(205 30% 22% / 0.6);
  border-radius: 999px;
  overflow: hidden;
}
.meta-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, hsl(205 70% 55%), hsl(172 60% 58%), hsl(40 75% 62%));
  border-radius: 999px;
  transition: width 320ms ease;
}
.freeze-ind {
  display: inline-block;
  margin-left: 8px;
  padding: 0 6px;
  background: hsl(200 60% 40% / 0.35);
  border: 1px solid hsl(200 60% 60% / 0.4);
  border-radius: 999px;
  font-size: 0.72rem;
  color: hsl(200 60% 88%);
}

.settings-select {
  background: hsl(205 40% 18% / 0.7);
  color: #eaf4ff;
  border: 1px solid hsl(205 40% 40% / 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  min-width: 120px;
}
.settings-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.settings-meta-row label { font-size: 0.9rem; color: hsl(205 15% 85%); }

/* ===================== CASE STEP DETAILS ================================ */
.case-step-details {
  margin-top: 10px;
  padding: 0 4px;
}
.case-step-details > summary {
  cursor: pointer;
  color: hsl(172 50% 70%);
  font-size: 0.82rem;
  padding: 4px 0;
  list-style: none;
  user-select: none;
}
.case-step-details > summary::-webkit-details-marker { display: none; }
.case-step-details > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 180ms ease;
}
.case-step-details[open] > summary::before { transform: rotate(90deg); }
.case-step-detalhes {
  margin: 6px 0 4px 0;
  padding: 8px 10px 8px 24px;
  border-left: 2px solid hsl(172 40% 40% / 0.4);
  display: grid;
  gap: 4px;
}
.case-step-detalhes li {
  color: hsl(205 15% 86%);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* ===================== BANCO DE ENTREVISTAS ============================= */
.entrev-list { display: grid; gap: 10px; margin-top: 12px; }
.entrev-categoria {
  border-radius: 10px;
  background: hsl(205 40% 12% / 0.5);
  border: 1px solid hsl(205 40% 28% / 0.35);
  overflow: hidden;
}
.entrev-categoria > summary {
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  list-style: none;
}
.entrev-categoria > summary::-webkit-details-marker { display: none; }
.entrev-categoria > summary::before {
  content: "▸";
  color: hsl(172 50% 68%);
  transition: transform 180ms ease;
}
.entrev-categoria[open] > summary::before { transform: rotate(90deg); }
.entrev-count {
  background: hsl(205 40% 24% / 0.7);
  color: hsl(205 15% 90%);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
}
.entrev-items { padding: 4px 10px 12px; display: grid; gap: 6px; }
.entrev-item {
  background: hsl(205 30% 10% / 0.5);
  border: 1px solid hsl(205 30% 22% / 0.35);
  border-radius: 8px;
  padding: 10px 12px;
}
.entrev-item > summary {
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.92rem;
  list-style: none;
}
.entrev-item > summary::-webkit-details-marker { display: none; }
.entrev-ordem {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-weight: 600;
  color: hsl(172 55% 70%);
  min-width: 28px;
}
.entrev-q { flex: 1; color: #f4fbff; }
.entrev-sr {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(205 15% 72%);
  background: hsl(205 40% 20% / 0.5);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.entrev-body {
  padding: 10px 4px 4px 36px;
  display: grid;
  gap: 10px;
}
.entrev-resposta {
  color: hsl(205 15% 88%);
  line-height: 1.65;
  font-size: 0.9rem;
}
.entrev-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.entrev-armadilha {
  padding: 8px 10px;
  background: hsl(40 50% 18% / 0.5);
  border-left: 3px solid hsl(40 70% 58%);
  border-radius: 0 8px 8px 0;
  color: hsl(40 35% 92%);
  font-size: 0.88rem;
  line-height: 1.5;
}
.entrev-armadilha strong { color: hsl(40 80% 72%); }

/* ===================== RAJADA V/F ======================================= */
.rajada-card { display: flex; flex-direction: column; }
.rajada-card--locked { opacity: 0.75; }
.rajada-lock-hint, .rajada-intro {
  color: hsl(205 15% 82%);
  font-size: 0.94rem;
  line-height: 1.55;
  margin: 6px 0 12px;
}
.rajada-rules {
  margin: 0 0 14px;
  padding: 10px 14px 10px 30px;
  background: hsl(205 30% 12% / 0.5);
  border-radius: 8px;
  list-style: '· ';
  font-size: 0.82rem;
  color: hsl(205 15% 82%);
}
.rajada-rules li { margin-bottom: 4px; }
.rajada-rules kbd {
  background: hsl(205 45% 20%);
  border: 1px solid hsl(205 40% 45% / 0.5);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
}
.rajada-start-btn {
  align-self: flex-start;
  padding: 10px 20px;
  font-size: 0.95rem;
}
.rajada-card--done .rajada-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 0;
}
.rajada-done-score {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: hsl(172 55% 70%);
}
.rajada-done-score.is-perfect { color: hsl(40 80% 68%); text-shadow: 0 0 18px hsl(40 85% 58% / 0.5); }
.rajada-done-meta { color: hsl(205 15% 84%); font-size: 0.92rem; }
.rajada-done-msg { color: hsl(205 15% 70%); font-size: 0.82rem; margin-top: 4px; font-style: italic; }

/* Dialog do jogo */
.rajada-dialog {
  width: min(680px, 96vw);
  max-height: 92vh;
  padding: 0;
  border-radius: 20px;
  border: 1px solid hsl(172 55% 45% / 0.4);
  background: linear-gradient(180deg, hsl(205 55% 10%), hsl(205 55% 8%));
  color: #eaf4ff;
  overflow: hidden;
}
.rajada-dialog::backdrop {
  background: hsl(205 55% 5% / 0.85);
  backdrop-filter: blur(6px);
}
.rajada-play { display: flex; flex-direction: column; }
.rajada-play-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid hsl(205 30% 24% / 0.35);
}
.rajada-progress {
  flex: 1;
  height: 6px;
  background: hsl(205 30% 18% / 0.8);
  border-radius: 999px;
  overflow: hidden;
}
.rajada-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, hsl(205 70% 55%), hsl(172 55% 58%));
  transition: width 240ms ease;
}
.rajada-counter {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-weight: 600;
  color: hsl(205 15% 90%);
  white-space: nowrap;
}
.rajada-counter span { color: hsl(205 15% 60%); font-weight: 400; font-size: 0.85rem; }

/* Timer bar */
.rajada-timer {
  height: 4px;
  background: hsl(205 30% 14%);
  overflow: hidden;
}
.rajada-timer-bar {
  height: 100%;
  background: linear-gradient(90deg, hsl(172 60% 55%), hsl(40 70% 58%), hsl(0 65% 58%));
  width: 100%;
}

/* Pergunta */
.rajada-question-card {
  padding: 36px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 300px;
  position: relative;
}
.rajada-question-card.is-answered { pointer-events: none; }
.rajada-badge-ordem {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 0.72rem;
  background: hsl(205 40% 20% / 0.7);
  color: hsl(205 15% 75%);
  padding: 3px 10px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.rajada-question-text {
  margin: 0;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.3rem;
  line-height: 1.45;
  color: #f4fbff;
  text-align: center;
  padding: 0 8px;
}
.rajada-answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: auto;
}
.rajada-ans {
  appearance: none;
  padding: 22px 16px 16px;
  border-radius: 14px;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #f4fbff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 100ms ease, border-color 160ms ease, background 200ms ease;
}
.rajada-ans:hover:not(:disabled) { transform: translateY(-2px); }
.rajada-ans:active:not(:disabled) { transform: scale(0.97); }
.rajada-ans--v {
  background: linear-gradient(135deg, hsl(172 55% 22% / 0.8), hsl(172 55% 30% / 0.8));
  border-color: hsl(172 55% 55% / 0.35);
}
.rajada-ans--v:hover:not(:disabled) { border-color: hsl(172 55% 70%); box-shadow: 0 8px 24px -8px hsl(172 65% 40% / 0.55); }
.rajada-ans--f {
  background: linear-gradient(135deg, hsl(0 45% 22% / 0.8), hsl(0 45% 30% / 0.8));
  border-color: hsl(0 55% 55% / 0.35);
}
.rajada-ans--f:hover:not(:disabled) { border-color: hsl(0 60% 70%); box-shadow: 0 8px 24px -8px hsl(0 65% 40% / 0.55); }
.rajada-ans-ico { font-size: 1.5rem; line-height: 1; }
.rajada-ans-label { font-size: 1rem; }
.rajada-ans-key { font-size: 0.7rem; color: hsl(205 15% 72%); font-family: 'JetBrains Mono', ui-monospace, monospace; }
.rajada-ans:disabled { cursor: not-allowed; opacity: 0.5; }

/* Resultado */
.rajada-result {
  display: flex;
  flex-direction: column;
  padding: 24px 24px 20px;
  gap: 18px;
  max-height: 92vh;
  overflow-y: auto;
}
.rajada-result-head {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 6px 10px 16px;
  border-bottom: 1px solid hsl(205 30% 24% / 0.35);
}
.rajada-result-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 22px;
  border-radius: 14px;
  background: hsl(205 40% 14% / 0.7);
  border: 1px solid hsl(205 40% 40% / 0.35);
  min-width: 120px;
}
.rajada-result-score.is-perfect {
  background: linear-gradient(135deg, hsl(40 55% 30% / 0.55), hsl(172 50% 28% / 0.4));
  border-color: hsl(40 75% 60% / 0.5);
  box-shadow: 0 0 30px -8px hsl(40 85% 55% / 0.55);
}
.rajada-result-num {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: #f4fbff;
  line-height: 1;
}
.rajada-result-pct {
  font-size: 0.88rem;
  color: hsl(205 15% 78%);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.rajada-result-meta { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.rajada-result-xp {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.3rem;
  color: hsl(172 55% 72%);
  font-weight: 600;
}
.rajada-result-time { color: hsl(205 15% 80%); font-size: 0.9rem; }
.rajada-result-tag {
  display: inline-block;
  background: hsl(40 50% 30% / 0.55);
  border: 1px solid hsl(40 70% 60% / 0.45);
  color: hsl(40 75% 85%);
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  width: fit-content;
  margin-top: 4px;
}
.rajada-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.rajada-errors { display: flex; flex-direction: column; gap: 10px; }
.rajada-err-item {
  padding: 12px 14px;
  border-radius: 10px;
  background: hsl(0 30% 14% / 0.45);
  border-left: 3px solid hsl(0 60% 58%);
}
.rajada-err-q {
  font-weight: 500;
  color: #f4fbff;
  font-size: 0.94rem;
  margin-bottom: 6px;
}
.rajada-err-ans { font-size: 0.84rem; color: hsl(205 15% 82%); margin-bottom: 6px; }
.rajada-err-ans .is-wrong { color: hsl(0 70% 70%); }
.rajada-err-ans .is-right { color: hsl(172 60% 68%); }
.rajada-err-expl { font-size: 0.86rem; color: hsl(205 15% 78%); font-style: italic; line-height: 1.5; }
.rajada-perfect-msg {
  padding: 18px;
  text-align: center;
  color: hsl(40 70% 72%);
  font-size: 1.1rem;
  font-weight: 500;
}
.rajada-result-foot { display: flex; justify-content: flex-end; padding-top: 10px; border-top: 1px solid hsl(205 30% 24% / 0.35); }

@media (max-width: 640px) {
  .rajada-question-card { padding: 24px 18px 18px; }
  .rajada-question-text { font-size: 1.1rem; }
  .rajada-ans { padding: 18px 12px 14px; }
  .rajada-result-head { flex-direction: column; align-items: stretch; }
}

/* ===================== CASOS — lista + detalhe ========================== */
.cases-header {
  margin-bottom: 18px;
}
.cases-title {
  margin: 4px 0;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.5rem;
  color: #f4fbff;
}
.cases-sub {
  color: hsl(205 18% 78%);
  max-width: 68ch;
  font-size: 0.94rem;
}
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.case-card {
  padding: 18px 20px;
  border-radius: 14px;
  background: linear-gradient(140deg,
    hsl(205 45% 18% / 0.75),
    hsl(172 42% 18% / 0.75));
  border: 1px solid hsl(205 45% 40% / 0.35);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 200ms ease;
  text-decoration: none;
  color: inherit;
}
.case-card:hover, .case-card:focus-visible {
  transform: translateY(-2px);
  border-color: hsl(172 55% 55% / 0.55);
  box-shadow: 0 14px 28px -14px hsl(205 80% 5% / 0.7);
  outline: none;
}
.case-card-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: hsl(172 50% 72%);
  font-weight: 600;
}
.case-card-titulo {
  margin: 4px 0 2px;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.1rem;
  color: #f4fbff;
  line-height: 1.3;
}
.case-card-lead {
  color: hsl(205 15% 85%);
  font-size: 0.9rem;
  line-height: 1.55;
  flex: 1;
  margin: 0;
}
.case-card-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid hsl(205 40% 30% / 0.3);
}
.case-card-frentes {
  font-size: 0.78rem;
  color: hsl(205 18% 78%);
  font-variant-numeric: tabular-nums;
}
.case-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ----- Detalhe do caso ----- */
.case-breadcrumb { margin-bottom: 8px; }
.case-hero {
  padding: 24px 26px;
  border-radius: 18px;
  background: linear-gradient(135deg,
    hsl(205 55% 20% / 0.95),
    hsl(172 48% 22% / 0.9));
  border: 1px solid hsl(172 50% 55% / 0.35);
  margin-bottom: 22px;
}
.case-titulo {
  margin: 6px 0 10px;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.75rem;
  line-height: 1.2;
  color: #f4fbff;
}
.case-lead {
  font-size: 1.05rem;
  color: hsl(205 15% 90%);
  margin: 0 0 16px;
  max-width: 68ch;
  line-height: 1.55;
}
.case-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.case-chip {
  background: hsl(205 30% 12% / 0.6);
  border: 1px solid hsl(205 40% 40% / 0.4);
  color: hsl(205 15% 90%);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.case-section {
  padding: 18px 20px;
  border-radius: 14px;
  background: hsl(205 40% 12% / 0.55);
  border: 1px solid hsl(205 40% 28% / 0.3);
  margin-bottom: 18px;
}
.case-problema { color: hsl(205 15% 88%); line-height: 1.7; max-width: 72ch; margin: 6px 0 0; }
.case-forcas {
  margin: 10px 0 0;
  padding: 0 0 0 4px;
  list-style: none;
  display: grid;
  gap: 10px;
}
.case-forcas li {
  padding: 10px 14px;
  border-left: 3px solid hsl(172 55% 55%);
  background: hsl(205 30% 10% / 0.45);
  border-radius: 0 8px 8px 0;
  color: hsl(205 15% 90%);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* Tabs de frente (AWS/Azure/GCP/Databricks) */
.case-tabs {
  position: sticky;
  top: 52px;
  z-index: 3;
  display: flex;
  gap: 4px;
  padding: 8px;
  background: linear-gradient(180deg,
    hsl(205 55% 8% / 0.96),
    hsl(205 55% 10% / 0.92));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid hsl(205 40% 30% / 0.35);
  border-radius: 12px 12px 0 0;
  margin: -18px -20px 16px;
  overflow-x: auto;
}
.case-tab {
  appearance: none;
  background: transparent;
  color: hsl(205 18% 80%);
  border: 1px solid transparent;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.case-tab:hover { color: #f4fbff; background: hsl(205 40% 22% / 0.5); }
.case-tab.is-active {
  background: hsl(172 55% 35% / 0.3);
  color: #f4fbff;
  border-color: hsl(172 55% 55% / 0.5);
}

/* Conteúdo da variante */
.case-variant { display: grid; gap: 18px; }
.case-variant-stack {
  padding: 14px 16px;
  border-radius: 10px;
  background: hsl(205 30% 10% / 0.5);
  border: 1px solid hsl(205 35% 30% / 0.3);
}
.case-stack-code {
  display: block;
  margin-top: 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.88rem;
  color: hsl(172 50% 75%);
  line-height: 1.6;
  word-break: break-word;
  background: transparent;
  padding: 0;
}
.mermaid-slot {
  padding: 16px;
  background: hsl(205 40% 10% / 0.6);
  border-radius: 10px;
  border: 1px solid hsl(205 35% 28% / 0.3);
  overflow-x: auto;
}
.mermaid-slot svg { max-width: 100%; height: auto; }
.mermaid-fallback pre {
  color: hsl(172 50% 70%);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  margin: 0;
  white-space: pre;
  overflow-x: auto;
}
.mermaid-err { color: hsl(0 60% 70%); font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* Passo a passo */
.case-steps {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.case-step {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  background: hsl(205 30% 10% / 0.45);
  border-radius: 10px;
  border: 1px solid hsl(205 35% 28% / 0.3);
}
.case-step-num {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  background: linear-gradient(135deg, hsl(205 70% 48%), hsl(172 55% 48%));
  color: #0b1f33;
  border-radius: 999px;
}
.case-step-body { flex: 1; min-width: 0; }
.case-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.case-step-head strong { color: #f4fbff; font-size: 0.96rem; }
.case-step-comp {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: hsl(172 50% 75%);
  background: hsl(172 40% 20% / 0.5);
  padding: 2px 8px;
  border-radius: 999px;
}
.case-step-desc {
  margin: 0;
  color: hsl(205 15% 86%);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* Tradeoffs */
.case-trades {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.case-trade {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: hsl(205 30% 10% / 0.5);
  border-left: 3px solid hsl(205 40% 45%);
}
.case-trade--pro { border-left-color: hsl(172 60% 55%); }
.case-trade--con { border-left-color: hsl(0 62% 58%); }
.case-trade--neutro { border-left-color: hsl(40 70% 55%); }
.case-trade-ico {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}
.case-trade--pro .case-trade-ico { background: hsl(172 50% 30%); color: hsl(172 80% 88%); }
.case-trade--con .case-trade-ico { background: hsl(0 45% 32%); color: hsl(0 70% 90%); }
.case-trade--neutro .case-trade-ico { background: hsl(40 45% 30%); color: hsl(40 80% 88%); }
.case-trade-title { color: #f4fbff; font-weight: 600; font-size: 0.92rem; margin-bottom: 2px; }
.case-trade-desc { color: hsl(205 15% 86%); font-size: 0.86rem; line-height: 1.5; }

/* Quando usar / NÃO usar */
.case-variant-when {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.case-when {
  padding: 14px 16px;
  border-radius: 10px;
  background: hsl(205 30% 10% / 0.45);
}
.case-when--yes { border-left: 3px solid hsl(172 60% 55%); }
.case-when--no { border-left: 3px solid hsl(0 60% 58%); }
.case-when p { margin: 4px 0 0; color: hsl(205 15% 88%); line-height: 1.55; font-size: 0.92rem; }

/* Comparativo */
.case-cmp {
  padding: 18px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg,
    hsl(205 50% 14% / 0.85),
    hsl(205 45% 18% / 0.7));
  border: 1px solid hsl(205 45% 40% / 0.35);
  margin-bottom: 18px;
}
.case-cmp h3 {
  margin: 6px 0 12px;
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-size: 1.15rem;
  color: #f4fbff;
}
.case-cmp-scroll { overflow-x: auto; }
.case-cmp-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}
.case-cmp-table th, .case-cmp-table td {
  padding: 10px 14px;
  border-bottom: 1px solid hsl(205 35% 25% / 0.3);
  text-align: left;
  font-size: 0.92rem;
}
.case-cmp-table thead th {
  background: hsl(205 40% 18% / 0.8);
  color: hsl(205 15% 92%);
  font-weight: 600;
}
.case-cmp-table tbody th {
  color: hsl(205 15% 88%);
  font-weight: 500;
  background: hsl(205 30% 12% / 0.5);
}
.cmp-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 110px;
}
.cmp-num {
  font-family: 'Space Grotesk', Inter, system-ui, sans-serif;
  font-weight: 600;
  color: #f4fbff;
  font-variant-numeric: tabular-nums;
  width: 14px;
}
.cmp-bar {
  flex: 1;
  height: 6px;
  background: hsl(205 30% 20% / 0.6);
  border-radius: 999px;
  overflow: hidden;
}
.cmp-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, hsl(172 60% 58%), hsl(40 75% 60%), hsl(0 65% 60%));
  border-radius: 999px;
}
.cmp-cell--s1 .cmp-num { color: hsl(172 70% 75%); }
.cmp-cell--s5 .cmp-num { color: hsl(0 70% 72%); }

.case-veredito { border-left: 3px solid hsl(172 55% 55%); }
.case-veredito p {
  margin: 6px 0 0;
  color: hsl(205 15% 88%);
  line-height: 1.7;
  font-size: 0.96rem;
  max-width: 74ch;
}

@media (max-width: 720px) {
  .case-tabs { top: 46px; }
  .case-variant-when { grid-template-columns: 1fr; }
  .case-titulo { font-size: 1.35rem; }
  .case-hero { padding: 18px 20px; }
}
