/* Veritas 2.0 — design system: base, layout, componentes e telas, vindo do protótipo v0.3 aprovado.
   Manter em sincronia com o protótipo só quando o visual mudar lá primeiro. Depende de tokens.css. */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  /* cor padrão de link na camada base: classes de layout e componentes (menu lateral, botões) definem a própria */
  a { color: var(--accent-strong); }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background:
      radial-gradient(900px 500px at 85% -10%, var(--bg-glow-1), transparent 60%),
      radial-gradient(800px 600px at 10% 110%, var(--bg-glow-2), transparent 60%),
      var(--bg);
    background-attachment: fixed;
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    transition: background-color .3s var(--ease), color .3s var(--ease);
  }
  h1, h2, h3, h4 { margin: 0; letter-spacing: -0.015em; font-weight: 650; }
  p { margin: 0; }
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; }
  :focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
  .num, .money, td.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum", "cv11"; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  ::selection { background: rgba(236,184,68,.35); }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
}

@layer layout {
  .app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; transition: grid-template-columns .25s var(--ease); }
  .app[hidden] { display: none; }
  .sidebar {
    position: sticky; top: 0; height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex; flex-direction: column;
    --side-pad: var(--space-4);
    padding: var(--space-5) var(--side-pad);
    transition: padding .25s var(--ease);
    border-right: 1px solid rgba(255,255,255,.06);
    overflow-y: auto; overflow-x: hidden;
  }
  /* barra de rolagem fina, sem setas nem trilho: discreta parada, dourada ao passar o mouse.
     No Chrome/Edge as propriedades padrão (scrollbar-width/color) anulam o ::-webkit-scrollbar
     e trazem de volta as setas do Windows; por isso elas ficam só para o Firefox. */
  .sidebar::-webkit-scrollbar { width: 10px; }
  .sidebar::-webkit-scrollbar-track { background: transparent; }
  .sidebar::-webkit-scrollbar-button { display: none; height: 0; }
  .sidebar::-webkit-scrollbar-corner { background: transparent; }
  .sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.10); border-radius: 999px;
    border: 3px solid transparent; background-clip: padding-box;
  }
  .sidebar:hover::-webkit-scrollbar-thumb { background-color: rgba(236,184,68,.45); }
  .sidebar::-webkit-scrollbar-thumb:hover { background-color: rgba(236,184,68,.70); }
  @supports not selector(::-webkit-scrollbar) {
    .sidebar { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
    .sidebar:hover { scrollbar-color: rgba(236,184,68,.45) transparent; }
  }
  .sidebar::after { /* fio dourado sutil */
    content: ""; position: absolute; top: 0; right: 0; width: 1px; height: 100%;
    background: linear-gradient(180deg, transparent, rgba(236,184,68,.35) 30%, transparent 80%);
  }
  /* logo em duas linhas (Audilog Logistics Audit · 20 anos): a etiqueta do Veritas fica abaixo; recolhido, só o símbolo */
  .brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 4px 8px 22px; }
  .brand img { height: 40px; width: auto; display: block; }
  .brand .brand-mark { display: none; height: 34px; }
  .brand-tag { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-gold-400); border: 1px solid rgba(236,184,68,.35); padding: 2px 6px; border-radius: 999px; }
  .nav-group { margin-top: 12px; }
  /* Título da seção: clicando, a seção abre e fecha (fechada, mostra a soma dos contadores) */
  .nav-label {
    display: flex; align-items: center; gap: 6px; width: 100%; white-space: nowrap;
    font: inherit; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; text-align: left;
    color: rgba(255,255,255,.38); background: none; border: 0; border-radius: 8px; padding: 6px 12px; margin-bottom: 2px; cursor: pointer;
    transition: color .2s var(--ease), background .2s var(--ease);
  }
  .nav-label:hover { color: rgba(255,255,255,.75); background: rgba(255,255,255,.04); }
  .nav-label:focus-visible { outline: 2px solid var(--brand-gold-400); outline-offset: -2px; }
  .nav-label > svg { width: 14px; height: 14px; margin-left: auto; flex: none; opacity: .7; transition: transform .25s var(--ease); }
  .nav-label .nav-badge { letter-spacing: 0; font-size: 10px; padding: 0 7px; }
  .nav-label .nav-badge + svg { margin-left: 0; }
  .nav-group:not(.closed) .nav-label .nav-badge { display: none; }
  .nav-group.closed .nav-label > svg { transform: rotate(-90deg); }
  .nav-items { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .25s var(--ease), opacity .2s var(--ease); }
  /* recorte para a animação; a margem negativa deixa à mostra o filete dourado do item ativo */
  .nav-items > div { overflow: hidden; min-height: 0; margin-inline: calc(-1 * var(--side-pad)); padding-inline: var(--side-pad); }
  .nav-group.closed .nav-items { grid-template-rows: 0fr; opacity: 0; }
  .nav-item {
    position: relative; display: flex; align-items: center; gap: 12px; width: 100%; white-space: nowrap;
    padding: 9px 12px; border-radius: 10px; border: 0; background: none; color: var(--sidebar-text);
    text-decoration: none; font-weight: 500; transition: background .2s var(--ease), color .2s var(--ease);
  }
  .nav-item svg { width: 18px; height: 18px; opacity: .85; flex: none; }
  .nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
  .nav-item[aria-current="page"] { background: var(--sidebar-active); color: #fff; }
  .nav-item[aria-current="page"]::before {
    content: ""; position: absolute; left: calc(-1 * var(--side-pad)); top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold-gradient);
  }
  .nav-item[aria-current="page"] svg { color: var(--brand-gold-400); opacity: 1; }
  .nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); }
  .nav-badge.warn { background: rgba(236,184,68,.18); color: var(--brand-gold-200); }
  .sidebar-foot { margin-top: auto; padding-top: 20px; }
  .env-card { border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); border-radius: 14px; padding: 12px; display: flex; gap: 10px; align-items: center; }
  .env-card .avatar { width: 34px; height: 34px; }
  .env-card strong { color: #fff; font-size: 13px; display: block; }
  .env-card span { font-size: 12px; color: rgba(255,255,255,.5); }

  /* Botão de recolher: preso na borda do menu, acompanha a largura */
  .side-toggle {
    position: fixed; z-index: 45; top: 25px; left: calc(var(--sidebar-w) - 13px);
    width: 26px; height: 26px; padding: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
    background: #0a2350; color: var(--brand-gold-200); border: 1px solid rgba(236,184,68,.45); box-shadow: 0 4px 12px rgba(0,0,0,.28);
    transition: left .25s var(--ease), background .2s var(--ease), color .2s var(--ease);
  }
  .side-toggle:hover { background: var(--brand-gold-400); color: #00183f; }
  .side-toggle:focus-visible { outline: 2px solid var(--brand-gold-400); outline-offset: 2px; }
  .side-toggle svg { width: 14px; height: 14px; transition: transform .25s var(--ease); }
  .side-tip {
    position: fixed; z-index: 60; transform: translateY(-50%); pointer-events: none; white-space: nowrap;
    background: #0a2350; color: #fff; font-size: 12.5px; font-weight: 500; padding: 6px 10px; border-radius: 8px;
    border: 1px solid rgba(236,184,68,.3); box-shadow: var(--shadow-lg);
  }
  .side-tip[hidden] { display: none; }

  /* Menu recolhido: só ícones; as seções ficam todas à mostra, separadas por um fio */
  @media (min-width: 901px) {
    .app.side-collapsed { grid-template-columns: 76px 1fr; }
    .side-collapsed .side-toggle { left: calc(76px - 13px); }
    .side-collapsed .side-toggle svg { transform: rotate(180deg); }
    .side-collapsed .sidebar { --side-pad: 12px; }
    .side-collapsed .brand { align-items: center; padding-inline: 0; }
    .side-collapsed .brand .brand-logo { display: none; }
    .side-collapsed .brand .brand-mark { display: block; }
    .side-collapsed .brand-tag, .side-collapsed .nav-label { display: none; }
    .side-collapsed .nav-group + .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.07); }
    .side-collapsed .nav-group.closed .nav-items { grid-template-rows: 1fr; opacity: 1; }
    .side-collapsed .nav-item { justify-content: center; padding: 8px 0; }
    .side-collapsed .nav-item > span:not(.nav-badge) { display: none; }
    .side-collapsed .nav-item .nav-badge { position: absolute; top: 2px; right: 6px; font-size: 9.5px; line-height: 15px; padding: 0 5px; background: #2a4a80; color: #fff; }
    .side-collapsed .nav-item .nav-badge.warn { background: var(--brand-gold-400); color: #00183f; }
    .side-collapsed .env-card { justify-content: center; padding: 8px 0; }
    .side-collapsed .env-card > div { display: none; }
  }

  .main { min-width: 0; display: flex; flex-direction: column; }
  .topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: var(--space-3);
    min-height: 72px; padding: 10px var(--space-6);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  /* título da página na barra do topo, na altura da marca da lateral (sem faixa branca entre barra e conteúdo) */
  .top-title { display: flex; flex-direction: column; min-width: 0; }
  .top-crumb { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
  .top-title .page-title { font-size: 20px; line-height: 1.25; letter-spacing: -.015em; }
  .top-title .page-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* detalhe de documento: voltar, título e status na barra do topo (detailHead) */
  .dt-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .dt-back { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); border: 1px solid var(--border); background: var(--surface); text-decoration: none; transition: background-color .18s, border-color .18s, color .18s; }
  .dt-back:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
  .dt-back svg { width: 17px; height: 17px; }
  .dt-titles { display: flex; flex-direction: column; min-width: 0; }
  .dt-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .dt-line .page-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dt-line .chip { flex: none; }
  .search {
    flex: 1; min-width: 0; max-width: 520px; display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text-3); box-shadow: var(--shadow-sm);
  }
  .search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; color: var(--text); }
  .search input::placeholder { color: var(--text-3); }
  .kbd { font-size: 11px; font-weight: 600; color: var(--text-3); border: 1px solid var(--border-strong); border-bottom-width: 2px; padding: 0 6px; border-radius: 6px; background: var(--surface-2); }
  .topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .content { padding: 20px var(--space-6) 110px; width: 100%; margin: 0 auto; /* todas as telas usam a largura toda */ }
  .page-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: 14px; flex-wrap: wrap; } /* linha de ferramentas: busca à esquerda, ações à direita */
  .page-head .count { font-size: 12.5px; color: var(--text-3); }
  .crumbs { font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
  .page-title { font-size: 26px; font-weight: 680; letter-spacing: -0.02em; }
  .page-sub { color: var(--text-2); margin-top: 4px; }
  .grid { display: grid; gap: var(--space-5); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .grid-2-1 { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
  .grid-1-2 { grid-template-columns: minmax(0,1fr) minmax(0,2fr); }
  .stack { display: flex; flex-direction: column; gap: var(--space-5); }
  .row { display: flex; align-items: center; gap: var(--space-3); }
  .spacer { flex: 1; }
}

@layer components {
  .card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md), var(--inset-hl);
  }
  .card-pad { padding: var(--space-5) var(--space-6); }
  .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px 0; flex-wrap: wrap; }
  .card-head .seg { max-width: 100%; overflow-x: auto; }
  .card-title { font-size: 15px; font-weight: 640; }
  .card-sub { font-size: 12.5px; color: var(--text-3); }
  .divider { height: 1px; background: var(--border); margin: 16px 0; }

  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: var(--control-h); padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    box-shadow: var(--shadow-sm); transition: transform .12s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
    white-space: nowrap; text-decoration: none;
  }
  .btn svg { width: 16px; height: 16px; }
  .btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
  .btn:active { transform: translateY(1px); }
  .btn-primary { background: var(--primary); color: var(--on-primary); border-color: transparent; box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 6px 16px -6px rgba(0,24,63,.55); }
  .btn-primary:hover { background: var(--primary-hover); }
  :root[data-theme="dark"] .btn-primary { box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 8px 22px -8px rgba(236,184,68,.55); }
  .btn-gold { background: var(--gold-gradient); color: #241800; border-color: transparent; box-shadow: 0 1px 0 rgba(255,255,255,.45) inset, 0 8px 20px -8px rgba(200,128,0,.65); }
  .btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
  .btn-ghost:hover { background: var(--surface-3); color: var(--text); }
  .btn-danger { color: var(--st-rej); }
  .btn-sm { height: var(--control-h-sm); padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
  .btn-sm.icon-btn { width: var(--control-h-sm); }
  .btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
  .icon-btn { width: var(--control-h); padding: 0; flex: none; }

  .chip {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 8px; border-radius: 999px;
    font-size: 12px; font-weight: 600; letter-spacing: .005em; white-space: nowrap;
  }
  .chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
  .chip.s-NEW { color: var(--st-new); background: var(--st-new-bg); }
  .chip.s-IN_AUDIT { color: var(--st-audit); background: var(--st-audit-bg); }
  .chip.s-IN_QUARANTINE { color: var(--st-quar); background: var(--st-quar-bg); }
  .chip.s-APPROVED { color: var(--st-ok); background: var(--st-ok-bg); }
  .chip.s-REJECTED { color: var(--st-rej); background: var(--st-rej-bg); }
  .chip.s-PENDING, .chip.s-EXPIRED { color: var(--st-muted); background: var(--st-muted-bg); }
  .tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); }
  .cur { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--text-3); margin-right: 4px; }

  .avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #241800; background: var(--gold-gradient); flex: none; box-shadow: 0 0 0 2px var(--surface); }
  .avatar.navy { background: linear-gradient(135deg, #163d7a, #00183f); color: #fff; }


  /* Tabela (premium: card com filete dourado, cabeçalho em faixa navy, linha com barra de destaque) */
  .table-wrap { overflow-x: auto; }
  /* Dentro do card a faixa do cabeçalho vai de ponta a ponta; o wrap recorta nos cantos do card
     (e, abrindo o card, deixa à mostra o filete dourado de 3px) */
  .card > .table-wrap { --wrap-pad: 0px; padding: 0 0 4px; }
  .card > .table-wrap:first-child { padding-top: 3px; border-top-left-radius: calc(var(--radius-lg) - 1px); border-top-right-radius: calc(var(--radius-lg) - 1px); }
  .card > .table-wrap:last-child { border-bottom-left-radius: calc(var(--radius-lg) - 1px); border-bottom-right-radius: calc(var(--radius-lg) - 1px); }
  .card-pad > .table-wrap { margin-inline: calc(-1 * var(--space-6)); } /* tabela no meio de um card com padding (ex.: formulário) */
  .card > .table-wrap table.data th { border-radius: 0; }
  .card > .table-wrap table.data :is(th, td):first-child { padding-left: var(--space-6); }
  .card > .table-wrap table.data :is(th, td):last-child { padding-right: var(--space-6); }
  .card:has(table.data) { background-image: var(--card-accent); background-repeat: no-repeat; background-size: 100% 3px; }
  /* Lista (tabela no topo do card): painel fino, sem sombra nem filete, cantos e margens menores */
  .card:has(> .table-wrap:first-child) { border-radius: var(--radius-md); box-shadow: none; background-image: none; }
  .card > .table-wrap:first-child { padding-top: 0; border-top-left-radius: calc(var(--radius-md) - 1px); border-top-right-radius: calc(var(--radius-md) - 1px); }
  .card:has(> .table-wrap:first-child) > .table-wrap:last-child { padding-bottom: 0; border-bottom-left-radius: calc(var(--radius-md) - 1px); border-bottom-right-radius: calc(var(--radius-md) - 1px); }
  .card > .table-wrap:first-child table.data :is(th, td):first-child { padding-left: 18px; }
  .card > .table-wrap:first-child table.data :is(th, td):last-child { padding-right: 14px; }
  table.data { width: 100%; border-collapse: separate; border-spacing: 0; }
  table.data th {
    text-align: left; font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--th-text);
    padding: 13px 16px; border: 0; background: var(--th-bg); position: sticky; top: 0; z-index: 1; white-space: nowrap;
  }
  table.data th:first-child { border-radius: 12px 0 0 12px; }
  table.data th:last-child { border-radius: 0 12px 12px 0; }
  table.data th:only-child { border-radius: 12px; }
  table.data td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; transition: background-color .15s, box-shadow .15s; }
  table.data tbody tr:last-child td { border-bottom: 0; }
  table.data tbody tr { cursor: pointer; }
  table.data tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
  table.data tr.selected td { background: color-mix(in srgb, var(--accent) 11%, transparent); }
  table.data tbody tr:hover td:first-child, table.data tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
  table.data tbody tr:hover .row-actions { opacity: 1; }
  .row-actions .row-main { color: var(--accent-strong); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
  .row-actions .row-main:hover { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
  /* Tabela mais larga que a tela: a coluna de ações fica presa à direita, com sombra enquanto há conteúdo por baixo.
     No celular a coluna presa tomaria metade da tela: lá a tabela só rola. */
  @media (min-width: 561px) {
    .table-wrap.x-scroll table.data:has(.row-actions) :is(th, td):last-child { position: sticky; right: calc(-1 * var(--wrap-pad, 0px)); }
    .table-wrap.x-scroll table.data:has(.row-actions) th:last-child { z-index: 2; }
    .table-wrap.x-scroll table.data:has(.row-actions) td:last-child { z-index: 1; background: var(--surface); }
    .table-wrap.x-scroll table.data:has(.row-actions) tbody tr:hover td:last-child { background: linear-gradient(color-mix(in srgb, var(--accent) 6%, transparent) 0 0), var(--surface); }
    .table-wrap.x-scroll table.data:has(.row-actions) tr.selected td:last-child { background: linear-gradient(color-mix(in srgb, var(--accent) 11%, transparent) 0 0), var(--surface); }
    .table-wrap.x-scroll:not(.x-end) table.data:has(.row-actions) :is(th, td):last-child { box-shadow: -14px 0 14px -12px var(--stick-shadow); }
    .table-wrap.x-scroll:not(.x-end) table.data:has(.row-actions) th:last-child { box-shadow: -14px 0 16px -12px var(--stick-shadow); }
  }
  .cur-flag { display: inline-flex; align-items: center; gap: 10px; }
  .flag { position: relative; flex: none; display: inline-block; width: 24px; height: 16px; border-radius: 4px; overflow: hidden; vertical-align: middle; box-shadow: 0 1px 3px rgba(11, 22, 48, .18); }
  .flag svg { display: block; width: 100%; height: 100%; }
  .flag::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); background: linear-gradient(160deg, rgba(255, 255, 255, .32), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, .1)); }
  .t-right { text-align: right !important; }
  .cell-main { font-weight: 600; white-space: nowrap; }
  .cell-sub { font-size: 12px; color: var(--text-3); }
  table.data td .cell-sub { white-space: nowrap; } /* a segunda linha da célula (tipo, filial, unidade) não quebra e não dobra a altura da linha */
  .row-actions { opacity: .0; transition: opacity .15s; display: inline-flex; gap: 4px; }
  .chip { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 16%, transparent); }
  .search { transition: border-color .2s, box-shadow .2s, color .2s; }
  .search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); color: var(--accent); }
  .pager { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
  .pager-size { margin-right: 8px; }
  .pager-btn {
    min-width: 32px; height: 32px; padding: 0 9px; border-radius: 9px; display: inline-grid; place-items: center;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
    transition: background-color .15s, border-color .15s, color .15s, transform .12s;
  }
  .pager-btn svg { width: 16px; height: 16px; }
  .pager-btn:hover:not(:disabled):not([aria-current]) { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
  .pager-btn:active:not(:disabled) { transform: scale(.94); }
  .pager-btn[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 6px 16px -8px var(--primary); cursor: default; }
  .pager-btn:disabled { opacity: .4; cursor: not-allowed; }
  .pager-gap { min-width: 18px; text-align: center; color: var(--text-3); }

  /* Busca premium (componente-busca.js): círculo com anel que estica, com elasticidade, até virar campo */
  .sx {
    position: relative; flex: 0 1 auto; width: 42px; min-width: 42px; max-width: none; height: 42px; padding: 0 11px; gap: 0; overflow: visible; cursor: pointer;
    border-radius: 21px; border: 1.5px solid color-mix(in srgb, var(--accent) 75%, transparent); background: var(--surface); color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft), 0 8px 22px -12px var(--accent);
    transition: width .6s cubic-bezier(.34,1.42,.5,1), border-radius .5s var(--ease), padding .4s var(--ease), border-color .3s, box-shadow .3s, color .3s, transform .2s var(--ease);
  }
  .sx > :first-child { display: grid; place-items: center; flex: none; }
  .sx > :first-child, .sx > :first-child svg { width: 18px; height: 18px; }
  .sx::after { content: ""; position: absolute; inset: -6px; border-radius: inherit; border: 1.5px solid var(--accent); opacity: 0; pointer-events: none; animation: sx-pulse 2.8s var(--ease) infinite; }
  .sx:not(.open):hover { transform: scale(1.07); }
  .sx input { flex: 1 1 0; width: 0; min-width: 0; height: 100%; opacity: 0; transform: translateX(-6px); transition: opacity .25s .12s, transform .35s .12s var(--ease); }
  .sx.open { width: 520px; cursor: text; gap: 10px; padding: 0 6px 0 13px; border-radius: 14px; color: var(--text-3); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
  .sx.open::after { display: none; }
  .sx.open input { opacity: 1; transform: none; }
  .sx.open.focus { color: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), 0 14px 34px -14px var(--accent); }
  .list-tools .sx.open { width: 300px; }
  .sx input:focus, .sx input:focus-visible { outline: none; box-shadow: none; }
  .sx input::-webkit-search-cancel-button { display: none; }
  .sx > .kbd { display: none; }
  .sx.open:not(.focus):not(.has-value) > .kbd { display: inline-block; }
  .sx-clear { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--text-3); transition: background-color .15s, color .15s, transform .15s; }
  .sx-clear svg { width: 16px; height: 16px; }
  .sx-clear:hover { background: var(--accent-soft); color: var(--accent); transform: rotate(90deg); }
  .sx-clear[hidden], .sx:not(.open) .sx-clear { display: none; }
  .sx-dots { position: absolute; inset: -9px -4px; pointer-events: none; display: none; }
  .sx.focus .sx-dots { display: block; }
  .sx-dots i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .55; animation: sx-dot-in .5s var(--ease) both, sx-float 3.4s ease-in-out .5s infinite; }
  .sx-dots i:nth-child(1) { left: 16%; top: 0; }
  .sx-dots i:nth-child(2) { left: 47%; top: -3px; width: 7px; height: 7px; opacity: .35; animation-delay: .08s, 1.1s; }
  .sx-dots i:nth-child(3) { right: 12%; top: 2px; animation-delay: .14s, .8s; }
  .sx-dots i:nth-child(4) { left: 30%; bottom: 0; width: 4px; height: 4px; animation-delay: .2s, 1.4s; }
  .sx-dots i:nth-child(5) { right: 30%; bottom: -2px; width: 6px; height: 6px; opacity: .4; animation-delay: .26s, .6s; }
  .sx-hint { position: absolute; left: 50%; top: calc(100% + 9px); transform: translateX(-50%); display: none; align-items: center; gap: 6px; z-index: 2; white-space: nowrap; pointer-events: none; font-size: 11.5px; color: var(--text-3); }
  .sx.focus .sx-hint { display: inline-flex; animation: sx-hint-in .3s .2s var(--ease) both; }
  @media (hover: none), (max-width: 560px) { .sx.focus .sx-hint { display: none; } }
  .sx-init, .sx-init * { transition: none !important; }
  @keyframes sx-pulse { 0% { opacity: .55; transform: scale(.88); } 70%, 100% { opacity: 0; transform: scale(1.3); } }
  @keyframes sx-dot-in { from { opacity: 0; transform: scale(0); } }
  @keyframes sx-float { 50% { transform: translateY(-5px); } }
  @keyframes sx-hint-in { from { opacity: 0; transform: translate(-50%, -4px); } }

  .table-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; color: var(--text-3); font-size: 12.5px; flex-wrap: wrap; gap: 10px; }

  /* KPI */
  .kpi { position: relative; overflow: hidden; padding: 20px 22px; }
  .kpi-label { font-size: 12.5px; color: var(--text-2); font-weight: 560; display: flex; align-items: center; gap: 8px; }
  .kpi-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
  .kpi-icon svg { width: 16px; height: 16px; }
  .kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 12px; }
  .kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12.5px; color: var(--text-3); }
  .delta { font-weight: 650; font-size: 12px; padding: 1px 6px; border-radius: 6px; }
  .delta.up { color: var(--st-ok); background: var(--st-ok-bg); }
  .delta.down { color: var(--st-rej); background: var(--st-rej-bg); }
  .kpi .spark { display: block; width: 100%; height: 34px; margin-top: 12px; opacity: .9; }
  .kpi.feature { background: linear-gradient(160deg, #0a2a5c 0%, #00183f 60%, #000c22 100%); color: #fff; border-color: rgba(255,255,255,.06); }
  .kpi.feature .kpi-label, .kpi.feature .kpi-foot { color: rgba(255,255,255,.7); }
  .kpi.feature::after { content: ""; position: absolute; inset: auto -40px -80px auto; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(236,184,68,.35), transparent 65%); }

  .queue { display: flex; flex-direction: column; }
  .queue-item { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-top: 1px solid var(--border); text-decoration: none; color: inherit; transition: background .15s; }
  .queue-item:first-child { border-top: 0; }
  .queue-item:hover { background: var(--surface-2); }
  .queue-count { margin-left: auto; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
  .bar-split { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; margin-top: 6px; }
  .bar-split span { display: block; height: 100%; }

  .timeline { list-style: none; margin: 0; padding: 0; position: relative; }
  .timeline li { position: relative; padding: 0 0 18px 28px; }
  .timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: -2px; width: 1px; background: var(--border-strong); }
  .timeline li:last-child::before { display: none; }
  .tl-dot { position: absolute; left: 0; top: 3px; width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); background: var(--surface-3); }
  .tl-dot.ok { background: var(--st-ok); } .tl-dot.warn { background: var(--st-quar); } .tl-dot.info { background: var(--st-audit); } .tl-dot.new { background: var(--st-new); }
  .tl-title { font-weight: 600; font-size: 13.5px; }
  .tl-meta { font-size: 12px; color: var(--text-3); }


  .compare { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 12px; }
  .compare .box { padding: 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
  .compare .box.hl { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
  .compare .lbl { font-size: 12px; color: var(--text-3); font-weight: 560; }
  .compare .val { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
  .compare .op { color: var(--text-3); font-size: 18px; }

  .file { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
  .file-ic { width: 38px; height: 46px; border-radius: 6px; background: linear-gradient(180deg, #fff, #f1f3f7); border: 1px solid var(--border-strong); display: grid; place-items: end center; padding-bottom: 6px; font-size: 9px; font-weight: 800; color: #b91c1c; position: relative; }
  :root[data-theme="dark"] .file-ic { background: linear-gradient(180deg, #1b2a45, #13223d); }
  .file-ic::before { content: ""; position: absolute; top: -1px; right: -1px; width: 12px; height: 12px; background: linear-gradient(225deg, var(--bg) 50%, var(--border-strong) 50%); border-top-right-radius: 6px; }

  .callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--st-quar) 30%, transparent); background: var(--st-quar-bg); }
  .callout svg { color: var(--st-quar); flex: none; width: 20px; height: 20px; margin-top: 1px; }
  .callout.info { border-color: color-mix(in srgb, var(--st-new) 25%, transparent); background: var(--st-new-bg); }
  .callout.info svg { color: var(--st-new); }
  .callout.ok { border-color: color-mix(in srgb, var(--st-ok) 28%, transparent); background: var(--st-ok-bg); }
  .callout.ok svg { color: var(--st-ok); }

  .actionbar { position: sticky; bottom: 76px; z-index: 15; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); margin-top: var(--space-6); }
  /* esquerda: ações de apoio (log, excluir), discretas; direita: as do fluxo */
  .ab-side { display: flex; align-items: center; gap: 4px; }
  .ab-side .btn { color: var(--text-2); }
  .ab-side .btn:hover { color: var(--text); }
  .ab-side .btn.btn-danger { color: var(--st-rej); }
  .ab-flow { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }

  /* Diálogo — padrão premium (aprovado em 24/11/2026, docs/veritas-2/padrao-modais): cabeçalho com ícone na faixa
     navy e filete dourado, corpo que rola, pé fixo com as ações; no celular, folha que sobe do pé. */
  dialog.modal { border: 0; padding: 0; background: transparent; color: var(--text); width: calc(100% - 32px); max-width: 560px; max-height: calc(100dvh - 48px); overflow: visible; }
  dialog.modal.sm { max-width: 440px; }
  dialog.modal.wide, dialog.modal.lg { max-width: 760px; }
  dialog.modal.xl { max-width: 980px; }
  dialog.modal::backdrop { background: radial-gradient(120% 80% at 50% 0%, rgba(13,50,112,.45), rgba(0,12,34,.72)); -webkit-backdrop-filter: blur(6px) saturate(1.1); backdrop-filter: blur(6px) saturate(1.1); }
  dialog.modal[open] { animation: modal-in .26s var(--ease); }
  dialog.modal[open]::backdrop { animation: modal-fade .26s var(--ease); }
  dialog.modal.closing { animation: modal-out .16s ease-in forwards; }
  dialog.modal.closing::backdrop { animation: modal-fade .16s ease-in reverse forwards; }
  @keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
  @keyframes modal-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }
  @keyframes modal-fade { from { opacity: 0; } }
  @keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

  .modal-card { position: relative; display: flex; flex-direction: column; max-height: calc(100dvh - 48px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 20px; overflow: hidden;
    box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 30px 80px -24px rgba(0,12,34,.55), 0 8px 24px -12px rgba(0,12,34,.3); }
  :root[data-theme="dark"] .modal-card { box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 30px 80px -20px rgba(0,0,0,.8); }
  .modal-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--card-accent); z-index: 2; }
  .modal.tone-danger .modal-card::before { background: linear-gradient(90deg, #dc2626, rgba(220,38,38,0)); }

  .modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
  .modal-head h3 { font-size: 17px; font-weight: 680; letter-spacing: -.012em; line-height: 1.3; overflow-wrap: anywhere; }
  .modal-head p { font-size: 13px; color: var(--text-2); margin-top: 3px; }
  .modal-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
  .modal-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--th-bg); color: var(--brand-gold-400); box-shadow: 0 10px 22px -12px rgba(0,24,63,.7), inset 0 1px 0 rgba(255,255,255,.12); }
  .modal-icon svg { width: 21px; height: 21px; }
  .modal-icon:is(.danger, .warn, .quar, .ok, .audit) { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 25%, transparent); }
  .modal-icon.danger { background: var(--st-rej-bg); color: var(--st-rej); }
  .modal-icon:is(.warn, .quar) { background: var(--st-quar-bg); color: var(--st-quar); }
  .modal-icon.ok { background: var(--st-ok-bg); color: var(--st-ok); }
  .modal-icon.audit { background: var(--st-audit-bg); color: var(--st-audit); }
  .modal-x { width: 32px; height: 32px; margin: -4px -6px 0 0; border-radius: 10px; border: 0; background: transparent; color: var(--text-3); display: grid; place-items: center; cursor: pointer; flex: none; transition: background .2s, color .2s; }
  .modal-x:hover { background: var(--surface-3); color: var(--text); }
  .modal-x:focus-visible { outline: none; box-shadow: var(--focus); }
  .modal-x svg { width: 17px; height: 17px; }

  .modal-body { padding: 18px 22px 20px; overflow: auto; display: flex; flex-direction: column; gap: 16px; overscroll-behavior: contain;
    background: linear-gradient(var(--surface) 30%, transparent) top / 100% 24px no-repeat local, linear-gradient(transparent, var(--surface) 70%) bottom / 100% 24px no-repeat local,
      radial-gradient(farthest-side at 50% 0, rgba(11,27,51,.12), transparent) top / 100% 8px no-repeat scroll, radial-gradient(farthest-side at 50% 100%, rgba(11,27,51,.12), transparent) bottom / 100% 8px no-repeat scroll; }
  .modal-sect { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); display: flex; align-items: center; gap: 10px; }
  .modal-sect::after { content: ""; flex: 1; height: 1px; background: var(--border); }
  .modal-type code { font-weight: 700; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }

  .modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 13px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
  :root[data-theme="dark"] .modal-foot { background: color-mix(in srgb, var(--surface-3) 50%, var(--surface)); }
  .modal-note { flex: 1 1 0; min-width: 0; font-size: 12px; line-height: 1.4; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
  .modal-note svg { width: 14px; height: 14px; }
  .modal-foot .spacer { flex: 1; }
  .btn.is-loading { pointer-events: none; }
  .btn.is-loading .spinner { width: 14px; height: 14px; border-color: color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; }

  /* Fechar com alteração pendente: a pergunta aparece no próprio pé, sem abrir outro diálogo */
  .modal-guard { display: none; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; font-size: 13px; color: var(--st-quar); font-weight: 600; }
  .modal-guard svg { width: 17px; height: 17px; flex: none; }
  .modal-guard > span { flex: 1 1 160px; min-width: 0; }
  .modal-guard .btn { flex: none; }
  .modal-card.guarding .modal-guard { display: flex; }
  .modal-card.guarding .modal-foot > :not(.modal-guard) { display: none; }
  .modal-card.guarding .modal-foot { background: var(--st-quar-bg); }

  /* Confirmação sem corpo: centrada, botões do mesmo tamanho */
  .modal.confirm .modal-card { text-align: center; }
  .modal.confirm .modal-head { flex-direction: column; align-items: center; gap: 12px; border: 0; background: none; padding: 28px 26px 18px; }
  .modal.confirm .modal-icon { width: 56px; height: 56px; border-radius: 18px; }
  .modal.confirm .modal-icon svg { width: 26px; height: 26px; }
  .modal.confirm .modal-x { position: absolute; top: 12px; right: 12px; margin: 0; }
  .modal.confirm .modal-body:not(:has(> :not([hidden]))) { display: none; }
  .modal.confirm .modal-foot { border: 0; background: none; padding: 0 26px 24px; }
  .modal.confirm .modal-foot .btn { flex: 1; }

  @media (max-width: 640px) {
    dialog.modal, dialog.modal.sm, dialog.modal.lg, dialog.modal.wide, dialog.modal.xl { width: 100%; max-width: none; margin: auto 0 0; max-height: 92dvh; }
    .modal-card { border-radius: 20px 20px 0 0; max-height: 92dvh; border-bottom: 0; }
    .modal-card::after { content: ""; position: absolute; top: 7px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: var(--border-strong); z-index: 3; }
    dialog.modal[open] { animation: modal-up .3s var(--ease); }
    dialog.modal.closing { animation: modal-down .2s ease-in forwards; }
    .modal-head { padding: 22px 18px 14px; }
    .modal-body { padding: 16px 18px; }
    .modal-foot { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
    .modal-foot > .btn { flex: 1; }
    .modal-note { display: none; }
  }
  @keyframes modal-up { from { transform: translateY(100%); } }
  @keyframes modal-down { to { transform: translateY(100%); } }
  .savings-preview { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); }

  .toast { position: fixed; right: 16px; bottom: 84px; max-width: calc(100vw - 32px); z-index: 60; display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); transform: translateY(20px); opacity: 0; pointer-events: none; transition: all .25s var(--ease); }
  .toast.show { transform: none; opacity: 1; }
  .toast .ok { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--st-ok-bg); color: var(--st-ok); }

  /* Idioma (languageMenu): mesmo corpo dos botões do topo; o painel usa o .cb-pop dos combos */
  .lang-btn { display: inline-flex; align-items: center; gap: 8px; height: var(--control-h); padding: 0 6px 0 11px; border-radius: 10px; border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-sm); cursor: pointer;
    transition: background .2s var(--ease), border-color .2s, box-shadow .2s; }
  .lang-btn:hover { background: var(--surface-2); }
  .lang-btn:focus-visible, .lang-btn.open { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--field-ring); }
  .lang-btn .flag { width: 20px; height: 14px; }
  .lang-chev { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--text-3); transition: transform .3s var(--ease), color .2s; }
  .lang-chev svg { width: 15px; height: 15px; }
  .lang-btn.open .lang-chev { transform: rotate(180deg); color: var(--accent); }
  .lang-pop { min-width: 190px; }
  .lang-pop .cb-list:focus { outline: 0; } /* o foco aparece na opção destacada, não no painel */
  .lang-pop .flag { width: 22px; height: 15px; }

}

