@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&family=Instrument+Serif:ital@0;1&display=swap');
:root {
  /* ── Stone (warm neutrals) ── */
  --stone-50:  #FAFAF9;
  --stone-100: #F5F5F4;
  --stone-150: #EFEEEC;
  --stone-200: #E7E5E4;
  --stone-300: #D6D3D1;
  --stone-400: #A8A29E;
  --stone-500: #78716C;
  --stone-600: #57534E;
  --stone-700: #44403C;
  --stone-800: #292524;
  --stone-900: #1C1917;
  --stone-950: #0C0A09;

  /* ── Brand (deep navy) ── */
  --brand-50:  #EEF1FA;
  --brand-100: #DDE3F4;
  --brand-200: #B6C2E8;
  --brand-300: #8E9FDC;
  --brand-400: #5C72C6;
  --brand-500: #2C46A8;
  --brand-600: #1F3590;
  --brand-700: #182872;
  --brand-800: #131F58;
  --brand-900: #0E1640;

  /* ── Accent (mostarda — uso raríssimo) ── */
  --accent-100: #FEF3C7;
  --accent-300: #FCD34D;
  --accent-500: #E5A02D;
  --accent-700: #A16207;

  /* ── Semânticas ── */
  --success-50:  #ECFDF5;
  --success-100: #D1FAE5;
  --success-500: #059669;
  --success-700: #047857;

  --warning-50:  #FFFBEB;
  --warning-100: #FEF3C7;
  --warning-500: #D97706;
  --warning-700: #B45309;

  --danger-50:  #FEF2F2;
  --danger-100: #FEE2E2;
  --danger-500: #DC2626;
  --danger-700: #B91C1C;

  /* ── Superfícies (semânticas) ── */
  --surface-page:     var(--stone-50);
  --surface-card:     #FFFFFF;
  --surface-elevated: #FFFFFF;
  --surface-sunken:   var(--stone-100);
  --surface-inverse:  var(--stone-900);

  /* ── Texto ── */
  --text-strong:    var(--stone-900);
  --text-body:      var(--stone-700);
  --text-muted:     var(--stone-500);
  --text-subtle:    var(--stone-400);
  --text-on-brand:  #FFFFFF;
  --text-on-accent: var(--stone-900);

  /* ── Bordas ── */
  --border-subtle:  var(--stone-200);
  --border-default: var(--stone-300);
  --border-strong:  var(--stone-400);

  /* ── Spacing (escala 4px) ── */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* ── Raios ── */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-full: 9999px;

  /* ── Sombras (layered, ultra-sutis) ── */
  --shadow-xs:    0 1px 2px 0 rgb(28 25 23 / 0.04);
  --shadow-sm:    0 1px 2px 0 rgb(28 25 23 / 0.05), 0 1px 3px 0 rgb(28 25 23 / 0.04);
  --shadow-md:    0 2px 4px -1px rgb(28 25 23 / 0.06), 0 4px 8px -2px rgb(28 25 23 / 0.05);
  --shadow-lg:    0 4px 8px -2px rgb(28 25 23 / 0.08), 0 8px 24px -4px rgb(28 25 23 / 0.08);
  --shadow-xl:    0 12px 32px -8px rgb(28 25 23 / 0.12), 0 24px 64px -16px rgb(28 25 23 / 0.10);
  --shadow-focus: 0 0 0 3px rgb(44 70 168 / 0.18);

  /* ── Tipografia ── */
  --font-sans:    'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono:    'Geist Mono', ui-monospace, 'Cascadia Code', monospace;
  --font-display: 'Instrument Serif', Georgia, serif;

  /* ── Tamanhos ── */
  --text-xs:   12px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   16px;
  --text-lg:   18px;
  --text-xl:   22px;
  --text-2xl:  28px;
  --text-3xl:  36px;
  --text-4xl:  48px;
  --text-5xl:  64px;

  /* ── Densidades ── */
  --row-compact: 36px;
  --row-default: 44px;

  /* ── Transições ── */
  --ease-out: cubic-bezier(.16,1,.3,1);
  --t-fast:   120ms;
  --t-base:   180ms;
  --t-slow:   280ms;

  /* ── Z-index ── */
  --z-dropdown: 1000;
  --z-sticky:   1020;
  --z-drawer:   1040;
  --z-modal:    1050;
  --z-toast:    1080;

  /* ============================================================
     Tokens fora-da-escala 4px — cobrem valores legados recorrentes
     que ainda não foram normalizados pra grade canônica. Fase 1.5
     deve eliminá-los migrando ou aproximando à escala oficial.
     ============================================================ */
  --space-1px:  1px;
  --space-2px:  2px;
  --space-6px:  6px;
  --space-10px: 10px;
  --space-14px: 14px;
  /* Regra: spacing fora da escala 4px requer comentário justificando o uso. */

  /* ============================================================
     Legacy color tokens — migração iniciada em 2026-05-05.
     Mantidos por compatibilidade durante transição; novos componentes
     devem preferir tokens semânticos modernos.
     ============================================================ */
  --legacy-text-light:        #e5e7eb;   /* texto primário em fundos escuros (slate-200) */
  --legacy-text-muted:        #94a3b8;   /* texto secundário muted (slate-400) */
  --legacy-text-subtle:       #64748b;   /* slate-500 */
  --legacy-accent-green:      #4ade80;   /* verde vivo (não bate com --success-500) */
  --legacy-accent-emerald:    #34d399;   /* emerald-400 */
  --legacy-accent-amber:      #fbbf24;   /* amber-400 */
  --legacy-accent-red-soft:   #f87171;   /* red-400 */
  --legacy-accent-red-pale:   #fca5a5;   /* red-300 */
  --legacy-deep-red:          #c0392b;   /* gradient hero btn-deep */
  --legacy-deep-coral:        #e74c3c;   /* gradient hero btn-deep */
  --legacy-light-bg:          #F5F7FA;   /* tema light: bg page */
  --legacy-light-s2:          #F0F3F8;   /* tema light: surface secundária */
  --legacy-light-s3:          #E8EDF5;   /* tema light: surface terciária */
  --legacy-light-b1:          #DDE3EE;   /* tema light: border subtle */
  --legacy-light-b2:          #C8D0E0;   /* tema light: border default */
  --legacy-light-b3:          #B0BAD0;   /* tema light: border strong */
  --legacy-light-t1:          #0F1523;   /* tema light: text strong */
  --legacy-light-t2:          #3D4A63;   /* tema light: text body */
  --legacy-light-t3:          #5A6A85;   /* tema light: text muted */
  --legacy-light-t4:          #EBF0FA;   /* tema light: text on brand */
  --legacy-light-success:     #00C47A;   /* tema light: success */
  --legacy-light-info:        #1A7FE8;   /* tema light: info/brand */
  --legacy-light-danger:      #E0203E;   /* tema light: danger */
  --legacy-light-warning:     #D4820A;   /* tema light: warning */
  --legacy-light-purple:      #8A2FE0;   /* tema light: purple accent */
  --legacy-light-cyan:        #00C4B8;   /* tema light: cyan accent */
  --legacy-light-code-bg:     #EEF2FA;   /* tema light: code/pre bg */
  --legacy-light-code-fg:     #1A2A45;   /* tema light: code/pre text */
  --legacy-near-black:        #0a0a0a;   /* near-black usado em color de btn-primary */
  --legacy-card-bg:           #1e293b;   /* slate-800: card bg legado */
  --legacy-deep-green:        #06230f;   /* verde escuro: pack-badge color */
  --legacy-red-500:           #ef4444;   /* red-500 puro */
  --legacy-amber-500:         #f59e0b;   /* amber-500 puro */
  --legacy-blue-400:          #60a5fa;   /* blue-400 (plan-badge color) */
  --legacy-purple-300:        #c084fc;   /* purple-300 */
  --legacy-purple-200:        #d8b4fe;   /* purple-200 */
  --legacy-cyan-400:          #2dd4bf;   /* cyan-400 */
  --legacy-emerald-200:       #6ee7b7;   /* emerald-200 */
  --legacy-amber-pale:        #fde68a;   /* amber-pale */
  --legacy-indigo-300:        #818cf8;   /* indigo-300 */
  --legacy-gray-500:          #6b7280;   /* gray-500 */
  --legacy-bg-1a1a1f:         #1a1a1f;   /* fundo card alternativo */

  /* Tokens semânticos de cor — ux-001 */
  --color-success: #16a34a;
  --color-success-bg: #f0fdf4;
  --color-success-border: #bbf7d0;
  --color-danger: #dc2626;
  --color-danger-bg: #fef2f2;
  --color-danger-border: #fecaca;
  --color-warning: #d97706;
  --color-warning-bg: #fffbeb;
  --color-warning-border: #fde68a;
}

/* ============================================================
   Aliases retro-compatíveis — remover depois da Fase 1.5.
   Mantém vars antigas (--bg, --s1..s3, --b1..b3, --a1..a6, --t1..t4,
   --font-d, --font-m, --r) acessíveis para o CSS legado e para os
   <style> inline das 15 páginas que ainda referenciam o esquema antigo.
   ============================================================ */
:root {
  --bg:     var(--surface-page);
  --s1:     var(--surface-card);
  --s2:     var(--surface-sunken);
  --s3:     var(--surface-elevated);
  --b1:     var(--border-subtle);
  --b2:     var(--border-default);
  --b3:     var(--border-strong);
  --a1:     var(--success-500);
  --a2:     var(--brand-600);
  --a3:     var(--danger-500);
  --a4:     var(--warning-500);
  --a5:     #8A2FE0; /* TODO: tokenizar — Fase 1.5 (sem token semântico no DS atual) */
  --a6:     #00C4B8; /* TODO: tokenizar — Fase 1.5 (sem token semântico no DS atual) */
  --t1:     var(--text-strong);
  --t2:     var(--text-body);
  --t3:     var(--text-muted);
  --t4:     var(--text-on-brand);
  --font-d: var(--font-sans);
  --font-m: var(--font-mono);
  --r:      var(--radius-md);
}

[data-theme="light"] {
  /* Fundos */
  --bg: var(--legacy-light-bg);
  --s1: var(--text-on-brand);
  --s2: var(--legacy-light-s2);
  --s3: var(--legacy-light-s3);

  /* Bordas */
  --b1: var(--legacy-light-b1);
  --b2: var(--legacy-light-b2);
  --b3: var(--legacy-light-b3);

  /* Textos */
  --t1: var(--legacy-light-t1);
  --t2: var(--legacy-light-t2);
  --t3: var(--legacy-light-t3);
  --t4: var(--legacy-light-t4);

  /* Accents — versões mais escuras para contraste em fundo claro */
  --a1: var(--legacy-light-success);
  --a2: var(--legacy-light-info);
  --a3: var(--legacy-light-danger);
  --a4: var(--legacy-light-warning);
  --a5: var(--legacy-light-purple);
  --a6: var(--legacy-light-cyan);
}

/* Transição suave ao trocar tema */
*, *::before, *::after {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.15s ease;
}

/* Ajustes específicos para tema claro */
[data-theme="light"] .sidebar {
  box-shadow: 2px 0 8px rgba(0,0,0,0.06);
}

