/* Identidade visual da Nuttria, seguindo o artefato "ROI & Break-even Suínos" (Calculadora Suínos). */
:root {
  --bg-page: #f4f6fb; --bg-surface: #ffffff; --bg-sunken: #eef1f8; --bg-inverse: #0a1652;
  --ink: #0d1638; --ink-muted: #4e567a; --ink-subtle: #7b829f; --ink-inverse: #ffffff;
  --border: #dbe0ec; --border-strong: #b9c1d5; --border-subtle: #eaeef6;
  --primary: #0a1652; --primary-hover: #060d33; --primary-soft: #e0e4f1; --on-primary: #ffffff;
  --accent: #ff213e; --accent-soft: #ffd9de; --accent-hover: #db1a32;
  --success: #1f8a5b; --success-soft: #d6f0e3; --warn: #d97706; --warn-soft: #fde6c6; --danger: #ff213e; --danger-soft: #ffd9de;
  --hover: var(--hover); --danger-ink: var(--danger-ink); --danger-box-ink: var(--danger-box-ink); --ok-ink: #14603f; --warn-ink: #8a4a05;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --row-h: 36px; --input-h: 34px; --radius: 6px; --radius-lg: 10px;
  --shadow-sm: 0 1px 0 rgba(20, 32, 26, .04); --shadow-pop: 0 8px 24px rgba(10,22,82,.18);
}
/* Como na calculadora: o padrão é sempre o claro; o escuro só entra pelo botão do topo. */
:root[data-theme="dark"] {
  --bg-page: #0b1020; --bg-surface: #131a31; --bg-sunken: #0f1529; --bg-inverse: #060c2e;
  --ink: #e6e9f6; --ink-muted: #a6aecb; --ink-subtle: #7f88a8;
  --border: #252e4d; --border-strong: #3a4670; --border-subtle: #1c2442;
  --primary: #8fa0ff; --primary-hover: #a9b6ff; --primary-soft: #1d2650; --on-primary: #060c2e;
  --accent: #ff4a62; --accent-soft: #3a1420; --accent-hover: #ff6f83;
  --success: #4cc794; --success-soft: #12342a; --warn: #f0a94a; --warn-soft: #3a2a10; --danger: #ff4a62; --danger-soft: #3a1420;
  --hover: #182042; --danger-ink: #ff8294; --danger-box-ink: #ffc2cb; --ok-ink: #8be0bd; --warn-ink: #f6c47f;
  --shadow-pop: 0 8px 24px rgba(0,0,0,.5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 var(--font-sans); color: var(--ink); background: var(--bg-page); }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 500; }
h1, h2 { font-weight: 600; }
h2 { font-size: 22px; line-height: 1.25; margin-bottom: 4px; }
h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }

/* Estrutura: barra lateral + topo + conteúdo */
.app { display: flex; height: 100vh; overflow: hidden; }
.side { width: 232px; flex-shrink: 0; background: var(--bg-inverse); color: var(--ink-inverse);
  display: flex; flex-direction: column; position: relative; overflow: hidden; }
.side-quina { position: absolute; right: -40px; bottom: -60px; width: 120px; height: 120px;
  background: var(--accent); transform: rotate(45deg); opacity: .9; pointer-events: none; }
