@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ============================================================
   TROVO MESSENGER — Design System
   Reescrito em 06/09/2026.

   REGRA DESTE ARQUIVO: todo nome de classe que existia continua
   existindo. As telas que ainda não foram migradas (disparos,
   configurações, carrinho, login) usam .card, .stat-card, .table,
   .tag, .btn-primary, .form-input e .modal-* e continuam de pé.
   O que mudou foi COMO cada uma é construída: tudo sai de token,
   nada tem cor escrita na regra.

   Fonte: Inter, uma família só. O @import está aqui e não no <head>
   de propósito: assim toda página pega a tipografia nova sem eu ter
   que editar o cabeçalho de cada arquivo. Syne ficou só no logotipo
   da marca, que é assinatura, não interface.

   Números usam tabular-nums e zero cortado em TODA a interface.
   Coluna de dinheiro que não alinha é erro de tipografia, não de CSS.

   ── DOIS TEMAS, UMA CAMADA SÓ (07/09/2026) ──────────────────
   `:root` é o tema CLARO, que virou o padrão a pedido do Gabriel.
   `[data-tema="escuro"]` redefine APENAS os tokens. Nenhuma regra de
   componente sabe qual tema está no ar, e é isso que impede a "ilha"
   de tema errado no meio da tela.

   O amarelo da marca tem duas faces, e confundir as duas é o erro
   clássico: `--gold-fill` é o amarelo de FUNDO (botão, barra), que
   continua amarelo nos dois temas; `--gold` é o dourado de TEXTO e
   traço, que precisa escurecer no claro, senão fica ilegível sobre
   branco (amarelo puro sobre branco dá contraste 1,6:1).
   ============================================================ */

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

/* ══════════ TEMA CLARO, o padrão ══════════ */
:root {
    color-scheme: light;

    /* ── Superfícies ───────────────────────────────────────── */
    --bg:          #f2f5f9;   /* fundo da página, cinza levemente azulado */
    --surface:     #ffffff;   /* painel, card, sidebar */
    --surface2:    #eef1f7;   /* elevado: hover, linha de tabela, input */
    --surface3:    #e2e8f1;   /* pressionado, selecionado */

    /* ── Traços ────────────────────────────────────────────── */
    --border:      rgba(16,32,64,0.13);
    --border-soft: rgba(16,32,64,0.07);
    --border-hard: rgba(16,32,64,0.26);

    /* ── Texto ─────────────────────────────────────────────── */
    --text:        #101828;
    --text2:       #475467;
    /* Medido no ar: #667085 dava 4,40 sobre branco e 3,96 sobre a faixa de
       aviso, abaixo dos 4,5 que o texto pequeno exige. Escurecido ate passar
       nos dois fundos. */
    --muted:       #5a6577;

    /* ── Marca ─────────────────────────────────────────────── */
    --gold:        #8a6100;   /* dourado de TEXTO, legível sobre branco */
    --gold2:       #a87700;
    --gold-fill:   #f5c842;   /* amarelo de FUNDO, igual nos dois temas */
    --gold-ink:    #120d00;   /* texto sobre o amarelo */
    --gold-weak:   rgba(245,200,66,0.22);
    --gold-line:   rgba(138,97,0,0.32);

    /* ── Semânticas ────────────────────────────────────────── */
    --success:     #067647;
    --success-weak:rgba(6,118,71,0.10);
    --success-line:rgba(6,118,71,0.26);
    --danger:      #b42318;
    --danger-weak: rgba(180,35,24,0.09);
    --danger-line: rgba(180,35,24,0.24);
    --warning:     #b54708;
    --warning-weak:rgba(181,71,8,0.10);
    --warning-line:rgba(181,71,8,0.26);
    --info:        #175cd3;
    --info-weak:   rgba(23,92,211,0.09);
    --info-line:   rgba(23,92,211,0.24);
    --purple:      #5925dc;
    --purple-weak: rgba(89,37,220,0.09);

    /* ── Apoio que muda de tema ────────────────────────────── */
    --sombra-cor:  rgba(16,32,64,0.16);
    --veu:         rgba(16,24,40,0.45);   /* fundo atrás do modal */
    --barra:       #c3ccda;               /* polegar da rolagem */
    --barra-hover: #a9b5c7;
    --brilho:      rgba(255,255,255,0.55);/* varredura do esqueleto */
    --opcao-bg:    #ffffff;               /* <option> do select nativo */
    --gold-hover:  #ffd75f;
    --gold-ativo:  #e6b52e;
    --danger-ink:  #ffffff;               /* texto sobre o vermelho cheio */
    --selecao:     rgba(245,200,66,0.42); /* trecho de texto marcado */

    /* ── Espaço ────────────────────────────────────────────── */
    --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
    --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px;

    /* ── Raio. Menos arredondado que a versão antiga, de propósito ── */
    --r-sm: 4px;   /* etiqueta, campo pequeno */
    --r:    6px;   /* botão, input, item de menu */
    --r-md: 8px;   /* bloco interno */
    --r-lg: 10px;  /* card, painel */
    --r-xl: 14px;  /* modal */

    /* ── Elevação. Só o que sobrepõe conteúdo ganha sombra ── */
    --shadow-pop:  0 6px 20px var(--sombra-cor);
    --shadow-modal:0 20px 56px var(--sombra-cor);

    /* ── Tipografia ────────────────────────────────────────── */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-brand: 'Syne', var(--font);
    --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;

    --t-display: 30px;  /* número herói, um por tela */
    --t-h1:      21px;  /* título da página */
    --t-h2:      15px;  /* título de bloco */
    --t-h3:      13px;  /* subtítulo interno */
    --t-body:    13.5px;
    --t-sm:      12.5px;
    --t-label:   11px;  /* rótulo em caixa alta */
    --t-num-lg:  25px;  /* número de métrica */
    --t-num:     17px;  /* número em linha */

    --lh-tight: 1.15;
    --lh:       1.5;

    --sidebar-w: 230px;
    --tap: 40px;        /* alvo mínimo de toque */
}