@layer screens {
  /* Login: cena única escura (globo, avião, navio, caminhão, porto) com o texto à esquerda e o cartão de vidro à direita.
     A página fica sempre no visual escuro; todas as telas de acesso (senha, 2FA, cadastro do 2FA, convite) usam o mesmo cartão. */
  .login {
    --bg: #020b1d; --surface: #0b1730; --surface-2: rgba(6,18,42,.72); --surface-3: #142a4f;
    --text: #eef3fb; --text-2: #b4c1d8; --text-3: #8392ad;
    --border: rgba(120,170,255,.14); --border-strong: rgba(120,170,255,.26);
    --accent: var(--brand-gold-400); --accent-strong: var(--brand-gold-200); --accent-soft: rgba(236,184,68,.14);
    --primary: var(--brand-gold-400); --primary-hover: #f3c862; --on-primary: #1a1200; --on-accent: #1a1200;
    --focus: 0 0 0 3px rgba(236,184,68,.45), 0 0 0 1px var(--brand-gold-400);
    --field-bg: rgba(4,14,34,.62); --field-bg-quiet: rgba(4,14,34,.5); --field-border: rgba(120,170,255,.28); --field-border-hover: rgba(140,185,255,.5);
    --field-ring: rgba(236,184,68,.2); --field-inset: inset 0 1px 2px rgba(0,0,0,.35); --field-lift: 0 1px 0 rgba(255,255,255,.03); --field-shadow: none; --field-disabled: #0d1a31;
    --st-ok: #4fd1a5; --st-ok-bg: rgba(16,185,129,.14); --st-rej: #ff8a8a; --st-rej-bg: rgba(248,113,113,.14); --st-quar: #f5b24a; --st-quar-bg: rgba(245,158,11,.14);
    color-scheme: dark;
    position: relative; isolation: isolate; overflow: hidden; min-height: 100vh; color: var(--text);
    display: grid; grid-template-rows: auto 1fr auto; padding: 32px 56px 28px; gap: 16px;
    background:
      radial-gradient(900px 600px at 42% 40%, rgba(26,78,170,.45), transparent 65%),
      radial-gradient(700px 500px at 100% 0%, rgba(22,61,122,.55), transparent 60%),
      linear-gradient(180deg, #04122e 0%, #020b1d 60%, #010714 100%);
  }
  .login[hidden] { display: none; }
  .login-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
  .login-scene {
    position: absolute; left: 17%; top: 50%; transform: translateY(-52%); height: min(92vh, 900px); width: auto; max-width: none;
    -webkit-mask-image: radial-gradient(closest-side at 50% 46%, #000 58%, transparent 100%); mask-image: radial-gradient(closest-side at 50% 46%, #000 58%, transparent 100%);
  }
  .login-waves { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 30vh; }
  .login-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
  .login-brand { height: 60px; width: auto; }
  .login-top .lang-btn, .login-top .icon-btn { background: rgba(4,14,34,.55); border-color: rgba(255,255,255,.28); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .login-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 470px); align-items: center; gap: 40px; }
  .login-quote { align-self: end; margin-bottom: 9vh; max-width: 440px; text-shadow: 0 2px 18px rgba(0,8,23,.85); }
  .login-quote h1 { font-family: var(--font-display); font-weight: 400; font-size: 44px; line-height: 1.12; letter-spacing: -0.01em; color: #fff; }
  .login-quote h1 em { font-style: italic; background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; }
  .login-quote h1::after { content: ""; display: block; width: 70px; height: 3px; border-radius: 3px; margin-top: 18px; background: var(--brand-gold-400); }
  .login-quote p { margin-top: 18px; color: rgba(255,255,255,.82); font-size: 15px; line-height: 1.55; }
  .login-stats { display: flex; margin-top: 30px; }
  .login-stats div { padding: 0 26px; border-left: 1px solid rgba(255,255,255,.28); }
  .login-stats div:first-child { padding-left: 0; border-left: 0; }
  .login-stats div strong { display: block; font-size: 22px; font-weight: 700; color: #fff; }
  .login-stats div span { font-size: 12.5px; color: rgba(255,255,255,.72); }
  .login-card {
    position: relative; border-radius: 26px; padding: 18px 40px; margin-bottom: 6vh;
    background: linear-gradient(160deg, rgba(14,40,92,.62), rgba(4,16,40,.72));
    border: 1px solid rgba(90,150,255,.42);
    box-shadow: 0 0 0 1px rgba(255,255,255,.04) inset, 0 0 32px -4px rgba(56,130,255,.55), 0 30px 70px -20px rgba(0,0,0,.8);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }
  .login-card::before { content: ""; position: absolute; left: 12%; right: 12%; top: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, #6fb0ff, transparent); }
  .login-card .btn-primary { background: linear-gradient(180deg, #f6cf6a 0%, #e2aa36 100%); color: #1a1200; }
  .login-card .btn-primary:hover { background: linear-gradient(180deg, #fad97f 0%, #e9b444 100%); }
  .login-card .btn:not(.btn-primary):not(.btn-ghost) { background: rgba(4,14,34,.55); border-color: var(--border-strong); color: var(--text); }
  .login-card .choice { background: rgba(4,14,34,.45); }
  .login-card .otp input { background: var(--field-bg); border-color: var(--field-border); }
  .login-card .otp input.filled { background: rgba(10,30,66,.8); }
  .login-card .link { color: var(--brand-gold-400); font-weight: 600; }
  .login-form[hidden] { display: none; }
  .login-quote { position: relative; max-width: 560px; }
  .login-quote h1 { font-family: var(--font-display); font-weight: 400; font-size: 44px; line-height: 1.04; letter-spacing: -0.01em; }
  .login-quote h1 em { font-style: italic; background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .login-quote p { margin-top: 12px; color: rgba(255,255,255,.7); font-size: 15px; max-width: 440px; }
  .login-stats { position: relative; display: flex; gap: 36px; margin-top: 22px; }
  .login-stats div strong { display: block; font-size: 22px; font-weight: 700; }
  .login-stats div span { font-size: 12px; color: rgba(255,255,255,.55); }
  .login-form { margin: auto; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
  .login-form h2 { font-size: 28px; letter-spacing: -0.025em; }
  .otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
  .otp input { width: 100%; min-width: 0; height: 54px; text-align: center; font-size: 22px; font-weight: 700; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); }
  .otp input:focus { outline: none; box-shadow: var(--focus); }
  /* Efeito de digitação e "dobra" ao completar (telas-acesso.js → bindOtp / foldOtp) */
  .otp { position: relative; align-content: start; transition: height .42s var(--ease); }
  .otp input { caret-color: var(--accent); transition: border-color .2s var(--ease), box-shadow .25s var(--ease), background-color .2s var(--ease), color .2s var(--ease); }
  .otp input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), 0 8px 22px -10px var(--accent); }
  .otp input.filled { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); background: var(--surface); }
  .otp input.pop { animation: otp-pop .36s var(--ease) both; }
  @keyframes otp-pop {
    0% { transform: translateY(8px) scale(.86); box-shadow: 0 0 0 0 var(--accent-soft); }
    55% { transform: translateY(-3px) scale(1.06); box-shadow: 0 0 0 7px var(--accent-soft); }
    100% { transform: none; }
  }
  .otp-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; color: var(--accent); transition: color .3s var(--ease), opacity .3s var(--ease); }
  .otp-links line { stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .3s var(--ease); }
  .otp.linked .otp-links line { stroke-dashoffset: 0; }
  .otp.folded input { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 22px -8px var(--accent); }
  .otp.ok .otp-links { color: var(--st-ok); }
  .otp.ok input { border-color: var(--st-ok); color: var(--st-ok); box-shadow: 0 0 0 3px var(--st-ok-bg), 0 0 24px -6px var(--st-ok); }
  .otp.bad .otp-links { color: var(--st-rej); }
  .otp.bad input { border-color: var(--st-rej); color: var(--st-rej); box-shadow: 0 0 0 3px var(--st-rej-bg), 0 0 20px -8px var(--st-rej); }
  .otp-done { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 18px; display: grid; place-items: center; border: 1.5px solid var(--st-ok); background: var(--st-ok-bg); color: var(--st-ok); box-shadow: 0 0 0 6px var(--st-ok-bg), 0 0 36px -6px var(--st-ok); }
  .otp-done svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
  .otp-done path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: otp-check .42s .18s var(--ease) forwards; }
  @keyframes otp-check { to { stroke-dashoffset: 0; } }
  .otp-spark { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: var(--st-ok); opacity: 0; pointer-events: none; }

  @media (min-width: 560px) { .filter-grid .span-2 { grid-column: span 2; } }

  .login-foot { font-size: 12px; color: rgba(255,255,255,.75); display: flex; justify-content: flex-end; gap: 14px; }
  .login-foot span + span { padding-left: 14px; border-left: 1px solid rgba(255,255,255,.35); }
  .logo-themed .logo-on-dark { display: none; }
  :root[data-theme="dark"] .logo-themed .logo-on-light { display: none; }
  :root[data-theme="dark"] .logo-themed .logo-on-dark { display: inline; }

  /* Guia visual */
  .swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .swatch { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
  .swatch div { height: 76px; }
  .swatch p { padding: 10px 12px; font-size: 12px; color: var(--text-2); }
  .swatch strong { display: block; color: var(--text); font-size: 12.5px; }
  .type-sample { display: flex; align-items: baseline; gap: 18px; padding: 12px 0; border-top: 1px solid var(--border); }
  .type-sample span { width: 120px; flex: none; font-size: 12px; color: var(--text-3); }
  .principle { display: flex; gap: 14px; }
  .principle .n { font-family: var(--font-display); font-size: 34px; line-height: 1; color: var(--accent); width: 34px; flex: none; }

  .cover { position: relative; overflow: hidden; border-radius: 28px; padding: 56px; color: #fff;
    background: radial-gradient(700px 420px at 100% 0%, rgba(236,184,68,.25), transparent 60%), linear-gradient(150deg, #0a2a5c, #00183f 55%, #000817); }
  .cover h1 { font-family: var(--font-display); font-weight: 400; font-size: 60px; line-height: 1.02; max-width: 760px; }
  .cover h1 em { background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .cover p { color: rgba(255,255,255,.72); max-width: 640px; margin-top: 18px; font-size: 16px; }
  .cover .meta { display: flex; gap: 28px; margin-top: 36px; flex-wrap: wrap; }
  .cover .meta div span { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.45); }
  .cover .meta div strong { font-weight: 600; }
  .shot-grid a { text-decoration: none; color: inherit; }
  .shot { padding: 20px; transition: transform .2s var(--ease), box-shadow .2s var(--ease); height: 100%; }
  .shot:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
  .shot .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }

  .deadline { display: flex; align-items: center; gap: 10px; }
  .ring { --p: 50; width: 44px; height: 44px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); display: grid; place-items: center; }
  .ring::after { content: attr(data-label); width: 34px; height: 34px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 10.5px; font-weight: 700; }
}

@layer utilities {
  .muted { color: var(--text-3); }
  .text-2 { color: var(--text-2); }
  .small { font-size: 12.5px; }
  .strong { font-weight: 650; }
  .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
  .gap-2 { gap: 8px; } .gap-4 { gap: 16px; }
  .wrap { flex-wrap: wrap; }
  .hide-sm { }
}

.menu-btn { display: none; }
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2-1, .grid-1-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .25s var(--ease); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .side-toggle, .side-tip { display: none !important; }
  .menu-btn { display: inline-flex !important; }
  .topbar { padding: 10px 16px; min-height: 60px; }
  .top-crumb, .top-title .page-sub { display: none; }
  .dt-line { flex-wrap: wrap; row-gap: 2px; } /* no celular, o selo de status desce para a linha do subtítulo (que some) */
  .dt-line .page-title { max-width: 100%; }
  .dt-line .chip { height: 20px; font-size: 11px; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .dt-back { width: 30px; height: 30px; }
  .top-title .page-title { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .content { padding: 16px 16px 96px; }
  .login { padding: 20px 16px 24px; grid-template-columns: minmax(0, 1fr); }
  .login-brand { height: 44px; min-width: 0; max-width: calc(100% - 120px); object-fit: contain; object-position: left center; }
  .login-body { grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
  .login-scene { left: 50%; top: 0; transform: translateX(-50%); height: 62vh; opacity: .55; }
  .login-quote { display: none; }
  .login-card { padding: 8px 20px; margin: 8vh 0 0; }
  .login-foot { justify-content: center; }
  .compare { grid-template-columns: 1fr; }
  .compare .op { display: none; }
  .cover { padding: 32px 22px; } .cover h1 { font-size: 38px; }
  .hide-sm { display: none !important; }
  .kbd { display: none; }
  .actionbar { flex-wrap: wrap; padding: 12px; bottom: 72px; }
  .ab-flow { flex: 1 1 auto; }
  .ab-flow .btn { flex: 1 1 auto; }
  .ab-side .btn { font-size: 0; gap: 0; padding: 0 9px; } /* no celular, só o ícone (o texto segue para leitores de tela) */
  .actionbar .spacer { display: none; }
  .type-sample { flex-wrap: wrap; gap: 4px; }
  .type-sample > span:first-child { width: 100%; }
  .type-sample > *:last-child { overflow-wrap: anywhere; flex: 1 1 100%; min-width: 0; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .lang-btn .lang-name { display: none; } /* o título da página precisa do espaço: no celular, só a bandeira */
  .lang-btn { padding-left: 9px; }
  .dt-back { display: none; } /* no celular o título precisa do espaço; volta-se pelo menu ou pelo voltar do navegador */
  .topbar-actions { gap: 4px; }
  .kpi-value { font-size: 26px; }
}

/* Histórico e conversa (doc 23) */
@layer components {
  .msg-body { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; background: var(--surface-2); }
  .msg-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 12.5px; }
  .msg-head .tag svg { width: 12px; height: 12px; margin-right: 4px; }
  .tag-warn { color: var(--st-quar); background: var(--st-quar-bg); border-color: transparent; }
  .msg-text { margin: 6px 0 0; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
  .msg-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  .msg-files:empty { display: none; } /* sem anexos, a lista não ocupa espaço (o botão Anexar fica alinhado com o Enviar) */
  .fpill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; font-weight: 600; color: var(--text); text-decoration: none; }
  .fpill > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .fpill svg { width: 14px; height: 14px; flex: none; color: var(--text-3); }
  a.fpill:hover { border-color: var(--border-strong); background: var(--surface-2); }
  .fpill-x { border: 0; background: transparent; padding: 0; display: grid; place-items: center; color: var(--text-3); cursor: pointer; }
  .msg-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 11.5px; color: var(--text-3); }
  .msg-foot span { display: inline-flex; align-items: center; gap: 4px; }
  .msg-foot svg { width: 13px; height: 13px; }
  /* cor de cada tom (status do documento) */
  .hx .tone-new { --c: var(--st-new); } .hx .tone-audit { --c: var(--st-audit); } .hx .tone-quar { --c: var(--st-quar); }
  .hx .tone-ok { --c: var(--st-ok); } .hx .tone-rej { --c: var(--st-rej); } .hx .tone-muted { --c: var(--st-muted); }
  .hx-head .card-sub { margin-top: 2px; }

  /* etapas do documento */
  .hx-jr { display: flex; align-items: flex-start; padding: 20px 24px 18px; background: var(--surface-2); border-block: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
  .hx-jr-step { flex: none; width: 116px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; }
  .hx-jr-dot { width: 28px; height: 28px; margin-bottom: 5px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--c); box-shadow: 0 0 0 4px var(--surface-2), 0 0 0 5px color-mix(in srgb, var(--c) 30%, transparent); }
  :root[data-theme="dark"] .hx-jr-dot { color: var(--surface); }
  .hx-jr-dot svg { width: 14px; height: 14px; stroke-width: 2.6; }
  .hx-jr-step.now .hx-jr-dot { position: relative; background: var(--surface); color: var(--c); border: 2px solid var(--c); }
  .hx-jr-step.todo .hx-jr-dot { background: var(--surface); color: var(--text-3); border: 1.5px dashed var(--border-strong); box-shadow: 0 0 0 4px var(--surface-2); }
  .hx-jr-name { font-size: 12.5px; font-weight: 640; }
  .hx-jr-step.todo .hx-jr-name { color: var(--text-3); font-weight: 600; }
  .hx-jr-when { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
  .hx-jr-now { margin-top: 3px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 11%, transparent); font-variant-numeric: tabular-nums; }
  .hx-jr-link { --from: var(--border-strong); --to: var(--border-strong); flex: 1; min-width: 56px; height: 2px; margin-top: 13px; position: relative; border-radius: 2px; background: linear-gradient(90deg, var(--from), var(--to)); }
  .hx-jr-link.from-new { --from: var(--st-new); } .hx-jr-link.from-audit { --from: var(--st-audit); } .hx-jr-link.from-quar { --from: var(--st-quar); }
  .hx-jr-link.to-audit { --to: var(--st-audit); } .hx-jr-link.to-quar { --to: var(--st-quar); } .hx-jr-link.to-ok { --to: var(--st-ok); } .hx-jr-link.to-rej { --to: var(--st-rej); } .hx-jr-link.to-muted { --to: var(--st-muted); }
  .hx-jr-link.todo { height: 0; background: none; border-top: 2px dashed var(--border-strong); }
  .hx-jr-link span { position: absolute; left: 50%; bottom: 7px; transform: translateX(-50%); white-space: nowrap; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
  .hx-jr-link.todo span { color: var(--text-3); font-weight: 500; }

  /* linha do tempo: hora | trilho | conteúdo */
  .hx-pad { padding-top: 22px; }
  .hx-list, .hx-cycle { list-style: none; margin: 0; padding: 0; }
  .hx-row { display: grid; grid-template-columns: 58px 34px minmax(0, 1fr); column-gap: 14px; animation: hx-in .45s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 40ms); }
  .hx-time { padding-top: 8px; text-align: right; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
  .hx-rail { position: relative; display: flex; justify-content: center; }
  .hx-rail::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--border-strong); }
  .hx-list > .hx-row:first-child > .hx-rail::before { top: 9px; }
  .hx-node { position: relative; z-index: 1; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--c, var(--st-muted)); background: color-mix(in srgb, var(--c, var(--st-muted)) 13%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c, var(--st-muted)) 32%, transparent); box-shadow: 0 0 0 4px var(--hx-bg, var(--surface)); }
  .hx-node svg { width: 16px; height: 16px; }
  .hx-avatar { font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: #241800; background: var(--gold-gradient); border: 0; }
  .hx-avatar.party { color: #fff; background: var(--st-new); }
  :root[data-theme="dark"] .hx-avatar.party { color: var(--surface); }
  .hx-body { min-width: 0; padding: 6px 0 20px; }
  .hx-title { font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
  .hx-title strong, .hx-big strong { color: var(--text); font-weight: 640; }
  .hx-sub { display: flex; flex-wrap: wrap; gap: 4px 0; margin-top: 3px; font-size: 12px; color: var(--text-3); }
  .hx-sub span + span::before { content: "·"; margin: 0 8px; }
  .hx-trans { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
  .hx-trans > svg { width: 14px; height: 14px; color: var(--text-3); }
  .hx-st { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 640; color: var(--c); background: color-mix(in srgb, var(--c) 11%, transparent); }
  .hx-st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .hx-quote { margin-top: 8px; padding: 9px 13px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--c, var(--border-strong)); font-size: 13px; line-height: 1.5; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
  .hx-quote b { display: block; margin-bottom: 2px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); white-space: normal; }
  .hx-amount { display: inline-flex; align-items: baseline; gap: 8px; margin-top: 8px; padding: 6px 12px; border-radius: 10px; background: color-mix(in srgb, var(--st-ok) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--st-ok) 25%, transparent); }
  .hx-amount small { font-size: 11.5px; color: var(--text-3); }
  .hx-amount strong { font-size: 15px; color: var(--st-ok); font-variant-numeric: tabular-nums; }

  /* dia e intervalo entre eventos */
  .hx-day .hx-body { padding: 2px 0 14px; display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
  .hx-day .hx-body::after { content: ""; flex: 1; height: 1px; background: var(--border); }
  .hx-day .hx-rail::after { content: ""; position: relative; z-index: 1; margin-top: 4px; width: 10px; height: 10px; border-radius: 3px; transform: rotate(45deg); background: var(--hx-bg, var(--surface)); border: 2px solid var(--border-strong); }
  .hx-gap { min-height: 26px; }
  .hx-gap .hx-time { padding-top: 4px; font-size: 11px; font-style: italic; white-space: nowrap; }
  .hx-gap.long .hx-rail::before { width: 0; background: none; border-left: 2px dashed var(--border-strong); }
  .hx-gap .hx-body { padding: 0; }

  /* mensagens */
  .hx-msg .msg-body { padding: 11px 14px 10px; border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; background: var(--surface-2); }
  .hx-msg.party .msg-body { background: color-mix(in srgb, var(--st-new) 6%, var(--surface)); border-color: color-mix(in srgb, var(--st-new) 24%, transparent); }
  .hx-msg.internal .msg-body { background: var(--surface); border-style: dashed; border-color: var(--border-strong); }

  /* ciclo de quarentena */
  .hx-cyclewrap { margin: 0 -14px; animation: hx-in .45s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 40ms); }
  .hx-cycle { --hx-bg: color-mix(in srgb, var(--st-quar) 5%, var(--surface)); padding: 0 14px 4px; border-radius: 16px; background: var(--hx-bg); border: 1px solid color-mix(in srgb, var(--st-quar) 22%, transparent); }
  .hx-cycle .hx-row { animation: none; }
  .hx-cycle-head .hx-body { padding: 12px 0 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
  .hx-cycle-title { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--st-quar); }
  .hx-cycle-meta { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
  .hx .tag-ok { color: var(--st-ok); background: var(--st-ok-bg); border-color: transparent; }

  /* agora / fim */
  .hx-now .hx-rail::before, .hx-end .hx-rail::before { bottom: 50%; }
  .hx-now .hx-node { background: var(--surface); border: 2px solid var(--c); }
  .hx-now .hx-node i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
  .hx-now .hx-node::after, .hx-jr-step.now .hx-jr-dot::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--c); opacity: 0; animation: hx-pulse 2.2s ease-out infinite; }
  .hx-now .hx-time { color: var(--c); font-weight: 600; }
  .hx-end .hx-node { color: #fff; background: var(--c); border: 0; }
  :root[data-theme="dark"] .hx-end .hx-node { color: var(--surface); }
  .hx-now .hx-body, .hx-end .hx-body { padding-bottom: 4px; }
  .hx-big { font-size: 14px; font-weight: 640; }
  .hx-now .hx-big strong { color: var(--c); }
  .hx-empty { padding: 8px 0; }

  @keyframes hx-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  @keyframes hx-pulse { 0% { opacity: .7; transform: scale(.8); } 80%, 100% { opacity: 0; transform: scale(1.5); } }
  @media (prefers-reduced-motion: reduce) {
    .hx-row, .hx-cyclewrap { animation: none; }
    .hx-now .hx-node::after, .hx-jr-step.now .hx-jr-dot::after { animation: none; }
  }
  .composer { display: flex; flex-direction: column; gap: 10px; padding: 16px 24px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
  .composer textarea { min-height: 84px; resize: vertical; }
  .composer p.row { margin: 0; }
  .composer p.row svg { width: 14px; height: 14px; flex: none; }
}
@media (max-width: 560px) {
  .composer { padding: 14px 16px 16px; }
  .hx-jr { padding: 18px 16px 16px; }
  .hx-row { grid-template-columns: 0 30px minmax(0, 1fr); column-gap: 10px; }
  .hx-time { visibility: hidden; }
  .hx-row.hx-gap { min-height: 14px; }
  .hx-node { width: 30px; height: 30px; }
  .hx-cyclewrap { margin: 0 -8px; }
  .hx-cycle { padding: 0 8px 4px; }
}

/* ===== Protótipo completo (v0.3): acesso, notificações, filtros, relatórios, administração ===== */
@layer components {
  .link { color: var(--accent); font-weight: 600; text-decoration: none; text-align: right; }
  .req { color: var(--st-rej); font-weight: 700; }
  .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chip.s-CANCELLED { color: var(--st-muted); background: var(--st-muted-bg); }
  .tl-dot.rej { background: var(--st-rej); }
  .callout.danger { border-color: color-mix(in srgb, var(--st-rej) 30%, transparent); background: var(--st-rej-bg); }
  .callout.danger svg { color: var(--st-rej); }
  .callout p { margin: 0; }
  .btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
  .btn-danger-solid { background: var(--st-rej); color: #fff; border-color: transparent; }
  .btn-danger-solid:hover { background: color-mix(in srgb, var(--st-rej) 85%, #000); }
  .btn-on { border-color: var(--accent); background: var(--accent-soft); }
  .count-dot { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; }
  .tag svg { width: 12px; height: 12px; margin-right: 4px; }
  .tag-lg { height: 30px; padding: 0 12px; font-size: 12.5px; text-decoration: none; color: var(--text); }
  .section-title { font-size: 18px; margin: 32px 0 16px; }

  /* Acesso */
  .auth-view { display: flex; flex: 1; }
  .auth-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
  .auth-ic.sm { width: 36px; height: 36px; border-radius: 10px; }
  .auth-ic.danger { background: var(--st-rej-bg); color: var(--st-rej); }
  .hint svg { width: 13px; height: 13px; vertical-align: -2px; }
  .other-methods summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); }
  .meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }
  .meter span { height: 4px; border-radius: 4px; background: var(--surface-3); }
  .meter span[data-on="1"] { background: var(--st-rej); } .meter span[data-on="2"] { background: var(--st-quar); }
  .meter span[data-on="3"], .meter span[data-on="4"] { background: var(--st-ok); }
  .choice { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); text-decoration: none; color: inherit; text-align: left; width: 100%; font: inherit; }
  .choice > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
  .choice:hover, .choice.on { border-color: var(--accent); background: var(--accent-soft); }
  .qr-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
  .qr { width: 132px; height: 132px; color: var(--text); border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
  .secret { display: inline-block; margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: var(--surface-3); font-weight: 700; letter-spacing: .08em; }
  .rec-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 24px; padding: 14px 14px 14px 36px; margin: 0; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); font-weight: 700; letter-spacing: .06em; }
  .big-code { font-size: 26px; font-weight: 700; letter-spacing: .12em; text-align: center; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); margin: 12px 0; }

  /* Navegação, usuário, notificações */
  .nav-phase { font-size: 9px; letter-spacing: .08em; padding: 1px 6px; border-radius: 999px; border: 1px solid rgba(236,184,68,.4); color: var(--brand-gold-200); margin-left: 0; }
  a.env-card { text-decoration: none; }
  a.env-card:hover { background: rgba(255,255,255,.07); }
  .env-card > div span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .avatar-link { text-decoration: none; }
  .bell-wrap { position: relative; }
  .bell-count { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--st-rej); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
  .bell-count[hidden] { display: none; }
  .notif-panel { position: absolute; right: 0; top: 46px; width: min(380px, calc(100vw - 24px)); z-index: 30; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
  .notif-panel[hidden] { display: none; }
  .notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .notif-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; }
  .notif-list a { display: flex; gap: 10px; padding: 12px 14px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
  .notif-list a > span:last-child { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
  .notif-list li.unread a { background: color-mix(in srgb, var(--accent) 6%, transparent); }
  .notif-list li.unread .notif-text { font-weight: 650; }
  .notif-list a:hover { background: var(--surface-2); }
  .toast[data-tone="warn"] .ok { background: var(--st-quar-bg); color: var(--st-quar); }
  .toast[data-tone="info"] .ok { background: var(--st-new-bg); color: var(--st-new); }


  /* Capa e painel */
  .persona-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .persona-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
  .persona-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-md); }
  .link-list { list-style: none; margin: 12px 0 0; padding: 0; }
  .link-list a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: 13.5px; }
  .link-list a svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
  .link-list li:first-child a { border-top: 0; }
  .legend-link { text-decoration: none; color: inherit; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
  .legend-link:hover { background: var(--surface-2); }
  .denied { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 56px 24px; }
  .denied > svg { width: 36px; height: 36px; color: var(--text-3); }
  .filter-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 16px 12px; padding: 10px 14px; border-radius: 12px; background: var(--st-new-bg); border: 1px solid color-mix(in srgb, var(--st-new) 25%, transparent); font-size: 13px; }
  .filter-banner svg { width: 16px; height: 16px; color: var(--st-new); }
  .click-card { cursor: pointer; text-decoration: none; color: inherit; transition: transform .15s var(--ease), box-shadow .15s; }
  .click-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
  .cur-lines { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; font-size: 15px; font-weight: 700; }
  .hbar { display: grid; grid-template-columns: minmax(120px, 1.2fr) 3fr auto; gap: 10px; align-items: center; font-size: 13px; padding: 6px 4px; border-radius: 8px; text-decoration: none; color: inherit; }
  .hbar:hover { background: var(--surface-2); }
  .hbar .bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; }
  .hbar .bar span { height: 100%; }
  .dur-strip { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-3); margin-top: 10px; }
  .dur-strip span { height: 100%; }
  .dur-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
  .dur-grid > div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
  .dur-grid strong { display: block; font-size: 16px; }
  .dur-grid span { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
  .dur-grid i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

  .mini-stat { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
  .mini-stat span { font-size: 12px; color: var(--text-3); }
  .mini-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
  .mini-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
  .check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; margin-top: 6px; }
  .check-list { display: flex; flex-direction: column; gap: 10px; }
  .check-list label { align-items: flex-start; }

  /* Listas, filtros e menus */
  .filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
  .bulkbar { display: flex; align-items: center; gap: 8px; margin: 0 16px 12px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); flex-wrap: wrap; }
  table.data tr.is-cancelled td { color: var(--text-3); }
  table.data tr.empty { cursor: default; }
  table.data tr.empty:hover td { background: none; box-shadow: none; }
  table.data.compact td { padding: 6px 8px; }
  .menu-wrap { position: relative; display: inline-flex; }
  .menu-pop { position: absolute; right: 0; top: 36px; z-index: 25; min-width: 220px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
  .menu-pop[hidden] { display: none; }
  .menu-pop button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 10px; border-radius: 8px; text-align: left; font-size: 13px; color: var(--text); white-space: nowrap; }
  .menu-pop button:hover { background: var(--surface-2); }
  .menu-pop button.danger { color: var(--st-rej); }
  .menu-pop svg { width: 16px; height: 16px; }
  .seg-link { display: inline-flex; align-items: center; gap: 6px; height: calc(var(--control-h) - 8px); padding: 0 12px; border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--text-2); text-decoration: none; }
  .seg-link svg { width: 15px; height: 15px; }
  .seg-link[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
  .seg button[disabled] { opacity: .45; cursor: not-allowed; }

  /* Detalhe */
  .kv-list { display: flex; flex-direction: column; gap: 10px; }
  .kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; }
  .kv > span:last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }
  .kv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .kv-table th { text-align: left; font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); padding: 6px 8px; border-bottom: 1px solid var(--border); }
  .kv-table td { padding: 8px; border-bottom: 1px solid var(--border); }
  .kv-table.diff tr.changed td { background: var(--accent-soft); }
  .composer-closed { padding: 14px 24px 18px; border-top: 1px solid var(--border); display: flex; gap: 6px; align-items: center; }
  .composer-closed svg { width: 14px; height: 14px; }
  .doc-preview { background: var(--surface-3); border-radius: 12px; padding: 20px; display: grid; place-items: center; }
  .doc-page { width: min(420px, 100%); aspect-ratio: 1 / 1.3; background: #fff; border-radius: 4px; box-shadow: var(--shadow-md); padding: 28px; display: flex; flex-direction: column; gap: 10px; color: #0b1b33; }
  .doc-head { display: flex; justify-content: space-between; font-size: 13px; border-bottom: 2px solid #0b1b33; padding-bottom: 8px; margin-bottom: 8px; }
  .doc-line { height: 8px; border-radius: 4px; background: #e5e8ee; }
  .doc-total { margin-top: auto; display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; border-top: 1px solid #ccd; padding-top: 8px; }

  /* Envio */
  .upload-form .card-title { display: flex; align-items: center; gap: 8px; }
  .upload-form .card-title svg { width: 16px; height: 16px; color: var(--accent); }
  .dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px; border-radius: 16px; border: 2px dashed var(--border-strong); background: var(--surface-2); cursor: pointer; text-align: center; transition: border-color .2s, background .2s; }
  .dropzone svg { width: 26px; height: 26px; color: var(--accent); }
  .dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
  .progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
  .progress span { display: block; height: 100%; background: var(--gold-gradient); transition: width .2s; }

  /* Relatórios */
  .report-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
  .report-sheet { overflow: hidden; }
  .report-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
  .report-table th, .report-table td { padding: 10px 12px; font-size: 12.5px; white-space: nowrap; }
  .th-tz { font-weight: 500; text-transform: none; letter-spacing: 0; }
  .report-totals { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; max-width: 860px; }
  .print-only { display: none; }
  .pdf-mock { display: grid; place-items: center; padding: 16px; border-radius: 12px; background: var(--surface-3); }
  .pdf-page { background: #fff; color: #0b1b33; box-shadow: var(--shadow-md); padding: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 8px; }
  .pdf-mock.landscape .pdf-page { width: min(560px, 100%); aspect-ratio: 1.414 / 1; }
  .pdf-mock.portrait .pdf-page { width: min(380px, 100%); aspect-ratio: 1 / 1.414; }
  .pdf-head { display: flex; gap: 10px; align-items: flex-start; border-bottom: 1.5px solid #0b1b33; padding-bottom: 6px; }
  .pdf-head div { display: flex; flex-direction: column; gap: 2px; }
  .pdf-head strong { font-size: 11px; }
  .pdf-page table { width: 100%; border-collapse: collapse; }
  .pdf-page th { text-align: left; background: #eef1f5; padding: 3px; font-size: 7px; }
  .pdf-page td { padding: 3px; border-bottom: 1px solid #e3e6ec; font-size: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70px; }
  .pdf-foot { margin-top: auto; display: flex; justify-content: space-between; color: #6b7890; border-top: 1px solid #e3e6ec; padding-top: 4px; }

  /* Log, grupos, usuários */
  .pill-btn { display: inline-flex; align-items: center; gap: 6px; height: var(--control-h-sm); padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--text); }
  .pill-btn svg { width: 14px; height: 14px; color: var(--accent); }
  .pill-btn:hover { border-color: var(--accent); }
  .pill-btn.mine { background: var(--accent-soft); }
  .sev { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
  .sev::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--st-muted); }
  .sev-WARNING::before { background: var(--st-quar); } .sev-ERROR::before { background: var(--st-rej); }
  .sev-CRITICAL { color: var(--st-rej); } .sev-CRITICAL::before { background: var(--st-rej); box-shadow: 0 0 0 3px var(--st-rej-bg); }
  .perm-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
  .perm-summary ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
  .perm-summary li { display: grid; grid-template-columns: 16px 1fr; gap: 2px 6px; font-size: 13px; }
  .perm-summary li svg { width: 14px; height: 14px; color: var(--st-ok); margin-top: 2px; }
  .perm-summary li .muted { grid-column: 2; }
  .perm-matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
  .perm-matrix fieldset { border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
  .perm-matrix legend { font-size: 12px; font-weight: 700; color: var(--text-2); padding: 0 6px; }
  .perm { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
  .perm.disabled { opacity: .55; cursor: not-allowed; }
  .perm-why { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--st-rej); }
  .perm-why svg { width: 12px; height: 12px; }
  .perm-meter { display: flex; flex-direction: column; gap: 6px; min-width: 110px; }
  .perm-meter .progress { height: 6px; width: 110px; }
  .method { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); flex-wrap: wrap; }
  .method.on { border-color: color-mix(in srgb, var(--st-ok) 40%, transparent); background: var(--st-ok-bg); }
  .email-list { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
  .email-list button { width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 10px; display: flex; flex-direction: column; gap: 2px; font: inherit; color: inherit; }
  .email-list button:hover { background: var(--surface-2); }
  .email-list button[aria-pressed="true"] { background: var(--accent-soft); }
  .email-frame { border: 1px solid var(--border-strong); border-radius: 14px; overflow: hidden; }
  .email-meta { padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
  /* o e-mail de verdade (HTML do servidor) num shadow DOM; fundo igual ao do e-mail, rolagem própria se faltar largura */
  .email-canvas { background: #eef1f6; overflow-x: auto; }
}
@media (max-width: 1180px) {
  .persona-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hide-md { display: none; }
}
@media (max-width: 900px) {
  .persona-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-actions { opacity: 1; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .rec-codes { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 1fr 2fr auto; }
}
@media (max-width: 560px) {
  .persona-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { flex-direction: column; align-items: flex-start; gap: 2px; }
  .kv > span:last-child { text-align: left; }
}
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff !important; }
  .sidebar, .side-toggle, .topbar, .presenter, .toast, .no-print, .actionbar, dialog { display: none !important; }
  .app { display: block !important; }
  .content { padding: 0 !important; max-width: none !important; }
  .card { box-shadow: none !important; border: 0 !important; }
  .report-table th, .report-table td { padding: 4px 6px; font-size: 9px; white-space: normal; }
  .table-wrap { overflow: visible !important; padding: 0 !important; }
  .card:has(table.data) { background-image: none !important; }
  table.data th { background: none !important; color: #000 !important; border-bottom: 1px solid #ccc !important; border-radius: 0 !important; position: static; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  .print-only { display: flex !important; justify-content: space-between; font-size: 9px; color: #555; margin-top: 12px; }
}

@layer components {
  .status-cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
  .status-cards .kpi-value { font-size: 26px; }
  .status-cards .kpi-foot { font-size: 11.5px; }
  .cell-link { color: inherit; text-decoration: none; display: block; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
  .cell-link:hover { background: var(--accent-soft); }
  tr.no-hover { cursor: default; }
  .chart-table { margin-top: 8px; font-size: 12.5px; }
  .chart-table summary { cursor: pointer; color: var(--text-2); font-weight: 600; }
  .dur-grid > a.click-card { display: block; }
  .dash-filters .seg { flex-wrap: wrap; }
}
@media (max-width: 1180px) { .status-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .status-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@layer components { .dur-grid > a { display: block; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); text-decoration: none; color: inherit; } .dur-grid > a strong { display: block; font-size: 16px; } }


/* Lista em telas estreitas: abas com contagem rolam; busca ocupa a linha */
@media (max-width: 640px) {
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .list-tools { width: 100%; }
  .list-tools .search:not(.sx), .list-tools .sx.open { flex: 1; min-width: 0; max-width: none !important; }
}
