/* =====================================================================
   LunHub — Design System v8 "SINAL NÍTIDO"  (tokens + componentes base)
   (evolução da v4 "SINAL": mesma marca, divisões de cor mais claras,
   bordas/estados nítidos e "acessórios" de acabamento. docs/design-v8.md)
   ---------------------------------------------------------------------
   cor-bit (nov/2026, decisão do dono): MESMA PEGADA DE COR do Painel BIT (bitpanel.vip, shadcn escuro):
   fundo quase preto #050506, cartões #0a0b0e, bordas discretas, PRIMÁRIA ROXA #530bb7 (anel #8b3cf0),
   texto #f8f7f0 / secundário #8691ad, visual chapado (sem aurora/brilho). O ciano fica SÓ na logo.
   Os textos abaixo descrevem a v8 original (histórico); os valores atuais são os marcados "cor-bit".
   Conceito: a conversa é um SINAL luminoso no ABISMO azul-marinho.
   A marca (robô no balão, gradiente ciano #14f7f0 -> #05ddff -> azul
   #1e74ff [v8b-cor: o azul saiu da UI; gradientes terminam em verde-água], "Bit" verde-água #00e5c8) vira a única fonte de luz da tela:
   superfícies marinho em camadas, linhas finas (hairlines) azuladas e o
   gradiente da marca reservado para o que importa (ação principal,
   item ativo, foco, números-chave). Guias: docs/design-v8.md (atual) e docs/design-v4.md

   Tema: <html data-theme="dark|light">  (localStorage 'vozk_theme').
   Regras:
   - telas usam SÓ estes tokens (nada de hex solto no CSS da tela);
   - os NOMES antigos (v3) continuam valendo, só os valores mudaram;
   - componentes novos usam o prefixo .tb-* (não colide com o CSS das telas).
   Contraste: todo texto de token >= 4.5:1 (AA) sobre as superfícies do tema.
   ===================================================================== */