[data-theme="light"] .card,
[data-theme="light"] .sec-card,
[data-theme="light"] .pack-card {
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

[data-theme="light"] .gherkin-block,
[data-theme="light"] .test-ex,
[data-theme="light"] pre,
[data-theme="light"] code {
  background: var(--legacy-light-code-bg);
  color: var(--legacy-light-code-fg);
}

[data-theme="light"] .tab-btn.active {
  color: var(--a1);
  border-bottom-color: var(--a1);
}

[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
  background: var(--text-on-brand);
  color: var(--t1);
  border-color: var(--b2);
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
  color: var(--t3);
}

[data-theme="light"] .btn-secondary {
  background: var(--s3);
  color: var(--t1);
  border-color: var(--b2);
}

[data-theme="light"] .btn-secondary:hover {
  background: var(--b1);
}

/* Score badges no tema claro */
[data-theme="light"] .badge-alta   { background: rgba(224,32,62,0.12);  color: #C01833; }
[data-theme="light"] .badge-media  { background: rgba(212,130,10,0.12); color: #A06000; }
[data-theme="light"] .badge-baixa  { background: rgba(0,196,122,0.12);  color: #007A4D; }

[data-theme="light"] .status-aprovada   { background: rgba(0,196,122,0.15); color: #00703A; }
[data-theme="light"] .status-refinamento{ background: rgba(212,130,10,0.15);color: #8A5500; }
[data-theme="light"] .status-reprovada  { background: rgba(224,32,62,0.15); color: #B0001A; }

/* Topbar no tema claro */
[data-theme="light"] .topbar,
[data-theme="light"] .page-header {
  background: var(--s1);
  border-bottom: 1px solid var(--b1);
}

/* Logo QA badge */
[data-theme="light"] .logo-badge {
  background: linear-gradient(135deg, var(--legacy-light-success), var(--legacy-light-info));
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  background: var(--bg);
  color: var(--t1);
  font-family: var(--font-d);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at -10% 0%, rgba(77,158,255,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 600px 400px at 110% 100%, rgba(79,255,176,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--b3); border-radius: 2px; }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 220px;
  background: var(--s1);
  border-right: 1px solid var(--b1);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99;
}

.sidebar-mobile-panel {
  width: min(280px, 85vw);
  height: 100%;
  background: var(--s1);
  border-right: 1px solid var(--b1);
  overflow-y: auto;
}

.hamburger-mobile {
  display: none;
}

.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--b2);
  border-radius: var(--radius-md);
  background: var(--s2);
  color: var(--t1);
  font-size: var(--text-lg);
  cursor: pointer;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-10px);
  padding: var(--space-5) var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--b1);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-m);
  font-size: var(--text-sm); font-weight: 500;
  color: var(--bg);
  flex-shrink: 0;
}

.sidebar-logo-name { font-size: 14px; font-weight: 600; color: var(--t1); line-height: 1.3; }
.sidebar-logo-sub  { font-size: 10px; font-family: var(--font-m); color: var(--t2); }

.sidebar-nav { flex: 1; padding: var(--space-3) 0; overflow-y: auto; }

.sidebar-section-label {
  font-family: var(--font-m);
  font-size: 10px;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-3) var(--space-4) var(--space-6px);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-10px);
  padding: var(--space-10px) var(--space-3);
  margin: var(--space-2px) var(--space-2);
  border-radius: 7px;
  color: var(--t2);
  font-size: var(--text-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--s2); color: var(--t1); }
.nav-item.active {
  background: rgba(77,158,255,0.1);
  color: var(--a2);
  border-color: rgba(77,158,255,0.15);
}
.nav-item-icon { width: 20px; text-align: center; flex-shrink: 0; font-size: 14px; }

.sidebar-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--b1);
  display: flex;
  align-items: center;
  gap: var(--space-10px);
  flex-shrink: 0;
}

.sidebar-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--a5), var(--a2));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-m);
  font-size: var(--text-sm);
  color: white;
  flex-shrink: 0;
}
.sidebar-user-name { font-size: var(--text-sm); font-weight: 500; color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.sidebar-user-role { font-size: 11px; font-family: var(--font-m); color: var(--t2); }

/* ── TOPBAR ── */
.topbar {
  position: sticky; top: 0;
  height: 60px;
  background: rgba(6,8,16,0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--b1);
  box-sizing: border-box;
  width: 100%;
  overflow: visible;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  z-index: 50;
  flex-shrink: 0;
}
.topbar-title { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; color: var(--t1); margin: 0; }
.topbar-sub    { font-size: 11px; font-family: var(--font-m); color: var(--t2); margin-top: var(--space-2px); }
.topbar-right,
.page-header__meta {
  flex-shrink: 0;
  flex-grow: 0;
  flex-basis: auto;
  width: auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar > div:not(.topbar-right) {
  flex: 1 1 0;
  min-width: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-2px);
}

.topbar-title,
.page-header__title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-header, header.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-height: 56px;
  padding: var(--space-2) var(--space-4);
  box-sizing: border-box;
  width: 100%;
}

.page-header h1, .topbar h1 {
  flex: 1;
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-header .actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.plan-badge {
  font-family: var(--font-m);
  font-size: 11px;
  padding: var(--space-1) var(--space-10px);
  border-radius: 20px;
  background: rgba(77,158,255,0.1);
  border: 1px solid rgba(77,158,255,0.2);
  color: var(--a2);
}

/* ── LAYOUT ── */
.app-layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.main-content { margin-left: 220px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.page-content { padding: var(--space-6) 28px 60px; flex: 1; }

@media (max-width: 768px) {
  .hamburger-mobile { display: flex !important; }
  .sidebar { display: none; }
  .sidebar-overlay.active { display: flex; }

  .main-content {
    margin-left: 0 !important;
    width: 100%;
    padding: 0 var(--space-4);
  }

  .hamburger-mobile {
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    font-size: var(--text-lg);
    cursor: pointer;
    color: var(--text-primary, var(--legacy-text-light));
  }
}

/* ── CARDS ── */
.card {
  background: var(--s2);
  border: 1px solid var(--b1);
  border-radius: var(--r);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  transition: border-color 0.15s;
}
.card.hoverable:hover { border-color: var(--b3); }

/* ── INPUTS ── */
input, textarea, select {
  background: var(--s1);
  border: 1px solid var(--b2);
  color: var(--t1);
  border-radius: 7px;
  padding: var(--space-10px) var(--space-14px);
  font-family: var(--font-d);
  font-size: 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--a2); }
input::placeholder, textarea::placeholder { color: var(--t2); }

.main-content input,
.main-content select,
.main-content textarea {
  max-width: 100%;
  box-sizing: border-box;
}

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: var(--space-6px); cursor: pointer; font-family: var(--font-d); transition: all 0.15s; border-radius: 7px; font-size: 14px; padding: var(--space-10px) var(--space-5); border: none; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-primary { background: var(--a1); color: var(--bg); font-weight: 600; }
.btn-primary:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }

.btn-secondary { background: transparent; border: 1px solid var(--b2); color: var(--t2); }
.btn-secondary:hover:not(:disabled) { border-color: var(--b3); color: var(--t1); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--t2); }
.btn-ghost:hover:not(:disabled) { background: var(--s2); color: var(--t1); }
.btn-danger { background: var(--a3); color: #fff; font-weight: 600; }
.btn-danger:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.btn-invert { background: #fff; color: #0a0a0a; border: 1px solid #fff; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }

.btn-purple { background: var(--a5); color: white; font-weight: 600; }
.btn-purple:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }

.btn-full { width: 100%; justify-content: center; }

.btn-deep-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2px);
  line-height: 1.2;
}

.btn-deep-cost {
  font-size: 10px;
  opacity: 0.65;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.module-suggest-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-10px) var(--space-4);
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: 10px;
  font-size: var(--text-sm);
  color: var(--text-secondary, var(--legacy-text-muted));
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.btn-dismiss {
  background: none;
  border: none;
  color: var(--text-secondary, var(--legacy-text-muted));
  cursor: pointer;
  font-size: var(--text-md);
  padding: 0 var(--space-1);
  margin-left: auto;
}

.btn-sm {
  padding: var(--space-6px) var(--space-3);
  font-size: var(--text-xs);
  min-height: 32px;
}

.quota-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary, var(--legacy-text-muted));
  padding: 3px var(--space-10px);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  flex-shrink: 0;
}
.quota-label { font-weight: 400; opacity: 0.7; }
.quota-indicator.quota-warning {
  color: var(--legacy-amber-500);
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.08);
}
.quota-indicator.quota-full {
  color: var(--legacy-red-500);
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

.quota-cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-radius: 10px;
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  flex-wrap: wrap;
}
.quota-cta-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--legacy-text-light);
}
.quota-cta-full {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--legacy-text-light);
}
.quota-cta-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

/* ── LABELS ── */
.field-label {
  font-family: var(--font-m);
  font-size: 11px;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: var(--space-6px);
}

/* ── SECTION HEADERS ── */
.sec-head {
  display: flex;
  align-items: center;
  gap: var(--space-10px);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--b1);
}
.sec-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm);
  flex-shrink: 0;
}
.sec-title {
  font-family: var(--font-m);
  font-size: 11px;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.i-green  { background: rgba(79,255,176,0.12); color: var(--a1); }
.i-blue   { background: rgba(77,158,255,0.12); color: var(--a2); }
.i-red    { background: rgba(255,77,109,0.12);  color: var(--a3); }
.i-amber  { background: rgba(255,184,77,0.12);  color: var(--a4); }
.i-purple { background: rgba(184,77,255,0.12);  color: var(--a5); }
.i-cyan   { background: rgba(77,255,238,0.12);  color: var(--a6); }

/* ── TAGS / BADGES ── */
.tag {
  display: inline-flex; align-items: center;
  padding: var(--space-2px) var(--space-2);
  border-radius: 20px;
  font-family: var(--font-m);
  font-size: 11px;
  font-weight: 500;
}
.tag-high   { background: rgba(255,77,109,0.15);  color: var(--a3); }
.tag-med    { background: rgba(255,184,77,0.15);   color: var(--a4); }
.tag-low    { background: rgba(79,255,176,0.15);   color: var(--a1); }
.tag-blue   { background: rgba(77,158,255,0.15);   color: var(--a2); }
.tag-purple { background: rgba(184,77,255,0.15);   color: var(--a5); }
.tag-unit   { background: rgba(77,158,255,0.15);   color: var(--a2); }
.tag-integ  { background: rgba(184,77,255,0.15);   color: var(--a5); }
.tag-e2e    { background: rgba(255,184,77,0.15);   color: var(--a4); }

/* ── LOADING ── */
.loading-bar { display: none; align-items: center; gap: var(--space-3); padding: var(--space-4); }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--b2);
  border-top-color: var(--a1);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-msg { font-family: var(--font-m); font-size: var(--text-sm); color: var(--t2); }

/* ── MESSAGES ── */
.msg-box { padding: var(--space-3) var(--space-4); border-radius: 7px; font-size: 14px; display: none; }
.msg-err { background: rgba(255,77,109,0.08); border: 1px solid rgba(255,77,109,0.2); color: var(--a3); }
.msg-ok  { background: rgba(79,255,176,0.08); border: 1px solid rgba(79,255,176,0.2);  color: var(--a1); }

/* ── AUTH PAGES ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  position: relative;
  z-index: 1;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--s1);
  border: 1px solid var(--b1);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: var(--space-10px);
  margin-bottom: 28px;
}
.auth-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-m); font-size: 14px; font-weight: 500; color: var(--bg);
}
.auth-logo-name { font-size: var(--text-md); font-weight: 600; color: var(--t1); }
.auth-title { font-size: 24px; font-weight: 600; color: var(--t1); margin-bottom: var(--space-6px); }
.auth-sub { font-family: var(--font-m); font-size: var(--text-xs); color: var(--t2); margin-bottom: 28px; }
.auth-field { margin-bottom: var(--space-14px); }
.auth-footer { text-align: center; margin-top: var(--space-5); font-size: var(--text-sm); color: var(--t2); }
.auth-link { color: var(--a2); text-decoration: none; }
.auth-link:hover { text-decoration: underline; }
.auth-forgot { display: block; text-align: right; font-size: var(--text-xs); color: var(--a2); text-decoration: none; margin-top: var(--space-1); }

/* ── PLAN CARDS (signup) ── */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-10px); margin-bottom: var(--space-5); }
.plan-card {
  background: var(--s2);
  border: 1px solid var(--b2);
  border-radius: var(--r);
  padding: var(--space-14px) var(--space-3);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.plan-card:hover { border-color: var(--a2); }
.plan-card.selected { border-color: var(--a1); background: rgba(79,255,176,0.05); }
.plan-card.featured { border-color: var(--a2); }
.plan-name  { font-size: var(--text-xs); font-weight: 600; color: var(--t1); margin-bottom: var(--space-1); }
.plan-price { font-family: var(--font-m); font-size: var(--text-lg); font-weight: 500; color: var(--a1); }
.plan-unit  { font-family: var(--font-m); font-size: 10px; color: var(--t2); }
.plan-desc  { font-size: 11px; color: var(--t2); margin-top: var(--space-6px); line-height: 1.4; }

/* ── GHERKIN ── */
.gherkin {
  background: var(--s1);
  border: 1px solid var(--b1);
  border-radius: 7px;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-m);
  font-size: var(--text-sm);
  line-height: 2;
  white-space: pre-wrap;
  color: var(--t2);
  margin-bottom: var(--space-3);
}
.gherkin:last-child { margin-bottom: 0; }
.gk { color: var(--a5); font-weight: 500; }