/* ══════════ TEMA ESCURO ══════════
   Só a camada de token muda. Nenhuma regra de componente daqui pra
   baixo sabe qual tema está no ar, e é por isso que não existe
   "ilha" de tema errado no meio da tela. */
[data-tema="escuro"] {
    color-scheme: dark;

    --bg:          #070a10;
    --surface:     #0d121b;
    --surface2:    #121926;
    --surface3:    #1a2333;

    --border:      rgba(148,175,214,0.11);
    --border-soft: rgba(148,175,214,0.06);
    --border-hard: rgba(148,175,214,0.20);

    --text:        #e9eef6;
    --text2:       #9dadc4;
    /* Clareado junto com o do tema claro: #67788f dava 3,91 a 4,40 sobre as
       superficies escuras, abaixo dos 4,5 do texto pequeno. Isso ja vinha do
       desenho antigo e so apareceu quando eu passei a medir. */
    --muted:       #7d8ea6;

    --gold:        #f5c842;
    --gold2:       #dfa61c;
    --gold-fill:   #f5c842;
    --gold-ink:    #120d00;
    --gold-weak:   rgba(245,200,66,0.10);
    --gold-line:   rgba(245,200,66,0.28);

    --success:     #3ecf8e;
    --success-weak:rgba(62,207,142,0.11);
    --success-line:rgba(62,207,142,0.26);
    --danger:      #f2706e;
    --danger-weak: rgba(242,112,110,0.11);
    --danger-line: rgba(242,112,110,0.26);
    --warning:     #f0a92b;
    --warning-weak:rgba(240,169,43,0.11);
    --warning-line:rgba(240,169,43,0.26);
    --info:        #5c9dfc;
    --info-weak:   rgba(92,157,252,0.11);
    --info-line:   rgba(92,157,252,0.26);
    --purple:      #9b8cf5;
    --purple-weak: rgba(155,140,245,0.11);

    --sombra-cor:  rgba(0,0,0,0.55);
    --veu:         rgba(3,6,11,0.72);
    --barra:       #1f2a3a;
    --barra-hover: #2b3a4e;
    --brilho:      rgba(255,255,255,0.045);
    --opcao-bg:    #16202e;
    --gold-hover:  #ffd75f;
    --gold-ativo:  #dfa61c;
    --danger-ink:  #1a0505;
    --selecao:     rgba(245,200,66,0.28);
}

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    font-size: var(--t-body);
    line-height: var(--lh);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* zero cortado + números de largura fixa em toda a interface */
    font-feature-settings: 'zero' 1, 'tnum' 1, 'cv05' 1;
}

/* Número sempre alinha coluna com coluna */
.num, .stat-value, .metric-v, .table td, .table th, time, [data-num] {
    font-variant-numeric: tabular-nums;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }

/* Foco visível, sem matar o mouse */
:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}
::selection { background: var(--selecao); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--barra); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--barra-hover); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ════════════════════════════════════════════════════════════
   A REGRA QUE EVITA CONTEÚDO CORTADO NO CELULAR
   ════════════════════════════════════════════════════════════
   Filho de grid e de flex nasce com `min-width: auto`, que quer dizer
   "nunca fique menor que o próprio conteúdo". Numa coluna de 355px, um
   card com tabela dentro simplesmente ignora a coluna e fica com 673px.
   O pai tem `overflow-x: hidden` pra a página não rolar de lado, e aí a
   sobra não vira rolagem: vira conteúdo APAGADO da tela.

   Foi exatamente isso que apareceu no celular em 07/09/2026: pedaço de
   card sumindo em dashboard, configurações, notificações e pixel.

   `min-width: 0` devolve a permissão de encolher. Onde o conteúdo não
   couber mesmo, tabela larga por exemplo, quem rola é o `.table-wrap`,
   dentro dele, e nada se perde.
   ════════════════════════════════════════════════════════════ */
.two-col > *, .three-col > *, .col-7-5 > *, .col-5-7 > *,
.stack > *, .metric-row > *, .filtros > *, .topbar > *,
.card-header > *, .card-footer > *, .list-item > *, .lst-i > *,
.u-row > *, .u-row-b > *, .modal-2col > *, .paginacao > * {
    min-width: 0;
    /* `min-width: 0` sozinho NÃO basta, e foi o que me enganou na primeira
       tentativa. Ele libera o encolhimento no eixo PRINCIPAL. Quando o pai
       é uma coluna (`flex-direction: column`, que é o que a barra de título
       vira no celular), a largura é o eixo CRUZADO: ali o item usa o próprio
       conteúdo como tamanho e o `align-items: stretch` só sabe esticar, nunca
       apertar. Medido no aparelho: a faixa de períodos ficava com 551px dentro
       de uma caixa de 355px. `max-width: 100%` é o que segura os dois eixos. */
    max-width: 100%;
}
/* Faixa que rola sozinha precisa poder encolher, senão a rolagem não
   existe: ela empurra o pai e o pai corta. */