/* ---------- 0. Constantes da marca (iguais nos dois temas) ---------- */
:root {
  --tb-cyan:   #8b3cf0;   /* cor-bit (era #14f7f0) */
  --tb-sky:    #7c3aed;   /* cor-bit (era #05ddff) */
  --tb-blue:   #530bb7;   /* cor-bit (era #00e5c8) */
  --tb-mint:   #22c55e;   /* cor-bit (era #00e5c8) */
  --tb-abyss:  #050506;   /* cor-bit (era #050c26) */
  --tb-navy:   #0a0b0e;   /* cor-bit (era #0a1433) */
  --tb-ink:    #050506;   /* cor-bit (era #03112b) */
  --brand-gradient-logo: linear-gradient(135deg, #14f7f0 0%, #05ddff 50%, #00e5c8 100%);   /* v8b-cor: ciano -> verde-água */
  --signal-line: linear-gradient(90deg, #8b3cf0, #8b3cf0);   /* cor-bit (era linear-gradient(90deg, #14f7f0, #05ddff 45%, #00e5c8)) */
}

/* ---------- 1. Tema ESCURO (padrão): "Abismo" ---------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  /* Superfícies em camadas (do fundo para cima; cada degrau = +1 nível de luz) */
  --bg:               #050506;   /* cor-bit (era #060d29) */
  --bg-surface:       #0a0b0e;   /* cor-bit (era #0e1a3f) */
  --bg-surface-alt:   #101116;   /* cor-bit (era #142350) */
  --bg-elev:          #16171d;   /* cor-bit (era #1b2d5f) */
  --bg-inset:         #060709;   /* cor-bit (era #040a1f) */
  --bg-overlay:       rgba(0,0,0,0.72);   /* cor-bit (era rgba(2,6,20,0.74)) */
  --bg-sidebar:       #020203;   /* cor-bit (era #030919) */
  --bg-sidebar-hover: #101116;   /* cor-bit (era #0a1636) */
  --bg-sidebar-active:#16171d;   /* cor-bit (era #0f2150) */
  --bg-aurora:        linear-gradient(transparent, transparent);   /* cor-bit (era aurora ciano) */
  --bg-glass:         rgba(10,11,14,0.88);   /* cor-bit (era rgba(12,26,66,0.72)) */

  /* Texto */
  --fg:               #f8f7f0;   /* cor-bit (era #eef4ff) */
  --fg-dim:           #aab2c8;   /* cor-bit (era #bccae6) */
  --fg-faint:         #8691ad;   /* cor-bit (era #a1b2d4) */
  --fg-sidebar:       #aab2c8;   /* cor-bit (era #bccbe8) */
  --fg-sidebar-bright:#f8f7f0;   /* cor-bit (era #ffffff) */
  --fg-on-accent:     #ffffff;   /* cor-bit (era #03112b) */
  --fg-on-brand:      #ffffff;   /* cor-bit (era #03112b) */
  --fg-on-color:      #ffffff;   /* texto/ícone sobre cor sólida escura, foto ou overlay (avatares, mídia, QR) */

  /* Marca / ação */
  --accent:           #530bb7;   /* cor-bit (era #05ddff) */
  --accent-hover:     #6a1fd6;   /* cor-bit (era #57e8ff) */
  --accent-press:     #470a9e;   /* cor-bit (era #00bde6) */
  --accent-light:     rgba(124,58,237,0.20);   /* cor-bit (era rgba(5,221,255,0.15)) */
  --accent-text:      #b794ff;   /* cor-bit (era #5ae4ff) */
  --accent-2:         #22c55e;   /* cor-bit (era #00e5c8) */
  --accent-2-light:   rgba(34,197,94,0.14);   /* cor-bit (era rgba(0,229,200,0.13)) */
  --accent-3:         #b794ff;   /* cor-bit (era #05ddff) */
  --brand-gradient:   linear-gradient(135deg, #530bb7 0%, #530bb7 100%);   /* cor-bit (era linear-gradient(135deg, #14f7f0 0%, #05ddff 42%, #00e5c8 ...) */
  --brand-gradient-soft: linear-gradient(135deg, rgba(124,58,237,0.16), rgba(124,58,237,0.10));   /* cor-bit (era linear-gradient(135deg, rgba(20,247,240,0.12), rgba(0,229...) */
  --brand-gradient-text: linear-gradient(120deg, #c4a6ff 0%, #b794ff 100%);   /* cor-bit (era linear-gradient(120deg, #14f7f0 0%, #05ddff 45%, #00e5c8 ...) */

  /* Bolhas do chat */
  --sent:             #5a12c2;   /* cor-bit (era #05ddff) */
  --sent-grad:        linear-gradient(135deg, #5a12c2 0%, #530bb7 100%);   /* cor-bit (era linear-gradient(135deg, #2fe6ff 0%, #05ddff 55%, #05d0ef ...) */
  --sent-fg:          #ffffff;   /* cor-bit (era #03112b) */
  --received:         #16171d;   /* cor-bit (era #0e1d47) */
  --received-fg:      #f8f7f0;   /* cor-bit (era #e6eeff) */
  --note-bg:          rgba(255,181,71,0.10);

  /* Estados */
  --danger:           #ff5d7a;
  --danger-light:     rgba(255,93,122,0.14);
  --warning:          #ffb547;
  --warning-light:    rgba(255,181,71,0.14);
  --success:          #22c55e;   /* cor-bit (era #00e5c8) */
  --success-light:    rgba(34,197,94,0.13);   /* cor-bit (era rgba(0,229,200,0.13)) */
  --info:             #60a5fa;   /* cor-bit (era #6cc4f5) */
  --info-light:       rgba(96,165,250,0.14);   /* cor-bit (era rgba(108,196,245,0.14)) */
  --online:           #22c55e;   /* cor-bit (era #00e5c8) */
  --whatsapp:         #25d366;

  /* Linhas, foco, sombras, brilho */
  --border:           #17181f;   /* cor-bit (era #243a6f) */
  --border-strong:    #25262f;   /* cor-bit (era #33508c) */
  --border-glow:      rgba(139,60,240,0.35);   /* cor-bit (era rgba(5,221,255,0.45)) */
  --divider:          rgba(255,255,255,0.06);   /* cor-bit (era rgba(150,185,255,0.12)) */
  --line-hi:          inset 0 1px 0 rgba(255,255,255,0.03);   /* cor-bit (era inset 0 1px 0 rgba(170,210,255,0.07)) */
  --focus-ring:       0 0 0 3px rgba(139,60,240,0.55);   /* cor-bit (era 0 0 0 3px rgba(5,221,255,0.40)) */
  --glow:             0 1px 2px rgba(0,0,0,0.45);   /* cor-bit (era 0 0 0 1px rgba(5,221,255,0.30), 0 10px 32px -10px rgba(5,...) */
  --glow-strong:      0 2px 6px rgba(0,0,0,0.55);   /* cor-bit (era 0 0 0 1px rgba(20,247,240,0.45), 0 14px 44px -10px rgba(5...) */
  --shadow-sm:        0 1px 2px rgba(0,0,0,0.50);   /* cor-bit (era 0 1px 2px rgba(0,3,15,0.50)) */
  --shadow-md:        0 8px 24px -6px rgba(0,0,0,0.65);   /* cor-bit (era 0 8px 24px -6px rgba(0,3,15,0.60)) */
  --shadow-lg:        0 28px 64px -16px rgba(0,0,0,0.80);   /* cor-bit (era 0 28px 64px -16px rgba(0,3,15,0.78)) */

  /* Avatares por nome (texto --fg-on-color, >= 4.75:1 em todos) */
  --av-1: #5c6a10; --av-2: #6b3fc4; --av-3: #0e7a6b; --av-4: #8a3d7a;   /* v8b-cor: av-1/av-4 eram azul royal; cor-bit: av-2 era ciano #0a7c93 -> roxo (branco 6.7:1) */
  --av-5: #c02f68; --av-6: #b4500c; --av-7: #36598f; --av-8: #0b6aa8;

  /* Skeleton / tooltip / scrollbar */
  --skeleton:         #16171d;   /* cor-bit (era #15265a) */
  --skeleton-shine:   rgba(255,255,255,0.05);   /* cor-bit (era rgba(120,180,255,0.10)) */
  --tooltip-bg:       #f8f7f0;   /* cor-bit (era #eef4ff) */
  --tooltip-fg:       #050506;   /* cor-bit (era #050c26) */
  --scrollbar:        rgba(255,255,255,0.14);   /* cor-bit (era rgba(140,180,255,0.18)) */

  /* Gráficos (categórico, mesma ordem nos 2 temas) */
  --chart-1: #8b3cf0; --chart-2: #34d399; --chart-3: #8fb4ea;   /* v8b-cor: chart-3 era #5b8cff; cor-bit: chart-1 #05ddff -> roxo, chart-2 #00e5c8 -> verde */ --chart-4: #ffb547; --chart-5: #ff6b9a; --chart-6: #8fa3c7;

  /* ---- v8: divisões de cor nomeadas (canvas < painel < cartão < sub-cartão; campo = poço) ---- */
  --bg-canvas:        var(--bg);
  --bg-panel:         #08090b;   /* cor-bit (era #0a1534) */
  --bg-card:          var(--bg-surface);
  --bg-field:         #060709;   /* cor-bit (era #091330) */
  --bg-highlight:     linear-gradient(0deg, rgba(124,58,237,0.08), rgba(124,58,237,0.08)), #0a0b0e;   /* cor-bit (era linear-gradient(135deg, rgba(20,247,240,0.10) 0%, rgba(5,...) */
  --border-field:     #3a3c4a;   /* cor-bit (era #3b5794) */
  --border-hover:     #4b4e60;   /* cor-bit (era #4d6bad) */
  --border-active:    #8b3cf0;   /* cor-bit: anel do BIT (o roxo profundo some no preto) */
  /* estados */
  --state-hover:      rgba(255,255,255,0.04);   /* cor-bit (era rgba(170,205,255,0.06)) */
  --state-press:      rgba(255,255,255,0.07);   /* cor-bit (era rgba(170,205,255,0.10)) */
  --state-selected:   rgba(124,58,237,0.20);   /* cor-bit (era rgba(5,221,255,0.15)) */
  --state-disabled-bg:#101116;   /* cor-bit (era #111d42) */
  --state-disabled-fg:#5c6274;   /* cor-bit (era #6f81aa) */
  --ring-danger:      0 0 0 3px rgba(255,93,122,0.30);
  --ring-success:     0 0 0 3px rgba(34,197,94,0.28);   /* cor-bit (era 0 0 0 3px rgba(0,229,200,0.28)) */
  --fg-on-success:    #050506;   /* cor-bit (era #03112b) */
  --fg-on-danger:     #1a0510;
  --fg-heading:       #ffffff;
  /* interruptor desligado (precisa ser visível, não "sumir" no cartão) */
  --switch-off-bg:    #1c1d25;   /* cor-bit (era #1a2b5a) */
  --switch-off-border:#44475a;   /* cor-bit (era #4a64a0) */
  --switch-off-knob:  #aab2c8;   /* cor-bit (era #b4c3e2) */
  /* acabamento */
  --grad-feature:     linear-gradient(135deg, rgba(124,58,237,0.08) 0%, rgba(124,58,237,0.03) 100%);   /* cor-bit (era linear-gradient(135deg, rgba(20,247,240,0.09) 0%, rgba(0,...) */
  --grad-feature-border: rgba(139,60,240,0.28);   /* cor-bit (era rgba(5,221,255,0.30)) */
  --shadow-card:      0 1px 2px rgba(0,0,0,0.45);   /* cor-bit (era 0 1px 0 rgba(170,210,255,0.05) inset, 0 1px 2px rgba(0,3,...) */
  --shadow-pop:       0 18px 48px -12px rgba(0,0,0,0.80), 0 0 0 1px rgba(255,255,255,0.06);   /* cor-bit (era 0 18px 48px -12px rgba(0,3,15,0.75), 0 0 0 1px rgba(150,1...) */
  /* prévia realista do WhatsApp (cores do app oficial, tema escuro) */
  --wa-bg: #0b141a; --wa-header: #202c33; --wa-in: #202c33; --wa-out: #005c4b; --wa-fg: #e9edef; --wa-meta: #8696a0; --wa-link: #53bdeb; --wa-day: #182229; --wa-tick: #53bdeb; --wa-doodle: rgba(255,255,255,0.035);
}

/* ---------- 2. Tema CLARO: "Maré" (mesma marca, luz invertida) ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg:               #f3f3f5;   /* cor-bit (era #e9eff7) */
  --bg-surface:       #ffffff;
  --bg-surface-alt:   #f7f7f9;   /* cor-bit (era #f5f8fd) */
  --bg-elev:          #ececf0;   /* cor-bit (era #e6edf8) */
  --bg-inset:         #f0f0f3;   /* cor-bit (era #e8eef7) */
  --bg-overlay:       rgba(5,5,6,0.48);   /* cor-bit (era rgba(5,12,38,0.48)) */
  --bg-sidebar:       #0a0b0e;   /* cor-bit (era #050c26) */
  --bg-sidebar-hover: #16171d;   /* cor-bit (era #0c1a42) */
  --bg-sidebar-active:#1f2028;   /* cor-bit (era #13285c) */
  --bg-aurora:        linear-gradient(transparent, transparent);   /* cor-bit (era aurora ciano) */
  --bg-glass:         rgba(255,255,255,0.88);   /* cor-bit (era rgba(255,255,255,0.78)) */

  --fg:               #0c0c10;   /* cor-bit (era #08122e) */
  --fg-dim:           #3d4152;   /* cor-bit (era #34425e) */
  --fg-faint:         #545a6e;   /* cor-bit (era #46557a) */
  --fg-sidebar:       #aab2c8;   /* cor-bit (era #bccbe8) */
  --fg-sidebar-bright:#f8f7f0;   /* cor-bit (era #ffffff) */
  --fg-on-accent:     #ffffff;   /* v8b-cor: sobre o ciano profundo --accent: 6.1:1 */
  --fg-on-brand:      #ffffff;   /* cor-bit (era #03112b) */
  --fg-on-color:      #ffffff;

  --accent:           #530bb7;   /* cor-bit (era #006c82) */
  --accent-hover:     #6a1fd6;   /* cor-bit (era #005b6e) */
  --accent-press:     #42098f;   /* cor-bit (era #004c5c) */
  --accent-light:     #efe7fb;   /* cor-bit (era #dcf3f7) */
  --accent-text:      #530bb7;   /* cor-bit (era #006c82) */
  --accent-2:         #137337;   /* cor-bit (era #007563; #15803d dava 4.35:1 no selo claro) */
  --accent-2-light:   #dcf5e4;   /* cor-bit (era #d8f6f0) */
  --accent-3:         #530bb7;   /* cor-bit (era #006c82) */
  --brand-gradient:   linear-gradient(135deg, #530bb7 0%, #530bb7 100%);   /* cor-bit (era linear-gradient(135deg, #14f7f0 0%, #05ddff 42%, #00e5c8 ...) */
  --brand-gradient-soft: linear-gradient(135deg, rgba(83,11,183,0.08), rgba(83,11,183,0.05));   /* cor-bit (era linear-gradient(135deg, rgba(20,247,240,0.12), rgba(0,229...) */
  --brand-gradient-text: linear-gradient(120deg, #530bb7 0%, #530bb7 100%);   /* cor-bit (era linear-gradient(120deg, #006c82 0%, #00695c 100%)) */

  --sent:             #530bb7;   /* cor-bit (era #0fb5c9) */
  --sent-grad:        linear-gradient(135deg, #5a12c2 0%, #530bb7 100%);   /* cor-bit (era linear-gradient(135deg, #1fc3d6 0%, #0fb5c9 55%, #0eadc1 ...) */
  --sent-fg:          #ffffff;   /* cor-bit (era #03112b) */
  --received:         #ffffff;
  --received-fg:      #0c0c10;   /* cor-bit (era #0d1733) */
  --note-bg:          #fff5e0;

  --danger:           #c8153b;
  --danger-light:     #fde7ec;
  --warning:          #9a5c00;
  --warning-light:    #fff1d6;
  --success:          #137337;   /* cor-bit (era #007563; #15803d dava 4.35:1 no selo claro, abaixo do AA) */
  --success-light:    #dcf5e4;   /* cor-bit (era #d8f6f0) */
  --info:             #1d5fa8;   /* v8b-cor (era #1f6fe0) */
  --info-light:       #e3eef8;
  --online:           #16a34a;   /* cor-bit (era #00a38c) */
  --whatsapp:         #13803c;

  --border:           #e2e2e8;   /* cor-bit (era #d3dcea) */
  --border-strong:    #c9c9d3;   /* cor-bit (era #b4c2d9) */
  --border-glow:      rgba(83,11,183,0.30);   /* cor-bit (era rgba(0,108,130,0.40)) */
  --divider:          rgba(12,12,16,0.08);   /* cor-bit (era rgba(8,18,46,0.09)) */
  --line-hi:          inset 0 1px 0 rgba(255,255,255,0.9);
  --focus-ring:       0 0 0 3px rgba(139,60,240,0.40);   /* cor-bit (era 0 0 0 3px rgba(0,140,165,0.32)) */
  --glow:             0 1px 2px rgba(12,12,16,0.10);   /* cor-bit (era 0 0 0 1px rgba(0,108,130,0.20), 0 10px 26px -10px rgba(0,...) */
  --glow-strong:      0 2px 6px rgba(12,12,16,0.16);   /* cor-bit (era 0 0 0 1px rgba(5,221,255,0.55), 0 14px 36px -10px rgba(0,...) */
  --shadow-sm:        0 1px 2px rgba(12,12,16,0.06), 0 1px 1px rgba(12,12,16,0.04);   /* cor-bit (era 0 1px 2px rgba(8,18,46,0.06), 0 1px 1px rgba(8,18,46,0.04)) */
  --shadow-md:        0 8px 24px -8px rgba(12,12,16,0.14);   /* cor-bit (era 0 8px 24px -8px rgba(8,18,46,0.14)) */
  --shadow-lg:        0 28px 60px -16px rgba(12,12,16,0.24);   /* cor-bit (era 0 28px 60px -16px rgba(8,18,46,0.26)) */

  --av-1: #5c6a10; --av-2: #6b3fc4; --av-3: #0e7a6b; --av-4: #8a3d7a;   /* v8b-cor: av-1/av-4 eram azul royal; cor-bit: av-2 era ciano #0a7c93 -> roxo (branco 6.7:1) */
  --av-5: #c02f68; --av-6: #b4500c; --av-7: #36598f; --av-8: #0b6aa8;

  --skeleton:         #ececf0;   /* cor-bit (era #e6edf8) */
  --skeleton-shine:   rgba(255,255,255,0.75);
  --tooltip-bg:       #0a0b0e;   /* cor-bit (era #050c26) */
  --tooltip-fg:       #f8f7f0;   /* cor-bit (era #eaf2ff) */
  --scrollbar:        rgba(12,12,16,0.18);   /* cor-bit (era rgba(8,18,46,0.18)) */

  --chart-1: #530bb7; --chart-2: #059669; --chart-3: #4a6b9e;   /* v8b-cor: chart-3 era #2f5fe8; cor-bit: chart-1 #0782b8 -> roxo, chart-2 #00a38c -> verde */ --chart-4: #d98a00; --chart-5: #d6336c; --chart-6: #7c8bab;

  --bg-canvas:        var(--bg);
  --bg-panel:         #fafafb;   /* cor-bit (era #f7f9fd) */
  --bg-card:          var(--bg-surface);
  --bg-field:         #ffffff;
  --bg-highlight:     linear-gradient(0deg, rgba(83,11,183,0.05), rgba(83,11,183,0.05)), #ffffff;   /* cor-bit (era linear-gradient(135deg, rgba(20,247,240,0.10) 0%, rgba(0,...) */
  --border-field:     #9c9cab;   /* cor-bit (era #9aaac4) */
  --border-hover:     #7e7e8f;   /* cor-bit (era #7d90b2) */
  --border-active:    #8b3cf0;   /* cor-bit: anel do BIT (o roxo profundo some no preto) */
  --state-hover:      rgba(12,12,16,0.045);   /* cor-bit (era rgba(8,18,46,0.045)) */
  --state-press:      rgba(12,12,16,0.08);   /* cor-bit (era rgba(8,18,46,0.08)) */
  --state-selected:   #efe7fb;   /* cor-bit (era #dcf3f7) */
  --state-disabled-bg:#ececf0;   /* cor-bit (era #e9eef6) */
  --state-disabled-fg:#8a8a99;   /* cor-bit (era #8593ad) */
  --ring-danger:      0 0 0 3px rgba(200,21,59,0.20);
  --ring-success:     0 0 0 3px rgba(21,128,61,0.20);   /* cor-bit (era 0 0 0 3px rgba(0,117,99,0.20)) */
  --fg-on-success:    #ffffff;
  --fg-on-danger:     #ffffff;
  --fg-heading:       #050506;   /* cor-bit (era #050c26) */
  --switch-off-bg:    #e4e4ea;   /* cor-bit (era #dfe6f2) */
  --switch-off-border:#9696a6;   /* cor-bit (era #8fa0bd) */
  --switch-off-knob:  #ffffff;
  --grad-feature:     linear-gradient(135deg, rgba(83,11,183,0.06) 0%, rgba(83,11,183,0.02) 100%);   /* cor-bit (era linear-gradient(135deg, rgba(20,247,240,0.10) 0%, rgba(0,...) */
  --grad-feature-border: rgba(83,11,183,0.24);   /* cor-bit (era rgba(0,108,130,0.28)) */
  --shadow-card:      0 1px 2px rgba(12,12,16,0.06), 0 8px 24px -18px rgba(12,12,16,0.20);   /* cor-bit (era 0 1px 2px rgba(8,18,46,0.06), 0 8px 24px -18px rgba(8,18,...) */
  --shadow-pop:       0 18px 44px -14px rgba(12,12,16,0.28), 0 0 0 1px rgba(12,12,16,0.05);   /* cor-bit (era 0 18px 44px -14px rgba(8,18,46,0.30), 0 0 0 1px rgba(8,18...) */
  --wa-bg: #efeae2; --wa-header: #f0f2f5; --wa-in: #ffffff; --wa-out: #d9fdd3; --wa-fg: #111b21; --wa-meta: #54656f; --wa-link: #027eb5; --wa-day: #ffffff; --wa-tick: #53bdeb; --wa-doodle: rgba(17,27,33,0.045);
}

/* ---------- 3. Escala (independe do tema) ---------- */
:root {
  /* Tipografia: corpo Plus Jakarta Sans; títulos e números grandes em Sora (geométrica, eco da logo) */
  --font: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
  --font-display: 'Sora', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --fs-2xs: 0.68rem; --fs-xs: 0.72rem; --fs-sm: 0.82rem; --fs-md: 0.92rem; --fs-lg: 1.05rem;
  --fs-xl: 1.3rem; --fs-2xl: 1.75rem; --fs-3xl: 2.25rem; --fs-display: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
  --lh-tight: 1.15; --lh-snug: 1.35; --lh: 1.55;
  --tracking-tight: -0.025em; --tracking-caps: 0.08em;
  --fs-page-title: clamp(1.5rem, 1.2rem + 1vw, 1.95rem);   /* v8: título de página (Sora 800) */
  --fs-section: 1.08rem;                                     /* v8: título de seção/cartão */
  --fw-medium: 500; --fw-semi: 600; --fw-bold: 700; --fw-black: 800;

  /* Raios: o balão da logo é a assinatura (cantos generosos, um canto "rabicho") */
  --radius-xl: 22px;
  --radius-lg: 18px;              /* v8: cartões de destaque, savebar */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --radius-pill: 999px;
  --radius-bubble: 18px;          /* bolhas: 18px com o canto do rabicho em --radius-tail */
  --radius-tail: 6px;

  --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;
  --control-h: 40px; --control-h-sm: 32px; --control-h-lg: 48px;   /* alturas de botão/input */
  --hairline: 1px;

  --z-dropdown: 50; --z-sticky: 80; --z-drawer: 900; --z-modal: 1000; --z-toast: 1100; --z-tooltip: 1200;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);          /* saída suave (padrão) */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* só p/ "pop" pequeno (badges, toasts) */
  --dur-fast: 120ms; --dur: 200ms; --dur-slow: 320ms;
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur: 0ms; --dur-slow: 0ms; }
  .tb-skeleton, .tb-dot-live, .tb-anim-rise, .tb-anim-pop, .tb-toast, .tb-modal, .tb-backdrop { animation: none !important; }
}

/* ---------- 4. Base mínima (especificidade zero: o CSS da tela sempre vence) ---------- */
:where(h1, h2, .tb-display) { font-family: var(--font-display); letter-spacing: var(--tracking-tight); }
:where(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); color: var(--fg); }
:where(*) { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
:where(*)::-webkit-scrollbar { width: 10px; height: 10px; }
:where(*)::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
:where(*)::-webkit-scrollbar-track { background: transparent; }
:where(.tb-num, .tb-kpi-value) { font-variant-numeric: tabular-nums; }

/* ---------- 5. Movimento ---------- */
@keyframes tb-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tb-rise    { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tb-pop     { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes tb-shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes tb-pulse   { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--online) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
@keyframes tb-spin    { to { transform: rotate(360deg); } }
@keyframes tb-signal  { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.tb-anim-rise { animation: tb-rise var(--dur-slow) var(--ease) both; }
.tb-anim-pop  { animation: tb-pop var(--dur) var(--ease-spring) both; }

/* ---------- 6. Componentes base (.tb-*) ---------- */

:where([class^="tb-"], [class*=" tb-"]), :where([class^="tb-"], [class*=" tb-"])::before, :where([class^="tb-"], [class*=" tb-"])::after { box-sizing: border-box; }

/* Botões: primary = SINAL (gradiente da marca + tinta marinho); secondary = superfície + hairline;
   ghost = só texto; danger; tamanhos sm/lg; .tb-btn-icon quadrado */
.tb-btn {
  --_h: var(--control-h);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: var(--_h); padding: 0 var(--space-4); border-radius: var(--radius-sm);
  font: var(--fw-bold) var(--fs-sm)/1 var(--font); letter-spacing: 0.005em; white-space: nowrap;
  color: var(--fg); background: var(--bg-surface-alt); border: var(--hairline) solid var(--border-strong);
  box-shadow: var(--line-hi); cursor: pointer; text-decoration: none; user-select: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease), color var(--dur) var(--ease);
}
.tb-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.tb-btn:hover { background: var(--bg-elev); border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); }
.tb-btn:active { transform: translateY(1px); }
.tb-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tb-btn:disabled, .tb-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.tb-btn-primary {
  color: var(--fg-on-brand); border-color: transparent;
  background: var(--brand-gradient); background-size: 160% 100%; background-position: 0 0;
  box-shadow: var(--glow), inset 0 1px 0 rgba(255,255,255,0.35);
}
.tb-btn-primary:hover { background: var(--brand-gradient); background-size: 160% 100%; background-position: 100% 0; border-color: transparent; box-shadow: var(--glow-strong), inset 0 1px 0 rgba(255,255,255,0.35); }
.tb-btn-primary:focus-visible { box-shadow: var(--focus-ring), var(--glow); }
.tb-btn-solid { color: var(--fg-on-accent); background: var(--accent); border-color: transparent; }
.tb-btn-solid:hover { background: var(--accent-hover); border-color: transparent; }
.tb-btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--fg-dim); }
.tb-btn-ghost:hover { background: var(--bg-elev); color: var(--fg); border-color: transparent; }
.tb-btn-danger { color: var(--danger); background: var(--danger-light); border-color: color-mix(in srgb, var(--danger) 30%, transparent); box-shadow: none; }
.tb-btn-danger:hover { color: var(--fg-on-accent); background: var(--danger); border-color: transparent; }
:root[data-theme="light"] .tb-btn-danger:hover { color: var(--fg-on-color); }
.tb-btn-sm { --_h: var(--control-h-sm); padding: 0 var(--space-3); font-size: var(--fs-xs); border-radius: var(--radius-xs); }
.tb-btn-lg { --_h: var(--control-h-lg); padding: 0 var(--space-6); font-size: var(--fs-md); border-radius: var(--radius); }
.tb-btn-icon { width: var(--_h); padding: 0; }
.tb-btn-block { width: 100%; }

/* Campos */
.tb-field { display: grid; gap: 6px; min-width: 0; }
.tb-label { font: var(--fw-bold) var(--fs-xs)/1.3 var(--font); color: var(--fg-dim); }
.tb-hint { font-size: var(--fs-xs); color: var(--fg-faint); line-height: 1.45; }
.tb-hint.is-error { color: var(--danger); }
.tb-input, .tb-select, .tb-textarea {
  width: 100%; min-width: 0; height: var(--control-h); padding: 0 var(--space-3);
  font: var(--fw-medium) var(--fs-md)/1.4 var(--font); color: var(--fg);
  background: var(--bg-field); border: var(--hairline) solid var(--border-field); border-radius: var(--radius-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
  appearance: none; -webkit-appearance: none;
}
.tb-textarea { height: auto; min-height: 96px; padding: var(--space-3); resize: vertical; }
.tb-select {
  padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-dim) 50%), linear-gradient(135deg, var(--fg-dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.tb-input::placeholder, .tb-textarea::placeholder { color: var(--fg-faint); }
.tb-input:hover, .tb-select:hover, .tb-textarea:hover { border-color: var(--border-hover); }
.tb-input:focus, .tb-select:focus, .tb-textarea:focus { outline: none; border-color: var(--border-active); box-shadow: var(--focus-ring); background: var(--bg-field); }
.tb-input[aria-invalid="true"], .tb-select[aria-invalid="true"], .tb-textarea[aria-invalid="true"], .tb-input.is-error { border-color: var(--danger); box-shadow: var(--ring-danger); }
.tb-input.is-success { border-color: var(--success); box-shadow: var(--ring-success); }
.tb-input:disabled, .tb-select:disabled, .tb-textarea:disabled, .tb-input[readonly] { background: var(--state-disabled-bg); color: var(--state-disabled-fg); border-style: dashed; cursor: not-allowed; }
.tb-input[readonly] { color: var(--fg-dim); cursor: text; }

/* Toggle (switch): <button class="tb-switch" role="switch" aria-checked="true"></button> */
.tb-switch {
  position: relative; width: 40px; height: 24px; flex-shrink: 0; padding: 0; border-radius: var(--radius-pill); cursor: pointer;
  background: var(--switch-off-bg); border: var(--hairline) solid var(--switch-off-border);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.tb-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--switch-off-knob); box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease-spring), background var(--dur) var(--ease);
}
.tb-switch[aria-checked="true"], .tb-switch.on { background: var(--brand-gradient); border-color: transparent; box-shadow: var(--glow); }
.tb-switch[aria-checked="true"]::after, .tb-switch.on::after { transform: translateX(16px); background: var(--fg-on-brand); }
.tb-switch:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tb-switch:hover { border-color: var(--border-hover); }
.tb-switch:disabled, .tb-switch[aria-disabled="true"] { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* Abas: sublinhado "sinal" (2px gradiente) / segmentado (pílulas) */
.tb-tabs { display: flex; gap: var(--space-1); border-bottom: var(--hairline) solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tb-tab {
  position: relative; padding: var(--space-3) var(--space-3); font: var(--fw-bold) var(--fs-sm)/1 var(--font); color: var(--fg-dim);
  background: none; border: 0; cursor: pointer; white-space: nowrap; transition: color var(--dur) var(--ease);
}
.tb-tab:hover { color: var(--fg); }
.tb-tab[aria-selected="true"], .tb-tab.active { color: var(--fg); }
.tb-tab[aria-selected="true"]::after, .tb-tab.active::after { content: ""; position: absolute; left: var(--space-2); right: var(--space-2); bottom: -1px; height: 2px; border-radius: 2px; background: var(--signal-line); box-shadow: 0 0 12px var(--border-glow); }
.tb-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: var(--bg-inset); border: var(--hairline) solid var(--border); }
.tb-seg > button { padding: 7px 12px; border: 0; border-radius: var(--radius-xs); background: none; color: var(--fg-dim); font: var(--fw-bold) var(--fs-xs)/1 var(--font); cursor: pointer; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.tb-seg > button:hover { color: var(--fg); }
.tb-seg > button[aria-pressed="true"], .tb-seg > button.active { background: var(--bg-elev); color: var(--fg); box-shadow: var(--shadow-sm), var(--line-hi); }

/* Cards: superfície + hairline + fio de luz no topo. --signal ganha a faixa da marca */
.tb-card {
  position: relative; background: var(--bg-surface); border: var(--hairline) solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm), var(--line-hi); padding: var(--space-5);
}
.tb-card-hover { transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.tb-card-hover:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow-md), var(--line-hi); }
.tb-card-signal { overflow: hidden; }
.tb-card-signal::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--signal-line); }
.tb-card-hero { background: var(--brand-gradient-soft), var(--bg-surface); border-color: color-mix(in srgb, var(--accent) 22%, var(--border)); }
.tb-card-title { font: var(--fw-bold) var(--fs-lg)/1.3 var(--font-display); color: var(--fg); letter-spacing: var(--tracking-tight); }
.tb-card-sub { font-size: var(--fs-sm); color: var(--fg-dim); margin-top: 2px; }
.tb-eyebrow { font: var(--fw-black) var(--fs-2xs)/1 var(--font); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--accent-text); }