/* ── ISO GRID ── */
.iso-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-10px); }
@media(max-width:540px) { .iso-grid { grid-template-columns: 1fr; } }

.iso-card {
  background: var(--s3);
  border: 1px solid var(--b1);
  border-radius: 7px;
  padding: 0;
  cursor: default;
  transition: border-color 0.15s;
}
.iso-card:hover  { border-color: var(--b3); }
.iso-card.open   { border-color: var(--a2); }

.iso-card__toggle {
  display: block;
  width: 100%;
  cursor: pointer;
  background: transparent;
  border: none;
  margin: 0;
  padding: var(--space-3);
  font: inherit;
  text-align: left;
  color: inherit;
  border-radius: 7px;
  box-sizing: border-box;
}
.iso-card__toggle:focus-visible {
  outline: 2px solid var(--a2);
  outline-offset: 2px;
}

.iso-card__head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
}
.iso-applic-badge {
  flex-shrink: 0;
  font-family: var(--font-m);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--b1);
  border: 1px solid var(--b2);
  color: var(--t2);
}

.iso-card--na .iso-detail {
  padding-left: var(--space-3);
  padding-right: var(--space-3);
  padding-bottom: var(--space-3);
}

.iso-name  { font-family: var(--font-m); font-size: 10px; font-weight: 500; color: var(--t2); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-2); display: block; }
.iso-row   { display: flex; align-items: center; gap: var(--space-2); }
.iso-track { flex: 1; height: 6px; background: var(--b2); border-radius: 3px; overflow: hidden; }
.iso-fill  { height: 100%; border-radius: 3px; transition: width 0.3s; }
.iso-pct   { font-family: var(--font-m); font-size: var(--text-sm); font-weight: 500; min-width: 36px; text-align: right; }
.iso-detail { display: none; margin-top: 0; padding-top: var(--space-10px); border-top: 1px solid var(--b1); }
.iso-card.open .iso-detail { display: block; }
.iso-just   { font-size: var(--text-xs); color: var(--t2); line-height: 1.5; margin-bottom: var(--space-2); }