.chips, .tabs, .seg, .topbar-actions, .table-wrap { min-width: 0; max-width: 100%; }

/* Campo de arquivo tem largura interna própria, herdada do sistema, e não
   respeita a caixa sozinho. O botão nativo também vinha cinza do sistema,
   destoando de tudo. */
input[type="file"] {
    max-width: 100%;
    padding: 5px 8px;
    height: auto;
    min-height: 34px;
    font-size: 12.5px;
    color: var(--muted);
}
input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface3);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--border-hard); }

/* ── Linha com tocador de áudio ──────────────────────────────────────────
   O `<audio>` tem largura mínima própria e não encolhe. Numa linha de flex
   de 353px ele ficava com 200px e empurrava o nome pra 50px: "Boas-vindas"
   virava "B...". Aqui o nome fica em cima, sozinho na linha, e o tocador
   embaixo ocupando a largura toda. A partir de 700px volta pra uma linha só. */
.item-audio { flex-wrap: wrap; }
.item-audio .list-info { flex: 1 1 100%; min-width: 0; }
/* Nome sozinho em cima; tocador e lixeira dividem a linha de baixo. */
.item-audio audio, .item-audio .aud {
    flex: 1 1 auto; width: auto; min-width: 0; max-width: none;
    height: 32px; margin-top: 6px;
}
.item-audio > button, .item-audio > .btn-icon { flex: 0 0 auto; margin-top: 6px; }
@media (min-width: 700px) {
    .item-audio { flex-wrap: nowrap; }
    .item-audio .list-info { flex: 1 1 auto; }
    .item-audio audio, .item-audio .aud { flex: 0 0 auto; width: auto; max-width: 210px; margin-top: 0; }
    .item-audio > button, .item-audio > .btn-icon { margin-top: 0; }
}

/* ════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--s2);
    padding: 18px var(--s4);
    border-bottom: 1px solid var(--border);
}

.sidebar-brand {
    font-family: var(--font-brand);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
.sidebar-brand strong { color: var(--gold); font-weight: 800; }

.sidebar-nav {
    flex: 1;
    padding: var(--s3) var(--s2);
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow-y: auto;
}

/* Rótulo de seção da navegação */
.nav-sec {
    padding: var(--s4) 12px 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
}
.sidebar-nav > .nav-sec:first-child { padding-top: var(--s1); }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    min-height: 34px;
    border-radius: var(--r);
    color: var(--text2);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background .12s, color .12s;
}
.nav-item svg { opacity: .75; flex-shrink: 0; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
    background: var(--gold-weak);
    color: var(--gold);
    font-weight: 600;
}
.nav-item.active svg { opacity: 1; }

/* Contador à direita do item (ex.: leads sem contato) */
.nav-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface2);
    padding: 1px 6px;
    border-radius: var(--r-sm);
    min-width: 20px;
    text-align: center;
}
.nav-item.active .nav-count { background: var(--gold-weak); color: var(--gold); }
.nav-count.alerta { background: var(--danger-weak); color: var(--danger); }

.sidebar-footer {
    padding: 10px var(--s4);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
    width: 32px; height: 32px;
    background: var(--gold-fill);
    border-radius: var(--r);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    color: var(--gold-ink);
    flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--muted); }

.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--r);
    text-decoration: none;
    transition: .12s;
}
.btn-logout:hover { background: var(--danger-weak); color: var(--danger); border-color: var(--danger-line); }
#btnTema:hover { background: var(--gold-weak); color: var(--gold); border-color: var(--gold-line); }

/* Quem mostra o quê no botão de tema. Os dois ícones ficam no HTML e o CSS
   esconde o que não vale: assim a troca é instantânea, sem redesenhar nada. */
.so-escuro { display: none; }
[data-tema="escuro"] .so-escuro { display: block; }
[data-tema="escuro"] .so-claro  { display: none; }

/* ════════════════════════════════════════════════════════════
   ÁREA PRINCIPAL
   ════════════════════════════════════════════════════════════ */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    padding: var(--s6) var(--s7) var(--s8);
    min-height: 100vh;
}
.main-wide { max-width: none; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--s4);
    flex-wrap: wrap;
    padding-bottom: var(--s4);
    margin-bottom: var(--s5);
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-size: var(--t-h1);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: var(--lh-tight);
}
.page-sub { font-size: var(--t-sm); color: var(--muted); margin-top: 3px; }

.topbar-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }

/* Faixa de contexto: período analisado e hora do dado */
.contexto {
    display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
    font-size: var(--t-sm); color: var(--muted);
    margin-bottom: var(--s4);
}
.contexto strong { color: var(--text); font-weight: 600; }
.contexto .sep { color: var(--muted); }

/* ════════════════════════════════════════════════════════════
   BOTÕES
   ════════════════════════════════════════════════════════════ */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger-solid {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: var(--r);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s;
}
.btn-primary  { background: var(--gold-fill); color: var(--gold-ink); border: 1px solid var(--gold-fill); }
.btn-primary:hover  { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn-primary:active { background: var(--gold-ativo); border-color: var(--gold-ativo); }

.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface3); border-color: var(--border-hard); }