/* KPI */
.tb-kpi-label { font: var(--fw-semi) var(--fs-sm)/1.3 var(--font); color: var(--fg-dim); }
.tb-kpi-value { font: var(--fw-bold) var(--fs-2xl)/1.1 var(--font-display); color: var(--fg); letter-spacing: -0.03em; }

/* Badges / pílulas: fundo tingido 13% + texto na cor do estado (AA nos dois temas) */
.tb-badge {
  --_c: var(--accent-text);
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: var(--radius-pill);
  font: var(--fw-bold) var(--fs-xs)/1 var(--font); white-space: nowrap;
  color: var(--_c); background: color-mix(in srgb, var(--_c) 13%, transparent); border: var(--hairline) solid color-mix(in srgb, var(--_c) 22%, transparent);
}
.tb-badge-success { --_c: var(--success); } .tb-badge-warning { --_c: var(--warning); }
.tb-badge-danger { --_c: var(--danger); } .tb-badge-info { --_c: var(--info); }
.tb-badge-neutral { --_c: var(--fg-dim); }
.tb-badge-solid { color: var(--fg-on-brand); background: var(--brand-gradient); border-color: transparent; }
.tb-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.tb-dot-live { background: var(--online); animation: tb-pulse 2.4s var(--ease) infinite; }
.tb-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; justify-content: center; font: var(--fw-black) 11px/1 var(--font); font-variant-numeric: tabular-nums; color: var(--fg-on-accent); background: var(--accent); }