/* Detalhamento ISO — feat-003 */
.iso-breakdown { margin-top: var(--space-2); }
.iso-breakdown-title {
  font-family: var(--font-m);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--t2);
  margin: var(--space-3) 0 var(--space-1);
}
.iso-breakdown-title:first-of-type { margin-top: 0; }
.iso-item-list {
  list-style: none;
  margin: 0 0 var(--space-2);
  padding: 0;
  font-size: var(--text-xs);
  line-height: 1.55;
}
.iso-item-list li { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 6px; }
.iso-item-list li:last-child { margin-bottom: 0; }
.iso-item-mark {
  flex-shrink: 0;
  color: var(--color-success, #16a34a);
  font-weight: 600;
  width: 1.1em;
  text-align: center;
}
.iso-item-list--covered li { color: var(--t1); }
.iso-item-list--gap .iso-item-mark--gap,
.iso-item-list--gap li { color: var(--color-danger, #dc2626); }
.iso-item-list--gap li { background: var(--color-danger-bg, #fef2f2); border-radius: 4px; padding: 6px 8px; margin-bottom: 6px; }
.iso-item-tag {
  font-family: var(--font-m);
  font-size: 10px;
  font-weight: 600;
  color: var(--t2);
  text-transform: uppercase;
  flex-shrink: 0;
}
.iso-item-empty { color: var(--t2); font-style: italic; }
.iso-item-list--gap li.iso-item-empty--gap {
  background: transparent;
  padding: 0;
  font-style: italic;
}

.iso-lacunas { font-size: var(--text-xs); color: var(--a3); line-height: 1.6; }

/* ── PYRAMID ── */
.pyr-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); margin-bottom: var(--space-5); }
.pyr-layer { display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.pyr-e2e   { width: 34%; height: 52px; background: rgba(255,184,77,0.08); border: 1px solid rgba(255,184,77,0.25); }
.pyr-integ { width: 62%; height: 60px; background: rgba(184,77,255,0.08); border: 1px solid rgba(184,77,255,0.25); }
.pyr-unit  { width: 90%; height: 72px; background: rgba(77,158,255,0.08); border: 1px solid rgba(77,158,255,0.25); }
.pyr-label { text-align: center; }
.pyr-name  { font-family: var(--font-m); font-size: var(--text-xs); font-weight: 500; display: block; }
.pyr-count { font-family: var(--font-m); font-size: 10px; opacity: 0.7; display: block; margin-top: var(--space-2px); }
.pyr-e2e .pyr-name   { color: var(--a4); }
.pyr-integ .pyr-name { color: var(--a5); }
.pyr-unit .pyr-name  { color: var(--a2); }

/* ── TEST ITEMS ── */
.test-item { padding: var(--space-14px) var(--space-4); border-bottom: 1px solid var(--b1); }
.test-item:last-child { border-bottom: none; }
.test-top  { display: flex; align-items: flex-start; gap: var(--space-2); margin-bottom: var(--space-2); flex-wrap: wrap; }
.test-title { font-size: 14px; font-weight: 500; flex: 1; min-width: 120px; line-height: 1.4; color: var(--t1); }
.test-desc  { font-size: var(--text-sm); color: var(--t2); line-height: 1.5; margin-bottom: var(--space-2); }
.test-ex    { font-size: var(--text-xs); color: var(--t2); font-family: var(--font-m); background: var(--s1); padding: var(--space-1) var(--space-10px); border-radius: var(--radius-sm); display: block; margin-top: var(--space-6px); line-height: 1.5; word-break: break-word; }

/* ── SCORE CARD ── */
.score-card { text-align: center; padding: var(--space-2) 0 var(--space-1); }
.score-num  { font-family: var(--font-m); font-size: 56px; font-weight: 500; line-height: 1; }
.score-lbl  { font-size: var(--text-sm); color: var(--t2); margin: var(--space-6px) 0 var(--space-10px); }
.score-badge-pill {
  display: inline-block;
  padding: 5px var(--space-4);
  border-radius: 20px;
  font-family: var(--font-m);
  font-size: var(--text-xs);
  font-weight: 500;
  margin-bottom: var(--space-5);
}
.badge-ok   { border: 1px solid var(--a1); background: rgba(79,255,176,0.08);  color: var(--a1); }
.badge-warn { border: 1px solid var(--a4); background: rgba(255,184,77,0.08);  color: var(--a4); }
.badge-bad  { border: 1px solid var(--a3); background: rgba(255,77,109,0.08);  color: var(--a3); }

.score-bars { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
@media(max-width:480px) { .score-bars { grid-template-columns: 1fr; } }

.score-bar-item { background: var(--s3); border-radius: 7px; padding: var(--space-2) var(--space-10px); }
.score-bar-name { font-family: var(--font-m); font-size: 10px; color: var(--t2); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 5px; }
.score-bar-row  { display: flex; align-items: center; gap: var(--space-2); }
.score-bar-track { flex: 1; height: 5px; background: var(--b2); border-radius: 3px; overflow: hidden; }
.score-bar-fill  { height: 100%; border-radius: 3px; }
.score-bar-val   { font-family: var(--font-m); font-size: var(--text-xs); font-weight: 500; min-width: 28px; text-align: right; }

/* feat-004 — Score pane: painel executivo na aba Score */
.score-pane {
  padding: var(--space-2);
}
.score-pane-hero {
  text-align: center;
  padding: var(--space-2) 0 28px;
}
.score-pane-section {
  margin-top: var(--space-10px);
  padding-top: var(--space-10px);
  border-top: 1px solid var(--b1, #DDE3EE);
}
.score-pane-section-title {
  font-family: var(--font-m);
  font-size: 10px;
  font-weight: 600;
  color: var(--t2, #3D4A63);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}

/* Faixas de score — barra horizontal com 3 segmentos */
.score-pane-faixas {
  position: relative;
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: visible;
  margin: var(--space-2) auto 0;
  max-width: 300px;
  padding-bottom: 4px;
}
.score-faixa {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
  overflow: hidden;
}
.score-faixa--bad  { background: var(--color-danger,  #dc2626); border-radius: 5px 0 0 5px; opacity: 0.3; }
.score-faixa--warn { background: var(--color-warning, #d97706); opacity: 0.3; }
.score-faixa--ok   { background: var(--color-success, #16a34a); border-radius: 0 5px 5px 0; opacity: 0.3; }
.score-faixa-label {
  font-size: 9px;
  font-family: var(--font-m);
  color: var(--t2, #3D4A63);
  position: absolute;
  bottom: -16px;
  white-space: nowrap;
}
.score-faixa-indicator {
  position: absolute;
  top: -3px;
  width: 4px;
  height: 16px;
  background: var(--t2, #3D4A63);
  border-radius: 2px;
  transform: translateX(-50%);
  z-index: 2;
}

/* Sugestões de melhoria */
.score-pane-sugestoes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.score-pane-sugestao {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--text-xs, 12px);
  line-height: 1.5;
}
.score-pane-sugestao-label {
  font-weight: 600;
  color: var(--t2, #3D4A63);
  font-family: var(--font-m);
  font-size: 10px;
  text-transform: uppercase;
}

/* Bloco de risco */
.score-pane-risco {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.score-pane-risco-desc {
  margin: 0;
  font-size: var(--text-xs, 12px);
  color: var(--t2, #3D4A63);
  line-height: 1.5;
}
.score-pane-risco-rec {
  margin: 0;
  font-size: var(--text-xs, 12px);
  color: var(--t2, #3D4A63);
  line-height: 1.5;
  font-style: italic;
}

/* feat-001 — Seletor de versões */
.version-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2, 8px);
  padding: 6px var(--space-10px, 10px);
  background: var(--s3, #E8EDF5);
  border-bottom: 1px solid var(--b1, #DDE3EE);
  flex-wrap: wrap;
}
.version-selector-label {
  font-family: var(--font-m);
  font-size: 10px;
  font-weight: 600;
  color: var(--t2, #3D4A63);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.version-selector-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.version-pill {
  font-family: var(--font-m);
  font-size: var(--text-xs, 12px);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--b2, #C8D0E0);
  background: var(--bg, #F5F7FA);
  color: var(--t2, #3D4A63);
  cursor: pointer;
  transition: all 0.15s;
}
.version-pill:hover {
  border-color: var(--a2, #1A7FE8);
  color: var(--a2, #1A7FE8);
}
.version-pill.active {
  background: var(--a2, #1A7FE8);
  border-color: var(--a2, #1A7FE8);
  color: #fff;
  cursor: default;
}
.version-pill:focus-visible {
  outline: 3px solid var(--a2, #1A7FE8);
  outline-offset: 2px;
}

.score-compare { display: flex; align-items: center; justify-content: center; gap: var(--space-5); margin-bottom: var(--space-4); padding: var(--space-3); background: var(--s3); border-radius: 7px; }
.sc-item { text-align: center; }
.sc-label { font-family: var(--font-m); font-size: 10px; color: var(--t2); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-1); }
.sc-num   { font-family: var(--font-m); font-size: 24px; font-weight: 500; }
.sc-arrow { font-size: 20px; }

/* ── RISK BOX ── */
.risco-box { border-radius: 7px; padding: var(--space-14px); }
.risco-low  { background: rgba(79,255,176,0.06);  border: 1px solid rgba(79,255,176,0.2); }
.risco-med  { background: rgba(255,184,77,0.06);  border: 1px solid rgba(255,184,77,0.2); }
.risco-high { background: rgba(255,77,109,0.06);  border: 1px solid rgba(255,77,109,0.2); }
.risco-crit { background: rgba(255,77,109,0.1);   border: 1px solid rgba(255,77,109,0.35); }

.risco-nivel  { font-family: var(--font-m); font-size: var(--text-sm); font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: var(--space-2); }
.risco-just   { font-size: 14px; color: var(--t1); line-height: 1.5; margin-bottom: var(--space-6px); }
.risco-rec    { font-size: var(--text-sm); color: var(--t2); font-style: italic; line-height: 1.5; padding: var(--space-2) var(--space-3); background: rgba(255,255,255,0.03); border-radius: 6px; margin-bottom: var(--space-10px); }
.risco-pontos { list-style: none; }
.risco-pontos li { font-size: var(--text-sm); color: var(--t2); padding: 3px 0; display: flex; gap: var(--space-2); line-height: 1.4; }
.risco-pontos li::before { content: "→"; flex-shrink: 0; }

/* ── REFINE SECTION ── */
.refine-section {
  display: none;
  background: rgba(184,77,255,0.04);
  border: 1px solid rgba(184,77,255,0.2);
  border-radius: var(--r);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}
.refine-sub { font-size: var(--text-sm); color: var(--t2); margin-bottom: var(--space-4); line-height: 1.5; }
.refine-q { background: var(--s2); border: 1px solid var(--b1); border-radius: 7px; padding: var(--space-14px); margin-bottom: var(--space-10px); }
.refine-q-header { display: flex; align-items: flex-start; gap: var(--space-2); margin-bottom: var(--space-6px); flex-wrap: wrap; }
.refine-q-num  { width: 22px; height: 22px; background: rgba(184,77,255,0.15); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--font-m); font-size: 11px; color: var(--a5); flex-shrink: 0; margin-top: var(--space-2px); }
.refine-q-text { font-size: 14px; color: var(--t1); flex: 1; line-height: 1.4; }
.refine-q-impact { font-size: var(--text-xs); color: var(--t2); margin-bottom: var(--space-2); }
.refine-input { margin-top: var(--space-2); resize: vertical; min-height: 72px; border-color: var(--b2); }
.refine-input.answered { border-color: rgba(79,255,176,0.4); }
.refine-progress { font-family: var(--font-m); font-size: var(--text-xs); color: var(--t2); margin-top: var(--space-2); text-align: right; }

/* ── REWRITTEN SECTION ── */
.rewritten-section {
  display: none;
  background: rgba(79,255,176,0.03);
  border: 1px solid rgba(79,255,176,0.2);
  border-radius: var(--r);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}
.rewritten-text {
  font-size: 14px;
  color: var(--t1);
  line-height: 1.7;
  padding: var(--space-14px) var(--space-4);
  background: var(--s2);
  border: 1px solid var(--b1);
  border-radius: 7px;
  margin: var(--space-3) 0 var(--space-4);
  white-space: pre-wrap;
}

/* ── HISTORY TABLE ── */
.hist-table { width: 100%; border-collapse: collapse; }
.hist-table th { font-family: var(--font-m); font-size: 10px; color: var(--t2); text-transform: uppercase; letter-spacing: 0.07em; padding: var(--space-10px) var(--space-14px); border-bottom: 1px solid var(--b1); text-align: left; }
.hist-table td { padding: var(--space-3) var(--space-14px); border-bottom: 1px solid var(--b1); font-size: 14px; color: var(--t2); vertical-align: middle; }
.hist-table td.hist-mod-cell { white-space: normal; max-width: 220px; vertical-align: middle; }

.mod-inline-select {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  border-radius: 6px;
  border: 1px solid var(--accent, var(--legacy-accent-green));
  background: var(--surface, var(--legacy-card-bg));
  color: var(--text-primary, var(--legacy-text-light));
  max-width: 140px;
  cursor: pointer;
}
.hist-table tr:hover td { background: rgba(255,255,255,0.02); }
.hist-table td:first-child { color: var(--t1); font-weight: 500; }
.hist-table th, .hist-table td { white-space: nowrap; }

.log-table th, .log-table td { white-space: nowrap; }

.table-scroll {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

.table-scroll table {
  min-width: 760px;
}

.history-table-container,
.table-wrapper {
  overflow-x: auto;
  width: 100%;
}

.status-badge,
[class*="status-"] {
  white-space: nowrap;
  min-width: fit-content;
  padding: var(--space-1) var(--space-10px);
}

.hist-table .tag {
  white-space: nowrap;
  min-width: fit-content;
  padding: var(--space-1) var(--space-10px);
}

.history-table td:last-child,
.history-table th:last-child,
.hist-table td:last-child,
.hist-table th:last-child {
  white-space: nowrap;
  min-width: 100px;
}

/* ── BILLING ── */
.usage-bar-track { height: 8px; background: var(--b2); border-radius: var(--radius-sm); overflow: hidden; }
.usage-bar-fill  { height: 100%; border-radius: var(--radius-sm); transition: width 0.4s; }

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--b1); margin: var(--space-5) 0; }

/* ── Badges de técnica de teste ── */
.badge-tecnica {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2px) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
  margin-right: var(--space-6px);
  vertical-align: middle;
  white-space: nowrap;
}
.badge-pe   { background: rgba(99,102,241,0.15); color: var(--legacy-indigo-300); border: 1px solid rgba(99,102,241,0.3); }
.badge-vl   { background: rgba(16,185,129,0.15); color: var(--legacy-accent-emerald); border: 1px solid rgba(16,185,129,0.3); }
.badge-td   { background: rgba(245,158,11,0.15); color: var(--legacy-accent-amber); border: 1px solid rgba(245,158,11,0.3); }
.badge-te   { background: rgba(239,68,68,0.15);  color: var(--legacy-accent-red-soft); border: 1px solid rgba(239,68,68,0.3); }
.badge-pw   { background: rgba(168,85,247,0.15); color: var(--legacy-purple-300); border: 1px solid rgba(168,85,247,0.3); }
.badge-eg   { background: rgba(20,184,166,0.15); color: var(--legacy-cyan-400); border: 1px solid rgba(20,184,166,0.3); }
.badge-sec  { background: rgba(239,68,68,0.12);  color: var(--legacy-accent-red-pale); border: 1px solid rgba(239,68,68,0.25); }

.badge-tipo-pos  { background: rgba(16,185,129,0.1); color: var(--legacy-emerald-200); border: 1px solid rgba(16,185,129,0.2); }
.badge-tipo-neg  { background: rgba(239,68,68,0.1);  color: var(--legacy-accent-red-pale); border: 1px solid rgba(239,68,68,0.2); }
.badge-tipo-edge { background: rgba(245,158,11,0.1); color: var(--legacy-amber-pale); border: 1px solid rgba(245,158,11,0.2); }
.badge-tipo-exc  { background: rgba(168,85,247,0.1); color: var(--legacy-purple-200); border: 1px solid rgba(168,85,247,0.2); }

.criterio-badges { margin-bottom: var(--space-6px); display: flex; flex-wrap: wrap; gap: var(--space-1); align-items: center; }
.criterio-justificativa {
  font-size: 11px;
  color: var(--t3, var(--legacy-gray-500));
  font-style: italic;
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
  line-height: 1.5;
}
.teste-badge-row { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-1); }
.badge-prioridade-alta   { background: rgba(239,68,68,0.1);  color: var(--legacy-accent-red-soft); border: 1px solid rgba(239,68,68,0.2);  padding: var(--space-1px) var(--space-6px); border-radius: 3px; font-size: 10px; }
.badge-prioridade-media  { background: rgba(245,158,11,0.1); color: var(--legacy-accent-amber); border: 1px solid rgba(245,158,11,0.2); padding: var(--space-1px) var(--space-6px); border-radius: 3px; font-size: 10px; }
.badge-prioridade-baixa  { background: rgba(16,185,129,0.1); color: var(--legacy-accent-emerald); border: 1px solid rgba(16,185,129,0.2); padding: var(--space-1px) var(--space-6px); border-radius: 3px; font-size: 10px; }

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-2);
}
.examples .chip,
.examples button,
.examples span[class*="chip"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6px);
  padding: 0 var(--space-14px);
  height: 34px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary, var(--legacy-text-light));
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
  transition: background 0.15s ease;
  user-select: none;
  box-sizing: border-box;
}
.examples .chip:hover,
.examples button:hover,
.examples span[class*="chip"]:hover { background: rgba(255,255,255,0.10); }
@media (max-width: 560px) {
  .examples .chip,
  .examples button,
  .examples span[class*="chip"] {
    font-size: var(--text-xs);
    padding: 0 var(--space-3);
    height: 32px;
  }
}

.form-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6px);
  padding: var(--space-3) 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  min-height: 48px;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
}
.form-actions .btn-primary {
  background: var(--accent, var(--legacy-accent-green));
  color: var(--legacy-near-black);
  border: none;
}
.form-actions .btn-secondary {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary, var(--legacy-text-light));
  border: 1px solid rgba(255,255,255,0.1);
}

/* mobile primeiro — forçar grid com !important para vencer herança */
@media (max-width: 560px) {
  div.form-actions,
  .form-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "primary primary"
      "clear   deep"
      "export  gherkin";
    gap: var(--space-2);
    width: 100%;
    box-sizing: border-box;
  }

  div.form-actions #genbtn,
  .form-actions #genbtn        { grid-area: primary; width: 100%; }

  div.form-actions #inputclearbtn,
  .form-actions #inputclearbtn { grid-area: clear;   width: 100%; }

  div.form-actions #btn-deep,
  .form-actions #btn-deep      { grid-area: deep;    width: 100%; }

  div.form-actions #exportbtn,
  .form-actions #exportbtn     { grid-area: export;  width: 100%; }

  div.form-actions #btn-export-gherkin,
  .form-actions #btn-export-gherkin { grid-area: gherkin; width: 100%; }

  .form-actions .btn {
    justify-content: center;
    padding: var(--space-3) var(--space-10px);
    font-size: var(--text-sm);
    min-height: 46px;
    box-sizing: border-box;
  }
}

/* desktop: flex normal com botões em linha */
@media (min-width: 561px) {
  .form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-10px);
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
  }
  .form-actions #genbtn {
    flex: 1 1 auto;
  }
  .form-actions #btn-deep,
  .form-actions #exportbtn,
  .form-actions #btn-export-gherkin {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .form-actions .btn { padding: 11px var(--space-2); font-size: var(--text-xs); }
}

.page-header {
  padding: var(--space-4) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: static; /* garante sem overlap */
}
.page-header__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary, var(--legacy-text-light));
  margin: 0;
  line-height: 1.2;
}
.page-header__subtitle {
  font-family: inherit; /* FIX monospace */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--text-sm);
  color: var(--text-secondary, var(--legacy-text-muted));
  margin: 0;
  line-height: 1.45;
}
.page-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
  position: static; /* FIX overlap */
  flex-shrink: 0;
}
.plan-badge {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: rgba(59,130,246,0.12);
  color: var(--legacy-blue-400);
  border: 1px solid rgba(59,130,246,0.3);
}
.org-pill {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-secondary, var(--legacy-text-muted));
  background: rgba(148,163,184,0.08);
  border: 1px solid rgba(148,163,184,0.18);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .page-header { padding: var(--space-14px) var(--space-4) var(--space-4); }
  .page-header__title { font-size: 20px; }
  .page-header__subtitle { font-size: var(--text-sm); }
}
@media (max-width: 380px) {
  .page-header__title { font-size: var(--text-lg); }
}

/* Wrapper de scroll para todas as tabelas do app */
.hist-table,
.log-table,
.productivity-table,
table {
  border-collapse: collapse;
}

/* Container pai das tabelas deve ter overflow-x: auto */
.hist-table-wrapper,
.log-table-wrapper,
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.table-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

/* Refino mobile para separar título e ações em linhas distintas */
@media (max-width: 560px) {
  .topbar {
    flex-wrap: wrap;
    gap: var(--space-2);
    padding-bottom: var(--space-10px);
  }

  /* Linha 1: hamburger + título (ocupa tudo) */
  .topbar > div:not(.topbar-right) {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* Linha 2: badge + ações na mesma linha, grupo alinhado à direita */
  .topbar-right {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-6px);
    order: 3; /* sempre depois do título */
  }

  /* margin-right:auto no badge forçava quebra em history.html */
  .topbar-right .plan-badge {
    margin-right: 0;
  }

  /* Botões dentro do topbar-right: compactos */
  .topbar-right .btn {
    padding: var(--space-6px) var(--space-3);
    font-size: var(--text-xs);
    min-height: 34px;
    white-space: nowrap;
  }

  /* Selects dentro do topbar-right (iso-metrics) */
  .topbar-right select {
    padding: var(--space-6px) var(--space-10px);
    font-size: var(--text-xs);
    min-height: 34px;
    max-width: 140px;
  }
}

@media (max-width: 900px) {
  .filters-row {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .filters-row > * {
    flex: 1 1 140px;
    min-width: 120px;
  }
}

@media (max-width: 600px) {
  .profile-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Billing: pacotes de análises extras ── */
#packs-section .packs-card-header.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-1);
  padding-bottom: 0;
  border-bottom: none;
}

#packs-section .packs-card-header .card-icon {
  font-size: var(--text-xl);
  line-height: 1;
  flex-shrink: 0;
}

#packs-section .packs-card-header .card-header-text {
  flex: 1;
  min-width: 0;
}

#packs-section .packs-card-header .card-title {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--t2);
}

#packs-section .packs-card-header .card-subtitle {
  font-size: var(--text-sm);
  color: var(--t3);
  margin-top: var(--space-2px);
  line-height: 1.4;
}

.packs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.pack-card {
  position: relative;
  padding: var(--space-5);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-6px);
}

.pack-card-popular {
  border-color: var(--accent, var(--legacy-accent-green));
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.2);
}

.pack-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent, var(--legacy-accent-green));
  color: var(--legacy-deep-green);
  font-size: 11px;
  font-weight: 700;
  padding: 3px var(--space-10px);
  border-radius: 20px;
  white-space: nowrap;
}

