/* Plataforma Zucato — sistema visual v2 da aplicação (PLAT-03, 10/10/2026). Desktop e celular.
   Marca: ph-brand-system/phraxis (AGENTS.md §3–§7, tokens/phraxis-tokens.json, aprovado em 05.10.2026).
   Os valores --phx-* são cópia literal dos tokens oficiais (a aplicação roda isolada). Não alterar aqui; mudar na origem e recopiar.

   Direção: instrumento editorial à luz do dia. Papel claro, tinta e um único metal (Titanium, até 8% da área).
   Hierarquia por peso e espaço, não por caixas. Fios em opacidade que somem quando não se procura por eles.
   Raio 8/12/16 (padrão de aplicação Phraxis aprovado por PH em 10/10/2026, DEC-047) e sombra só em camada flutuante
   (popover, folha, diálogo, paleta, dock, aviso). Painéis e tabelas nunca têm sombra.
   Assinaturas: barra de rateio (.bar-split) e trilho de nós (.track, .nav-track). Status = forma do nó + rótulo, nunca só cor.

   Ordem: tokens · base · texto · ícones e nós · faixa superior · faixa inferior · casca e navegação · página ·
   superfícies · controles · filtros · números e barras · dados · flutuantes · estados · tooltip · login · legado ·
   utilitários · larguras · celular · movimento reduzido. Composições de tela ficam em app.css e extras.css. */

@font-face { font-family: "Roboto"; src: url("/static/fonts/Roboto-Variable.ttf") format("truetype"); font-weight: 100 900; font-stretch: 75% 100%; font-display: swap; }
@font-face { font-family: "Roboto Mono"; src: url("/static/fonts/RobotoMono-Variable.ttf") format("truetype"); font-weight: 100 700; font-display: swap; }

:root {
  color-scheme: light;
  /* tokens Phraxis (cópia literal) */
  --phx-ink: #0A0A0A; --phx-graphite: #171717; --phx-structure: #2B2B2B; --phx-stone: #646B6E; --phx-line: #D8D6D0;
  --phx-soft: #ECEBE7; --phx-paper: #F4F3EF; --phx-white: #FFFFFF; --phx-titanium: #A99D89;
  --phx-mist: #AEB6B8; --phx-dark-line: #33373A; --phx-cool: #BAC7CA;
  --phx-text: #0A0A0A; --phx-text-2: #2B2E30; --phx-text-3: #3A3E40;
  --phx-font: "Roboto", Arial, sans-serif; --phx-mono: "Roboto Mono", Consolas, monospace;

  /* tokens de aplicação v2 (contrato_componentes.md §1) */
  --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --line-1: rgba(10,10,10,.06); --line-2: rgba(10,10,10,.10); --line-3: rgba(10,10,10,.18); --line-4: var(--phx-ink);
  --surface-canvas: var(--phx-paper); --surface-raised: var(--phx-white); --surface-inset: var(--phx-soft);
  --shadow-float: 0 1px 2px rgba(10,10,10,.06), 0 16px 40px -16px rgba(10,10,10,.22);
  --ease: cubic-bezier(.2,.7,.2,1); --t-fast: 120ms; --t-base: 180ms; --t-slow: 260ms;
  --ui-bar: 56px; --ui-foot: 36px; --ui-side: 232px; --ui-gutter: 32px; --ui-content: 1440px;
  --ui-body: 13.5px; --ui-small: 12.5px; --ui-meta: 11px; --ui-control: 34px; --ui-row: 40px;
  /* escala de espaço (ritmo de 4 px): padding, margin e gap só em múltiplos de 4; 2 px só como ajuste óptico, 1 px só em fio */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-7: 28px; --s-8: 32px; --s-9: 36px; --s-10: 40px;
  /* escala tipográfica: 11 · 12,5 · 13 (tabela) · 13,5 (corpo) · 15 · 18 · 22 · 26 · 28 · 44 (herói; 32 no celular).
     Exceção funcional: 16 px nos campos do celular, porque o iOS amplia a página ao focar campo menor. */

  /* derivados (só tokens acima): lavagem de hover, controles, trilho, véu dos flutuantes, tons sobre Ink */
  --wash: rgba(10,10,10,.04);                 /* hover discreto sobre claro, abaixo do Soft do item ativo */
  --control-bg: var(--surface-inset);         /* campo recebe conteúdo: um tom abaixo do entorno (Soft sobre Paper) */
  --control-bg-raised: var(--phx-paper);      /* campo dentro de White (painel, diálogo, folha, dock): Paper */
  --control-line: rgba(10,10,10,.14);
  --control-line-hover: rgba(10,10,10,.28);
  --line-ctl: rgba(10,10,10,.24);             /* borda de campo, busca e chip-select: contraste não textual aprovado por PH em 10/10/2026 (DEC-047, Q-066) */
  --line-ctl-hover: rgba(10,10,10,.38);
  --rail: var(--line-2);                      /* fio do trilho de execução */
  --bar-gap: var(--surface-canvas);           /* fenda entre segmentos da barra de rateio = cor da superfície */
  --veil: rgba(10,10,10,.35);                 /* véu atrás de folha, diálogo, paleta e gaveta */
  --on-ink-1: color-mix(in srgb, var(--phx-paper) 7%, transparent);    /* lavagem sobre Ink */
  --on-ink-2: color-mix(in srgb, var(--phx-paper) 14%, transparent);   /* fio sobre Ink */
  --ui-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23646B6E' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  --ui-check: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23F4F3EF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12.5l4.5 4.5L19 7.5'/></svg>");
  --ui-dash: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23F4F3EF' stroke-width='3' stroke-linecap='round'><path d='M6 12h12'/></svg>");

  /* aliases dos nomes antigos (app.css e extras.js ainda usam) */
  --ui-line: var(--line-2); --ui-line-soft: var(--line-1); --ui-line-strong: var(--line-3);
  --ui-radius: var(--r-sm); --ui-control-line: var(--control-line); --ui-control-bg: var(--control-bg); --ui-control-bg-inset: var(--control-bg-raised);
  --ui-focus: var(--line-4); --ui-fast: var(--t-fast); --ui-slow: var(--t-slow); --ui-ease: var(--ease);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 13.5px; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--ui-bar) + 12px); overflow-x: clip; }   /* nunca rolagem horizontal da página */
body { margin: 0; min-width: 320px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; font-family: var(--phx-font); font-weight: 400; font-size: var(--ui-body); color: var(--phx-text); background: var(--surface-canvas); line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
h3 { font-size: 13.5px; font-weight: 500; }
strong, b { font-weight: 500; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--line-4); outline-offset: 2px; }
::selection { background: var(--phx-ink); color: var(--phx-paper); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 99; background: var(--phx-paper); color: var(--phx-ink); padding: 8px 16px; border-radius: var(--r-sm); box-shadow: var(--shadow-float); text-decoration: none; font-weight: 500; }
.skip-link:focus { top: 12px; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 4px; border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--phx-white); color: var(--phx-stone); font: 400 11px/1 var(--phx-mono); letter-spacing: 0; white-space: nowrap; }

/* ---------- texto ---------- */
.eyebrow, .nav-kicker, .brand-client, .footband, th, caption, .section-count, .dialog-kicker, .sheet-kicker, .page-meta, .ctx-label,
.def-list dt, .pill, .badge, .login-client, .cmdk-group-label, .metric-link, .nav-index, .branch-summary span, .alert-action > strong,
.evidence-body caption, .rule-block-title b {
  font-family: var(--phx-mono); font-size: var(--ui-meta); font-weight: 400; letter-spacing: .08em; text-transform: uppercase; line-height: 1.5;
}
.eyebrow { color: var(--phx-stone); display: block; }
.code { display: block; font-family: var(--phx-mono); font-size: 11px; letter-spacing: .01em; color: var(--phx-stone); line-height: 1.5; margin-top: 2px; overflow-wrap: anywhere; }
.num, .account-item b, .comparison-label strong, .alert-footer strong { font-family: var(--phx-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--phx-stone); }
.lead { font-size: 13.5px; line-height: 1.55; color: var(--phx-text-2); max-width: 62ch; }

/* ---------- ícones e nós ---------- */
.ic { display: inline-block; flex: none; vertical-align: -3px; }
.node { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--phx-stone); background: transparent; vertical-align: middle; }
.node-ok { background: var(--phx-ink); border-color: var(--phx-ink); }                      /* ● conferido */
.node-warn { display: inline-grid; place-items: center; background: transparent; border-color: var(--phx-ink); }   /* ◉ atenção: anel Ink com ponto central */
.node-warn::after { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--phx-ink); }          /* forma própria: não se confunde com o neutro */
.node-bad { border-radius: 2px; background: var(--phx-ink); border-color: var(--phx-ink); } /* ■ bloqueio */
.node-active { background: var(--phx-titanium); border-color: var(--phx-titanium); }        /* ● único nó ativo */
.node-neutral { border-color: var(--phx-stone); }                                           /* ○ neutro (anel Stone) */
.node-pending { border: 1.2px dashed var(--phx-stone); }                                    /* ◌ pendente */
.node-ink { background: var(--phx-ink); border-color: var(--phx-ink); }
.node-stone { background: var(--phx-stone); border-color: var(--phx-stone); }
.node-titanium { background: var(--phx-titanium); border-color: var(--phx-titanium); }
.node-soft { background: var(--phx-line); border-color: var(--phx-line); }