.btn-ghost { background: transparent; color: var(--text2); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-danger-solid { background: var(--danger); color: var(--danger-ink); border: 1px solid var(--danger); }
.btn-danger-solid:hover { filter: brightness(1.08); }

.btn-primary:disabled, .btn-secondary:disabled, .btn-primary[disabled], .btn-secondary[disabled] {
    opacity: .45; cursor: not-allowed;
}
.btn-lg { height: 40px; padding: 0 20px; font-size: 13.5px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r);
    cursor: pointer;
    transition: .12s;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); border-color: var(--border-hard); }
.btn-icon.btn-danger:hover { background: var(--danger-weak); color: var(--danger); border-color: var(--danger-line); }

/* Botão em estado de espera: mostra que a ação saiu */
.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.is-loading::after {
    content: ''; position: absolute; inset: 0; margin: auto;
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid currentColor; border-top-color: transparent;
    color: var(--gold-ink);
    animation: spin .6s linear infinite;
}
.btn-secondary.is-loading::after, .btn-icon.is-loading::after { color: var(--text2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════
   CARD / PAINEL
   ════════════════════════════════════════════════════════════ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: var(--s4);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s3);
    padding: 12px var(--s4);
    border-bottom: 1px solid var(--border);
    min-height: 44px;
}
.card-header h3, .card-title {
    font-size: var(--t-h2);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}
.card-header .hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.card-body { padding: var(--s4); }
.card-body.flush { padding: 0; }
.card-footer {
    padding: 10px var(--s4);
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
    font-size: var(--t-sm); color: var(--muted);
}

.link-ver-todos {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 4px;
    transition: color .12s;
}
.link-ver-todos:hover { color: var(--gold); }

/* ════════════════════════════════════════════════════════════
   MÉTRICAS
   Composição, não parede de card com ícone. Um bloco só,
   dividido por linha vertical. Sem ícone colorido por número.
   ════════════════════════════════════════════════════════════ */
.metric-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    margin-bottom: var(--s4);
    /* Sem `overflow: hidden` de propósito. O fundo e o traço são da faixa,
       e as métricas dentro não têm fundo próprio, então o canto arredondado
       não precisa de corte. Com corte, a dica que sobe da primeira linha
       era decepada, e qualquer sobra de conteúdo sumia calada. */
}
.metric {
    padding: 14px var(--s4) 15px;
    border-left: 1px solid var(--border-soft);
    min-width: 0;
}
.metric:first-child { border-left: none; }
.metric-l {
    font-size: var(--t-label);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    display: flex; align-items: center; gap: 5px;
}
.metric-v {
    font-size: var(--t-num-lg);
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-top: 6px;
    color: var(--text);
    white-space: nowrap;
}
.metric-v.ok    { color: var(--success); }
.metric-v.bad   { color: var(--danger); }
.metric-v.gold  { color: var(--gold); }
.metric-v.muted { color: var(--muted); }
.metric-s { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.4; }

/* Variação contra período anterior */
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; }
.delta.sobe  { color: var(--success); }
.delta.desce { color: var(--danger); }
.delta.igual { color: var(--muted); }
/* Em custo, subir é ruim: a cor inverte */
.delta.custo.sobe  { color: var(--danger); }
.delta.custo.desce { color: var(--success); }

/* Métrica em destaque, uma por tela no máximo */
.metric-hero .metric-v { font-size: var(--t-display); }

/* ── Compatibilidade: .stats-grid / .stat-card das telas antigas ──
   Reconstruídos sobre os mesmos tokens pra não destoar do resto.  */
.stats-grid, .stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
    gap: var(--s3);
    margin-bottom: var(--s4);
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 14px var(--s4);
    display: flex;
    align-items: center;
    gap: var(--s3);
    min-width: 0;
}
.stat-icon {
    width: 30px; height: 30px;
    border-radius: var(--r);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    background: var(--surface2);
}
.stat-info { display: flex; flex-direction: column; min-width: 0; }
.stat-value {
    font-size: var(--t-num-lg);
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.1;
    white-space: nowrap;
}
.stat-label {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 3px;
}

/* ════════════════════════════════════════════════════════════
   GRADES
   ════════════════════════════════════════════════════════════ */
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-bottom: var(--s4); }
.col-7-5   { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--s4); margin-bottom: var(--s4); align-items: start; }
.col-5-7   { display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--s4); margin-bottom: var(--s4); align-items: start; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); margin-bottom: var(--s4); }
.stack     { display: flex; flex-direction: column; gap: var(--s4); }

/* ════════════════════════════════════════════════════════════
   TABELA
   ════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.table th {
    padding: 9px var(--s4);
    text-align: left;
    color: var(--muted);
    font-size: var(--t-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 1;
}
.table td {
    padding: 9px var(--s4);
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
    color: var(--text2);
}
.table td strong, .table td b { color: var(--text); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface2); }
.table .num, .table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-acao { width: 1%; white-space: nowrap; text-align: right; }

/* Cabeçalho clicável de ordenação */
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--text); }
.th-sort[aria-sort="ascending"], .th-sort[aria-sort="descending"] { color: var(--gold); }

.empty-td { text-align: center; color: var(--muted); padding: var(--s7) !important; }

/* ════════════════════════════════════════════════════════════
   ESTADOS: vazio, carregando, erro
   ════════════════════════════════════════════════════════════ */