.pack-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-secondary, var(--legacy-text-muted));
}

.pack-analyses {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary, var(--legacy-text-light));
}

.pack-price {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pack-unit {
  font-size: 11px;
  color: var(--muted, var(--legacy-text-subtle));
  margin-bottom: var(--space-2);
}

.packs-price-note {
  margin-top: 18px;
  font-size: var(--text-xs);
  color: var(--muted, var(--legacy-text-subtle));
  text-align: center;
  line-height: 1.5;
}

@media (max-width: 560px) {
  .packs-grid {
    grid-template-columns: 1fr;
  }
}

.sidebar-mobile-nav {
  width: 220px;
  height: 100%;
  background: var(--s1);
  overflow-y: auto;
  padding: var(--space-5) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2px);
}

/* Análise Profunda — visual definido em body.analyze-page .an-btn--deep
   (paleta nova stone-900). Regras legadas com gradient vermelho removidas
   na Fase 5A.1 — não há mais consumidores. */

/* ux-001: score + abas em sticky unificado (wrapper); #score-section não é mais sticky */
body.analyze-page .sticky-result-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg, #F5F7FA);
  border-bottom: 1px solid var(--b1, #DDE3EE);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

@media (max-width: 768px) {
  body.analyze-page .sticky-result-header {
    position: static;
  }
}

@media print {
  body.analyze-page .sticky-result-header {
    position: static;
  }
}

/* Card de score dentro do cabeçalho sticky — scroll/sticky ficam no wrapper */
body.analyze-page #score-section {
  position: static;
  z-index: auto;
  padding: var(--space-14px) 18px;
  margin-top: 0;
  background: var(--card-bg, var(--s2, var(--legacy-bg-1a1a1f)));
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}

/* NAV DE TABS */
.result-tabs {
  display: flex;
  gap: var(--space-2px);
  border-bottom: 1px solid var(--b1);
  margin: var(--space-4) 0 0 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.result-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: var(--space-6px);
  padding: var(--space-10px) var(--space-4);
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--t2);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  border-radius: 0;
}
.tab-btn:hover { color: var(--t1); }
.tab-btn.active {
  color: var(--a1);
  border-bottom-color: var(--a1);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--s2);
  color: var(--t2);
  font-size: 10px;
  font-weight: 600;
  border-radius: 9px;
}
.tab-btn.active .tab-count {
  background: rgba(79,255,176,0.15);
  color: var(--a1);
}

/* CONTEÚDO DAS TABS */
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* MOBILE: tabs scrolláveis */
@media (max-width: 768px) {
  .tab-btn { padding: 9px var(--space-3); font-size: var(--text-xs); }
}

/* ========================================================================
   QAVISION FIX 1 — Overflow mobile (.topbar-right e .plan-badge)
   ========================================================================
   Em viewports <=560px, .topbar-right (botões+badge) e .plan-badge
   extrapolavam a tela. Restringimos largura, escondemos overflow e
   reduzimos paddings.
*/
@media (max-width: 560px) {
  .topbar-right,
  [class*="topbar-right"] {
    flex-shrink: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    gap: var(--space-1) !important;
  }
  .plan-badge,
  [class*="plan-badge"] {
    font-size: 10px !important;
    padding: var(--space-2px) var(--space-6px) !important;
    white-space: nowrap !important;
    max-width: 60px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}


/* ========================================================================
   QAVISION FIX 2 — Fontes <12px em mobile
   ========================================================================
   Badges/labels: mínimo 11px. Textos secundários: mínimo 12px.
*/
@media (max-width: 768px) {
  * {
    -webkit-text-size-adjust: 100%;
  }
  .sec-title, .badge, [class*="badge"],
  [class*="tag"], [class*="label"],
  .tab-count, .pack-unit, .criterio-id,
  .test-top .badge, small {
    font-size: max(11px, 0.7em) !important;
  }
  .t2, .t3, [class*="unit"], [class*="hint"],
  .helper-text, caption, figcaption {
    font-size: max(var(--text-xs), 0.75em) !important;
  }
}

/* ========================================================================
   QAVISION FIX 3 — Touch targets mínimos 44px em mobile
   ========================================================================
   Apple HIG e Google Material: 44px. Badges/status excluídos.
*/
@media (max-width: 768px) {
  button,
  a[href],
  [role="button"],
  input[type="submit"],
  input[type="button"],
  .tab-btn {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
  }
  .badge, .plan-badge, .tab-count,
  [class*="badge"], [class*="status"] {
    min-height: unset !important;
    display: inline-block !important;
  }
  .sidebar a,
  .sidebar-overlay a {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
  }
}

/* ======================================================================
   === Landing page (Fase 3) ===
   Classes lp-* exclusivas de public/index.html. Mobile-first.
   Tokens-only, zero hex, zero magic number, especificidade limpa.
   Namespace isolado de .topbar/.main-content (não afeta shell logado).
   ====================================================================== */

body.landing-page {
  background: var(--surface-page);
  color: var(--text-body);
  font-family: var(--font-sans);
  scroll-behavior: smooth;
}
/* `:where(...)` zera a especificidade do seletor de contexto, evitando que
   `body.landing-page a` sobrescreva regras de botões da landing. */
:where(body.landing-page) a { color: inherit; text-decoration: none; }

.lp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-page);
  border-bottom: var(--space-1px) solid transparent;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  transition: background var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out),
              backdrop-filter var(--t-base) var(--ease-out);
}
.lp-nav.is-scrolled {
  background: rgba(250, 250, 249, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border-subtle);
}
.lp-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-xl);
  color: var(--text-strong);
}
.lp-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-6);
  height: var(--space-6);
  border-radius: var(--radius-md);
  background: var(--brand-600);
  color: var(--text-on-brand);
  font-family: var(--font-mono);
  font-style: normal;
  font-size: var(--text-xs);
  font-weight: 600;
}
.lp-nav-links { display: none; }
.lp-nav-cta { display: none; }
.lp-hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--row-compact);
  height: var(--row-compact);
  background: transparent;
  border: var(--space-1px) solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-strong);
  font-size: var(--text-lg);
  cursor: pointer;
}
.lp-mobile-menu {
  display: none;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-card);
  border-bottom: var(--space-1px) solid var(--border-subtle);
}
.lp-mobile-menu.is-open { display: flex; }
.lp-mobile-menu a {
  color: var(--text-body);
  font-size: var(--text-sm);
  padding: var(--space-2) 0;
}
.lp-mobile-menu .btn { width: 100%; justify-content: center; }

.btn-lp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: var(--space-1px) solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-strong);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}
.btn-lp:hover { transform: translateY(calc(-1 * var(--space-1px))); }
.btn-lp:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn-primary.btn-lp {
  background: var(--brand-600);
  color: var(--text-on-brand);
  border-color: var(--brand-600);
}
.btn-primary.btn-lp:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn-secondary.btn-lp {
  background: var(--surface-card);
  color: var(--text-strong);
  border-color: var(--border-default);
}
.btn-secondary.btn-lp:hover { background: var(--stone-100); border-color: var(--border-strong); }
.btn-ghost.btn-lp {
  background: transparent;
  color: var(--text-strong);
}
.btn-ghost.btn-lp:hover { background: var(--stone-100); }
.btn-lg.btn-lp { padding: var(--space-4) var(--space-6); font-size: var(--text-md); }
.btn-full.btn-lp { width: 100%; }
.btn-invert.btn-lp {
  background: var(--text-on-brand);
  color: var(--stone-950);
  border-color: var(--text-on-brand);
}
.btn-invert.btn-lp:hover { background: var(--stone-100); border-color: var(--stone-100); }

.lp-hero {
  padding: var(--space-12) var(--space-4) var(--space-10);
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}
.lp-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(44, 70, 168, 0.06), transparent 70%);
  pointer-events: none;
}
.lp-hero > * { position: relative; }
.lp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6px) var(--space-14px);
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-body);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-xs);
}
.lp-eyebrow::before {
  content: "";
  width: var(--space-6px);
  height: var(--space-6px);
  border-radius: var(--radius-full);
  background: var(--success-500);
}
.lp-hero-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(var(--text-3xl), 7vw, var(--text-5xl));
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  margin: 0 auto var(--space-5);
  max-width: 18ch;
  font-weight: 400;
}
.lp-hero-title em { color: var(--brand-700); font-style: italic; }
.lp-hero-sub {
  font-size: clamp(var(--text-md), 2vw, var(--text-lg));
  color: var(--text-body);
  max-width: 56ch;
  margin: 0 auto var(--space-6);
  line-height: 1.5;
}
.lp-hero-cta {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: stretch;
  max-width: 320px;
  margin: 0 auto;
}
.lp-hero-trust {
  margin-top: var(--space-8);
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}
.lp-hero-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-5);
}
.lp-hero-badge {
  padding: var(--space-1) var(--space-3);
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-body);
}
.lp-hero-preview {
  margin-top: var(--space-10);
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  padding: var(--space-2);
}
.lp-hero-preview-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--space-1px) solid var(--border-subtle);
}
.lp-hero-preview-dot {
  width: var(--space-10px);
  height: var(--space-10px);
  border-radius: var(--radius-full);
  background: var(--stone-300);
}
.lp-hero-preview-url {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.lp-hero-preview-body {
  padding: var(--space-6);
  background: linear-gradient(to bottom, var(--stone-50), var(--surface-card));
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}
.lp-kpi {
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  text-align: left;
}
.lp-kpi-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lp-kpi-value {
  font-size: var(--text-2xl);
  color: var(--text-strong);
  font-weight: 600;
  margin-top: var(--space-1);
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}
.lp-kpi-delta {
  font-size: var(--text-xs);
  color: var(--success-700);
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.lp-section {
  padding: var(--space-12) var(--space-4);
  max-width: 1200px;
  margin: 0 auto;
}
.lp-section-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-2xl);
  color: var(--text-strong);
  text-align: center;
  margin: 0 0 var(--space-3);
  letter-spacing: -0.01em;
  font-weight: 400;
}
.lp-section-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-md);
  max-width: 56ch;
  margin: 0 auto var(--space-8);
}