/* ---------- faixa superior: Ink + malha técnica oficial ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--ui-bar); flex: none; display: flex; align-items: center; gap: 16px; padding: 0 16px 0 24px; background: var(--phx-ink); color: var(--phx-mist); }
.topbar--field { background: var(--phx-ink) url("/static/assets/campo-faixa.svg") left center / auto 100% repeat-x; }
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-logo { display: block; width: 96px; height: auto; flex: none; }
.rule { display: block; flex: none; width: 1px; height: 22px; background: var(--phx-stone); }
.brand-client { color: var(--phx-paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; position: relative; min-width: 0; }
/* homologação (DEC-065): etiqueta titânio sobre a faixa Ink, logo após o cliente; o cliente encurta antes dela */
.env-tag { display: inline-flex; align-items: center; gap: 10px; flex: none; height: 28px; padding: 0 14px; border-radius: var(--r-pill); background: var(--phx-titanium); color: var(--phx-ink);
  font: 500 11px/1 var(--phx-mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.env-tag::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--phx-ink); }
.env-tag-name { font-weight: 700; }
.env-tag-detail { padding-left: 10px; border-left: 1px solid color-mix(in srgb, var(--phx-ink) 35%, transparent); font: 400 12px/1 var(--phx-font); letter-spacing: 0; text-transform: none; }
.topbar .btn-icon { color: var(--phx-mist); }
.topbar .btn-icon:hover:not(:disabled) { background: var(--on-ink-1); color: var(--phx-paper); }
.topbar .nav-toggle { display: none; }
/* UX-06 (A-02): foco visível na faixa escura: contorno Paper só nos controles sobre o Ink (o menu da conta é claro e segue o contorno Ink) */
.topbar > .nav-toggle:focus-visible, .top-actions > :focus-visible, .brand :focus-visible { outline-color: var(--phx-paper); }
/* busca/comando: um campo-botão que abre a paleta (Ctrl K) */
.top-cmdk.btn-icon { width: auto; min-width: 248px; justify-content: flex-start; gap: 8px; padding: 0 4px 0 12px; margin-right: 8px; background: var(--on-ink-1); box-shadow: inset 0 0 0 1px var(--on-ink-2); font-size: 13px; }
.top-cmdk.btn-icon:hover:not(:disabled) { background: var(--on-ink-2); }
.top-cmdk-text { flex: 1; text-align: left; white-space: nowrap; }
.top-cmdk kbd { background: transparent; border-color: var(--on-ink-2); color: var(--phx-mist); border-radius: var(--r-xs); }
/* estado do SAP: nó + rótulo; o texto de governança fica no tooltip e na folha */
.top-status { display: inline-flex; align-items: center; gap: 8px; height: var(--ui-control); padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--phx-mist); font-family: var(--phx-mono); font-size: var(--ui-meta); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; transition: background-color var(--t-fast) var(--ease); }
.top-status:hover:not(:disabled) { background: var(--on-ink-1); color: var(--phx-paper); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--phx-mist); background: transparent; flex: none; }
.status-dot.online { background: var(--phx-mist); }    /* ● leitura disponível */
.status-dot.offline { background: transparent; }        /* ○ snapshot local */
.user-menu { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 4px; margin-left: 8px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--phx-paper); text-align: left; line-height: 1.25; transition: background-color var(--t-fast) var(--ease); }
.user-menu:hover, .user-menu[aria-expanded="true"] { background: var(--on-ink-1); }
.user-menu > .ic { color: var(--phx-mist); }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-menu #user-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 168px; }
.user-menu small { color: var(--phx-mist); font-size: 11px; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: var(--r-pill); display: grid; place-items: center; flex: none; background: var(--phx-soft); color: var(--phx-ink); font-family: var(--phx-mono); font-size: 11px; letter-spacing: .04em; }
.topbar .avatar { background: var(--phx-structure); color: var(--phx-paper); box-shadow: inset 0 0 0 1px var(--on-ink-2); }
.user-popover { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 264px; padding: 4px; background: var(--surface-raised); color: var(--phx-text); border: 1px solid var(--line-1); border-radius: var(--r-md); box-shadow: var(--shadow-float);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease), display 160ms allow-discrete; transform-origin: top right; }
.user-popover[hidden] { opacity: 0; transform: translateY(-4px); transition-duration: 120ms; }
@starting-style { .user-popover { opacity: 0; transform: translateY(-4px); } }
.popover-head { padding: 8px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line-1); }
.popover-head strong { display: block; font-size: 13.5px; }
.popover-head .code { margin-top: 0; }
.popover-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 36px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--phx-text-2); font-size: 13.5px; text-align: left; transition: background-color var(--t-fast) var(--ease); }
.popover-item .ic { color: var(--phx-stone); }
.popover-item:hover { background: var(--phx-soft); color: var(--phx-ink); }
.popover-item small { margin-left: auto; color: var(--phx-stone); font-size: 11px; }
.popover-sep { height: 1px; background: var(--line-1); margin: 4px 0; }

/* ---------- faixa inferior: Ink chapado, símbolo + fio + descritor (sem grafismo) ---------- */
.footband { flex: none; min-height: var(--ui-foot); display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 24px; background: var(--phx-ink); color: var(--phx-mist); }
.signature { display: inline-flex; align-items: center; gap: 12px; }
.signature img { display: block; width: 16px; height: auto; }
.signature .rule { height: 16px; }
.signature-text { font-family: var(--phx-font); font-weight: 300; font-size: 12.5px; letter-spacing: 0; text-transform: none; color: var(--phx-paper); }
.footband-info { display: inline-flex; align-items: center; gap: 16px; white-space: nowrap; }
.footband-context { max-width: 40ch; overflow: hidden; text-overflow: ellipsis; }

/* ---------- casca e navegação ---------- */
.app-shell { flex: 1; display: grid; grid-template-columns: var(--ui-side) minmax(0, 1fr); position: relative; }
.sidebar { position: sticky; top: var(--ui-bar); align-self: start; max-height: calc(100dvh - var(--ui-bar)); min-height: calc(100dvh - var(--ui-bar) - var(--ui-foot)); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 20px 12px 28px 28px; background: var(--surface-canvas); border-right: 1px solid var(--line-1); }
.sidebar-backdrop { display: none; }
main#workspace { min-width: 0; padding: 28px var(--ui-gutter) 48px; }
main#workspace > * { max-width: var(--ui-content); }
main#workspace:focus { outline: none; }