.empty-state, .state {
    text-align: center;
    color: var(--muted);
    padding: var(--s7) var(--s5);
    font-size: var(--t-sm);
    line-height: 1.6;
}
.state svg { margin: 0 auto 10px; opacity: .35; }
.state-t { color: var(--text); font-size: var(--t-body); font-weight: 600; margin-bottom: 4px; }
.state-a { margin-top: var(--s4); }

.state-erro { color: var(--danger); }
.state-erro .state-t { color: var(--danger); }
.state-erro svg { opacity: .55; }

/* Esqueleto de carregamento */
.skel { background: var(--surface2); border-radius: var(--r-sm); position: relative; overflow: hidden; }
.skel::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, var(--brilho), transparent);
    animation: skel 1.3s infinite;
}
@keyframes skel { to { transform: translateX(100%); } }
.skel-l { height: 11px; margin: 6px 0; }

/* Aviso em faixa. Uma linha, não um card */
.aviso {
    display: flex; gap: 10px; align-items: flex-start;
    background: var(--warning-weak);
    border: 1px solid var(--warning-line);
    border-radius: var(--r-md);
    padding: 11px 14px;
    margin-bottom: var(--s4);
    font-size: var(--t-sm);
    color: var(--text);
    line-height: 1.55;
}
.aviso svg { flex-shrink: 0; margin-top: 1px; color: var(--warning); }
.aviso.perigo { background: var(--danger-weak); border-color: var(--danger-line); }
.aviso.perigo svg { color: var(--danger); }
.aviso.info { background: var(--info-weak); border-color: var(--info-line); }
.aviso.info svg { color: var(--info); }
.aviso.ok { background: var(--success-weak); border-color: var(--success-line); }
.aviso.ok svg { color: var(--success); }

/* Dado indisponível. Nunca mostrar zero no lugar de erro */
.sem-dado { color: var(--muted); font-style: normal; }
.sem-dado::before { content: '—'; }

/* ════════════════════════════════════════════════════════════
   ETIQUETAS
   ════════════════════════════════════════════════════════════ */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: var(--r-sm);
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
    background: var(--surface2);
    color: var(--text2);
}
/* ponto de status à esquerda, mais legível que cor de fundo sozinha */
.tag::before {
    content: '';
    width: 5px; height: 5px; border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.tag.sem-ponto::before, .tag-origem::before { display: none; }

.tag-novo,        .tag.info    { background: var(--info-weak);    color: var(--info); }
.tag-contactado,  .tag.roxo    { background: var(--purple-weak);  color: var(--purple); }
.tag-comprou,     .tag-ativo,    .tag-enviado, .tag.ok    { background: var(--success-weak); color: var(--success); }
.tag-nao_comprou, .tag-cancelado,.tag-erro,    .tag.ruim  { background: var(--danger-weak);  color: var(--danger); }
.tag-descartado,  .tag.neutro  { background: var(--surface2);     color: var(--muted); }
.tag-pendente,    .tag-vencido, .tag-aguardando, .tag.atencao { background: var(--warning-weak); color: var(--warning); }
.tag-teste_vencido { background: var(--warning-weak); color: var(--warning); }
.tag-origem { background: transparent; color: var(--muted); border: 1px solid var(--border); font-weight: 500; }

/* ════════════════════════════════════════════════════════════
   FILTROS
   ════════════════════════════════════════════════════════════ */
.filtros {
    display: flex;
    gap: var(--s2);
    align-items: flex-end;
    flex-wrap: wrap;
    padding: var(--s3) var(--s4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    margin-bottom: var(--s4);
}
.filtro-campo { display: flex; flex-direction: column; gap: 5px; min-width: 140px; }
.filtro-campo.cresce { flex: 1; min-width: 190px; }

.filter-label {
    display: block;
    font-size: var(--t-label);
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 5px;
}
.filtro-campo .filter-label { margin-bottom: 0; }

/* Chips de período */
.chips { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    height: 30px; padding: 0 11px;
    border-radius: var(--r);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 12.5px; font-weight: 500;
    text-decoration: none; cursor: pointer;
    white-space: nowrap;
    transition: .12s;
}
.chip:hover { color: var(--text); border-color: var(--border-hard); background: var(--surface2); }
.chip.on {
    background: var(--gold-weak);
    border-color: var(--gold-line);
    color: var(--gold);
    font-weight: 600;
}

/* Grupo segmentado, pra escolha única */
.seg { display: inline-flex; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r); padding: 2px; gap: 2px; }
.seg a, .seg button {
    height: 26px; padding: 0 11px;
    display: inline-flex; align-items: center;
    border: none; background: transparent; cursor: pointer;
    border-radius: var(--r-sm);
    font-size: 12.5px; font-weight: 500; color: var(--muted);
    text-decoration: none; white-space: nowrap;
    transition: .12s;
}
.seg a:hover, .seg button:hover { color: var(--text); }
.seg .on { background: var(--surface3); color: var(--text); font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   FORMULÁRIO
   ════════════════════════════════════════════════════════════ */
.form-input, .form-select, .form-textarea {
    width: 100%;
    height: 34px;
    padding: 0 11px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    outline: none;
    transition: border-color .12s, background .12s;
}
.form-textarea { height: auto; padding: 9px 11px; line-height: 1.55; resize: vertical; }
.form-input::placeholder, .form-textarea::placeholder { color: var(--muted); }
.form-input:hover, .form-select:hover { border-color: var(--border-hard); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--gold-line);
    background: var(--surface3);
}
.form-input:disabled { opacity: .5; cursor: not-allowed; }
.form-input option, .form-select option, select.form-input option { background: var(--opcao-bg); color: var(--text); }
.form-input[type="date"] { padding-right: 8px; }
.form-input.erro { border-color: var(--danger-line); }
.form-erro { font-size: 11.5px; color: var(--danger); margin-top: 4px; }
.form-ajuda { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

/* Busca com ícone */
.busca { position: relative; }
.busca svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.busca .form-input { padding-left: 32px; }

.status-select {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 12px;
    height: 26px;
    padding: 0 6px;
    cursor: pointer;
    outline: none;
    max-width: 150px;
}
.status-select:hover { border-color: var(--border-hard); }

input[type="checkbox"] { accent-color: var(--gold); width: 15px; height: 15px; cursor: pointer; }
input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .4; }

/* ════════════════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--veu);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s5);
    backdrop-filter: blur(2px);
}
.modal-box {
    background: var(--surface);
    border: 1px solid var(--border-hard);
    border-radius: var(--r-xl);
    width: 100%;
    max-width: 460px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-modal);
    animation: modalIn .16s ease-out;
}
.modal-box.lg { max-width: 720px; }
.modal-box.xl { max-width: 960px; }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s3);
    padding: 14px var(--s5);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.modal-header h3 { font-size: var(--t-h2); font-weight: 600; letter-spacing: -0.01em; }
.modal-close {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    width: 26px; height: 26px;
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    transition: .12s;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-body { padding: var(--s5); overflow-y: auto; }
.modal-footer {
    display: flex;
    gap: var(--s2);
    justify-content: flex-end;
    padding: 13px var(--s5);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.form-group-modal { margin-bottom: var(--s4); }
.form-group-modal:last-child { margin-bottom: 0; }
.modal-2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

/* Gaveta lateral, pra detalhe sem perder a lista de trás */
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(560px, 94vw);
    background: var(--surface);
    border-left: 1px solid var(--border-hard);
    box-shadow: var(--shadow-modal);
    z-index: 9100;
    display: flex; flex-direction: column;
    animation: drawerIn .18s ease-out;
}
@keyframes drawerIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-header { padding: 14px var(--s5); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }
.drawer-body { padding: var(--s5); overflow-y: auto; flex: 1; }