.lp-three {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
.lp-step {
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
}
.lp-step-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-3xl);
  color: var(--brand-500);
  line-height: 1;
  margin-bottom: var(--space-3);
}
.lp-step h3 {
  font-size: var(--text-lg);
  margin: 0 0 var(--space-2);
  color: var(--text-strong);
  font-weight: 600;
}
.lp-step p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.lp-personas {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
.lp-persona {
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  border: var(--space-1px) solid var(--border-subtle);
  background: var(--surface-card);
}
.lp-persona.is-cto {
  background: var(--stone-950);
  color: var(--stone-100);
  border-color: var(--stone-900);
}
.lp-persona.is-cto h3 { color: var(--text-on-brand); }
.lp-persona.is-cto li { color: var(--stone-300); }
.lp-persona.is-cto li::before { color: var(--accent-300); }
.lp-persona.is-cto .lp-persona-tag {
  background: var(--stone-900);
  color: var(--accent-300);
  border-color: var(--stone-800);
}
.lp-persona-tag {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: var(--brand-50);
  color: var(--brand-700);
  border: var(--space-1px) solid var(--brand-100);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.lp-persona h3 {
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  margin: var(--space-3) 0 var(--space-3);
  color: var(--text-strong);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.lp-persona ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.lp-persona li {
  color: var(--text-body);
  font-size: var(--text-sm);
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}
.lp-persona li::before {
  content: "→";
  color: var(--brand-500);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.lp-pricing {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  align-items: stretch;
  margin-bottom: var(--space-6);
}
.lp-plan {
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
}
.lp-plan.is-featured {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 1px var(--brand-500), var(--shadow-md);
  position: relative;
}
.lp-plan.is-featured::before {
  content: "Mais escolhido";
  position: absolute;
  top: calc(-1 * var(--space-10px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-600);
  color: var(--text-on-brand);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
}
.lp-plan-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-strong);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.lp-plan-price {
  display: flex;
  align-items: baseline;
  gap: var(--space-1);
  margin: var(--space-3) 0;
}
.lp-plan-price strong {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  color: var(--text-strong);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.lp-plan-price span {
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.lp-plan-target {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}
.lp-plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-5);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.lp-plan-features li {
  font-size: var(--text-sm);
  color: var(--text-body);
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}
.lp-plan-features li svg {
  width: var(--space-4);
  height: var(--space-4);
  color: var(--success-500);
  flex-shrink: 0;
  margin-top: var(--space-2px);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.lp-plan .btn { margin-top: auto; }

.lp-extras {
  margin-top: var(--space-8);
  padding: var(--space-6);
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-align: center;
}
.lp-extras h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}
.lp-extras p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.lp-extras-grid {
  margin-top: var(--space-5);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}
.lp-extra {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: var(--space-1px) solid var(--border-subtle);
  background: var(--stone-50);
}
.lp-extra.is-best {
  border-color: var(--brand-500);
  background: var(--brand-50);
}
.lp-extra-badge {
  position: absolute;
  top: calc(-1 * var(--space-2px) - var(--space-2px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-600);
  color: var(--text-on-brand);
  border-radius: var(--radius-full);
  padding: var(--space-2px) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
}
.lp-extra-qty { color: var(--text-strong); font-size: var(--text-sm); font-weight: 600; }
.lp-extra-price {
  color: var(--brand-700);
  font-size: var(--text-xl);
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}
.lp-extras-note {
  margin-top: var(--space-4);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.lp-faq { max-width: 720px; margin: 0 auto; }
.lp-faq-item {
  border-bottom: var(--space-1px) solid var(--border-subtle);
  padding: var(--space-4) 0;
}
.lp-faq-item summary {
  font-size: var(--text-md);
  color: var(--text-strong);
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.lp-faq-item summary::-webkit-details-marker { display: none; }
.lp-faq-item summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: var(--text-xl);
  flex-shrink: 0;
}
.lp-faq-item[open] summary::after { content: "−"; }
.lp-faq-item p {
  margin: var(--space-3) 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.lp-cta-final {
  background: var(--stone-950);
  color: var(--stone-100);
  text-align: center;
  padding: var(--space-12) var(--space-4);
  margin-top: var(--space-10);
}
.lp-cta-final h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-2xl);
  color: var(--text-on-brand);
  margin: 0 0 var(--space-3);
  font-weight: 400;
  letter-spacing: -0.01em;
}
.lp-cta-final p {
  color: var(--stone-400);
  max-width: 50ch;
  margin: 0 auto var(--space-5);
  font-size: var(--text-md);
}

.lp-footer {
  background: var(--stone-950);
  color: var(--stone-500);
  padding: var(--space-6) var(--space-4);
  border-top: var(--space-1px) solid var(--stone-900);
  font-size: var(--text-xs);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-align: center;
}
.lp-footer-brand { color: var(--stone-300); font-weight: 600; }
.lp-footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.lp-footer a {
  color: var(--stone-400);
  transition: color var(--t-fast) var(--ease-out);
}
.lp-footer a:hover { color: var(--stone-100); }

@media (min-width: 768px) {
  .lp-nav { padding: var(--space-4) var(--space-6); }
  .lp-nav-links { display: flex; align-items: center; gap: var(--space-5); }
  .lp-nav-links a {
    font-size: var(--text-sm);
    color: var(--text-body);
    transition: color var(--t-fast) var(--ease-out);
  }
  .lp-nav-links a:hover { color: var(--text-strong); }
  .lp-nav-cta { display: flex; align-items: center; gap: var(--space-2); }
  .lp-hamburger { display: none; }
  .lp-mobile-menu { display: none; }
  .lp-hero { padding: var(--space-16) var(--space-6) var(--space-12); }
  .lp-hero-cta { flex-direction: row; max-width: none; justify-content: center; }
  .lp-hero-preview-body { grid-template-columns: 1fr 1fr; }
  .lp-section { padding: var(--space-16) var(--space-6); }
  .lp-section-title { font-size: var(--text-3xl); }
  .lp-three { grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
  .lp-personas { grid-template-columns: 1fr 1fr; gap: var(--space-5); }
  .lp-pricing { grid-template-columns: repeat(2, 1fr); }
  .lp-extras-grid { grid-template-columns: repeat(3, 1fr); }
  .lp-cta-final { padding: var(--space-16) var(--space-6); }
  .lp-cta-final h2 { font-size: var(--text-3xl); }
  .lp-footer {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
    padding: var(--space-8) var(--space-6);
  }
  .lp-footer-links { justify-content: flex-end; }
}

@media (min-width: 1024px) {
  .lp-hero { padding: var(--space-20) var(--space-6) var(--space-16); }
  .lp-hero-preview-body { grid-template-columns: repeat(4, 1fr); }
  .lp-pricing { grid-template-columns: repeat(4, 1fr); }
}

/* === Auth pages (Fase 4) === */
.lp-auth {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  background: var(--surface-page);
}
.lp-auth-form {
  background: var(--surface-card);
  padding: var(--space-8) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  min-height: 100vh;
}
.lp-auth-side {
  display: none;
  background: var(--stone-950);
  color: var(--text-on-brand);
  padding: var(--space-12);
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-12);
}
.lp-auth-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-xl);
  color: var(--text-strong);
  text-decoration: none;
}
.lp-auth-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-6);
  height: var(--space-6);
  border-radius: var(--radius-md);
  background: var(--brand-600);
  color: var(--text-on-brand);
  font-family: var(--font-mono);
  font-style: normal;
  font-size: var(--text-xs);
  font-weight: 600;
}
.lp-auth-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.lp-auth-title {
  font-family: var(--font-sans);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.01em;
  margin: 0;
}
.lp-auth-sub {
  margin: 0 0 var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}
.lp-auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: var(--space-2) 0;
  font-family: var(--font-mono);
}
.lp-auth-divider::before,
.lp-auth-divider::after {
  content: '';
  flex: 1;
  height: var(--space-1px);
  background: var(--border-default);
}
.lp-auth-sso {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.lp-auth-sso .btn { justify-content: center; }
.lp-auth-sso .btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.lp-auth-foot {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: var(--space-1px) solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
}
.lp-auth-foot a {
  color: var(--brand-700);
  text-decoration: none;
  font-weight: 600;
}
.lp-auth-foot a:hover { text-decoration: underline; }
.lp-auth-forgot {
  display: inline-block;
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--brand-700);
  text-decoration: none;
}
.lp-auth-forgot:hover { text-decoration: underline; }
.lp-auth-side-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-300);
  font-weight: 600;
  margin-bottom: var(--space-3);
}
.lp-auth-side-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-2xl);
  line-height: 1.3;
  color: var(--text-on-brand);
  margin: 0 0 var(--space-3) 0;
}
.lp-auth-side-attribution {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent-300);
}
.lp-auth-side-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.lp-auth-feature {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-on-brand);
}
.lp-auth-feature svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}
.lp-auth-coupon {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  background: var(--accent-100);
  border: var(--space-1px) solid var(--accent-300);
  border-radius: var(--radius-md);
}
.lp-auth-coupon-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--text-on-accent);
  margin-top: var(--space-2px);
}
.lp-auth-coupon-body {
  font-size: var(--text-sm);
  color: var(--text-on-accent);
  line-height: 1.4;
}
.lp-auth-coupon-body strong {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-2px);
}

@media (min-width: 960px) {
  .lp-auth { grid-template-columns: 1fr 1fr; }
  .lp-auth-form {
    padding: var(--space-12);
  }
  .lp-auth-side { display: flex; }
}

/* ======================================================================
   === Analyze page (Fase 5A) ===
   Classes an-* exclusivas de public/analyze.html. Mobile-first.
   Convivem com classes legadas (.topbar, .page-header, .card) por cascata.
   Tokens-only, especificidade limpa, contraste WCAG AA garantido.
   ====================================================================== */

/* Override de contraste das classes legadas no contexto da analyze.
   body.analyze-page eleva especificidade pra vencer regras antigas
   tipo `.page-header__title { color: var(--text-primary, slate-200); }`. */
body.analyze-page .page-header__title,
body.analyze-page .topbar-title {
  color: var(--text-strong);
}
body.analyze-page .page-header__subtitle,
body.analyze-page .topbar-sub {
  color: var(--text-muted);
}
body.analyze-page .plan-badge {
  background: var(--brand-50);
  color: var(--brand-700);
  border: var(--space-1px) solid var(--brand-100);
}
body.analyze-page .quota-indicator {
  background: var(--surface-card);
  color: var(--text-body);
  border: var(--space-1px) solid var(--border-subtle);
}

/* Topbar light: legacy .topbar usa rgba escura translúcida com backdrop-blur,
   o que sobre fundo claro gera contraste 1.14:1 no título. Força fundo card
   pra que body.analyze-page .topbar-title (var(--text-strong)) leia limpo. */
body.analyze-page .topbar {
  background: var(--surface-card);
  border-bottom-color: var(--border-subtle);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Análise Profunda: stone-900 sólido. As regras legadas com gradient vermelho
   foram removidas; o body.analyze-page eleva especificidade só pra vencer
   .form-actions .btn (definidos com a mesma especificidade que .an-btn--deep). */
body.analyze-page #btn-deep,
body.analyze-page .an-btn--deep {
  background: var(--stone-900);
  background-image: none;
  color: var(--text-on-brand);
  border-color: var(--stone-900);
}
body.analyze-page #btn-deep:hover:not(:disabled),
body.analyze-page .an-btn--deep:hover:not(:disabled) {
  background: var(--stone-950);
  border-color: var(--stone-950);
  filter: none;
}

/* Chips de exemplo + botão Limpar: legacy usa fundo translúcido branco
   (rgba(255,255,255,0.06)) e cor herdada que mal aparece sobre surface-card.
   Reaplica fundo sunken + texto body pra contraste WCAG AA. */
body.analyze-page .examples .chip,
body.analyze-page .examples button,
body.analyze-page .examples span[class*="chip"] {
  background: var(--surface-sunken);
  color: var(--text-body);
  border-color: var(--border-default);
}
body.analyze-page .examples .chip:hover,
body.analyze-page .examples button:hover,
body.analyze-page .examples span[class*="chip"]:hover {
  background: var(--stone-200);
  color: var(--text-strong);
}
body.analyze-page .btn-clear,
body.analyze-page .action-clear,
body.analyze-page #inputclearbtn {
  background: var(--surface-card);
  color: var(--text-body);
  border: var(--space-1px) solid var(--border-default);
}
body.analyze-page .btn-clear:hover:not(:disabled),
body.analyze-page .action-clear:hover:not(:disabled),
body.analyze-page #inputclearbtn:hover:not(:disabled) {
  background: var(--stone-100);
  color: var(--text-strong);
}