/* grupos: Dashboards, Fechamento (trilho), Lotes, Administração */
.nav-group + .nav-group { margin-top: 24px; }
.nav-kicker { color: var(--phx-stone); margin: 0 0 8px 12px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-item { position: relative; width: 100%; min-height: 34px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--phx-text-3); font-size: 13.5px; line-height: 1.3; text-align: left; transition: background-color var(--t-fast) var(--ease); }
.nav-item .ic { color: var(--phx-stone); }
.nav-item:hover { background: var(--wash); color: var(--phx-ink); }
.nav-item.active, .nav-item[aria-current="page"] { background: var(--phx-soft); color: var(--phx-ink); font-weight: 500; }
.nav-item.active .ic, .nav-item[aria-current="page"] .ic { color: var(--phx-ink); }
.nav-text { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-text small { display: none; }                         /* subtítulos da v08 saem da navegação */
.nav-index { order: 3; margin-left: auto; color: var(--phx-stone); letter-spacing: .04em; }
.nav-item.active .nav-index { color: var(--phx-text-3); }
/* trilho de execução: fio e nós na calha à esquerda; um único nó ativo, em Titanium */
.nav-track li { position: relative; }
.nav-track li::before { content: ""; position: absolute; left: -16px; top: 0; bottom: 0; width: 1px; background: var(--rail); }
.nav-track li:first-child::before { top: 50%; }
.nav-track li:last-child::before { bottom: 50%; }
.nav-track li:only-child::before { display: none; }
.nav-track .nav-item::before { content: ""; position: absolute; left: -20px; top: 50%; width: 9px; height: 9px; transform: translateY(-50%); border-radius: 50%; border: 1.5px solid var(--phx-stone); background: var(--surface-canvas); transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.nav-track .nav-item:hover::before { border-color: var(--phx-ink); }
.nav-track .nav-item.active::before, .nav-track .nav-item[aria-current="page"]::before { background: var(--phx-titanium); border-color: var(--phx-titanium); }

/* ---------- página: cabeçalho único (UX-01, R4 e R6), seções ----------
   Uma faixa só por tela: título (26 px); a barra de contexto, com display: contents, entrega à faixa os controles (período, filtros), o grupo do fim
   ("Mês parcial", "Atualizado em") e as ações da tela; a ⓘ é o último filho do cabeçalho. Os controles ficam colados ao título e empurram o resto para a
   direita (margin-right: auto); quando não cabem (três controles ou mais abaixo de 1440 px de contêiner, a largura útil máxima; qualquer barra abaixo de
   1024), descem inteiros para a segunda linha, com respiro menor (G1 a). Linhas que começam pelas ações alinham à direita (justify-content). O fio de baixo
   só existe quando há barra de contexto. Sem subtítulo nem descrição: .page-sub saiu em UX-01; o que explicava a tela mora na folha ⓘ. */
main#workspace > #screen { container: screen / inline-size; }
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 16px; }
.page-head:has(> .context-bar), .page-head:has(.ctx-end) { padding-bottom: 12px; border-bottom: 1px solid var(--line-1); }   /* o Fluxo de Caixa tem o grupo do fim nas ações, sem barra */
.page-head:has(> .context-bar) { justify-content: flex-end; }
.page-title { flex: none; min-width: 0; max-width: 100%; }
.page-head:not(:has(.ctx-controls)) > .page-title { margin-right: auto; }
.page-meta { display: block; color: var(--phx-stone); margin-bottom: 4px; }
.page-head h1 { font-size: 26px; font-weight: 300; line-height: 1.15; letter-spacing: -.015em; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.page-head > .context-bar { display: contents; }
.page-head > .context-bar > .page-actions { margin-left: 0; }
.page-head > .btn-icon { width: 30px; height: 30px; }   /* a ⓘ do cabeçalho único tem a altura dos controles (chips de 30 px): a linha do título não cresce por ela */
/* Intervalo (seletor com "de" e "até") junto de três chips ou mais: os controles descem inteiros em qualquer largura, para a ⓘ nunca cair sozinha */
.page-head > .context-bar > .ctx-controls:has(> .periodo > :nth-child(3)):has(> :nth-child(3)) { order: 2; flex: 1 0 100%; }
.page-head:has(> .context-bar > .ctx-controls > .periodo > :nth-child(3)):has(> .context-bar > .ctx-controls > :nth-child(3)) { row-gap: 4px; padding-bottom: 8px; }
.page-head:has(> .context-bar > .ctx-controls > .periodo > :nth-child(3)):has(> .context-bar > .ctx-controls > :nth-child(3)) > .page-title { margin-right: auto; }
.page-head:has(> .context-bar > .ctx-controls > .periodo > :nth-child(3)):has(> .context-bar > .ctx-controls > :nth-child(3)) + * { margin-top: 8px; }
.ctx-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; margin-right: auto; }
.ctx-end { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-left: auto; }
.ctx-controls:empty, .ctx-end:empty { display: none; }
.periodo { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ctx-item { display: inline-flex; align-items: center; gap: 8px; font-size: var(--ui-small); color: var(--phx-text-2); white-space: nowrap; }
.ctx-label { color: var(--phx-stone); }
.ctx-value { font-variant-numeric: tabular-nums; }
/* "Atualizado em": um só estilo em toda tela (auditoria T6), o da linha de contexto do Fechamento (.fch-meta): mono 12 px, sem versalete */
.ctx-updated { font: 400 12px/1.6 var(--phx-mono); letter-spacing: .02em; color: var(--phx-stone); }
.ctx-updated .ctx-label { font: inherit; letter-spacing: inherit; text-transform: none; color: inherit; }
.ctx-updated .ctx-value { color: var(--phx-text-2); }
@container screen (max-width: 1439px) {
  .page-head > .context-bar > .ctx-controls:has(> :nth-child(3)) { order: 2; flex: 1 0 100%; }
  .page-head:has(> .context-bar > .ctx-controls > :nth-child(3)) { row-gap: 4px; padding-bottom: 8px; }
  .page-head:has(> .context-bar > .ctx-controls > :nth-child(3)) > .page-title { margin-right: auto; }
  .page-head:has(> .context-bar > .ctx-controls > :nth-child(3)) + * { margin-top: 8px; }
}
@container screen (max-width: 1023px) {
  .page-head > .context-bar > .ctx-controls { order: 2; flex: 1 0 100%; }
  .page-head > .page-title { margin-right: auto; }
}
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px 16px; margin: 32px 0 12px; }
.section > .section-head:first-child { margin-top: 0; }
.section-head h2 { font-size: 15px; font-weight: 500; line-height: 1.35; letter-spacing: 0; }
.section-head .eyebrow + h2 { margin-top: 4px; }
.section-head p { font-size: var(--ui-small); color: var(--phx-stone); margin-top: 4px; max-width: 90ch; }
.section-count { color: var(--phx-stone); white-space: nowrap; }

/* ---------- superfícies ---------- */
.panel { background: var(--surface-raised); border: 1px solid var(--line-2); border-radius: var(--r-md); overflow: hidden; --bar-gap: var(--surface-raised); }
.panel + .panel { margin-top: 16px; }
.two-col > .panel + .panel, .form-row > .panel + .panel { margin-top: 0; }   /* lado a lado em grade: sem o respiro vertical */
.panel.pad { padding: 20px; }
.panel h2 { font-size: 15px; font-weight: 500; line-height: 1.35; }
.panel.pad > h2 { margin-bottom: 16px; }
.panel .section-head:first-child { margin-top: 0; }
.panel-head, .panel-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 12px 8px 20px; border-bottom: 1px solid var(--line-1); }
.panel-head p, .panel-toolbar p { font-size: var(--ui-small); color: var(--phx-stone); margin-top: 2px; }
.panel-head .actions, .panel-toolbar .actions { flex: none; }
.panel-body { padding: 20px; }
.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 8px 12px 8px 20px; border-top: 1px solid var(--line-1); font-size: var(--ui-small); color: var(--phx-stone); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > * { padding: 12px 0; border-top: 1px solid var(--line-1); }
.rows > *:first-child { border-top: 0; }
.panel > .rows > * { padding-inline: 20px; }
.hint { display: flex; align-items: flex-start; gap: 8px; font-size: var(--ui-small); line-height: 1.5; color: var(--phx-stone); }
.hint > .ic { margin-top: 2px; }
.alert { position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 12px 16px 12px 20px; border-radius: var(--r-sm); background: var(--phx-soft); color: var(--phx-ink); font-size: 13px; line-height: 1.5; }
.alert::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--phx-stone); }
.alert-bad::before { background: var(--phx-ink); }
.alert-warn::before { background: var(--phx-titanium); }
.alert > .ic { margin-top: 2px; }
.alert-text { flex: 1; min-width: 0; }
.alert > .btn, .alert > .actions { margin-left: auto; align-self: center; flex: none; }
.alert + .alert { margin-top: 8px; }