.side-logo { padding: 22px 18px 18px; position: relative; z-index: 1; }
.side-logo img { width: 86px; height: auto; display: block; }
.side nav { padding: 0 10px; position: relative; z-index: 1; flex: 1; overflow-y: auto; }
.side-usuario { padding: 12px 14px; border-top: 1px solid #ffffff14; position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px; }
.side-usuario-info { flex: 1; min-width: 0; }
.side-usuario-nome { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-usuario-perfil { font-size: 10.5px; color: #ffffff8c; text-transform: capitalize; }
.side-usuario form { margin: 0; }
.side-sair { background: transparent; border: 0; color: #ffffffb3; padding: 6px; height: auto; border-radius: 4px; }
.side-sair:hover { background: #ffffff14; color: #fff; border: 0; }
.side-sair svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.topo-vr { width: 1px; height: 24px; background: var(--border); }
.tema-btn { background: none; border: 0; color: var(--ink-muted); padding: 7px; height: auto; border-radius: 6px; }
.tema-btn:hover { background: var(--bg-sunken); }
.tema-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.tema-btn .sol { display: block; } .tema-btn .lua { display: none; }
:root[data-theme="dark"] .tema-btn .sol { display: none; } :root[data-theme="dark"] .tema-btn .lua { display: block; }
.tema-flutuante { position: absolute; top: 16px; right: 16px; }
.topo-usuario { font-size: 12px; font-weight: 500; line-height: 1.3; }
.topo-usuario small { display: block; font-size: 11px; text-transform: capitalize; }
.side-secao { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #ffffff73;
  font-weight: 500; padding: 14px 10px 6px; }
.side-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius);
  color: #ffffffc7; font-size: 13px; text-decoration: none; position: relative; margin-bottom: 2px; }
.side-item:hover { background: #ffffff0d; }
.side-item.ativo { background: #ffffff14; color: #fff; font-weight: 500; }
.side-item.ativo::before { content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px;
  background: var(--accent); border-radius: 2px; }
.side-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.topo { min-height: 56px; border-bottom: 1px solid var(--border); background: var(--bg-surface);
  display: flex; flex-wrap: wrap; align-items: center; padding: 8px 24px; gap: 8px 16px; flex-shrink: 0; }
.topo-titulo { font-size: 13px; font-weight: 500; }
.topo-apuracao { margin-left: 16px; padding: 4px 12px; border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--bg-sunken); font-size: 13px; white-space: nowrap; }
.topo-espaco { flex: 1 1 0; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.pill.ok { background: var(--success-soft); color: var(--success); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.off { background: var(--bg-sunken); color: var(--ink-subtle); }
.pill.red { background: var(--accent-soft); color: var(--accent); }
.selo[data-estado] { font-weight: 500; font-size: 11px; padding: 2px 8px; background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.selo[data-estado="aprovacao"] { background: var(--warn-soft); color: var(--warn); }
.selo[data-estado="aprovada"] { background: var(--success-soft); color: var(--success); }
.selo[data-estado="fechada"] { background: var(--bg-sunken); color: var(--ink-subtle); border-color: var(--border); }
.selo { font-size: 11.5px; font-weight: 600; color: var(--ink-muted); background: var(--bg-sunken);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.topo form { display: inline; margin: 0; }
.conteudo { flex: 1; overflow: auto; padding: 24px 24px 40px; }
.conteudo > * { max-width: 1240px; }

/* Cartões, faixa de indicadores, avisos */
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.faixa { background: var(--bg-inverse); color: var(--ink-inverse); border-radius: var(--radius-lg);
  padding: 14px 20px; margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 12px 40px; }
.faixa div { min-width: 120px; }
.faixa small { display: block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: #ffffffa6; font-weight: 500; }
.faixa strong { font-family: var(--font-mono); font-size: 16px; font-weight: 500; }
.nota { background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; font-size: 12.5px; color: var(--ink-muted); margin-bottom: 16px; }
.aviso { color: var(--warn); }
.erro { color: var(--danger-ink); }
.erro-box { background: var(--danger-soft); border: 1px solid var(--accent); color: var(--danger-box-ink);
  border-radius: var(--radius-lg); padding: 12px 16px; margin-bottom: 16px; }
.voltar { font-size: 12.5px; margin-bottom: 8px; display: block; }
.sub { color: var(--ink-muted); font-size: 13px; margin: 0 0 16px; }
.cob-banner { border-radius: var(--radius-lg); padding: 12px 16px; margin-bottom: 16px; font-size: 15px; border: 1px solid; }
.cob-ok { background: var(--success-soft); border-color: var(--success); color: var(--ok-ink); }
.cob-atencao { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-ink); }
.cob-falha { background: var(--danger-soft); border-color: var(--accent); color: var(--danger-box-ink); }
.cob-sit { font-weight: 600; }
.cob-sit-ok { color: var(--success); }
.cob-sit-atencao { color: var(--warn); }
.cob-sit-falha { color: var(--danger-ink); }
.cob-sit-info { color: var(--ink-muted); }
.cob-neutro { color: var(--ink-muted); }

/* Tabelas */
table { border-collapse: collapse; width: 100%; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 16px; }
th { background: var(--bg-surface); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-subtle); font-weight: 500; text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--border); }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); height: var(--row-h); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover td { background: var(--hover); }
td.num, th.num { text-align: right; font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
th.num { font-family: var(--font-sans); }
table.compacta { width: auto; }
/* Conferência: tabelas largas rolam na horizontal e só a coluna de texto livre (observação,
   detalhe, ações) quebra linha; o resto fica em uma linha, em fonte menor. */
.conteudo .conf-larga { max-width: none; overflow-x: auto; margin-bottom: 16px; }
table.conf { width: max-content; min-width: 100%; }
table.conf th, table.conf td { padding: 5px 8px; font-size: 12px; white-space: nowrap; height: auto; }
table.conf th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
table.conf td.num { font-size: 12px; }
table.conf td.obs { white-space: normal; min-width: 380px; max-width: 560px; line-height: 1.35; }
table.conf td.acoes { white-space: normal; min-width: 260px; }
table.conf td.acoes .btn { margin: 0 4px 4px 0; display: inline-block; }

/* Formulários e botões */
label { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 500; margin-bottom: 4px; }
input, select, textarea { font: inherit; font-size: 13px; color: var(--ink); background: var(--bg-surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); height: var(--input-h); padding: 0 10px; }
input[type=file] { height: auto; padding: 6px 10px; }
textarea { height: auto; padding: 8px 10px; width: 100%; min-width: 130px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
button, .btn { font: inherit; font-size: 13px; font-weight: 500; color: var(--ink); background: var(--bg-surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px 12px; height: var(--input-h);
  cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; }
button:hover, .btn:hover { background: var(--bg-sunken); }
/* botões pequenos dentro de tabelas e ações em linha */
td button, td .btn, .acoes button, .acoes .btn, form.inline button, table.conf .btn { height: 28px; padding: 2px 10px; font-size: 12px; }
button.primario, .btn.primario { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
button.primario:hover { background: var(--primary-hover); }
button.perigo { color: var(--danger-ink); }
.perfis-opcoes { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; height: var(--input-h); }
.perfis-opcoes label { display: inline-flex; align-items: center; gap: 6px; margin: 0 !important; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); }
.perfis-opcoes input { height: auto; }
.linha-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.linha-form > div { display: flex; flex-direction: column; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
form.inline input { width: 110px; height: 30px; text-align: right; font-family: var(--font-mono); }
.acoes { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.acoes form { margin: 0; }
small { color: var(--ink-subtle); }

/* Login e telas públicas: painel da marca à esquerda, formulário à direita (mesmo desenho da calculadora) */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1.05fr; background: var(--bg-page); }
.auth-marca { background: var(--bg-inverse); color: var(--ink-inverse); padding: 36px 44px; display: flex;
  flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-marca::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 20% 80%, rgba(255,33,62,.06), transparent 60%); }
.auth-topo, .auth-meio, .auth-rodape { position: relative; z-index: 1; }
.auth-info { margin-top: 32px; display: inline-flex; background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius-lg); overflow: hidden; }
.auth-info > div { padding: 12px 16px; }
.auth-info > div + div { border-left: 1px solid rgba(255,255,255,.10); }
.auth-info small { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255,255,255,.55); font-weight: 500; }
.auth-info strong { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; margin-top: 4px; }
.auth-ponto { width: 6px; height: 6px; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 3px rgba(255,33,62,.18); }
.req { color: var(--accent); }
.auth-topo img { width: 68px; height: auto; display: block; }
.auth-meio { max-width: 460px; }
.auth-eyebrow { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
  font-weight: 500; margin-bottom: 12px; }
.auth-eyebrow-claro { color: var(--ink-subtle); letter-spacing: .12em; margin-bottom: 4px; }
.auth-marca h1 { font-size: 38px; line-height: 1.1; font-weight: 500; letter-spacing: -.02em; }
.auth-rodape { font-size: 11.5px; color: rgba(245,241,230,.45); letter-spacing: .04em; }
.auth-form { position: relative; display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-bloco { width: 100%; max-width: 380px; }
.auth-bloco h2 { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin: 4px 0 0; }
.auth-bloco .sub { margin: 6px 0 22px; font-size: 13px; }
.auth-campos .campo { margin-bottom: 14px; }
.auth-campos label { font-size: 10.5px; letter-spacing: .08em; margin-bottom: 6px; }
.auth-campos input { width: 100%; height: 40px; font-size: 14px; }
.auth-campos button.grande { width: 100%; height: 42px; font-weight: 500; justify-content: center; font-size: 14px; margin-top: 8px; }
.senha-wrap { position: relative; }
.senha-wrap input { padding-right: 38px; }
.ver-senha { position: absolute; right: 4px; top: 3px; height: 30px; width: 30px; padding: 0; border: 0;
  background: none; color: var(--ink-muted); justify-content: center; }
.ver-senha:hover { background: none; color: var(--ink); }
.ver-senha svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 800px) { .auth { grid-template-columns: 1fr; } .auth-marca { padding: 24px; }
  .auth-rodape { display: none; } .auth-info { margin-top: 20px; } .auth-marca h1 { font-size: 26px; } .auth-form { padding: 28px 20px; } }

@media (max-width: 800px) { .side { display: none; } .conteudo { padding: 12px 16px 32px; } }

.escolher { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.escolher select { width: 100%; min-width: 150px; max-width: 280px; }
.escolher { flex-direction: column; align-items: flex-start; gap: 6px; }

/* Menu: grupo "Regras variáveis" com subnível */
.side-grupo summary { list-style: none; cursor: pointer; }
.side-grupo summary::-webkit-details-marker { display: none; }
.side-grupo summary .side-seta { margin-left: auto; width: 14px; height: 14px; transition: transform .15s; opacity: .7; }
.side-grupo[open] summary .side-seta { transform: rotate(90deg); }
.side-sub { margin: 2px 0 4px 14px; padding-left: 8px; border-left: 1px solid #ffffff26; }
.side-sub .side-item { font-size: 12.5px; padding: 6px 10px; }
.side-sub .side-item.ativo::before { left: -9px; }

/* Abas do período (Variáveis | Representantes) */
.abas { display: inline-flex; background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2px; margin-bottom: 16px; }
.abas a { font-size: 12.5px; font-weight: 500; color: var(--ink-muted); padding: 5px 14px;
  border-radius: 4px; text-decoration: none; }
.abas a[aria-selected=true] { background: var(--bg-surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* Navegação do período: abas grandes (ida e volta), Conferência em destaque, Versões/Exportar empilhados */
.barra-periodo { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
  gap: 12px; margin-bottom: 16px; }
.barra-periodo .abas { margin-bottom: 0; }
.abas-grandes { padding: 4px; gap: 4px; }
.abas-grandes a { font-size: 15px; font-weight: 600; padding: 9px 22px; color: var(--ink);
  border: 1px solid transparent; }
.abas-grandes a:hover { background: var(--bg-surface); border-color: var(--border-strong); }
.abas-grandes a[aria-selected=true] { background: var(--primary); color: #fff; border-color: var(--primary); }
.abas-grandes a.destaque { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.abas-grandes a.destaque[aria-selected=true] { background: var(--primary); color: #fff; }
.acoes-periodo { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.acoes-periodo .btn { text-align: center; }

/* Representantes: matriz, conferência */
.filtros { margin-bottom: 16px; }
.filtros select { min-width: 180px; }
table.matriz td.recuo { padding-left: 36px; color: var(--ink-muted); }
table.matriz tr.mae td { background: var(--bg-sunken); font-weight: 500; }
table.matriz tr.mae { cursor: pointer; }
table.matriz tbody.recolhido tr.nota-linha { display: none; }
table.matriz tbody.recolhido button.seta { transform: rotate(-90deg); }
table.matriz button.seta { height: 22px; width: 22px; padding: 0; justify-content: center; border: 0;
  background: transparent; transition: transform .15s; }
tr.total-geral td { background: var(--bg-sunken); border-top: 2px solid var(--border-strong); }
tr.diverge td { background: var(--warn-soft); }
tr.diverge:hover td { background: var(--warn-soft); }
.col-olho { color: var(--ink-muted); font-size: 12.5px; }

/* quadro de fechamento e cadastros de representantes (Plano 2) */
.rolagem { overflow-x: auto; max-width: 100%; }
details.editar summary { cursor: pointer; font-size: 12.5px; color: var(--primary); }
details.editar[open] { margin-top: 6px; }

/* filtros com várias escolhas (checkbox + busca): mesma aparência do campo select (ex.: Tipo na Carteira) */
/* matriz: a rolagem (vertical e horizontal) fica DENTRO do quadro, com a barra sempre à vista na base do quadro;
   cabeçalho, coluna do nome e linha de total ficam fixos ao rolar */
.matriz-rolagem { max-height: calc(100vh - 170px); overflow: auto; max-width: 100%; margin-bottom: 16px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); }
.matriz-rolagem table.matriz { overflow: visible; border: 0; border-radius: 0; margin: 0; width: max-content; min-width: 100%; }
table.matriz thead th { position: sticky; top: 0; z-index: 3; }
table.matriz th:first-child, table.matriz td:first-child { position: sticky; left: 0; z-index: 2; background: var(--bg-surface); }
table.matriz thead th:first-child { z-index: 4; background: var(--bg-sunken); }
table.matriz tr.mae td:first-child, table.matriz tfoot td:first-child { background: var(--bg-sunken); }
table.matriz tfoot td { position: sticky; bottom: 0; z-index: 2; }
table.matriz tfoot td:first-child { z-index: 3; }
table.matriz td:first-child { box-shadow: 1px 0 0 var(--border); max-width: 420px; }
table.matriz td:first-child small.col-olho { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* matriz: coluna do nome mais larga (e ajustável), cabeçalhos ordenáveis */
table.matriz th.col-nome, table.matriz td:first-child { min-width: 280px; }
table.matriz th.col-nome { position: relative; }
.col-resize { position: absolute; top: 0; right: 0; width: 6px; height: 100%; cursor: col-resize; }
.col-resize:hover, .col-resize.ativo { background: var(--border-strong); }
table.ordenavel th[data-ordem] { cursor: pointer; user-select: none; white-space: nowrap; }
table.ordenavel th[data-ordem]:hover { color: var(--ink); }
table.ordenavel th[data-ordem]::after { content: " ↕"; color: var(--ink-subtle); font-size: 11px; }
table.ordenavel th[aria-sort=ascending]::after { content: " ▲"; color: var(--primary); }
table.ordenavel th[aria-sort=descending]::after { content: " ▼"; color: var(--primary); }
.multi-filtro { position: relative; }
.multi { position: relative; }
.multi summary { display: flex; align-items: center; min-width: 180px; height: var(--input-h); box-sizing: border-box;
  padding: 0 30px 0 10px; font-size: 13px; color: var(--ink); background-color: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; list-style: none; white-space: nowrap;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234e567a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.multi summary::-webkit-details-marker { display: none; }
.multi summary:focus-visible, .multi[open] summary { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.multi-lista { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: 360px;
  max-height: 320px; overflow-y: auto; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 6px; }
.multi-lista .multi-busca { width: 100%; box-sizing: border-box; margin: 0 0 6px; }
.multi-lista label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 8px; font-size: 13px;
  font-weight: 400; color: var(--ink); cursor: pointer; border-radius: 4px; }
.multi-lista label:hover { background: var(--bg-sunken); }
.multi-lista input[type=checkbox] { height: auto; width: auto; padding: 0; margin: 0; }
.multi-lista .multi-todos { border-bottom: 1px solid var(--border-subtle); margin-bottom: 4px; border-radius: 0; }

/* Todas as tabelas: rolagem DENTRO do quadro (a barra horizontal fica sempre à vista), cabeçalho fixo.
   O app.js envolve cada tabela solta num .tabela-rolagem. */
.tabela-rolagem { max-height: calc(100vh - 170px); overflow: auto; max-width: 100%; margin-bottom: 16px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); }
.tabela-rolagem > table { overflow: visible; border: 0; border-radius: 0; margin: 0; width: 100%; }
.tabela-rolagem > table thead th, .tabela-rolagem > table tr:first-child > th { position: sticky; top: 0; z-index: 3; }

/* tabela do tamanho do conteúdo (ex.: Condições de pagamento) */
.tabela-rolagem:has(> table.ajustada) { width: fit-content; }
.tabela-rolagem > table.ajustada { width: auto; min-width: 0; }
table.ajustada td, table.ajustada th { white-space: nowrap; }
.ajuste-celula { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; justify-content: flex-end; }
.ajuste-celula .linha-form { flex-wrap: nowrap; align-items: center; gap: 6px; }

/* campo de observação maior */
textarea.obs { height: auto; min-height: 76px; width: min(460px, 100%); padding: 8px 10px; resize: vertical; line-height: 1.4; }
/* a observação ocupa todo o espaço livre da linha, à direita */
.linha-form > div:has(> textarea.obs) { flex: 1 1 420px; min-width: 280px; }
.linha-form > div > textarea.obs { width: 100%; box-sizing: border-box; }

/* formulário de ajuda de custo: campos na mesma linha base, todos da mesma altura; a observação cresce à direita */
.linha-form.alinhar { align-items: flex-end; margin-bottom: 10px; }
.linha-form.alinhar > div > input, .linha-form.alinhar .multi summary { height: var(--input-h); }
.linha-form.alinhar textarea.obs { min-height: var(--input-h); height: var(--input-h); width: 100%; padding: 7px 10px; }
.linha-form > .campo-largo { flex: 1 1 300px; min-width: 240px; }

/* Representantes (cadastro): listas longas rolam dentro do bloco */
.lista-rolagem { max-height: 168px; overflow-y: auto; margin: 0; padding: 4px 8px; list-style: none;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface); }
.lista-rolagem li { padding: 3px 0; border-bottom: 1px solid var(--border-subtle); font-size: 12.5px; }
.lista-rolagem li:last-child { border-bottom: 0; }
.card.pequeno { max-width: 420px; }
.tabela-rolagem { max-height: calc(100vh - 230px); min-height: 220px; overflow: auto; max-width: 100%; margin-bottom: 16px;
  border: 1px solid var(--border); border-radius: var(--radius); }
.tabela-rolagem table { margin: 0; }
.tabela-rolagem thead th, .tabela-rolagem tr:first-child th { position: sticky; top: 0; z-index: 2; }