/* Form card */
.an-form-card {
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-xs);
}
.an-form-header { margin-bottom: var(--space-5); }
.an-form-header h1 {
  font-family: var(--font-sans);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-strong);
  margin: 0 0 var(--space-2);
  letter-spacing: -0.01em;
}
.an-form-header p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}
.an-form-body { display: flex; flex-direction: column; gap: var(--space-4); }
.an-field { display: flex; flex-direction: column; gap: var(--space-2); }
.an-field-label {
  font-size: var(--text-xs);
  color: var(--text-body);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.an-textarea {
  width: 100%;
  min-height: 140px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-strong);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
}
.an-textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--shadow-focus);
}
.an-textarea::placeholder { color: var(--text-subtle); }

.an-examples-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.an-examples-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: var(--space-1);
}
.an-example-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2px) var(--space-3);
  background: var(--surface-card);
  color: var(--text-body);
  border: var(--space-1px) solid var(--border-default);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out);
}
.an-example-chip:hover {
  background: var(--stone-100);
  border-color: var(--border-strong);
  color: var(--text-strong);
}
.an-example-chip:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.an-example-chip.is-active {
  background: var(--brand-50);
  border-color: var(--brand-500);
  color: var(--brand-700);
}

/* Toolbar */
.an-form-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: var(--space-1px) solid var(--border-subtle);
}
.an-form-toolbar-primary,
.an-form-toolbar-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.an-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: var(--space-1px) solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-strong);
  background: var(--surface-card);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}
.an-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.an-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.an-btn--primary {
  background: var(--brand-600);
  color: var(--text-on-brand);
  border-color: var(--brand-600);
}
.an-btn--primary:hover:not(:disabled) {
  background: var(--brand-700);
  border-color: var(--brand-700);
}
.an-btn--secondary {
  background: var(--surface-card);
  color: var(--text-strong);
  border-color: var(--border-default);
}
.an-btn--secondary:hover:not(:disabled) {
  background: var(--stone-100);
  border-color: var(--border-strong);
}
.an-btn--ghost {
  background: transparent;
  color: var(--text-body);
  border-color: transparent;
}
.an-btn--ghost:hover:not(:disabled) {
  background: var(--stone-100);
  color: var(--text-strong);
}
.an-btn--deep {
  background: var(--stone-900);
  color: var(--text-on-brand);
  border-color: var(--stone-900);
}
.an-btn--deep:hover:not(:disabled) {
  background: var(--stone-950);
  border-color: var(--stone-950);
}
.an-btn--lg { padding: var(--space-4) var(--space-6); font-size: var(--text-md); }
.an-btn-cost-chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2px) var(--space-2);
  background: var(--stone-800);
  color: var(--accent-300);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  margin-left: var(--space-1);
}

/* Tabs (estética nova sobre .result-tabs / .tab-btn legados, namespace lateral) */
.an-tabs {
  display: flex;
  gap: var(--space-1);
  margin: var(--space-5) 0 var(--space-4);
  padding-bottom: var(--space-1px);
  border-bottom: var(--space-1px) solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.an-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  border-bottom: var(--space-2px) solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out);
}
.an-tab:hover { color: var(--text-strong); }
.an-tab:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); }
.an-tab.is-active {
  color: var(--brand-700);
  border-bottom-color: var(--brand-600);
}
.an-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--space-5);
  height: var(--space-5);
  padding: 0 var(--space-2px);
  background: var(--stone-100);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
}
.an-tab.is-active .an-tab-count {
  background: var(--brand-100);
  color: var(--brand-700);
}

/* Override visual sobre as classes legadas dentro de body.analyze-page */
body.analyze-page .result-tabs {
  display: flex;
  gap: var(--space-1);
  margin: var(--space-5) 0 var(--space-4);
  padding-bottom: var(--space-1px);
  border-bottom: var(--space-1px) solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
body.analyze-page .tab-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  border-bottom: var(--space-2px) solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out);
  border-radius: 0;
}
body.analyze-page .tab-btn:hover { color: var(--text-strong); }
body.analyze-page .tab-btn.active {
  color: var(--brand-700);
  border-bottom-color: var(--brand-600);
}
body.analyze-page .tab-count {
  background: var(--stone-100);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  min-width: var(--space-5);
  padding: 0 var(--space-2px);
}
body.analyze-page .tab-btn.active .tab-count {
  background: var(--brand-100);
  color: var(--brand-700);
}

/* Cards de item (override visual sobre cards legados) */
body.analyze-page .card {
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
body.analyze-page .card.excluded {
  opacity: 0.55;
  background: var(--stone-50);
}
body.analyze-page .excluded-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2px) var(--space-2);
  background: var(--stone-200);
  color: var(--text-body);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
}

/* Modal (#modal-exclude) — redesenho com tokens, mantém IDs.
   Position/display do JS: inline-style 'flex' quando abre, 'none' quando fecha. */
body.analyze-page #modal-exclude {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.55);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
body.analyze-page #modal-exclude > div {
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-6);
  max-width: 460px;
  width: 100%;
  position: relative;
}
body.analyze-page #modal-exclude h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-strong);
}
body.analyze-page #modal-exclude p,
body.analyze-page #modal-exclude label {
  font-size: var(--text-sm);
  color: var(--text-body);
}
body.analyze-page #exclude-reason {
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-strong);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  padding: var(--space-3) var(--space-4);
}
body.analyze-page #exclude-reason:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--shadow-focus);
}
body.analyze-page #modal-exclude .an-modal-cancel {
  background: transparent;
  border: var(--space-1px) solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-body);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
}
body.analyze-page #modal-exclude .an-modal-cancel:hover {
  background: var(--stone-100);
  color: var(--text-strong);
}
body.analyze-page #modal-exclude .an-modal-confirm {
  background: var(--danger-500);
  border: var(--space-1px) solid var(--danger-500);
  border-radius: var(--radius-md);
  color: var(--text-on-brand);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
body.analyze-page #modal-exclude .an-modal-confirm:hover {
  background: var(--danger-700);
  border-color: var(--danger-700);
}

/* Refine / rewritten sections — visual leve até item 3 ser decidido */
body.analyze-page .refine-section,
body.analyze-page .rewritten-section {
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-top: var(--space-4);
}

/* Modal Análise Profunda (#modal-deep-confirm) */
body.analyze-page #modal-deep-confirm {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.55);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
body.analyze-page #modal-deep-confirm > div {
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-6);
}
body.analyze-page #modal-deep-confirm h3 { color: var(--text-strong); }
body.analyze-page #modal-deep-confirm p { color: var(--text-body); }
body.analyze-page #deep-cost-label { color: var(--stone-900); }

@media (min-width: 768px) {
  .an-form-card { padding: var(--space-6); }
  .an-form-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* Migração das regras antigas que estavam em <style> inline do analyze.html.
   Mantidas com mesmos nomes (JS depende: mod-combo-input, mod-dropdown, mod-option,
   mod-modal, examples no DOM gerado, results-grid, cache-badge, etc.) e re-tokenizadas. */
body.analyze-page .results-grid { display: grid; gap: var(--space-4); }
body.analyze-page #story {
  min-height: 140px;
  resize: vertical;
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-strong);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.5;
}
body.analyze-page #story:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--shadow-focus);
}
body.analyze-page #story::placeholder { color: var(--text-subtle); }
body.analyze-page .prob-item {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  padding: var(--space-2) 0;
  border-bottom: var(--space-1px) solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--text-body);
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}
body.analyze-page .prob-item:last-child { border-bottom: none; }
body.analyze-page .prob-arrow {
  color: var(--danger-500);
  flex-shrink: 0;
  margin-top: var(--space-2px);
}
body.analyze-page .criterio-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-strong);
  margin-bottom: var(--space-2px);
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* IDs estáveis precisam permanecer legíveis em mobile sem quebrar layout. */
body.analyze-page .id-tag {
  display: inline-block;
  margin-right: var(--space-1);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.8;
  white-space: nowrap;
}

body.analyze-page .test-item,
body.analyze-page .criterio-card,
body.analyze-page .test-desc {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Botões longos/tabs em viewport pequena: quebra controlada sem esconder overflow. */
@media (max-width: 640px) {
  body.analyze-page .tab-btn {
    white-space: normal;
    line-height: 1.25;
    align-items: flex-start;
  }

  body.analyze-page .btn-exclude {
    flex-shrink: 0;
  }
}

@media print { body.analyze-page .no-print { display: none; } }

body.analyze-page .cache-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  margin-bottom: var(--space-3);
}
body.analyze-page .cache-badge.hit {
  background: var(--success-50);
  color: var(--success-700);
  border: var(--space-1px) solid var(--success-100);
}
body.analyze-page .cache-badge.miss {
  background: var(--stone-100);
  color: var(--text-body);
  border: var(--space-1px) solid var(--border-subtle);
}
body.analyze-page .cache-badge .time {
  opacity: 0.8;
  font-size: var(--text-xs);
}

body.analyze-page .force-btn {
  background: transparent;
  border: var(--space-1px) solid var(--border-default);
  color: var(--text-body);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  cursor: pointer;
  margin-left: var(--space-2);
}
body.analyze-page .force-btn:hover {
  border-color: var(--danger-500);
  color: var(--danger-500);
}

body.analyze-page .org-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: var(--space-1) var(--space-3);
  background: var(--stone-100);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-body);
  font-family: var(--font-mono);
}
body.analyze-page .org-label strong { color: var(--text-strong); font-weight: 500; }

body.analyze-page .mod-field { margin-top: var(--space-4); }
body.analyze-page .mod-field label {
  font-size: var(--text-xs);
  color: var(--text-body);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: block;
  margin-bottom: var(--space-2);
}
body.analyze-page .mod-combo { position: relative; }
body.analyze-page .mod-combo-input {
  width: 100%;
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-default);
  color: var(--text-strong);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
}
body.analyze-page button.mod-combo-input { appearance: none; -webkit-appearance: none; margin: 0; }
body.analyze-page .mod-combo-input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--shadow-focus);
}
body.analyze-page .mod-selected {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-strong);
}
body.analyze-page .mod-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2px) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
}
body.analyze-page .mod-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: var(--space-1);
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  display: none;
}
body.analyze-page .mod-dropdown.open { display: block; }
body.analyze-page .mod-search-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: var(--space-2) var(--space-3) 0;
}
body.analyze-page .mod-search {
  width: 100%;
  border: none;
  border-bottom: var(--space-1px) solid var(--border-subtle);
  background: transparent;
  color: var(--text-strong);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  outline: none;
}
body.analyze-page .mod-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-body);
  border-bottom: var(--space-1px) solid var(--border-subtle);
}
body.analyze-page .mod-option:last-child { border-bottom: none; }
body.analyze-page .mod-option:hover { background: var(--stone-100); color: var(--text-strong); }
body.analyze-page .mod-option .ico { font-size: var(--text-md); width: var(--space-5); text-align: center; }
body.analyze-page .mod-option .count {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}
body.analyze-page .mod-create { color: var(--brand-600); font-weight: 600; }
body.analyze-page .mod-clear {
  margin-left: var(--space-2);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-md);
}
body.analyze-page .mod-clear:hover { color: var(--danger-500); }