/* ---------- controles ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--ui-control); padding: 0 12px; border: 1px solid var(--control-line); border-radius: var(--r-sm); background: var(--surface-raised); color: var(--phx-ink); font-size: 13px; font-weight: 500; line-height: 1.2; white-space: nowrap; text-decoration: none; transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.btn > .ic { margin-left: -2px; }
.btn:hover:not(:disabled) { border-color: var(--control-line-hover); }
.btn:active:not(:disabled) { background: var(--phx-soft); }
.btn.primary { background: var(--phx-ink); border-color: var(--phx-ink); color: var(--phx-paper); }
.btn.primary:hover:not(:disabled) { background: var(--phx-structure); border-color: var(--phx-structure); }
.btn.primary:active:not(:disabled) { background: var(--phx-graphite); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--phx-text-3); padding-inline: 8px; }
.btn.ghost:hover:not(:disabled) { border-color: transparent; background: var(--line-1); color: var(--phx-ink); }
.btn.danger { background: var(--phx-ink); border-color: var(--phx-ink); color: var(--phx-paper); }
.btn.danger:hover:not(:disabled) { background: var(--phx-structure); border-color: var(--phx-structure); }
.btn.danger:not(:has(.ic))::before { content: ""; width: 16px; height: 16px; flex: none; margin-left: -2px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M12 4.5l8.5 15h-17L12 4.5z'/><path d='M12 10v4.2M12 17.1v.1'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M12 4.5l8.5 15h-17L12 4.5z'/><path d='M12 10v4.2M12 17.1v.1'/></svg>") center / contain no-repeat; }
.btn.small { min-height: 28px; padding: 0 8px; font-size: 12.5px; gap: 4px; border-radius: calc(var(--r-sm) - 1px); }
.btn.block { width: 100%; }
.btn .count, .btn > small { font-family: var(--phx-mono); font-size: 11px; font-weight: 400; color: var(--phx-stone); letter-spacing: 0; }
.btn.primary .count, .btn.primary > small { color: var(--phx-mist); }
.btn .spinner { width: 14px; height: 14px; border-width: 1.5px; margin: 0; }
.btn.primary .spinner, .btn.danger .spinner { border-color: var(--on-ink-2); border-top-color: var(--phx-paper); }
.btn-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: var(--ui-control); height: var(--ui-control); padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--phx-stone); transition: background-color var(--t-fast) var(--ease); }
.btn-icon:hover:not(:disabled) { background: var(--line-1); color: var(--phx-ink); }
.btn-icon.is-active, .btn-icon[aria-pressed="true"] { background: var(--phx-soft); color: var(--phx-ink); }
.btn-icon.small { width: 28px; height: 28px; border-radius: calc(var(--r-sm) - 1px); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.link-button { background: none; border: 0; padding: 0; color: var(--phx-text-3); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; font-size: inherit; border-radius: var(--r-xs); }
.link-button:hover { color: var(--phx-ink); text-decoration-color: currentColor; }

/* campos */
.field { min-width: 0; }
.field label, .field-label, .period-control label { display: block; margin-bottom: 8px; font-size: var(--ui-small); font-weight: 500; color: var(--phx-text-2); }
.field-hint { font-weight: 400; color: var(--phx-stone); margin-left: 4px; }
.field-help { font-size: 12.5px; color: var(--phx-stone); margin-top: 8px; line-height: 1.5; }
/* UX-06 (spec §2.6): erro junto ao campo (ui.fieldError); o estado também pela borda, não só pela frase */
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--phx-ink); }
.field-error { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; font-size: var(--ui-small); color: var(--phx-ink); }
.field-error::before { content: ""; width: 2px; align-self: stretch; border-radius: 2px; background: var(--phx-titanium); flex: none; }
input, select, textarea { width: 100%; min-height: var(--ui-control); padding: 4px 12px; border: 1px solid var(--line-ctl); border-radius: var(--r-sm); background: var(--control-bg); color: var(--phx-ink); font-size: 13.5px; line-height: 1.4; transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.panel input, .panel select, .panel textarea, dialog input, dialog select, dialog textarea, .dock input, .dock select, .dock textarea { background-color: var(--control-bg-raised); }
input:hover, select:hover, textarea:hover { border-color: var(--line-ctl-hover); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--line-4); outline-offset: 2px; border-color: var(--phx-ink); background-color: var(--phx-white); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--phx-ink); }
input:disabled, select:disabled, textarea:disabled { color: var(--phx-stone); background-color: var(--phx-soft); cursor: not-allowed; }
input[readonly] { background-color: var(--phx-soft); color: var(--phx-text-3); }
select { appearance: none; -webkit-appearance: none; background-image: var(--ui-chevron); background-repeat: no-repeat; background-position: right 8px center; background-size: 16px 16px; padding-right: 32px; text-overflow: ellipsis; color: var(--phx-ink); cursor: pointer; }
textarea { resize: vertical; min-height: 76px; line-height: 1.45; padding-block: 8px; }
input[type=search]::-webkit-search-decoration { -webkit-appearance: none; }
input::-ms-reveal { display: none; }
::placeholder { color: var(--phx-stone); opacity: 1; }
input[type=checkbox], input[type=radio] { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; flex: none; border: 1px solid var(--control-line-hover); background: var(--phx-white) center / 12px 12px no-repeat; vertical-align: -3px; cursor: pointer; }
input[type=checkbox] { border-radius: var(--r-xs); }
input[type=checkbox]:checked { background-color: var(--phx-ink); border-color: var(--phx-ink); background-image: var(--ui-check); }
input[type=checkbox]:indeterminate { background-color: var(--phx-ink); border-color: var(--phx-ink); background-image: var(--ui-dash); }
input[type=radio] { border-radius: 50%; }
input[type=radio]:checked { border: 5px solid var(--phx-ink); background-color: var(--phx-white); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline-offset: 2px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 30px; height: 18px; flex: none; border-radius: var(--r-pill); background: var(--line-3); transition: background-color var(--t-fast) var(--ease); }
.switch-track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--phx-white); transition: transform var(--t-fast) var(--ease); }
.switch input:checked + .switch-track { background: var(--phx-ink); }
.switch input:checked + .switch-track::after { transform: translateX(12px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--line-4); outline-offset: 2px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.input-group { position: relative; display: flex; }
.input-group input { padding-right: 64px; }
.input-group:has(.input-action .ic) input { padding-right: 40px; }
.input-action { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-width: 30px; height: calc(100% - 8px); max-height: 36px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: calc(var(--r-sm) - 4px); background: transparent; color: var(--phx-stone); font-family: var(--phx-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; transition: background-color var(--t-fast) var(--ease); }   /* recuo de 4 px concêntrico ao raio do campo (revisão 1.7, B2) */
.input-action:has(.ic) { padding: 0; width: 32px; }
.input-action:hover { background: var(--line-1); color: var(--phx-ink); }
.input-action .ic-hide, .input-action[aria-pressed="true"] .ic-show { display: none; }
.input-action[aria-pressed="true"] .ic-hide { display: inline-block; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line-1); cursor: pointer; }
.choice:first-of-type { border-top: 0; }
.choice input { margin-top: 2px; }
.choice > span { flex: 1; font-size: 13.5px; }
.choice strong { display: block; }
.choice .code { margin-top: 2px; }

/* controle segmentado */
.seg:not(rect) { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 2px; border-radius: var(--r-sm); background: var(--phx-soft); overflow-x: auto; scrollbar-width: none; vertical-align: middle; }
.seg:not(rect)::-webkit-scrollbar { display: none; }
.seg-item { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border: 1px solid transparent; border-radius: calc(var(--r-sm) - 2px); background: transparent; color: var(--phx-text-3); font-size: 12.5px; white-space: nowrap; transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.seg-item:hover { color: var(--phx-ink); }
.seg-item[aria-disabled="true"], .seg-item[aria-disabled="true"]:hover { color: var(--phx-stone); cursor: not-allowed; }   /* item inativo: fica no grupo e na ordem de Tab, sem ação */
.seg-item.is-active, .seg-item[aria-pressed="true"] { background: var(--surface-raised); border-color: var(--line-2); color: var(--phx-ink); font-weight: 500; }
.seg-item small { font-family: var(--phx-mono); font-size: 11px; font-weight: 400; color: var(--phx-stone); letter-spacing: 0; }

/* ---------- filtros: busca, chip-select, trilho de filtros, chips ativos ---------- */
.filter-rail { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0 0 12px; }
.filter-rail-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; flex: 1 1 auto; }
.filter-rail-chips:empty { display: none; }
.filter-rail-end { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.panel-head .filter-rail, .panel-toolbar .filter-rail { margin: 0; flex: 1; }
.search { position: relative; display: inline-flex; align-items: center; gap: 8px; flex: 0 1 264px; min-width: 180px; height: 30px; padding: 0 4px 0 12px; border: 1px solid var(--line-ctl); border-radius: var(--r-pill); background: var(--surface-raised); color: var(--phx-stone); cursor: text; transition: border-color var(--t-fast) var(--ease); }
.search:hover { border-color: var(--line-ctl-hover); }
.search:has(input:focus-visible) { outline: 2px solid var(--line-4); outline-offset: 2px; border-color: var(--line-ctl-hover); }
label.search > input { flex: 1; min-width: 0; height: 28px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--phx-ink); font-size: 12.5px; outline: none; }
.search kbd { height: 18px; min-width: 18px; border-radius: var(--r-xs); }
.search:focus-within kbd, .search input:not(:placeholder-shown) ~ kbd { display: none; }
.chip-select { position: relative; display: inline-flex; align-items: center; gap: 4px; flex: none; max-width: 100%; height: 30px; padding-left: 12px; border: 1px solid var(--line-ctl); border-radius: var(--r-pill); background: var(--surface-raised); color: var(--phx-text-3); font-size: 12.5px; white-space: nowrap; cursor: pointer; transition: border-color var(--t-fast) var(--ease); }
.chip-select:hover { border-color: var(--line-ctl-hover); }
.chip-select.is-set { border-color: var(--phx-titanium); background: var(--phx-soft); }   /* estado também pelo preenchimento, não só pelo fio */
.chip-select-label { color: var(--phx-stone); }
.chip-select.is-set .chip-select-label { color: var(--phx-text-3); }
label.chip-select > select { width: auto; max-width: 220px; height: 28px; min-height: 0; padding: 0 28px 0 4px; border: 0; border-radius: 0 var(--r-pill) var(--r-pill) 0; background: transparent none; color: var(--phx-ink); font-size: 12.5px; font-weight: 500; field-sizing: content; text-overflow: ellipsis; outline: none; }
.chip-select:not(.is-set) > select { color: var(--phx-text-3); font-weight: 400; }
label.chip-select > select:disabled { background: transparent; color: var(--phx-stone); }
.chip-select:has(select:focus-visible) { outline: 2px solid var(--line-4); outline-offset: 2px; }
.chip-select > .ic { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--phx-stone); pointer-events: none; }
.chip-select.is-set > .ic { color: var(--phx-ink); }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-rail + .chips { margin: -4px 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-pill); background: var(--surface-raised); color: var(--phx-text-2); font-size: 12.5px; white-space: nowrap; transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
button.chip:hover { border-color: var(--line-3); }
.chip.is-active { gap: 4px; padding: 0 8px 0 12px; border-color: transparent; background: var(--phx-soft); color: var(--phx-ink); }
.chip.is-active:hover { border-color: var(--line-2); }
.chip-key { color: var(--phx-stone); }
.chip-val { font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.chip .ic { color: var(--phx-stone); }
.chip:hover .ic { color: var(--phx-ink); }

/* ---------- números e barras: herói, colunas com fio, barra de rateio, ranking, legenda, trilho ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 28px; margin: 4px 0 28px; }
.kpi, .metric { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--line-3); border-radius: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
.kpi-label { display: inline-flex; align-items: center; gap: 8px; font-size: var(--ui-small); color: var(--phx-text-3); }
.kpi-value { margin-top: 4px; font-size: 28px; font-weight: 300; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--phx-ink); overflow-wrap: anywhere; }
.kpi-note { font-size: 12.5px; color: var(--phx-stone); line-height: 1.45; }
.kpi-bar { display: block; width: 100%; margin-top: 8px; }
.kpi.is-link { cursor: pointer; transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.kpi.is-link:hover { border-top-color: var(--phx-ink); }
.kpi.is-link:focus-visible { outline-offset: 4px; border-radius: var(--r-xs); }
.kpi-go { position: absolute; right: 0; top: 13px; color: var(--phx-stone); opacity: 0; transform: translateX(-4px); transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }   /* ajuste óptico: centra a seta na linha do rótulo (padding de 12 px mais meia linha) */
.kpi.is-link:hover .kpi-go, .kpi.is-link:focus-visible .kpi-go { opacity: 1; transform: none; color: var(--phx-ink); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 40px; align-items: end; padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--line-1); }
.hero-main { min-width: 0; }
.hero-label { display: inline-flex; align-items: center; gap: 8px; font-size: var(--ui-small); color: var(--phx-text-3); }
.hero-value { display: block; margin-top: 4px; font-size: 44px; font-weight: 300; line-height: 1.05; letter-spacing: -.025em; font-variant-numeric: tabular-nums; color: var(--phx-ink); overflow-wrap: anywhere; }
.hero-note { margin-top: 8px; font-size: 13px; color: var(--phx-stone); }
.hero-bar { margin-top: 20px; }
.hero .legend { margin-top: 12px; }
.hero-aside { align-self: stretch; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; min-width: 240px; max-width: 340px; padding-left: 24px; border-left: 1px solid var(--line-2); font-size: 13px; }
.bar-split { display: block; width: 100%; border-radius: 3px; overflow: hidden; }
.bar-rank { display: block; width: 100%; height: 4px; border-radius: 2px; overflow: hidden; }
rect.seg-ink { fill: var(--phx-ink); }
rect.seg-stone { fill: var(--phx-stone); }
rect.seg-titanium { fill: var(--phx-titanium); }
rect.seg-soft { fill: var(--phx-line); }
.bar-track { fill: var(--line-1); }
.bar-gap { stroke: var(--bar-gap); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rank-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 4px 16px; width: calc(100% + 24px); margin: 0 -12px; padding: 8px 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--phx-ink); font-size: 13px; text-align: left; transition: background-color var(--t-fast) var(--ease); }
button.rank-row:hover { background: var(--phx-soft); }
.panel button.rank-row:hover { background: var(--phx-paper); }
.rank-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-label small { display: block; font-family: var(--phx-mono); font-size: 11px; color: var(--phx-stone); letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; }
.rank-value { font-family: var(--phx-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-value small { margin-left: 8px; color: var(--phx-stone); font-size: 11px; }
.rank-row .bar-rank { grid-column: 1 / -1; margin-top: 4px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: var(--ui-small); }
.legend li { display: inline-flex; align-items: center; gap: 8px; color: var(--phx-text-3); }
.legend .node { width: 10px; height: 10px; border-radius: 3px; border: 0; }
.legend-value { font-family: var(--phx-mono); font-size: 12.5px; color: var(--phx-ink); font-variant-numeric: tabular-nums; }
.track { list-style: none; margin: 0; padding: 0; display: flex; counter-reset: step; }
.track-step { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; padding-right: 12px; font-size: 13px; color: var(--phx-text-2); }
.track-step::before { content: ""; position: absolute; left: 12px; right: 4px; top: 4px; height: 1px; background: var(--rail); }
.track-step:last-child::before { display: none; }
.track-step > .node { position: relative; z-index: 1; box-shadow: 0 0 0 3px var(--bar-gap); }
.track-text { display: block; min-width: 0; line-height: 1.4; }
.track-text small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--phx-stone); }
.track-step.is-active { color: var(--phx-ink); font-weight: 500; }
.track-step.is-active small { font-weight: 400; }
.track-step.is-blocked { color: var(--phx-ink); }
.track-step.is-pending { color: var(--phx-text-3); }
.track--v { flex-direction: column; }
.track--v .track-step { flex-direction: row; align-items: flex-start; gap: 12px; padding: 0 0 16px; }
.track--v .track-step:last-child { padding-bottom: 0; }
.track--v .track-step::before { left: 4px; right: auto; top: 16px; bottom: 0; width: 1px; height: auto; }
.track--v .track-step > .node { margin-top: 4px; }