/* Tabela: cabeçalho em caixa-alta discreta, linhas por hairline, hover sutil */
.tb-table-wrap { overflow-x: auto; border: var(--hairline) solid var(--border); border-radius: var(--radius); background: var(--bg-surface); }
.tb-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.tb-table th {
  position: sticky; top: 0; z-index: 1; text-align: left; padding: 11px var(--space-4); background: var(--bg-surface-alt);
  font: var(--fw-black) var(--fs-2xs)/1 var(--font); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--fg-faint);
  border-bottom: var(--hairline) solid var(--border);
}
.tb-table td { padding: 12px var(--space-4); border-bottom: var(--hairline) solid var(--divider); color: var(--fg); vertical-align: middle; }
.tb-table tbody tr { transition: background var(--dur-fast) var(--ease); }
.tb-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.tb-table tbody tr:last-child td { border-bottom: 0; }
.tb-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Modal */
.tb-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: var(--space-4); background: var(--bg-overlay); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: tb-fade-in var(--dur) var(--ease) both; }
.tb-modal {
  width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; border-radius: var(--radius-xl);
  background: var(--bg-surface); border: var(--hairline) solid var(--border); box-shadow: var(--shadow-lg), var(--line-hi);
  animation: tb-pop var(--dur-slow) var(--ease) both;
}
.tb-modal-head { padding: var(--space-5) var(--space-6) var(--space-3); }
.tb-modal-title { font: var(--fw-bold) var(--fs-xl)/1.25 var(--font-display); letter-spacing: var(--tracking-tight); color: var(--fg); }
.tb-modal-body { padding: 0 var(--space-6) var(--space-5); color: var(--fg-dim); font-size: var(--fs-md); line-height: var(--lh); }
.tb-modal-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: var(--hairline) solid var(--divider); background: var(--bg-surface-alt); }

/* Toast: vidro escuro + barra de estado à esquerda */
.tb-toast {
  position: relative; display: flex; gap: var(--space-3); align-items: flex-start; width: min(380px, calc(100vw - 32px)); max-width: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3) calc(var(--space-4) + 3px); border-radius: var(--radius);
  background: var(--bg-glass); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: var(--hairline) solid var(--border-strong); box-shadow: var(--shadow-lg); color: var(--fg); font-size: var(--fs-sm);
  animation: tb-rise var(--dur-slow) var(--ease) both; overflow: hidden;
}
.tb-toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--signal-line); }
.tb-toast.is-error::before { background: var(--danger); } .tb-toast.is-success::before { background: var(--success); }
.tb-toast-title { font-weight: var(--fw-bold); }
.tb-toast-body { color: var(--fg-dim); margin-top: 2px; }