body.analyze-page .mod-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.55);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
body.analyze-page .mod-modal-overlay.open { display: flex; }
body.analyze-page .mod-modal {
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-6);
  max-width: 460px;
  width: 100%;
}
body.analyze-page .mod-modal h3 {
  margin: 0 0 var(--space-4);
  color: var(--text-strong);
  font-size: var(--text-lg);
  font-weight: 600;
}
body.analyze-page .mod-modal label,
body.analyze-page .mod-modal .mod-modal-caption {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-body);
  font-family: var(--font-mono);
  margin: var(--space-3) 0 var(--space-2);
}
body.analyze-page .mod-modal input[type=text],
body.analyze-page .mod-modal textarea {
  width: 100%;
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-default);
  color: var(--text-strong);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
}
body.analyze-page .mod-modal textarea { resize: vertical; min-height: 80px; }

body.analyze-page .color-swatches { display: flex; gap: var(--space-2); flex-wrap: wrap; }
body.analyze-page .color-sw {
  width: var(--space-8);
  height: var(--space-8);
  border-radius: var(--radius-full);
  cursor: pointer;
  border: var(--space-2px) solid transparent;
}
body.analyze-page .color-sw.selected {
  border-color: var(--text-strong);
  transform: scale(1.1);
}
body.analyze-page .icon-picker {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: var(--space-1);
}
body.analyze-page .icon-pick {
  font-size: var(--text-lg);
  padding: var(--space-1);
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
}
body.analyze-page .icon-pick.selected {
  border-color: var(--brand-500);
  background: var(--brand-50);
}
body.analyze-page .mod-preview {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--stone-50);
  border: var(--space-1px) dashed var(--border-default);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
body.analyze-page .mod-preview-ico { font-size: var(--text-xl); }
body.analyze-page .mod-preview-txt { font-size: var(--text-sm); font-weight: 600; }

/* Toolbar legada (.analyze-actions) — convive com .an-form-toolbar */
body.analyze-page .analyze-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ── Aba Refinar com IA: Seção 1 (itens fora de escopo) ── */
.an-refinar-section {
  margin: 0;
  padding: var(--space-5) 0;
}
.an-refinar-section.refine-section,
.an-refinar-section.rewritten-section {
  background: transparent;
  border: 0;
  padding: var(--space-5) 0;
  margin: 0;
}
.an-refinar-section-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}
.an-refinar-section-title {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-strong);
  margin: 0;
  letter-spacing: -0.01em;
}
.an-refinar-counter {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}
.an-refinar-counter strong {
  color: var(--text-strong);
  font-weight: 600;
}
.an-refinar-divider {
  height: var(--space-1px);
  background: var(--border-subtle);
  border: 0;
  margin: 0;
}
.an-refinar-empty {
  padding: var(--space-5) var(--space-4);
  background: var(--stone-50);
  border: var(--space-1px) dashed var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-align: center;
}
.an-refinar-summary-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.an-refinar-group {
  background: var(--surface-card);
  border: var(--space-1px) solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
.an-refinar-group-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--brand-700);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}
.an-refinar-group-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.an-refinar-item {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-top: var(--space-1px) solid var(--border-subtle);
}
.an-refinar-item:first-child { border-top: 0; }
.an-refinar-item-body {
  flex: 1;
  min-width: 0;
}
.an-refinar-item-title {
  font-size: var(--text-sm);
  color: var(--text-strong);
  font-weight: 500;
  line-height: 1.4;
}
.an-refinar-item-reason {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
  margin-top: var(--space-1);
}
.an-refinar-item-remove {
  flex-shrink: 0;
  padding: var(--space-2px) var(--space-2);
  background: transparent;
  color: var(--text-muted);
  border: var(--space-1px) solid var(--border-default);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
}
.an-refinar-item-remove:hover {
  background: var(--stone-100);
  color: var(--text-strong);
  border-color: var(--border-strong);
}
.an-refinar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* Badge "tab-refinar" ganha visual de chip pequeno quando aparece */
body.analyze-page .an-tab-refinar-badge {
  background: var(--danger-100);
  color: var(--danger-700);
}
body.analyze-page .tab-btn.active .an-tab-refinar-badge {
  background: var(--danger-500);
  color: var(--text-on-brand);
}

/* feat-005 — Landing: banner cupom + tabela comparadora */

/* Banner cupom */
.lp-coupon-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fef9c3 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px 20px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.lp-coupon-badge {
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
  white-space: nowrap;
}
.lp-coupon-text {
  font-size: 14px;
  color: #78350f;
  line-height: 1.5;
}
.lp-coupon-text strong {
  color: #92400e;
  font-weight: 700;
}

/* Tabela comparadora */
.lp-compare-wrapper {
  margin-top: 48px;
}
.lp-compare-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
}
.lp-compare-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid #DDE3EE;
}
.lp-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 600px;
}
.lp-compare-table thead tr {
  background: #F5F7FA;
}
.lp-compare-table th {
  padding: 12px 16px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  color: #3D4A63;
  border-bottom: 2px solid #DDE3EE;
}
.lp-compare-table th.lp-compare-feature-col {
  text-align: left;
  width: 35%;
}
.lp-compare-featured-col {
  background: #EFF6FF !important;
  color: #1A7FE8 !important;
  font-weight: 700;
}
.lp-compare-table td {
  padding: 10px 16px;
  text-align: center;
  border-bottom: 1px solid #EEF0F5;
  color: #3D4A63;
}
.lp-compare-table td:first-child {
  text-align: left;
  color: #3D4A63;
}
.lp-compare-table tr:last-child td {
  border-bottom: none;
}
.lp-compare-table tbody tr:hover {
  background: #F8FAFC;
}
.lp-compare-group-row td {
  background: #F0F4FA;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6B7A99;
  padding: 8px 16px;
  border-bottom: 1px solid #DDE3EE;
}
.lp-compare-group-row td[colspan] {
  text-align: left;
}

/* ✓ e — na tabela */
.lp-compare-table td:not(:first-child) {
  font-size: 15px;
}

/* ux-004: perguntas de Refinar agrupadas por categoria */
.refine-category {
  margin-bottom: 14px;
  border: 1px solid var(--b1, #1a2035);
  border-radius: 8px;
  overflow: hidden;
}
.refine-category[open] {
  background: var(--s2, #0f1320);
}
.refine-category-title {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
  color: var(--t1, #f0f4ff);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.refine-category-title::-webkit-details-marker { display: none; }
.refine-category-title::before {
  content: '▶';
  font-size: 10px;
  color: var(--t2, #b8c2d8);
  transition: transform 0.15s ease;
}
.refine-category[open] > .refine-category-title::before {
  transform: rotate(90deg);
}
.refine-category-count {
  font-family: var(--font-m, monospace);
  font-size: 11px;
  color: var(--t2, #b8c2d8);
  font-weight: 400;
}
.refine-questions {
  padding: 4px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ux-005: filtro por camada na pirâmide de testes */
.pyr-layer {
  transition: opacity 0.15s ease, outline-color 0.15s ease;
}
.pyr-layer.pyr-active {
  opacity: 1 !important;
  outline: 2px solid var(--a2, #4d9eff);
  outline-offset: 2px;
}
.pyr-wrap:has(.pyr-active) .pyr-layer:not(.pyr-active) {
  opacity: 0.45;
}

/* ux-006: detalhe expandível em test-items */
.test-item.expandable { cursor: pointer; }
.test-item.expandable:hover {
  background: var(--s3, #141928);
}
.test-detail {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--b1, #1a2035);
}
.test-detail-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  flex-wrap: wrap;
}
.test-detail-label {
  font-weight: 600;
  color: var(--t2, #b8c2d8);
  min-width: 80px;
}
.test-steps {
  margin: 0 0 8px 16px;
  padding: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--t2, #b8c2d8);
}
.test-steps li {
  margin-bottom: 2px;
}

/* === Team page === */
/* Classes específicas da página /team.html — substituem o <style> inline
   antigo (~493 linhas hardcoded em hex dark). Todas as cores vêm de
   tokens do design-system, sem hex/rgb literal exceto onde indicado
   (overlay 50% e tag-bg via color-mix). */

.usage-section {
  margin-bottom: var(--space-8);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}
.usage-text {
  font-size: var(--text-sm);
  color: var(--text-body);
  margin-bottom: var(--space-4);
}
.usage-bar-fill.warning  { background: var(--warning-500); }
.usage-bar-fill.critical { background: var(--danger-500); }

.members-grid,
.invites-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
}
.members-grid { margin-bottom: var(--space-8); }
.invites-section { margin-top: var(--space-8); }

.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.card-member-info { flex: 1; min-width: 0; }
.card-name {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-strong);
}
.card-email {
  font-size: var(--text-sm);
  color: var(--text-muted);
  word-break: break-all;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-on-brand);
  flex-shrink: 0;
}
.avatar.owner   { background: var(--success-500); color: var(--text-on-brand); }
.avatar.lead    { background: var(--brand-600);   color: var(--text-on-brand); }
.avatar.analyst { background: var(--a5);          color: var(--text-on-brand); }
.avatar.viewer  { background: var(--text-muted);  color: var(--text-on-brand); }

.card-role {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.tag-owner {
  background: color-mix(in srgb, var(--success-500) 15%, transparent);
  color: var(--success-700);
}
.tag-lead {
  background: color-mix(in srgb, var(--brand-600) 15%, transparent);
  color: var(--brand-700);
}
.tag-analyst {
  background: color-mix(in srgb, var(--a5) 15%, transparent);
  color: var(--a5);
}
.tag-viewer {
  background: color-mix(in srgb, var(--text-muted) 18%, transparent);
  color: var(--text-body);
}

.card-stats {
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}
.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  color: var(--text-body);
}
.stat-row:last-child { margin-bottom: 0; }
.stat-label { color: var(--text-muted); }
.stat-value { color: var(--text-strong); font-weight: 600; }

.card-actions {
  display: flex;
  gap: var(--space-2);
}
.btn-small {
  padding: 6px var(--space-3);
  font-size: var(--text-xs);
}

.dropdown-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  font-size: 20px;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.dropdown-btn:hover {
  color: var(--text-strong);
  background: var(--surface-sunken);
}
.dropdown-menu {
  position: absolute;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 150px;
  z-index: 100;
  right: 0;
}
.dropdown-item {
  padding: var(--space-3) var(--space-4);
  color: var(--text-body);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
}
.dropdown-item:hover {
  background: var(--surface-sunken);
  color: var(--text-strong);
}
.dropdown-item.danger { color: var(--danger-500); }
.dropdown-item.danger:hover {
  background: color-mix(in srgb, var(--danger-500) 8%, transparent);
}

.invite-card {
  background: var(--surface-card);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}
.invite-email {
  font-size: var(--text-md);
  color: var(--text-strong);
  font-weight: 500;
  margin-bottom: var(--space-2);
  word-break: break-all;
}
.invite-role {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}
.invite-expires {
  font-size: var(--text-xs);
  color: var(--text-subtle);
  margin-bottom: var(--space-4);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  /* Overlay translúcido derivado de stone-950 (preto do sistema). */
  background: color-mix(in srgb, var(--stone-950) 50%, transparent);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}
.modal-title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: var(--space-6);
}
.modal-actions {
  display: flex;
  gap: var(--space-4);
  justify-content: flex-end;
}
.modal-paragraph {
  font-size: var(--text-sm);
  color: var(--text-body);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}
.modal-warning-box {
  padding: var(--space-3);
  background: color-mix(in srgb, var(--warning-500) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning-500) 40%, transparent);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-body);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}

.field-input,
.field-select {
  width: 100%;
  padding: var(--space-3);
  background: var(--surface-page);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-strong);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  box-sizing: border-box;
  font-family: var(--font-sans);
}
.field-input:focus,
.field-select:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: var(--shadow-focus);
}

.empty-state {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
}

.relative { position: relative; }

.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: color-mix(in srgb, var(--accent-500) 15%, transparent);
  color: var(--accent-700);
  border: 1px solid color-mix(in srgb, var(--accent-500) 40%, transparent);
  padding: 3px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: help;
  margin-left: var(--space-2);
}