/* ---------- dados: tabelas ---------- */
.table-wrap { overflow: auto; max-height: 480px; overscroll-behavior: contain; scrollbar-width: thin; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
th { position: sticky; top: 0; z-index: 1; height: 36px; padding: 0 12px; background: var(--surface-raised); color: var(--phx-stone); text-align: left; white-space: nowrap; vertical-align: middle; border-bottom: 1px solid var(--line-3); }
th.num { text-align: right; }
td { height: var(--ui-row); padding: 8px 12px; border-bottom: 1px solid var(--line-1); vertical-align: middle; line-height: 1.45; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
tbody tr:last-child td { border-bottom: 0; }
tbody td { transition: background-color var(--t-fast) var(--ease); }
tbody tr:hover td { background: var(--wash); }   /* passar o mouse: mais fraco que a seleção */
tbody tr.is-selected td, tbody tr[aria-selected="true"] td { background: var(--phx-soft); }
tbody tr.is-selected td:first-child, tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 2px 0 0 var(--phx-ink); }   /* marca da linha selecionada (não é elevação) */
td.num { font-size: 12.5px; }
td strong { font-weight: 500; }
td .code { margin-top: 0; }
td .tag + .tag { margin-left: 8px; }
tfoot th, tfoot td { position: static; height: var(--ui-row); padding-block: 8px; border-top: 1px solid var(--line-3); border-bottom: 0; color: var(--phx-ink); background: var(--surface-raised); }
tfoot th.num { font-size: 12.5px; letter-spacing: -.01em; }
caption { text-align: left; padding: 12px 20px 4px; color: var(--phx-stone); }
.check, th.check, td.check { width: 44px; text-align: center; }
.truncate { max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn + .btn { margin-left: 4px; }
.tbl-foot, .table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 44px; padding: 4px 12px 4px 20px; border-top: 1px solid var(--line-1); color: var(--phx-stone); font-size: var(--ui-small); }
.tbl-foot .actions, .table-foot .actions { gap: 4px; }
.tbl-foot .btn-icon, .table-foot .btn-icon { width: 30px; height: 30px; }
.filters { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line-1); }