/* Empty state: ícone num "balão" (forma da logo) + título + texto + ação */
.tb-empty { display: grid; justify-items: center; gap: var(--space-2); text-align: center; padding: var(--space-10) var(--space-6); color: var(--fg-dim); }
.tb-empty-art {
  width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: var(--space-2); color: var(--accent-text);
  border-radius: 22px 22px 22px 8px; background: var(--brand-gradient-soft); border: var(--hairline) solid color-mix(in srgb, var(--accent) 25%, transparent);
  box-shadow: 0 12px 30px -14px var(--border-glow);
}
.tb-empty-art svg { width: 28px; height: 28px; }
.tb-empty-title { font: var(--fw-bold) var(--fs-lg)/1.3 var(--font-display); color: var(--fg); }
.tb-empty-text { font-size: var(--fs-sm); max-width: 38ch; line-height: var(--lh); }

/* Skeleton */
.tb-skeleton {
  display: block; border-radius: var(--radius-xs); min-height: 12px;
  background: linear-gradient(90deg, var(--skeleton) 0%, var(--skeleton) 35%, color-mix(in srgb, var(--skeleton-shine) 100%, var(--skeleton)) 50%, var(--skeleton) 65%, var(--skeleton) 100%);
  background-size: 200% 100%; animation: tb-shimmer 1.6s linear infinite;
}
.tb-skeleton-circle { border-radius: 50%; }

/* Tooltip: <span data-tb-tip="Texto">…</span> */
[data-tb-tip] { position: relative; }
[data-tb-tip]::after {
  content: attr(data-tb-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: var(--z-tooltip);
  transform: translate(-50%, 4px); opacity: 0; pointer-events: none; white-space: nowrap;
  padding: 6px 9px; border-radius: var(--radius-xs); background: var(--tooltip-bg); color: var(--tooltip-fg);
  font: var(--fw-bold) var(--fs-xs)/1.2 var(--font); box-shadow: var(--shadow-md);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
[data-tb-tip]:hover::after, [data-tb-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 350ms; }

/* Avatar (iniciais sobre --av-N) */
.tb-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; overflow: hidden; font: var(--fw-black) var(--fs-xs)/1 var(--font); color: var(--fg-on-color); background: var(--av-1); }
.tb-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Diversos */
.tb-divider { height: 1px; border: 0; background: var(--divider); margin: var(--space-4) 0; }
.tb-signal-bar { height: 2px; border-radius: 2px; background: var(--signal-line); }
.tb-kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; font: 600 11px/1 var(--font-mono); color: var(--fg-dim); background: var(--bg-surface-alt); border: var(--hairline) solid var(--border-strong); box-shadow: inset 0 -1px 0 var(--border-strong); }
.tb-link { color: var(--accent-text); font-weight: var(--fw-bold); text-decoration: none; border-radius: 4px; }
.tb-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.tb-glass { background: var(--bg-glass); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); }
.tb-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); animation: tb-spin .8s linear infinite; }
.tb-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* =====================================================================
   7. v8 "SINAL NÍTIDO" — acessórios e componentes de configuração
   Todos usam só tokens; funcionam nos 2 temas; prefixo .tb-*.
   Guia de uso (com do/don't): docs/design-v8.md · vitrine: qa/tools/ds-v8-preview.html
   ===================================================================== */

/* ---- Ladrilho de ícone (cabeçalho de seção, stat, item de lista, callout) ---- */
.tb-icon-tile {
  --_c: var(--accent-text);
  width: 36px; height: 36px; display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 11px;
  color: var(--_c); background: color-mix(in srgb, var(--_c) 12%, var(--bg-surface));
  border: var(--hairline) solid color-mix(in srgb, var(--_c) 28%, transparent); box-shadow: var(--line-hi);
}
.tb-icon-tile svg { width: 18px; height: 18px; }
.tb-icon-tile-sm { width: 28px; height: 28px; border-radius: 9px; } .tb-icon-tile-sm svg { width: 15px; height: 15px; }
.tb-icon-tile-lg { width: 44px; height: 44px; border-radius: 14px; } .tb-icon-tile-lg svg { width: 22px; height: 22px; }
.tb-icon-tile-brand { color: var(--fg-on-brand); background: var(--brand-gradient); border-color: transparent; box-shadow: var(--glow); }
.tb-icon-tile-success { --_c: var(--success); } .tb-icon-tile-warning { --_c: var(--warning); }
.tb-icon-tile-danger { --_c: var(--danger); } .tb-icon-tile-info { --_c: var(--info); }
.tb-icon-tile-whatsapp { --_c: var(--whatsapp); } .tb-icon-tile-neutral { --_c: var(--fg-dim); }

/* ---- Cabeçalho de página: eyebrow + título Sora 800 + subtítulo + ações ---- */
.tb-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4) var(--space-6); flex-wrap: wrap; padding-bottom: var(--space-5); margin-bottom: var(--space-6); border-bottom: var(--hairline) solid var(--border); }
.tb-page-title { margin: 6px 0 0; font: var(--fw-black) var(--fs-page-title)/1.1 var(--font-display); letter-spacing: -0.03em; color: var(--fg-heading); }
.tb-page-sub { margin-top: 6px; font-size: var(--fs-md); color: var(--fg-dim); max-width: 70ch; line-height: var(--lh); }
.tb-page-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ---- Cabeçalho de seção (dentro ou acima de um cartão) ---- */
.tb-section-head { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.tb-section-titles { flex: 1; min-width: 0; }
.tb-section-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; font: var(--fw-bold) var(--fs-section)/1.3 var(--font-display); letter-spacing: -0.015em; color: var(--fg-heading); }
.tb-section-desc { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--fg-dim); line-height: 1.5; max-width: 72ch; }
.tb-section-actions { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
@media (max-width: 640px) { .tb-section-head { flex-wrap: wrap; } .tb-section-actions { width: 100%; } }

/* ---- Cartões v8: anatomia head/body/foot + variantes ---- */
.tb-card-v8 { background: var(--bg-card); border: var(--hairline) solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); min-width: 0; }
.tb-card-head { padding: var(--space-5) var(--space-6); border-bottom: var(--hairline) solid var(--divider); }
.tb-card-body { padding: var(--space-5) var(--space-6); }
.tb-card-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; padding: var(--space-3) var(--space-6); border-top: var(--hairline) solid var(--divider); background: var(--bg-surface-alt); border-radius: 0 0 var(--radius) var(--radius); }
.tb-card-flat { background: var(--bg-surface-alt); box-shadow: none; }
.tb-card-inset { background: var(--bg-inset); box-shadow: inset 0 1px 2px rgba(0,0,0,.12); }
.tb-card-dashed { background: transparent; border-style: dashed; border-color: var(--border-strong); box-shadow: none; }
.tb-card-feature { position: relative; overflow: hidden; background: var(--grad-feature), var(--bg-card); border-color: var(--grad-feature-border); }
.tb-card-feature::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--signal-line); }
.tb-card-interactive { cursor: pointer; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.tb-card-interactive:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tb-card-interactive:active { transform: none; }
.tb-card-selected, .tb-card-interactive[aria-pressed="true"], .tb-card-interactive[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--glow); }
.tb-card-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: color-mix(in srgb, var(--danger) 5%, var(--bg-card)); }
@media (max-width: 640px) { .tb-card-head, .tb-card-body { padding: var(--space-4); } .tb-card-foot { padding: var(--space-3) var(--space-4); } }

/* ---- Stat tiles (KPI com ícone, valor, variação) ---- */
.tb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--space-4); }
.tb-stat {
  --_c: var(--accent-text);
  position: relative; display: grid; gap: 6px; padding: var(--space-4) var(--space-5); min-width: 0;
  background: var(--bg-card); border: var(--hairline) solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden;
}
.tb-stat::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--_c); opacity: .9; }
.tb-stat-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.tb-stat-label { font: var(--fw-black) var(--fs-2xs)/1.2 var(--font); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--fg-dim); }
.tb-stat-value { font: var(--fw-bold) var(--fs-2xl)/1.05 var(--font-display); letter-spacing: -0.03em; color: var(--fg-heading); font-variant-numeric: tabular-nums; }
.tb-stat-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--fg-faint); }
.tb-stat-success { --_c: var(--success); } .tb-stat-warning { --_c: var(--warning); } .tb-stat-danger { --_c: var(--danger); } .tb-stat-info { --_c: var(--info); }
.tb-delta { display: inline-flex; align-items: center; gap: 2px; padding: 2px 6px; border-radius: var(--radius-pill); font: var(--fw-black) var(--fs-2xs)/1.3 var(--font); font-variant-numeric: tabular-nums; }
.tb-delta.is-up { color: var(--success); background: var(--success-light); } .tb-delta.is-down { color: var(--danger); background: var(--danger-light); } .tb-delta.is-flat { color: var(--fg-dim); background: var(--state-hover); }