/* ════════════════════════════════════════════════════════════
   LISTA
   ════════════════════════════════════════════════════════════ */
.list-item {
    display: flex;
    align-items: center;
    gap: var(--s3);
    padding: 10px var(--s4);
    border-bottom: 1px solid var(--border-soft);
    transition: background .12s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--surface2); }
.list-avatar {
    width: 28px; height: 28px;
    background: var(--surface2);
    color: var(--muted);
    border-radius: var(--r);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.list-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.list-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-meta { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* Lista com barra proporcional, pra ranking */
.lst { display: flex; flex-direction: column; }
.lst-i { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: var(--t-sm); border-bottom: 1px solid var(--border-soft); }
.lst-i:last-child { border-bottom: none; }
.lst-nome { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); }
.lst-n { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.lst-bar { height: 3px; border-radius: 2px; background: var(--gold-fill); opacity: .7; min-width: 3px; }

/* ════════════════════════════════════════════════════════════
   LINHA DO TEMPO
   ════════════════════════════════════════════════════════════ */
.tl { position: relative; padding-left: 26px; }
.tl::before { content: ''; position: absolute; left: 9px; top: 8px; bottom: 8px; width: 1px; background: var(--border); }
.tl-item { position: relative; display: flex; align-items: baseline; gap: 10px; padding: 5px 0; font-size: var(--t-sm); }
.tl-pt {
    position: absolute; left: -21px; top: 6px;
    width: 19px; height: 19px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--surface2); border: 1px solid var(--border);
}
.tl-t { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; flex-shrink: 0; min-width: 42px; }
.tl-nome { font-weight: 600; color: var(--text); }
.tl-det { color: var(--muted); flex: 1; word-break: break-word; }

/* ════════════════════════════════════════════════════════════
   FUNIL
   ════════════════════════════════════════════════════════════ */
.funil { display: flex; flex-direction: column; gap: 2px; }
.fun-linha {
    position: relative; display: flex; align-items: center; gap: var(--s3);
    padding: 9px 13px; border-radius: var(--r-md);
    background: var(--surface2); overflow: hidden;
}
.fun-barra {
    position: absolute; inset: 0;
    background: linear-gradient(90deg, var(--gold-weak), transparent);
    border-right: 2px solid var(--gold-line);
    transition: width .4s ease;
}
.fun-txt { position: relative; flex: 1; font-size: 13px; font-weight: 500; }
.fun-n   { position: relative; font-weight: 700; font-size: var(--t-num); min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.fun-pct { position: relative; color: var(--muted); font-size: 11.5px; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.fun-perda { display: flex; align-items: center; gap: 5px; padding: 2px 13px 2px 26px; color: var(--danger); font-size: 11.5px; font-weight: 600; }
.fun-perda.leve { color: var(--muted); font-weight: 500; }

/* ════════════════════════════════════════════════════════════
   GRÁFICO
   ════════════════════════════════════════════════════════════
   O Chart.js com `maintainAspectRatio: false` tenta ocupar a altura do
   pai. Se o pai não tem altura própria, o pai cresce porque o canvas
   cresceu, o canvas cresce de novo, e vira laço: medido no ar em
   07/09/2026, o gráfico do Bitcoin chegou a 1.746px e deixou meia tela
   de branco embaixo. A caixa com altura fixa e o canvas absoluto dentro
   dela cortam o laço na raiz. */
.grafico { position: relative; height: 180px; width: 100%; }
.grafico.baixo { height: 150px; }
.grafico > canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
@media (max-width: 560px) { .grafico { height: 160px; } }

/* Tela larga: os dois gráficos de mercado ficam lado a lado, então cada um
   passa dos 800px. Com 150px de altura a linha vira uma tira achatada e o
   movimento some. Cresce junto com a largura. */
@media (min-width: 1400px) {
    .grafico       { height: 240px; }
    .grafico.baixo { height: 210px; }
}

/* ════════════════════════════════════════════════════════════
   PROGRESSO
   ════════════════════════════════════════════════════════════ */
.progress-track { height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.progress-fill  { height: 100%; border-radius: 3px; background: var(--gold-fill); transition: width .4s ease; }
.progress-fill.ok  { background: var(--success); }
.progress-fill.bad { background: var(--danger); }

/* ════════════════════════════════════════════════════════════
   ABAS
   ════════════════════════════════════════════════════════════ */
.tabs { display: flex; gap: var(--s5); border-bottom: 1px solid var(--border); margin-bottom: var(--s5); }
.tab {
    padding: 0 0 10px;
    font-size: 13.5px; font-weight: 500;
    color: var(--muted); text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .12s, border-color .12s;
    white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--gold); font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   PAGINAÇÃO
   ════════════════════════════════════════════════════════════ */
.paginacao { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 10px var(--s4); border-top: 1px solid var(--border); font-size: var(--t-sm); color: var(--muted); flex-wrap: wrap; }
.pag-btns { display: flex; gap: 4px; }
.pag-btn {
    min-width: 28px; height: 28px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: var(--r-sm);
    background: transparent; color: var(--text2);
    font-size: 12.5px; text-decoration: none; cursor: pointer;
    font-variant-numeric: tabular-nums;
    transition: .12s;
}
.pag-btn:hover { background: var(--surface2); color: var(--text); }
.pag-btn.on { background: var(--gold-weak); border-color: var(--gold-line); color: var(--gold); font-weight: 600; }
.pag-btn[aria-disabled="true"] { opacity: .35; pointer-events: none; }

/* ════════════════════════════════════════════════════════════
   AVISO FLUTUANTE
   ════════════════════════════════════════════════════════════ */
.toast-area { position: fixed; bottom: var(--s5); right: var(--s5); z-index: 9500; display: flex; flex-direction: column; gap: var(--s2); }
.toast {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface3);
    border: 1px solid var(--border-hard);
    border-radius: var(--r-md);
    padding: 11px 15px;
    font-size: 13px;
    box-shadow: var(--shadow-pop);
    animation: toastIn .18s ease-out;
    max-width: 380px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast.ok   { border-color: var(--success-line); }
.toast.ok svg   { color: var(--success); }
.toast.erro { border-color: var(--danger-line); }
.toast.erro svg { color: var(--danger); }

/* ════════════════════════════════════════════════════════════
   DICA
   ════════════════════════════════════════════════════════════ */
[data-dica] { position: relative; }
[data-dica]::after {
    content: attr(data-dica);
    position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    background: var(--surface3); color: var(--text);
    border: 1px solid var(--border-hard); border-radius: var(--r-sm);
    padding: 6px 9px; font-size: 11.5px; font-weight: 500; line-height: 1.45;
    text-align: center; pointer-events: none;
    /* O rótulo de métrica é caixa alta com espaçamento largo, e a dica
       herdava os dois: a explicação inteira saía GRITADA e mais larga
       do que precisava. Frase é frase. */
    text-transform: none; letter-spacing: normal;
    /* QUEBRA LINHA, e com teto de largura. Com `white-space: nowrap` uma
       explicação de duas frases virava uma tira de 714px que empurrava a
       faixa de métricas inteira e fazia o pai cortar conteúdo de verdade. */
    white-space: normal;
    width: max-content;
    max-width: min(260px, 62vw);
    box-shadow: var(--shadow-pop);
    z-index: 50;
    /* ESCONDIDA COM `display: none`, e não com `opacity: 0`. Caixa absoluta
       transparente continua ocupando lugar no layout: a dica de um rótulo da
       coluna da direita saía 30px pra fora da faixa de métricas, o corpo
       cortava o que passava, e no celular sumia um pedaço do número sem aviso.
       Sem fade de propósito: animar `display` depende de `allow-discrete`, e
       onde o navegador não aplica a dica fica montada e invisível. Aparecer na
       hora vale mais que aparecer bonito. */
    display: none;
}
[data-dica]:hover::after, [data-dica]:focus-visible::after { display: block; }
/* Sem mouse não há como abrir a dica, e ela só ocuparia espaço invisível. */
@media (hover: none) {
    [data-dica]::after { content: none; }
}

/* ════════════════════════════════════════════════════════════
   CÓDIGO
   ════════════════════════════════════════════════════════════ */
.codigo, .px-cod, .webhook-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--gold);
    word-break: break-all;
    line-height: 1.6;
}

/* ════════════════════════════════════════════════════════════
   UTILITÁRIOS
   ════════════════════════════════════════════════════════════ */
.u-ok    { color: var(--success); }
.u-bad   { color: var(--danger); }
.u-gold  { color: var(--gold); }
.u-info  { color: var(--info); }
.u-muted { color: var(--muted); }
.u-nowrap{ white-space: nowrap; }
.u-right { text-align: right; }
.u-row   { display: flex; align-items: center; gap: var(--s2); }
.u-row-b { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.u-wrap  { flex-wrap: wrap; }
.u-grow  { flex: 1; min-width: 0; }
.u-hide  { display: none !important; }
.u-elip  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-mb0   { margin-bottom: 0 !important; }
.u-mt4   { margin-top: var(--s4); }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVO
   O comportamento de menu no celular está no mobile.css.
   Aqui fica só o que é estrutura de conteúdo.
   ════════════════════════════════════════════════════════════ */
@media (max-width: 1180px) {
    .col-7-5, .col-5-7 { grid-template-columns: 1fr; }
    .three-col { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    .main { padding: var(--s4) var(--s3) var(--s7); }
    .two-col, .three-col { grid-template-columns: 1fr; }
    .topbar { padding-bottom: var(--s3); margin-bottom: var(--s4); }
    .page-title { font-size: 19px; }
    .metric-row { grid-template-columns: 1fr 1fr; }
    .metric { border-left: none; border-top: 1px solid var(--border-soft); }
    .metric:nth-child(-n+2) { border-top: none; }
    .metric:nth-child(even) { border-left: 1px solid var(--border-soft); }
    .modal-2col { grid-template-columns: 1fr; }
    /* Cabeçalho e rodapé de card são flex numa linha só. No celular o texto
       de apoio e o botão do lado disputavam o mesmo espaço e ficavam um por
       cima do outro, com o rótulo do botão cortado. Deixar quebrar resolve. */
    .card-header, .card-footer { flex-wrap: wrap; }
    .card-footer > * { flex: 1 1 100%; }
    .card-footer .btn-ghost, .card-footer .btn-secondary, .card-footer .btn-primary,
    .card-footer form { flex: 0 0 auto; }

    /* alvo de toque: nada com menos de 40px no celular */
    .btn-primary, .btn-secondary, .btn-ghost, .btn-icon, .chip, .form-input, .form-select { min-height: var(--tap); }
    .btn-icon { width: var(--tap); }
    .status-select { height: 32px; }
    .table th, .table td { padding: 10px var(--s3); }

    /* ── Coluna âncora presa ao rolar ────────────────────────────────────
       Tabela de nove colunas não cabe em 375px, e rolar de lado é a saída
       certa: nada se perde. O que se perde é o CONTEXTO, porque assim que
       você arrasta, o nome sai da tela e sobra uma linha de valores órfãos.
       A coluna marcada com `col-fixa` no HTML fica presa na borda esquerda,
       então dá sempre pra saber de quem é a linha que você está lendo. */
    .table th.col-fixa, .table td.col-fixa {
        position: sticky;
        left: 0;
        z-index: 2;
        background: var(--surface);
        box-shadow: 1px 0 0 var(--border);
        max-width: 168px;
        /* Sem o corte, nome comprido escapava da célula presa e ficava escrito
           por cima da coluna de plano da linha ao lado. */
        overflow: hidden;
    }
    .table td.col-fixa > * {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
        text-align: left;
    }
    .table thead th.col-fixa { z-index: 3; }
    .table tbody tr:hover td.col-fixa { background: var(--surface2); }
}
@media (max-width: 560px) {
    /* A faixa de contexto quebrava em três linhas com um "·" solto no fim de
       cada uma. Empilhada, sem separador, ela lê como três informações. */
    .contexto { flex-direction: column; align-items: flex-start; gap: 2px; }
    .contexto .sep { display: none; }

    /* Continua em DUAS colunas, como no bloco de 900px. Empilhar tudo numa
       coluna só transformava seis métricas em 1.101px de rolagem para ler os
       números do topo; em duas, são 664px. O que muda aqui é só o aperto: o
       número encolhe pra "R$ 405.867,00" não encostar na coluna do lado. */
    .metric { padding: 12px 13px 13px; }
    .metric-v { font-size: 20px; letter-spacing: -0.025em; }
    .metric-hero .metric-v { font-size: 24px; }
    .metric-l { font-size: 10.5px; letter-spacing: 0.05em; }
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal-box { max-width: none; max-height: 92vh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
    .toast-area { left: var(--s3); right: var(--s3); bottom: var(--s3); }
    .toast { max-width: none; }
}

/* Impressão: relatório sai em preto e branco */
@media print {
    .sidebar, .mobile-menu-toggle, .sidebar-overlay, .topbar-actions,
    .filtros, .chips, .paginacao, .toast-area { display: none !important; }
    body { background: #fff; color: #000; display: block; }
    .main { margin-left: 0; padding: 0; }
    .card, .metric-row, .table th, .table td { background: #fff !important; color: #000 !important; border-color: #bbb !important; }
    .metric-v, .stat-value, .page-title, .card-header h3 { color: #000 !important; }
    a { text-decoration: none; color: #000; }
}