/* ---------- flutuantes: diálogo, folha lateral, paleta, aviso, dock ---------- */
dialog { width: min(720px, calc(100vw - 32px)); max-width: none; max-height: min(88vh, 920px); max-height: min(88dvh, 920px); padding: 0; border: 0; border-radius: var(--r-lg); background: var(--surface-raised); color: var(--phx-ink); box-shadow: var(--shadow-float); overscroll-behavior: contain; --bar-gap: var(--surface-raised); }
dialog::backdrop { background: rgba(10,10,10,.35); }   /* = --veil; ::backdrop não herda variáveis em todos os navegadores */
dialog:focus, dialog:focus-visible { outline: none; }   /* o foco vai para dentro da camada */
dialog[open] { animation: dialog-in var(--t-base) var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
#modal.dialog-narrow, .dialog-narrow { width: min(520px, calc(100vw - 32px)); }
.management-dialog { width: min(1480px, calc(100vw - 32px)); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 12px 12px 24px; background: var(--surface-raised); border-bottom: 1px solid var(--line-1); }
.modal-head h2 { font-size: 18px; font-weight: 400; line-height: 1.3; letter-spacing: -.01em; }
.modal-head .btn-icon, .sheet-head .btn-icon { margin-top: -4px; }
.dialog-kicker { display: block; color: var(--phx-stone); margin-bottom: 4px; }
.modal-body { padding: 20px 24px 24px; }
.modal-body > .field + .field, .modal-body > .form-row + .form-row, .modal-body > .form-row + .field, .modal-body > .field + .form-row { margin-top: 16px; }
.modal-body .lead { font-size: 13.5px; }
.modal-actions { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 24px; background: var(--surface-raised); border-top: 1px solid var(--line-1); }
.modal-actions .push, .sheet-foot .push { margin-right: auto; }
.dialog-error, .sheet-error { margin-top: 16px; }
.dialog-error-list { margin: 8px 0 0; padding-left: 16px; }   /* motivos e campos da recusa, dentro do alerta */
.dialog-error-list li + li { margin-top: 4px; }
.dialog-error-list .code { margin-right: 4px; }
.qr-block { display: grid; grid-template-columns: 168px 1fr; gap: 20px; align-items: start; margin-top: 16px; }
.qr-block img { display: block; width: 168px; height: 168px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--phx-white); }
.qr-block .code { user-select: all; font-size: 12.5px; letter-spacing: .06em; color: var(--phx-ink); }
/* folha lateral: ancorada à direita, cabeçalho fixo, corpo rolável, rodapé de ações */
dialog.sheet { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(520px, 100vw); height: 100vh; height: 100dvh; max-height: none; border-radius: var(--r-lg) 0 0 var(--r-lg); display: none; flex-direction: column; overflow: hidden; }
dialog.sheet[open] { display: flex; animation: sheet-in var(--t-slow) var(--ease); }
dialog.sheet.sheet--wide { width: min(960px, 80vw); }
@keyframes sheet-in { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: none; } }
.sheet-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 12px 12px 24px; border-bottom: 1px solid var(--line-1); }
.sheet-titles { min-width: 0; }
.sheet-kicker { display: block; color: var(--phx-stone); margin-bottom: 4px; }
.sheet-head h2 { font-size: 18px; font-weight: 400; line-height: 1.3; letter-spacing: -.01em; }
.sheet-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 20px 24px 28px; }
.sheet-body > p + p { margin-top: 12px; }
.sheet-body > .section-head:first-child { margin-top: 0; }
.sheet-foot { flex: none; display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 24px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-1); }
/* paleta de comandos (Ctrl K) */
dialog.cmdk { width: min(600px, calc(100vw - 32px)); margin: 12vh auto auto; max-height: min(70vh, 560px); display: none; flex-direction: column; overflow: hidden; }
dialog.cmdk[open] { display: flex; animation: dialog-in var(--t-base) var(--ease); }
.cmdk-search { flex: none; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 4px 12px 4px 16px; border-bottom: 1px solid var(--line-1); color: var(--phx-stone); }
.cmdk-search > input { flex: 1; min-width: 0; height: 44px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--phx-ink); font-size: 15px; outline: none; }
dialog .cmdk-search > input, dialog .cmdk-search > input:focus-visible { background: transparent; outline: none; }
.cmdk-close { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0; border: 0; border-radius: calc(var(--r-lg) - 8px); background: transparent; color: var(--phx-stone); }
.cmdk-close:hover kbd { border-color: var(--line-3); color: var(--phx-ink); }
.cmdk-close .ic { display: none; }
.cmdk-list { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 8px; scroll-padding: 8px; }
.cmdk-group + .cmdk-group { margin-top: 4px; }
.cmdk-group-label { padding: 8px 12px 4px; color: var(--phx-stone); }
.cmdk-item { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: var(--r-sm); color: var(--phx-text-2); font-size: 13.5px; cursor: pointer; }
.cmdk-item .ic { color: var(--phx-stone); }
.cmdk-ic { width: 16px; flex: none; }
.cmdk-item.is-active { background: var(--phx-soft); color: var(--phx-ink); }
.cmdk-item.is-active .ic { color: var(--phx-ink); }
.cmdk-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item-hint { font-size: 12.5px; color: var(--phx-stone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.cmdk-enter { visibility: hidden; }
.cmdk-item.is-active .cmdk-enter { visibility: visible; }
.cmdk-empty { padding: 32px 16px; text-align: center; font-size: 13px; color: var(--phx-stone); }
.cmdk-foot { flex: none; display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--line-1); font-size: 11px; color: var(--phx-stone); }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 4px; }
.cmdk-foot kbd { height: 18px; min-width: 18px; }
/* aviso flutuante: Ink, um nó Titanium como sinal; sem sombra (ZUC-103 item 9, R4: o Ink sobre o Paper já separa; diverge da DEC-047, registrado em D-02/Q-129) */
#toast { position: fixed; right: 24px; bottom: 24px; z-index: 80; display: flex; align-items: center; gap: 12px; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; border-radius: var(--r-md); background: var(--phx-ink); color: var(--phx-paper); font-size: 13px; line-height: 1.45; animation: toast-in var(--t-slow) var(--ease); }
#toast::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--phx-titanium); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* dock: barra flutuante presa ao rodapé do conteúdo */
.dock { position: sticky; bottom: 16px; z-index: 6; display: flex; align-items: center; gap: 12px 20px; min-height: 56px; margin-top: 20px; padding: 8px 8px 8px 20px; border: 1px solid var(--line-1); border-radius: var(--r-lg); background: var(--surface-raised); box-shadow: var(--shadow-float); --bar-gap: var(--surface-raised); }
.dock-total { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 18px; font-weight: 400; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dock-total small { font-size: 12.5px; color: var(--phx-stone); letter-spacing: 0; }
.dock-fields { display: flex; align-items: center; gap: 8px; min-width: 0; margin-left: auto; }
.dock-fields > * { min-width: 0; }
.dock-fields input, .dock-fields select { width: auto; min-width: 180px; }
.dock-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.dock-fields + .dock-actions { margin-left: 0; }
.dock .btn { border-radius: calc(var(--r-lg) - 8px); }

/* ---------- estados: carregando, vazio ---------- */
.spinner { width: 24px; height: 24px; border: 1.5px solid var(--line-3); border-top-color: var(--phx-ink); border-radius: 50%; animation: spin .8s linear infinite; margin: auto; }
@keyframes spin { to { transform: rotate(360deg); } }
#screen { transition: opacity var(--t-fast) var(--ease); }
.loading-cover { opacity: .55; pointer-events: none; transition: opacity var(--t-base) var(--ease) 200ms; }   /* só aparece após ~200 ms */
.initial-loading { min-height: 60vh; display: grid; place-content: center; text-align: center; color: var(--phx-stone); gap: 16px; }
.skeleton { display: grid; gap: 16px; max-width: 980px; animation: fade-in var(--t-base) var(--ease) 200ms both; }
.skeleton span { display: block; height: 12px; border-radius: var(--r-pill); background: var(--phx-soft); animation: pulse 1.6s ease-in-out 200ms infinite; }
.skeleton .sk-title { height: 26px; width: 34%; border-radius: var(--r-sm); }
.skeleton .sk-lead { width: 58%; }
.skeleton .sk-chips { height: 30px; width: 46%; }
.skeleton .sk-row { height: 64px; margin-top: 8px; border-radius: var(--r-md); }
@keyframes pulse { 50% { opacity: .5; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.empty { padding: 36px 20px; text-align: center; color: var(--phx-stone); font-size: 13.5px; }
.empty-state { padding: 40px 32px; max-width: 640px; --bar-gap: var(--surface-canvas); }
.panel .empty-state, .panel.empty-state { --bar-gap: var(--surface-raised); }
.empty-art { display: block; width: 168px; height: 48px; margin-bottom: 16px; }
.empty-line { stroke: var(--phx-line); stroke-width: 1.2; }
.empty-node { fill: var(--bar-gap); stroke: var(--phx-stone); stroke-width: 1.2; }
.empty-node--active { fill: var(--phx-titanium); stroke: var(--phx-titanium); }
.empty-state.is-error .empty-node--active { fill: var(--phx-ink); stroke: var(--phx-ink); }   /* UX-06 (spec §2.5): falha de leitura, nó Ink em vez do Titanium */
.empty-state h2 { font-size: 22px; font-weight: 300; line-height: 1.25; letter-spacing: -.01em; }
.empty-state p { margin-top: 8px; font-size: var(--ui-body); line-height: 1.55; color: var(--phx-stone); max-width: 64ch; }
.empty-state .empty-action, .empty-state > .btn { margin-top: 20px; }

/* ---------- tooltip: [data-tip] → ::after; sem JS; some em telas de toque (texto também em aria-label/title) ---------- */
:where([data-tip]) { position: relative; }
[data-tip]::after { content: attr(data-tip); display: none; position: absolute; z-index: 90; left: var(--tip-left, 50%); right: var(--tip-right, auto); top: var(--tip-top, auto); bottom: var(--tip-bottom, calc(100% + 8px));
  width: max-content; max-width: min(280px, calc(100vw - 32px)); padding: 8px 12px; border-radius: calc(var(--r-sm) - 2px); background: var(--phx-ink); color: var(--phx-paper); box-shadow: var(--shadow-float);
  font: 400 12.5px/1.45 var(--phx-font); letter-spacing: 0; text-transform: none; text-align: left; white-space: normal; pointer-events: none; transform: translate(var(--tip-x, -50%), 0); }
[data-tip]:focus-visible::after { display: block; animation: tip-in var(--t-fast) var(--ease) both; }
@media (hover: hover) {
  [data-tip]:hover::after { display: block; animation: tip-in var(--t-fast) var(--ease) 350ms both; }   /* atraso evita piscar ao atravessar a tela */
}
@keyframes tip-in { from { opacity: 0; transform: translate(var(--tip-x, -50%), var(--tip-dy, 4px)); } to { opacity: 1; transform: translate(var(--tip-x, -50%), 0); } }
@media (hover: none) { [data-tip]::after, [data-tip]:focus-visible::after { display: none; } }
[data-tip-pos="below"] { --tip-top: calc(100% + 8px); --tip-bottom: auto; --tip-dy: -4px; }
[data-tip-pos="below-end"] { --tip-top: calc(100% + 8px); --tip-bottom: auto; --tip-dy: -4px; --tip-left: auto; --tip-right: 0; --tip-x: 0; }
[data-tip-pos="below-start"] { --tip-top: calc(100% + 8px); --tip-bottom: auto; --tip-dy: -4px; --tip-left: 0; --tip-x: 0; }
[data-tip-pos="end"] { --tip-left: auto; --tip-right: 0; --tip-x: 0; }
[data-tip-pos="start"] { --tip-left: 0; --tip-x: 0; }

/* ---------- login: capa escura à esquerda, formulário suave à direita ---------- */
.login-body { background: var(--surface-canvas); }
.login-stage { flex: 1; display: grid; grid-template-columns: minmax(360px, 44%) minmax(0, 1fr); min-height: calc(100vh - var(--ui-foot)); min-height: calc(100dvh - var(--ui-foot)); }
/* capa em três faixas iguais (DEC-065): logo Phraxis no topo, marca do cliente no centro exato, produto no pé */
.login-cover { position: relative; display: grid; grid-template-rows: 1fr auto 1fr; padding: 48px 56px; overflow: hidden; background: var(--phx-ink) url("/static/assets/campo-16x9-abertura.svg") center / cover no-repeat; color: var(--phx-paper); }
.login-cover .brand-logo { width: 150px; align-self: start; }
.login-cover-foot { display: flex; flex-direction: column; gap: 16px; max-width: 420px; align-self: end; }
/* marca do cliente como foto de perfil: logo inteira no centro e a mesma pelagem em volta (scripts/gerar_avatar_cliente.py) */
.login-client-mark { margin: 0; justify-self: center; }
.client-avatar { display: block; width: clamp(176px, 14vw, 232px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: var(--phx-mist);
  box-shadow: 0 0 0 1px var(--on-ink-2), 0 0 0 12px color-mix(in srgb, var(--phx-paper) 4%, transparent), 0 28px 64px color-mix(in srgb, var(--phx-ink) 60%, transparent); }
.client-avatar img { display: block; width: 100%; height: 100%; }
@media (max-height: 720px) and (min-width: 769px) { .client-avatar { width: 148px; } }
.login-cover .product { font-weight: 300; font-size: 28px; line-height: 1.1; letter-spacing: -.015em; }
.login-cover .product-sub { display: block; margin-top: 12px; font-size: 15px; font-weight: 400; line-height: 1.5; letter-spacing: 0; color: var(--phx-mist); }
.login-cover .login-client { color: var(--phx-mist); }
.login-cover .phx-thesis-line { margin: 0; padding-top: 16px; border-top: 1px solid var(--phx-dark-line); font-weight: 300; font-size: 13.5px; color: var(--phx-mist); }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 64px 8vw 64px 7vw; }
.login-panel > * { width: 100%; max-width: 380px; }
.login-title { font-size: 28px; font-weight: 300; line-height: 1.15; letter-spacing: -.015em; }
.login-form { display: flex; flex-direction: column; gap: 16px; margin-top: 28px; }
.login-form input:not([type=checkbox]) { height: 44px; min-height: 44px; padding: 0 12px; font-size: 15px; }
.login-form .input-group input { padding-right: 48px; }
.login-form .input-action { right: 4px; width: 36px; height: 36px; border-radius: calc(var(--r-sm) - 4px); }
.login-code > summary { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: 13px; color: var(--phx-text-3); border-radius: var(--r-xs); }
.login-code > summary:hover { color: var(--phx-ink); }
.login-code > summary .ic-chevron { color: var(--phx-stone); transition: transform var(--t-fast) var(--ease); }
.login-code[open] > summary .ic-chevron { transform: rotate(90deg); }
.login-code .field { margin-top: 8px; }
.login-error[hidden] { display: none !important; }
.login-submit { height: 44px; width: 100%; margin-top: 4px; font-size: 13.5px; }
.login-note { margin-top: 24px; font-size: 12.5px; color: var(--phx-stone); line-height: 1.5; }
/* homologação (DEC-065): etiqueta e rodapé só quando o servidor marca o corpo com data-ambiente="homologacao" */
.login-env { display: none; margin-bottom: 20px; }
.login-body[data-ambiente="homologacao"] .login-env { display: flex; }
.login-env .pill-ink { height: 30px; padding: 0 14px; gap: 10px; font-size: 11.5px; }
.login-env .pill-ink::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--phx-titanium); }
.login-body[data-ambiente="homologacao"] .footband-context::after { content: " · Homologação"; }
.footband--login { margin-top: 0; }

/* ---------- legado da v08 (app.js/extras.js ainda usam; a migração das telas vem na PLAT-03/B e C) ---------- */
.tag { display: inline-flex; align-items: center; gap: 8px; font-size: var(--ui-small); line-height: 1.4; color: var(--phx-text-2); white-space: nowrap; }
.tag + .tag { margin-left: 12px; }
.tag-bad, .tag.bad { color: var(--phx-ink); font-weight: 500; }
.tag:not(:has(.node))::before { content: ""; width: 9px; height: 9px; flex: none; border-radius: 50%; border: 1.5px solid var(--phx-stone); }
.tag.ok::before, .tag.good::before { background: var(--phx-ink); border-color: var(--phx-ink); }
.tag.warn::before, .tag.attention::before { background: var(--phx-ink); border-color: var(--phx-ink); box-shadow: inset 0 0 0 1.5px var(--bar-gap); }   /* anel com ponto, como .node-warn */
.tag.bad::before, .tag.fail::before { border-radius: 2px; background: var(--phx-ink); border-color: var(--phx-ink); }
.tag.active::before { background: var(--phx-titanium); border-color: var(--phx-titanium); }
.tag.plain::before, .tag-plain::before { display: none; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r-pill); background: transparent; color: var(--phx-text-3); line-height: 1; white-space: nowrap; vertical-align: middle; }
.pill-titanium { border-color: var(--phx-titanium); color: var(--phx-ink); }
.pill-ink { background: var(--phx-ink); border-color: var(--phx-ink); color: var(--phx-paper); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; margin-left: 8px; border: 1px solid var(--phx-titanium); border-radius: var(--r-pill); color: var(--phx-ink); line-height: 1; vertical-align: middle; }
.notice { position: relative; max-width: 980px; margin: 16px 0; padding: 2px 0 2px 16px; color: var(--phx-text-2); font-size: 13.5px; line-height: 1.55; }
.notice::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px; border-radius: 2px; background: var(--phx-titanium); }
.notice.info::before, .notice.success::before { background: var(--phx-stone); }
.notice.error { padding: 12px 16px 12px 20px; border-radius: var(--r-sm); background: var(--phx-soft); color: var(--phx-ink); }
.notice.error::before { left: 8px; top: 8px; bottom: 8px; background: var(--phx-ink); }
.notice p { margin-top: 4px; }
.app-message { position: relative; margin-bottom: 16px; padding: 12px 16px 12px 20px; border-radius: var(--r-sm); background: var(--phx-soft); color: var(--phx-ink); font-size: 13.5px; }
.app-message::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--phx-ink); }
.app-message.info::before, .app-message.success::before { background: var(--phx-stone); }
.app-message:focus { outline: none; }
.app-message:focus-visible { outline: 2px solid var(--line-4); outline-offset: 2px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 28px; margin: 20px 0 28px; }
.metric > small { display: block; font-size: 12.5px; line-height: 1.45; color: var(--phx-stone); }
.metric > small:first-child { font-size: var(--ui-small); color: var(--phx-text-3); }
.metric > strong { display: block; margin: 4px 0 0; font-size: 28px; font-weight: 300; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric.attention > strong::after, .metric.good > strong::after { content: ""; display: inline-block; width: 9px; height: 9px; margin-left: 8px; border: 1.5px solid var(--phx-ink); border-radius: 50%; vertical-align: middle; }
.metric.good > strong::after { background: var(--phx-ink); }
.metric.attention > strong::after { background: var(--phx-ink); box-shadow: inset 0 0 0 1.5px var(--bar-gap); }
button.metric { cursor: pointer; transition: border-color var(--t-fast) var(--ease); }
button.metric:hover { border-top-color: var(--phx-ink); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two-col p + p { margin-top: 12px; }
.def-list { display: grid; grid-template-columns: max-content 1fr; gap: 12px 24px; margin: 0; font-size: 13.5px; }
.def-list dt { color: var(--phx-stone); padding-top: 2px; }
.def-list dd { margin: 0; color: var(--phx-text-2); }

/* ---------- utilitários (style-src 'self' recusa estilo inline) ---------- */
.u-mt4 { margin-top: 4px; }
.u-mt6 { margin-top: 8px; }   /* nome herdado da v08; no ritmo de 4 px vale 8 px (prefira .u-mt8) */
.u-mt8 { margin-top: 8px; }
.u-mt12 { margin-top: 12px; }
.u-mt16 { margin-top: 16px; }
.u-mt24 { margin-top: 24px; }
.u-mb16 { margin-bottom: 16px; }
.u-w68 { width: 68px; flex: none; }
.u-right { text-align: right; }
/* visibilidade por largura: .only-desktop some no celular, .only-mobile some no desktop (corte em 768 px) */
@media (min-width: 769px) { .only-mobile { display: none !important; } }
main#workspace h1[tabindex="-1"]:focus { outline: none; }   /* título recebe o foco após navegar (paleta); não é controle */

/* ---------- larguras intermediárias ---------- */
@media (max-width: 1340px) {
  .env-tag-detail { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }   /* só o nome; o detalhe segue no title e para leitor de tela */
}
@media (max-width: 1100px) {
  .top-cmdk.btn-icon { min-width: 0; }
  .top-cmdk-text { display: none; }
}
@media (max-width: 960px) {
  .user-meta, .user-menu > .ic { display: none; }
  .env-tag { height: 24px; padding: 0 10px; letter-spacing: .04em; }
  .env-tag::before { display: none; }
  .user-menu { padding: 0 4px; }
  .hero { grid-template-columns: 1fr; }
  .hero-aside { max-width: none; padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--line-2); }
}

/* ---------- celular (compact): faixas curtas, gaveta de navegação, camadas em tela cheia ---------- */
@media (max-width: 768px) {
  :root { --ui-gutter: 16px; --ui-bar: 56px; --ui-foot: 36px; }
  .topbar { gap: 2px; padding: 0 4px; }
  .topbar .nav-toggle { display: inline-flex; width: 44px; height: 44px; }
  .brand { flex: 1 1 auto; gap: 8px; }
  .brand-logo { width: 72px; }   /* largura mínima da logo em tela */
  .brand .rule { height: 18px; }
  .brand:has(> .env-tag:not([hidden])) > .brand-client { display: none; }   /* homologação: a etiqueta ocupa o lugar do cliente */
  .top-actions { flex: none; gap: 0; }
  .top-cmdk.btn-icon { width: 44px; height: 44px; min-width: 0; padding: 0; margin: 0; justify-content: center; background: transparent; box-shadow: none; }
  .top-cmdk kbd { display: none; }
  .top-status { width: 32px; height: 44px; padding: 0; justify-content: center; }
  .top-status #connection-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
  .user-menu { height: 44px; margin-left: 0; padding: 0 4px; }
  .footband { padding: 0 16px; }
  .footband-context { display: none; }   /* compact: símbolo, fio, descritor da marca e versão */
  .footband .signature { gap: 8px; }
  .footband .signature-text { font-size: 11px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; top: var(--ui-bar); left: 0; bottom: 0; z-index: 28; align-self: stretch; width: min(84vw, 300px); height: auto; min-height: 0; max-height: none; padding: 16px 12px calc(24px + env(safe-area-inset-bottom)) 28px; border-right: 1px solid var(--line-1); transform: translateX(-100%); visibility: hidden; transition: transform var(--t-slow) var(--ease), visibility 0s linear var(--t-slow); }
  body.nav-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-float); transition: transform var(--t-slow) var(--ease), visibility 0s; }
  .sidebar-backdrop { display: block; position: fixed; inset: var(--ui-bar) 0 0 0; z-index: 27; background: var(--veil); animation: fade-in var(--t-base) var(--ease); }
  .nav-item { min-height: 44px; }
  main#workspace { padding: 20px var(--ui-gutter) 32px; overflow-x: clip; }   /* no celular, nada alarga a viewport de layout */
  .section-count { white-space: normal; overflow-wrap: anywhere; }
  .user-popover { position: fixed; left: 8px; right: 8px; top: calc(var(--ui-bar) + 8px); min-width: 0; }
  .popover-item { min-height: 44px; }
  /* ações em linha própria: a faixa completa permite quebra sem cortar o último botão */
  .page-head { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px 12px; }
  .page-title { flex: 1 1 0; min-width: 120px; }
  .page-actions { flex: 1 1 100%; min-width: 0; max-width: 100%; flex-wrap: wrap; margin-left: 0; gap: 4px; }
  .page-actions .btn { min-height: 36px; padding: 0 12px; }
  .page-actions .btn:not([data-tip])::after { content: ""; position: absolute; inset: -4px 0; }   /* alvo de toque de 44 px */
  .page-head h1 { font-size: 22px; }
  /* cabeçalho em duas linhas (G1 b): título e a ⓘ; depois a barra de contexto inteira (controles primeiro, "Atualizado em" e ações) numa linha rolável de ponta a ponta */
  .page-head:has(> .context-bar) { justify-content: flex-start; row-gap: 8px; padding-bottom: 8px; margin-bottom: 8px; }
  .page-head > .page-title { margin-right: auto; }
  .page-head > .btn-icon { flex: none; width: 44px; height: 44px; }
  .page-head > .context-bar { display: flex; order: 3; flex: 1 1 100%; min-width: 0; align-items: center; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; gap: 12px; margin: 0 calc(var(--ui-gutter) * -1); padding: 0 var(--ui-gutter); scroll-padding-inline: var(--ui-gutter); }
  .page-head > .context-bar::-webkit-scrollbar { display: none; }
  .page-head > .context-bar > .ctx-controls { order: 0; }
  .context-bar > *, .ctx-controls > *, .periodo > *, .context-bar .page-actions > * { flex: none; }
  .ctx-controls, .ctx-end, .periodo, .context-bar > .page-actions { flex-wrap: nowrap; margin: 0; }
  .context-bar > .page-actions { flex: none; max-width: none; gap: 8px; }
  .hero-label { line-height: 1.3; }   /* o rótulo do herói com o período pode ocupar duas linhas no celular sem empurrar o valor */
  .ctx-optional, .only-desktop { display: none !important; }
  .section-head, .panel-toolbar { flex-direction: column; align-items: flex-start; }
  .panel-head { flex-wrap: wrap; }
  /* trilho de filtros: uma linha rolável; o botão Filtros abre a folha com os mesmos controles */
  .filter-rail { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--ui-gutter) * -1); padding: 4px var(--ui-gutter); scroll-padding-inline: var(--ui-gutter); }
  .filter-rail::-webkit-scrollbar { display: none; }
  .filter-rail .search { flex: 0 0 200px; height: 44px; }
  .search kbd { display: none; }   /* sem teclado físico, o atalho / não se aplica */
  .filter-rail-chips { flex-wrap: nowrap; flex: none; }
  .filter-rail-end { margin-left: 0; }
  .chip-select { height: 44px; }
  label.chip-select > select { height: 44px; min-height: 44px; }   /* o campo cobre o chip inteiro (a borda de 1 px fica sob ele): alvo de 44 px no próprio campo */
  .chip { position: relative; height: 36px; }
  button.chip:not([data-tip])::after, .btn.small:not([data-tip])::after { content: ""; position: absolute; inset: -4px 0; }   /* alvo de toque de 44 px */
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--ui-gutter) * -1); padding: 4px var(--ui-gutter); }
  /* campos (achado 11, DEC-047): 16 px evita o zoom do iOS ao focar e 44 px é o alvo de toque do próprio campo, também dentro de busca, chip-select, paleta, dock, login, diálogos e folhas */
  input:not([type=checkbox]):not([type=radio]), select, textarea { min-height: 44px; font-size: 16px; }
  label.search > input, label.chip-select > select, .cmdk-search > input, .dock-fields input, .dock-fields select, .login-form input:not([type=checkbox]) { font-size: 16px; }   /* mesma especificidade das regras de desktop e depois delas: nenhuma reduz o campo abaixo de 16 px */
  .search { height: 44px; }
  label.search > input { height: 44px; }   /* cobre o invólucro de 44 px, como o select do chip-select */
  .chip-select { font-size: 13px; }
  .btn { min-height: 44px; }
  .btn.small { min-height: 36px; }
  .panel-head .btn.small, .panel-toolbar .btn.small { min-height: 44px; }   /* cabeçalho do painel: alvo de 44 px no próprio botão; o título e o botão seguem centrados (align-items) e o cabeçalho cresce de 52 para 60 px (achado 21, DEC-047) */
  .tbl-foot .btn-icon, .table-foot .btn-icon { width: 44px; height: 44px; }
  .btn-icon, .btn-icon.small { width: 44px; height: 44px; }
  details > summary { min-height: 44px; display: inline-flex; align-items: center; }   /* alvo de toque de 44 px */
  .login-code > summary { min-height: 44px; }
  .seg-item { height: 40px; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .kpi-value { font-size: 22px; }
  .hero-value { font-size: 32px; }
  td { height: 48px; padding-block: 12px; }   /* linha de 48 px no toque */
  .table-wrap th, .table-wrap td { white-space: nowrap; }   /* tabela rola na horizontal em vez de quebrar em três linhas */
  .table-wrap td.wrap, .table-wrap td .code { white-space: normal; }   /* código e célula marcada quebram dentro da célula: nada invade a coluna vizinha */
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .track:not(.track--v) { flex-direction: column; }
  .track:not(.track--v) .track-step { flex-direction: row; gap: 12px; padding: 0 0 16px; }
  .track:not(.track--v) .track-step::before { left: 4px; right: auto; top: 16px; bottom: 0; width: 1px; height: auto; }
  .track:not(.track--v) .track-step > .node { margin-top: 4px; }
  /* camadas flutuantes em tela cheia */
  dialog, #modal.dialog-narrow, .dialog-narrow, .management-dialog { width: 100vw; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
  dialog.sheet, dialog.sheet.sheet--wide { width: 100vw; border-radius: 0; }
  dialog.cmdk { width: 100vw; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
  .cmdk-item { min-height: 48px; }
  .cmdk-foot { display: none; }
  .cmdk-close { width: 44px; height: 44px; }
  .cmdk-close kbd { display: none; }
  .cmdk-close .ic { display: inline-block; }
  #modal-content { min-height: 100%; display: flex; flex-direction: column; }
  #modal-content > .modal-body { flex: 1; }
  .modal-head, .sheet-head { padding: 12px 8px 12px 16px; }
  .modal-body, .sheet-body { padding: 16px; }
  .modal-actions, .sheet-foot { flex-wrap: wrap; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  #toast { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: none; }
  /* dock de largura total, empilhado */
  .dock { bottom: 0; flex-direction: column; align-items: stretch; gap: 8px; margin: 20px calc(var(--ui-gutter) * -1) 0; padding: 12px var(--ui-gutter) calc(12px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .dock-fields { margin-left: 0; }
  .dock-fields > * { flex: 1 1 0; }
  .dock-fields input, .dock-fields select { width: 100%; min-width: 0; min-height: 44px; }
  .dock-actions { margin-left: 0; }
  .dock-actions .btn { flex: 1; }
  .form-row, .two-col, .def-list { grid-template-columns: 1fr; }
  .qr-block { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; row-gap: 16px; }
  .empty-state { padding: 28px 4px; }
  /* login */
  .login-stage { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 0; }
  .login-cover { min-height: 220px; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; gap: 28px 16px; padding: 20px 20px 24px; }   /* altura fixa: linha auto da grade (o 1fr fica com o painel); o erro do formulário não desloca a capa */
  .login-cover .brand-logo { width: 110px; grid-column: 1; grid-row: 1; align-self: center; }
  .login-client-mark { grid-column: 2; grid-row: 1; }   /* no celular a marca do cliente fica ao lado da logo Phraxis */
  .login-cover-foot { grid-column: 1 / -1; grid-row: 2; }
  .client-avatar { width: 56px; box-shadow: 0 0 0 1px var(--on-ink-2); }
  .login-env { margin-bottom: 16px; }
  .login-cover .product { font-size: 22px; }
  .login-cover .product-sub { margin-top: 8px; font-size: 13.5px; }
  .login-cover .phx-thesis-line { display: none; }
  .login-panel { justify-content: flex-start; padding: 32px 20px 40px; }
  .login-panel > * { max-width: none; }
  .login-title { font-size: 22px; }
}

/* ---------- movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: 0ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
  .spinner { animation: spin 2.4s linear infinite !important; }
  .skeleton span { animation: none !important; }
}

/* ---------- login: acesso pela conta da empresa (SSO) ---------- */
/* Escondido por padrão (atributo hidden); o login.js mostra o bloco só com data-sso="1". O display fica sob :not([hidden]) para nunca vencer o hidden. */
.login-sso:not([hidden]) { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.login-sso-sep { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--phx-stone); }
.login-sso-sep::before, .login-sso-sep::after { content: ""; flex: 1; height: 1px; background: var(--phx-line); }
.login-sso .btn { width: 100%; height: 44px; font-size: 13.5px; }