/* ---- Chips de status (mais altos e legíveis que o badge; com ponto) ---- */
.tb-chip {
  --_c: var(--fg-dim);
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--radius-pill); max-width: 100%;
  font: var(--fw-bold) var(--fs-xs)/1 var(--font); white-space: nowrap; color: var(--_c);
  background: color-mix(in srgb, var(--_c) 13%, var(--bg-card)); border: var(--hairline) solid color-mix(in srgb, var(--_c) 34%, transparent);
}
.tb-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.tb-chip.no-dot::before { display: none; }
.tb-chip svg { width: 14px; height: 14px; flex-shrink: 0; }
.tb-chip-success { --_c: var(--success); } .tb-chip-warning { --_c: var(--warning); } .tb-chip-danger { --_c: var(--danger); }
.tb-chip-info { --_c: var(--info); } .tb-chip-brand { --_c: var(--accent-text); } .tb-chip-neutral { --_c: var(--fg-dim); }
.tb-chip-whatsapp { --_c: var(--whatsapp); }
.tb-chip-live::before { animation: tb-pulse 2.4s var(--ease) infinite; }
.tb-chip-sm { height: 22px; padding: 0 8px; font-size: var(--fs-2xs); }
.tb-chip-lg { height: 32px; padding: 0 14px; font-size: var(--fs-sm); }
.tb-chip-x { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: -4px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.tb-chip-x:hover { background: color-mix(in srgb, currentColor 18%, transparent); }
.tb-count-warning { background: var(--warning); color: var(--tb-ink); } .tb-count-danger { background: var(--danger); color: var(--fg-on-danger); }
.tb-count-neutral { background: var(--bg-elev); color: var(--fg-dim); border: var(--hairline) solid var(--border); }

/* ---- Abas v8 (ícone + contador) e variante "pílula" ---- */
.tb-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; }
.tb-tab svg { width: 16px; height: 16px; flex-shrink: 0; }
.tb-tab[aria-selected="true"] svg, .tb-tab.active svg { color: var(--accent-text); }
.tb-tab .tb-count { height: 18px; min-width: 18px; font-size: 10px; }
.tb-tab:not([aria-selected="true"]):not(.active) .tb-count { background: var(--bg-elev); color: var(--fg-dim); }
.tb-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-xs); }
.tb-tabs-pill { gap: 4px; padding: 4px; border: var(--hairline) solid var(--border); border-radius: var(--radius-sm); background: var(--bg-inset); }
.tb-tabs-pill .tb-tab { min-height: 36px; padding: 0 var(--space-3); border-radius: var(--radius-xs); }
.tb-tabs-pill .tb-tab:hover { background: var(--state-hover); }
.tb-tabs-pill .tb-tab[aria-selected="true"], .tb-tabs-pill .tb-tab.active { background: var(--bg-card); box-shadow: var(--shadow-sm), var(--line-hi), 0 0 0 1px var(--border); }
.tb-tabs-pill .tb-tab[aria-selected="true"]::after, .tb-tabs-pill .tb-tab.active::after { display: none; }
/* segmentado: ícones e largura total */
.tb-seg > button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; }
.tb-seg > button svg { width: 14px; height: 14px; }
.tb-seg > button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tb-seg > button[aria-pressed="true"], .tb-seg > button.active { background: var(--bg-card); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border-strong); }
.tb-seg-block { display: flex; width: 100%; } .tb-seg-block > button { flex: 1; }

/* ---- Navegação lateral de configurações (grupos, ícone, item ativo com sinal) ---- */
.tb-nav { display: grid; gap: 2px; }
.tb-nav-group { padding: var(--space-4) var(--space-3) var(--space-2); font: var(--fw-black) var(--fs-2xs)/1 var(--font); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--fg-faint); }
.tb-nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-sm);
  border: var(--hairline) solid transparent; background: none; color: var(--fg-dim); font: var(--fw-semi) var(--fs-sm)/1.2 var(--font); text-align: left; text-decoration: none; cursor: pointer; width: 100%;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tb-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--fg-faint); transition: color var(--dur-fast) var(--ease); }
.tb-nav-item:hover { background: var(--state-hover); color: var(--fg); }
.tb-nav-item:hover svg { color: var(--fg-dim); }
.tb-nav-item[aria-current="page"], .tb-nav-item.is-active { background: var(--state-selected); color: var(--fg-heading); font-weight: var(--fw-bold); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
.tb-nav-item[aria-current="page"] svg, .tb-nav-item.is-active svg { color: var(--accent-text); }
.tb-nav-item[aria-current="page"]::before, .tb-nav-item.is-active::before { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--signal-line); }
.tb-nav-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tb-nav-meta { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }

/* ---- Linha de interruptor (toggle row): título + descrição + switch; ligada ganha tinta da marca ---- */
.tb-toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: 14px var(--space-4);
  border: var(--hairline) solid var(--border); border-radius: var(--radius-sm); background: var(--bg-surface-alt); box-shadow: var(--line-hi);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.tb-toggle-row:has(.tb-switch[aria-checked="true"]), .tb-toggle-row:has(input:checked), .tb-toggle-row.is-on {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border)); background: color-mix(in srgb, var(--accent) 7%, var(--bg-surface-alt));
}
.tb-toggle-main { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.tb-toggle-title { font: var(--fw-bold) var(--fs-md)/1.3 var(--font); color: var(--fg); }
.tb-toggle-desc { margin-top: 2px; font-size: var(--fs-sm); color: var(--fg-dim); line-height: 1.45; }
.tb-toggle-row + .tb-toggle-row { margin-top: var(--space-2); }

/* ---- Linha de formulário com ajuda (rótulo + ajuda à esquerda, controle à direita) ---- */
.tb-form-row { display: grid; grid-template-columns: minmax(180px, 280px) minmax(0, 1fr); gap: 8px var(--space-8); padding: var(--space-5) 0; border-top: var(--hairline) solid var(--divider); }
.tb-form-row:first-child { border-top: 0; padding-top: 0; }
.tb-form-row:last-child { padding-bottom: 0; }
.tb-form-label { font: var(--fw-bold) var(--fs-sm)/1.35 var(--font); color: var(--fg); }
.tb-form-help { margin-top: 4px; font-size: var(--fs-xs); color: var(--fg-faint); line-height: 1.5; }
.tb-form-control { display: grid; gap: 8px; min-width: 0; align-content: start; }
.tb-req { color: var(--danger); margin-left: 2px; }
.tb-optional { margin-left: 6px; font-weight: var(--fw-medium); font-size: var(--fs-2xs); color: var(--fg-faint); }
.tb-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
@media (max-width: 760px) { .tb-form-row { grid-template-columns: 1fr; gap: 8px; } .tb-field-grid { grid-template-columns: 1fr; } }

/* ---- Grupo de input (prefixo/sufixo/botão colado) ---- */
.tb-input-group { display: flex; align-items: stretch; min-width: 0; height: var(--control-h); border: var(--hairline) solid var(--border-field); border-radius: var(--radius-sm); background: var(--bg-field); overflow: hidden; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.tb-input-group:hover { border-color: var(--border-hover); }
.tb-input-group:focus-within { border-color: var(--border-active); box-shadow: var(--focus-ring); }
.tb-input-group > .tb-input, .tb-input-group > input { flex: 1; min-width: 0; height: auto; border: 0; border-radius: 0; background: transparent; box-shadow: none; padding: 0 var(--space-3); font: var(--fw-medium) var(--fs-md)/1.4 var(--font); color: var(--fg); outline: none; }
.tb-addon { display: inline-flex; align-items: center; gap: 6px; padding: 0 var(--space-3); flex-shrink: 0; white-space: nowrap; font: var(--fw-bold) var(--fs-sm)/1 var(--font); color: var(--fg-dim); background: var(--bg-surface-alt); }
.tb-addon:first-child { border-right: var(--hairline) solid var(--border); } .tb-addon:last-child { border-left: var(--hairline) solid var(--border); }
.tb-addon svg { width: 16px; height: 16px; }
.tb-input-group > .tb-btn { height: auto; border-radius: 0; border: 0; border-left: var(--hairline) solid var(--border); box-shadow: none; }

/* ---- Savebar (aparece quando há alteração; sticky no fim do conteúdo ou fixa) ---- */
.tb-savebar {
  position: sticky; bottom: var(--tb-savebar-bottom, 16px); z-index: var(--z-sticky);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
  margin-top: var(--space-4); padding: 10px 12px 10px var(--space-4); border-radius: var(--radius-lg);
  background: var(--bg-glass); -webkit-backdrop-filter: blur(12px) saturate(1.3); backdrop-filter: blur(12px) saturate(1.3);
  border: var(--hairline) solid var(--border-strong); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(12px); pointer-events: none; visibility: hidden;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility 0s linear var(--dur);
}
.tb-savebar.is-visible { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.tb-savebar-fixed { position: fixed; left: 50%; width: min(760px, calc(100vw - 32px)); margin: 0; transform: translate(-50%, 12px); }
.tb-savebar-fixed.is-visible { transform: translate(-50%, 0); }
.tb-savebar-msg { display: flex; align-items: center; gap: 8px; min-width: 0; font: var(--fw-bold) var(--fs-sm)/1.3 var(--font); color: var(--fg); }
.tb-savebar-msg::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 4px var(--warning-light); flex-shrink: 0; }
.tb-savebar.is-saved .tb-savebar-msg::before { background: var(--success); box-shadow: 0 0 0 4px var(--success-light); }
.tb-savebar.is-error .tb-savebar-msg::before { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-light); }
.tb-savebar-actions { display: flex; gap: var(--space-2); margin-left: auto; }
@media (max-width: 640px) { .tb-savebar { bottom: calc(var(--tb-savebar-bottom, 12px) + env(safe-area-inset-bottom, 0px)); } .tb-savebar-actions { width: 100%; } .tb-savebar-actions > * { flex: 1; } }

/* ---- Callout (aviso em linha: info/sucesso/atenção/erro) ---- */
.tb-callout { --_c: var(--info); display: flex; align-items: flex-start; gap: 12px; padding: 14px var(--space-4); border-radius: var(--radius-sm); color: var(--fg); font-size: var(--fs-sm); line-height: 1.5; background: color-mix(in srgb, var(--_c) 9%, var(--bg-card)); border: var(--hairline) solid color-mix(in srgb, var(--_c) 34%, transparent); }
.tb-callout > svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--_c); }
.tb-callout-title { font-weight: var(--fw-bold); color: var(--fg); }
.tb-callout-success { --_c: var(--success); } .tb-callout-warning { --_c: var(--warning); } .tb-callout-danger { --_c: var(--danger); } .tb-callout-brand { --_c: var(--accent-text); }

/* ---- Empty state ilustrado (SVG inline leve; cores por classe, nada de hex) ---- */
.tb-empty-ill { width: 128px; height: auto; margin-bottom: var(--space-2); color: var(--accent-text); }
.tb-empty-ill .i-bg { fill: var(--bg-surface-alt); stroke: var(--border-strong); stroke-width: 1.5; }
.tb-empty-ill .i-card { fill: var(--bg-card); stroke: var(--border-strong); stroke-width: 1.5; }
.tb-empty-ill .i-line { stroke: var(--border-strong); stroke-width: 6; stroke-linecap: round; }
.tb-empty-ill .i-accent { fill: currentColor; }
.tb-empty-ill .i-soft { fill: currentColor; opacity: .16; }
.tb-empty-ill .i-stroke { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.tb-empty-compact { padding: var(--space-6) var(--space-4); }
.tb-empty-compact .tb-empty-ill { width: 88px; }

/* ---- Linha do tempo (histórico de pedido, auditoria) ---- */
.tb-timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.tb-tl-item { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding-bottom: var(--space-5); }
.tb-tl-item::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--border); }
.tb-tl-item:last-child { padding-bottom: 0; } .tb-tl-item:last-child::before { display: none; }
.tb-tl-dot { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-surface-alt); border: 2px solid var(--border-strong); color: var(--fg-dim); }
.tb-tl-dot svg { width: 13px; height: 13px; }
.tb-tl-item.is-done .tb-tl-dot { background: var(--success-light); border-color: var(--success); color: var(--success); }
.tb-tl-item.is-done::before { background: color-mix(in srgb, var(--success) 45%, var(--border)); }
.tb-tl-item.is-current .tb-tl-dot { background: var(--brand-gradient); border-color: transparent; color: var(--fg-on-brand); box-shadow: var(--glow); }
.tb-tl-item.is-error .tb-tl-dot { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
.tb-tl-item.is-warning .tb-tl-dot { background: var(--warning-light); border-color: var(--warning); color: var(--warning); }
.tb-tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; padding-top: 4px; }
.tb-tl-title { font: var(--fw-bold) var(--fs-sm)/1.35 var(--font); color: var(--fg); }
.tb-tl-time { font-size: var(--fs-xs); color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.tb-tl-body { margin-top: 2px; font-size: var(--fs-sm); color: var(--fg-dim); line-height: 1.5; }

/* ---- Stepper (etapas) + barra de progresso ---- */
.tb-stepper { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 0; min-width: 0; }
.tb-step { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.tb-step:last-child { flex: 0 0 auto; }
.tb-step::after { content: ""; flex: 1; min-width: 12px; height: 2px; margin: 0 10px 0 2px; border-radius: 2px; background: var(--border-strong); }
.tb-step:last-child::after { display: none; }
.tb-step-num { width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; font: var(--fw-black) var(--fs-xs)/1 var(--font); font-variant-numeric: tabular-nums; color: var(--fg-dim); background: var(--bg-card); border: 2px solid var(--border-strong); }
.tb-step-num svg { width: 14px; height: 14px; }
.tb-step-label { font: var(--fw-semi) var(--fs-sm)/1.25 var(--font); color: var(--fg-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-step.is-done .tb-step-num { background: var(--success); border-color: var(--success); color: var(--fg-on-success); }
.tb-step.is-done::after { background: var(--success); }
.tb-step.is-done .tb-step-label { color: var(--fg); }
.tb-step.is-current .tb-step-num { background: var(--brand-gradient); border-color: transparent; color: var(--fg-on-brand); box-shadow: var(--glow); }
.tb-step.is-current .tb-step-label { color: var(--fg-heading); font-weight: var(--fw-bold); }
.tb-step.is-error .tb-step-num { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
@media (max-width: 640px) { .tb-step:not(.is-current) .tb-step-label { display: none; } }
.tb-progress { height: 6px; border-radius: var(--radius-pill); background: var(--bg-inset); border: var(--hairline) solid var(--border); overflow: hidden; }
.tb-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--signal-line); transition: width var(--dur-slow) var(--ease); }
.tb-progress.is-warning > span { background: var(--warning); } .tb-progress.is-danger > span { background: var(--danger); } .tb-progress.is-success > span { background: var(--success); }

/* ---- Tooltip: posições e quebra de linha ---- */
[data-tb-tip][data-tb-tip-pos="bottom"]::after { bottom: auto; top: calc(100% + 8px); transform: translate(-50%, -4px); }
[data-tb-tip][data-tb-tip-pos="bottom"]:hover::after, [data-tb-tip][data-tb-tip-pos="bottom"]:focus-visible::after { transform: translate(-50%, 0); }
[data-tb-tip][data-tb-tip-pos="right"]::after { left: calc(100% + 8px); bottom: auto; top: 50%; transform: translate(-4px, -50%); }
[data-tb-tip][data-tb-tip-pos="right"]:hover::after, [data-tb-tip][data-tb-tip-pos="right"]:focus-visible::after { transform: translate(0, -50%); }
[data-tb-tip][data-tb-tip-wrap]::after { white-space: normal; width: max-content; max-width: 240px; line-height: 1.4; text-align: left; }
@media (hover: none) { [data-tb-tip]::after { display: none; } }

/* ---- Skeleton: linhas de texto e blocos ---- */
.tb-skeleton-text { height: .78em; margin: .4em 0; border-radius: 4px; }
.tb-skeleton-text.w-60 { width: 60%; } .tb-skeleton-text.w-40 { width: 40%; } .tb-skeleton-text.w-80 { width: 80%; }
.tb-skeleton-title { height: 1.2em; width: 45%; margin-bottom: .6em; border-radius: 6px; }
.tb-skeleton-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: var(--hairline) solid var(--divider); }
.tb-skeleton-row > .tb-skeleton-circle { width: 36px; height: 36px; flex-shrink: 0; }
.tb-skeleton-row > div { flex: 1; min-width: 0; }

/* ---- Toasts: pilha + ícone de estado ---- */
.tb-toasts { position: fixed; right: 16px; bottom: 16px; z-index: var(--z-toast); display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.tb-toasts > * { pointer-events: auto; }
@media (max-width: 640px) { .tb-toasts { left: 16px; right: 16px; top: calc(12px + env(safe-area-inset-top, 0px)); bottom: auto; justify-items: stretch; } .tb-toasts .tb-toast { width: 100%; } }
.tb-toast-ic { width: 28px; height: 28px; display: grid; place-items: center; flex-shrink: 0; border-radius: 9px; color: var(--accent-text); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tb-toast-ic svg { width: 16px; height: 16px; }
.tb-toast.is-success .tb-toast-ic { color: var(--success); background: var(--success-light); }
.tb-toast.is-error .tb-toast-ic { color: var(--danger); background: var(--danger-light); }
.tb-toast.is-warning::before { background: var(--warning); } .tb-toast.is-warning .tb-toast-ic { color: var(--warning); background: var(--warning-light); }
.tb-toast-close { margin-left: auto; width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--fg-faint); cursor: pointer; }
.tb-toast-close:hover { background: var(--state-hover); color: var(--fg); }

/* ---- Avatares: tamanhos, anel da marca, presença ---- */
.tb-avatar-sm { width: 28px; height: 28px; font-size: var(--fs-2xs); }
.tb-avatar-lg { width: 48px; height: 48px; font-size: var(--fs-sm); }
.tb-avatar-xl { width: 72px; height: 72px; font-size: var(--fs-lg); }
.tb-avatar-brand { background: var(--brand-gradient); color: var(--fg-on-brand); }
.tb-avatar-wrap { position: relative; display: inline-flex; flex-shrink: 0; border-radius: 50%; }
.tb-avatar-ring { padding: 2px; background: var(--signal-line); }
.tb-avatar-ring > .tb-avatar { box-shadow: 0 0 0 2px var(--bg-card); }
.tb-presence { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--fg-faint); border: 2px solid var(--bg-card); }
.tb-presence.is-online { background: var(--online); } .tb-presence.is-away { background: var(--warning); } .tb-presence.is-busy { background: var(--danger); }
.tb-avatar-stack { display: inline-flex; } .tb-avatar-stack > * { margin-left: -8px; box-shadow: 0 0 0 2px var(--bg-card); } .tb-avatar-stack > :first-child { margin-left: 0; }

/* ---- Lista chave/valor (perfil, detalhes de pedido) ---- */
.tb-kv { display: grid; margin: 0; }
.tb-kv > div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); padding: 10px 0; border-top: var(--hairline) solid var(--divider); min-width: 0; }
.tb-kv > div:first-child { border-top: 0; }
.tb-kv dt { font-size: var(--fs-sm); color: var(--fg-dim); flex-shrink: 0; }
.tb-kv dd { margin: 0; font: var(--fw-semi) var(--fs-sm)/1.4 var(--font); color: var(--fg); text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* ---- Opção selecionável (pacotes, formas de pagamento, planos) ---- */
.tb-option {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: var(--space-4); text-align: left; width: 100%;
  border: var(--hairline) solid var(--border-strong); border-radius: var(--radius); background: var(--bg-card); color: var(--fg); cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.tb-option:hover { border-color: var(--border-hover); background: color-mix(in srgb, var(--accent) 3%, var(--bg-card)); }
.tb-option:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tb-option[aria-checked="true"], .tb-option[aria-pressed="true"], .tb-option.is-selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--bg-card)); box-shadow: 0 0 0 1px var(--accent), var(--glow); }
.tb-option-check { margin-left: auto; width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--border-field); display: grid; place-items: center; color: transparent; }
.tb-option-check svg { width: 12px; height: 12px; }
.tb-option[aria-checked="true"] .tb-option-check, .tb-option[aria-pressed="true"] .tb-option-check, .tb-option.is-selected .tb-option-check { background: var(--brand-gradient); border-color: transparent; color: var(--fg-on-brand); }

/* ---- Tabela v8: linha clicável, coluna de ações, vira cartões no celular ---- */
.tb-table tbody tr.is-clickable { cursor: pointer; }
.tb-table td.actions { text-align: right; white-space: nowrap; }
.tb-table .tb-cell-main { font-weight: var(--fw-bold); color: var(--fg); }
.tb-table .tb-cell-sub { display: block; font-size: var(--fs-xs); color: var(--fg-faint); margin-top: 2px; }
@media (max-width: 640px) {
  .tb-table-stack thead { display: none; }
  .tb-table-stack, .tb-table-stack tbody, .tb-table-stack tr, .tb-table-stack td { display: block; width: 100%; }
  .tb-table-stack tr { padding: var(--space-3) var(--space-4); border-bottom: var(--hairline) solid var(--border); }
  .tb-table-stack td { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: 4px 0; border: 0; text-align: right; }
  .tb-table-stack td[data-label]::before { content: attr(data-label); font: var(--fw-black) var(--fs-2xs)/1.2 var(--font); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--fg-faint); text-align: left; }
}

/* ---- Prévia realista do WhatsApp (editor de textos do bot) ---- */
.tb-wa { display: flex; flex-direction: column; min-width: 0; border-radius: var(--radius); overflow: hidden; border: var(--hairline) solid var(--border); box-shadow: var(--shadow-card); background: var(--wa-bg); color: var(--wa-fg); font: 400 14px/1.4 -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'; }
.tb-wa-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--wa-header); color: var(--wa-fg); }
.tb-wa-head .tb-avatar { width: 34px; height: 34px; }
.tb-wa-name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.tb-wa-status { font-size: 12px; color: var(--wa-meta); }
.tb-wa-body {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 4% 14px; min-height: 160px; overflow-y: auto;
  background-color: var(--wa-bg); background-image: radial-gradient(var(--wa-doodle) 1.2px, transparent 1.3px); background-size: 18px 18px;
}
.tb-wa-day { align-self: center; margin: 6px 0 8px; padding: 5px 12px; border-radius: 8px; font-size: 12px; color: var(--wa-meta); background: var(--wa-day); box-shadow: 0 1px .5px rgba(11,20,26,.13); }
.tb-wa-msg { position: relative; align-self: flex-start; max-width: min(85%, 520px); padding: 6px 8px 8px 9px; border-radius: 8px; background: var(--wa-in); color: var(--wa-fg); white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px .5px rgba(11,20,26,.13); margin-top: 2px; }
.tb-wa-msg.out { align-self: flex-end; background: var(--wa-out); }
.tb-wa-msg.tail { margin-top: 8px; border-top-left-radius: 0; }
.tb-wa-msg.out.tail { border-top-left-radius: 8px; border-top-right-radius: 0; }
.tb-wa-msg.tail::before { content: ""; position: absolute; top: 0; left: -8px; border-top: 0 solid transparent; border-right: 8px solid var(--wa-in); border-bottom: 10px solid transparent; }
.tb-wa-msg.out.tail::before { left: auto; right: -8px; border-right: 0; border-left: 8px solid var(--wa-out); }
.tb-wa-msg a { color: var(--wa-link); }
.tb-wa-msg b, .tb-wa-msg strong { font-weight: 700; }
.tb-wa-time { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 8px 0 -5px 12px; font-size: 11px; line-height: 1; color: var(--wa-meta); }
.tb-wa-time svg { width: 16px; height: 11px; color: var(--wa-tick); }
.tb-wa-var { padding: 0 3px; border-radius: 4px; background: color-mix(in srgb, var(--wa-link) 18%, transparent); color: inherit; font-family: var(--font-mono); font-size: .9em; }

/* ---- Microinterações discretas ---- */
.tb-press { transition: transform var(--dur-fast) var(--ease); } .tb-press:active { transform: scale(.98); }
.tb-lift { transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); } .tb-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tb-anim-stagger > * { animation: tb-rise var(--dur-slow) var(--ease) both; }
.tb-anim-stagger > :nth-child(2) { animation-delay: 40ms; } .tb-anim-stagger > :nth-child(3) { animation-delay: 80ms; } .tb-anim-stagger > :nth-child(4) { animation-delay: 120ms; } .tb-anim-stagger > :nth-child(n+5) { animation-delay: 160ms; }
@media (prefers-reduced-motion: reduce) { .tb-anim-stagger > *, .tb-chip-live::before { animation: none !important; } .tb-lift:hover, .tb-card-interactive:hover { transform: none; } }

/* =====================================================================
   8. MARCA — logos oficiais (public/brand/v8/*.webp, exportadas de
   public/brand/fontes/ por qa/tools/brand-v8-export.js).
   As logos oficiais têm FUNDO MARINHO próprio (sem transparência):
   - sempre dentro de uma MOLDURA que assume esse fundo (.tb-logo-frame
     e derivados): cantos arredondados, fio ciano, brilho da marca;
   - a moldura é marinho nos DOIS temas (no claro vira um "cartão escuro
     intencional", com sombra e anel azul, nunca um quadrado colado);
   - sem moldura/fundo transparente (topbar, rail, texto corrido): usar
     os vetores /brand/logo-mark.svg, logo-full.svg, logo-full-light.svg.
   Mapa de uso completo: docs/design-v8.md §3.
   ===================================================================== */
:root {
  --logo-frame-bg:     #050c26;                       /* = fundo das imagens oficiais (igual nos 2 temas) */
  --logo-frame-ring:   rgba(255,255,255,0.09);   /* cor-bit (era fio ciano) */
  --logo-frame-glow:   0 10px 30px -12px rgba(0,0,0,0.75);   /* cor-bit (era brilho ciano) */
  --logo-icon-url:     url("/brand/v8/icone-192.webp");
}
:root[data-theme="light"] {
  --logo-frame-ring:   rgba(12,12,16,0.10);   /* cor-bit */
  --logo-frame-glow:   0 10px 24px -14px rgba(12,12,16,0.35);   /* cor-bit */
}
/* Moldura base: a imagem preenche, nunca estica (aspect-ratio vem do width/height da <img>) */
.tb-logo-frame {
  position: relative; display: inline-block; flex-shrink: 0; overflow: hidden; isolation: isolate; line-height: 0;
  background: var(--logo-frame-bg); border: 1px solid var(--logo-frame-ring); border-radius: var(--radius-lg);
  box-shadow: var(--logo-frame-glow);
}
.tb-logo-frame > img { display: block; width: 100%; height: auto; }
.tb-logo-frame::after { /* fio de luz no topo, igual aos cartões */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(170,230,255,0.16);
}
/* Peça de destaque (completa / quadrada): login, boas-vindas, estado vazio grande */
.tb-logo-hero { width: clamp(168px, 22vw, 280px); border-radius: 28px; }
.tb-logo-hero-sm { width: clamp(132px, 30vw, 184px); border-radius: 22px; }
/* Halo estático atrás da peça (sem animação contínua) */
.tb-logo-halo { position: relative; display: inline-grid; place-items: center; }
.tb-logo-halo::before {
  content: ""; position: absolute; inset: -18%; z-index: -1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
}
/* Faixa horizontal (cabeçalho do painel admin, do painel do bot e do Master) */
.tb-logo-banner { height: 40px; width: auto; aspect-ratio: 640 / 234; border-radius: 11px; box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 20px -12px rgba(0,0,0,0.55); }   /* cor-bit: sem brilho ciano */
.tb-logo-banner > img { width: 100%; height: 100%; object-fit: cover; }
.tb-logo-banner-sm { height: 32px; border-radius: 9px; }
/* Ícone de app (robô em balão): rail, cartões, carregamento. Tamanhos 24/32/40/56/72 */
.tb-app-icon { --_s: 40px; width: var(--_s); height: var(--_s); border-radius: 28%; }
.tb-app-icon > img { width: 100%; height: 100%; object-fit: cover; }
.tb-app-icon-24 { --_s: 24px; border-width: 0; box-shadow: 0 0 0 1px var(--logo-frame-ring); }
.tb-app-icon-32 { --_s: 32px; } .tb-app-icon-56 { --_s: 56px; } .tb-app-icon-72 { --_s: 72px; border-radius: 24%; }
/* Avatar do bot / Atendente IA (círculo; o robô fica centralizado no recorte) */
.tb-bot-avatar {
  --_s: 32px; width: var(--_s); height: var(--_s); flex-shrink: 0; border-radius: 50%; overflow: hidden; display: inline-block;
  background: var(--logo-frame-bg) var(--logo-icon-url) center / 118% no-repeat; border: 1px solid var(--logo-frame-ring);
  box-shadow: 0 0 0 2px var(--bg-card);
}
.tb-bot-avatar > img { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.18); }   /* <img> dentro também vale (quando a página não pode usar a URL do token) */
.tb-bot-avatar-sm { --_s: 24px; } .tb-bot-avatar-lg { --_s: 44px; }
/* Carregamento com a marca: ícone + anel que gira devagar (para em reduced-motion) */
.tb-brand-loader { position: relative; display: inline-grid; place-items: center; width: 72px; height: 72px; }
.tb-brand-loader > .tb-app-icon { --_s: 48px; }
.tb-brand-loader::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 18%, transparent); border-top-color: var(--accent);
  animation: tb-spin 1.1s linear infinite;
}
/* "Atendimento por LunHub" (cliente, widget, rodapés) */
.tb-powered { display: inline-flex; align-items: center; gap: 6px; font: var(--fw-semi) var(--fs-xs)/1 var(--font); color: var(--fg-faint); text-decoration: none; }
.tb-powered b { color: var(--fg-dim); font-weight: var(--fw-black); }
.tb-powered .tb-bot-avatar { --_s: 18px; box-shadow: none; }
/* Estado vazio com a marca (ex.: "nenhuma conversa selecionada") */
.tb-empty-brand { display: grid; justify-items: center; gap: var(--space-3); text-align: center; padding: var(--space-10) var(--space-6); }
.tb-empty-brand .tb-logo-frame { margin-bottom: var(--space-2); }
@media (max-width: 640px) { .tb-logo-banner { height: 34px; border-radius: 9px; } }
@media (prefers-reduced-motion: reduce) { .tb-brand-loader::before { animation: none; } }

/* Fade lateral para abas/linhas que rolam na horizontal (indica que há mais itens) */
.tb-scroll-fade-x {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 28px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 28px), transparent 100%);
}
