/* Manzo · sistema de operação. Tema do protótipo (design/prototipo/css): mesmos tokens, tipografia e componentes.
   Sem estilo inline e sem dependências externas (CSP: default-src 'self'). */

@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("/assets/fonts/montserrat-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("/assets/fonts/montserrat-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Tokens (tema claro; o escuro é o padrão, via html[data-theme="dark"]) ---------- */
:root {
  color-scheme: light;
  --brand-orange: #FD4D02; --brand-black: #0A0A0A; --brand-offwhite: #F2EFEA;
  --bg: #FFFFFF; --surface: #F5F5F5; --surface-2: #EDEDED; --text: #1A1A1A; --text-muted: #5C5C5C; --line: #E3E3E3; --line-strong: #CFCFCF;
  --accent: var(--brand-orange); --accent-text: #B03600; --accent-soft: rgba(253, 77, 2, 0.10); --on-accent: #1A1A1A;
  --nav-bg: var(--brand-black); --nav-text: var(--brand-offwhite); --nav-muted: #9C978F; --nav-line: #2A2A2D; --nav-active-bg: #17171A;
  --pos: #1F7A4D; --pos-bg: #E3F2EA; --warn: #8A5A00; --warn-bg: #FFF1CF; --risk: #B42318; --risk-bg: #FCE5E2;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --fs-xs: .75rem; --fs-sm: .8125rem; --fs-md: .9375rem; --fs-lg: 1.125rem; --fs-xl: 1.5rem; --fs-kpi: 1.75rem; --fs-hero: 2.25rem;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --radius: 8px; --radius-sm: 6px; --radius-pill: 999px; --tap: 44px; --focus: 0 0 0 3px rgba(253, 77, 2, 0.45);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0A0A; --surface: #141416; --surface-2: #1C1C1F; --text: #F2EFEA; --text-muted: #A8A39B; --line: #2A2A2D; --line-strong: #3A3A3E;
  --accent-text: #FD4D02; --accent-soft: rgba(253, 77, 2, 0.16); --nav-active-bg: #1C1C1F;
  --pos: #4CC38A; --pos-bg: rgba(76, 195, 138, 0.14); --warn: #E5B04A; --warn-bg: rgba(229, 176, 74, 0.14); --risk: #FF6B6B; --risk-bg: rgba(255, 107, 107, 0.14);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs-md); line-height: 1.5; font-feature-settings: "tnum" 1, "lnum" 1; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
p { margin-bottom: var(--sp-3); }
p:last-child { margin-bottom: 0; }
h3 { font-size: var(--fs-md); font-weight: 700; margin: var(--sp-5) 0 var(--sp-3); }
a { color: var(--accent-text); }
small, .muted { color: var(--text-muted); }
small { font-size: var(--fs-xs); }
.break { overflow-wrap: anywhere; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
.sprite { position: absolute; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; z-index: 100; border-radius: var(--radius-sm); font-weight: 700; }
.skip:focus { left: 8px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 16px; height: 16px; }

/* ---------- Estrutura: menu lateral preto + cabeçalho ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--nav-bg); color: var(--nav-text); display: flex; flex-direction: column; padding: var(--sp-5) var(--sp-3); border-right: 1px solid var(--nav-line); }
.brand { display: block; padding: var(--sp-2) var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--accent); margin-bottom: var(--sp-4); }
.brand img { display: block; width: 150px; height: auto; }
.nav-group { margin-top: var(--sp-4); }
.nav-label { font-size: var(--fs-xs); letter-spacing: .16em; text-transform: uppercase; color: var(--nav-muted); padding: 0 var(--sp-3) var(--sp-2); font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); padding: 0 var(--sp-3); border-radius: var(--radius-sm); text-decoration: none; color: var(--nav-text); font-weight: 500; position: relative; }
.nav-link:hover { background: var(--nav-active-bg); }
.nav-link[aria-current="page"] { background: var(--nav-active-bg); font-weight: 700; }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--accent); border-radius: 2px; }
.nav-link[aria-current="page"] .icon { color: var(--accent); }

.page { min-width: 0; display: flex; flex-direction: column; }
.head { position: sticky; top: 0; z-index: 20; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-6); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.titles { margin-right: auto; min-width: 0; }
.topbar h1 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.topbar .sub { display: block; font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); }
.top-actions { display: flex; gap: var(--sp-2); align-items: center; justify-content: flex-end; flex-wrap: wrap; min-width: 0; margin-left: auto; }
.identity { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted); min-width: 0; }
.identity .who { min-width: 0; overflow-wrap: anywhere; text-align: right; }
.identity .who b { display: block; color: var(--text); font-weight: 600; }
.identity .who span { font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.content { padding: var(--sp-6); max-width: 1320px; width: 100%; margin: 0 auto; outline: none; }
.footnote { padding: var(--sp-6); color: var(--text-muted); font-size: var(--fs-xs); border-top: 1px solid var(--line); margin-top: auto; }

#message:not(:empty) { display: flex; gap: var(--sp-3); padding: var(--sp-3) var(--sp-6); background: var(--surface); border-bottom: 1px solid var(--line); border-left: 3px solid var(--risk); color: var(--risk); font-size: var(--fs-sm); font-weight: 600; }
#message.success:not(:empty) { border-left-color: var(--pos); color: var(--pos); }

/* ---------- Botões ---------- */
button { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-5); border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: var(--fs-sm); letter-spacing: .06em; text-transform: uppercase; }
button:hover { filter: brightness(.94); }
button.secondary { background: transparent; border-color: var(--line-strong); color: var(--text); letter-spacing: 0; text-transform: none; }
button.secondary:hover { border-color: var(--accent); filter: none; }
button:disabled { opacity: .45; cursor: wait; filter: none; }
.icon-btn { width: var(--tap); min-width: var(--tap); height: var(--tap); padding: 0; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); }
.icon-btn:hover { border-color: var(--accent); filter: none; }
td button { min-height: 36px; padding: 0 var(--sp-3); font-size: 12px; }
.actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; margin-top: var(--sp-3); }
.actions .field { margin: 0; }
form > button { margin-top: var(--sp-1); }
#backup-now { margin-bottom: var(--sp-3); }

/* ---------- Campos ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-bottom: var(--sp-4); }
.field label { font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--text-muted); }
input, select { min-height: var(--tap); width: 100%; min-width: 0; padding: 0 var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
input:hover, select:hover { border-color: var(--text-muted); }

/* ---------- Cartões, grades, indicadores ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-5); min-width: 0; margin-bottom: var(--sp-4); }
.card-h { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.card-h h2 { font-size: var(--fs-lg); font-weight: 700; margin-right: auto; min-width: 0; overflow-wrap: anywhere; }
.card-h .more { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; text-decoration: none; border: 1px solid var(--accent); border-radius: var(--radius-sm); min-height: 36px; padding: 0 var(--sp-3); display: inline-flex; align-items: center; }
.intro { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--sp-4); max-width: 90ch; }
.grid { display: grid; gap: 0 var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.g-kpi { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-4); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); align-items: start; }
.kpi { margin: 0; }
.kpi .lbl { display: flex; align-items: center; gap: var(--sp-2); }
.kpi .lbl .icon { color: var(--accent); }
.lbl { font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--text-muted); }
.kpi .val { display: block; font-size: var(--fs-kpi); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: var(--sp-2) 0; overflow-wrap: anywhere; }
.kpi .meta { font-size: var(--fs-sm); color: var(--text-muted); display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.kpi .meta .pill { white-space: normal; min-width: 0; }
.kpi .meta a { margin-left: auto; font-size: var(--fs-xs); font-weight: 700; text-decoration: none; letter-spacing: .06em; text-transform: uppercase; min-height: 32px; display: inline-flex; align-items: center; }
.hero { display: block; font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.hint { font-size: var(--fs-xs); color: var(--text-muted); }

/* Inadimplência: sempre visível, estilo neutro (como no protótipo) */
.inad { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-6); align-items: center; border-left: 3px solid var(--text-muted); }
.inad .big { display: block; font-size: var(--fs-hero); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.inad .sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-2); }
.inad .sub b { color: var(--text); }
.inad .more { grid-column: 3; }
.inad a.more { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; text-decoration: none; border: 1px solid var(--accent); border-radius: var(--radius-sm); min-height: var(--tap); padding: 0 var(--sp-4); display: inline-flex; align-items: center; justify-content: center; }

/* Barras em SVG (a CSP não permite largura por atributo style) */
svg.meter { display: block; width: 100%; height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-pill); }
svg.meter rect { fill: var(--accent); }
.inad svg.meter rect { fill: var(--text); }
.rank { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: grid; gap: var(--sp-3); }
.rank li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--sp-3); font-size: var(--fs-sm); align-items: baseline; }
.rank .nm { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.rank .vl { color: var(--text-muted); text-align: right; }
.rank .vl b { color: var(--text); }
.rank svg.meter { grid-column: 1 / -1; height: 6px; }

.chart { width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--text-muted); font-size: 11px; font-family: var(--font); }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .today { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .bar-open { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 2; }
.chart .bar-over { fill: var(--text); }
.legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-muted); margin: var(--sp-3) 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend i.open { border: 1.5px dashed var(--accent); background: var(--accent-soft); }
.legend i.over { background: var(--text); }

.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.alerts li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--radius-sm); padding: var(--sp-3); font-size: var(--fs-sm); }
.alerts li.warn { border-left-color: var(--warn); }
.alerts li .t { font-weight: 600; display: block; }
.alerts li .d { color: var(--text-muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.alerts li a { font-weight: 700; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; text-decoration: none; min-height: var(--tap); display: inline-flex; align-items: center; }

/* ---------- Selos: sempre ícone ou texto, nunca só cor ---------- */
.pill, .tag { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); color: var(--text-muted); white-space: nowrap; }
.pill .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.pill.pos { color: var(--pos); background: var(--pos-bg); border-color: currentColor; }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: currentColor; }
.tag.negative { color: var(--risk); background: var(--risk-bg); border-color: var(--risk); }
.negative { color: var(--risk); }

.notice { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-strong); border-left: 3px solid var(--accent); background: var(--bg); border-radius: var(--radius-sm); font-size: var(--fs-sm); }
.empty { color: var(--text-muted); padding: var(--sp-4) 0; }

/* ---------- Abas (Cadastros) ---------- */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-5); overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--sp-4); border-bottom: 3px solid transparent; font-weight: 600; color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th { text-align: left; font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--accent); white-space: nowrap; }
td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: break-word; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nw { white-space: nowrap; }
td.rev .v { text-decoration: line-through; color: var(--text-muted); }
td .v > button + button { margin-left: var(--sp-2); }

/* ---------- Pedido: itens ---------- */
.item-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--sp-3); align-items: end; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-3); margin-bottom: var(--sp-3); }
.item-row .field { margin: 0; }

details { margin-top: var(--sp-4); }
summary { cursor: pointer; color: var(--accent-text); font-weight: 700; min-height: var(--tap); display: flex; align-items: center; gap: var(--sp-2); }
summary::before { content: "▸"; }
details[open] > summary::before { content: "▾"; }
summary::-webkit-details-marker { display: none; }
summary { list-style: none; }
details > form { padding-top: var(--sp-2); }
td details { margin: 0; }
td summary { min-height: 32px; font-size: var(--fs-xs); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-xs); margin: var(--sp-2) 0 0; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 20px; letter-spacing: 1px; user-select: all; word-break: break-all; }

/* ---------- Janelas ---------- */
dialog { color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-top: 3px solid var(--accent); border-radius: var(--radius); width: min(520px, 95vw); max-height: 90vh; overflow: auto; padding: var(--sp-6); }
dialog.wide { width: min(760px, 95vw); }
dialog::backdrop { background: rgba(0, 0, 0, .62); }
dialog h2 { font-size: var(--fs-lg); font-weight: 700; margin-bottom: var(--sp-4); overflow-wrap: anywhere; }
dialog .grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
#dialog-message:not(:empty) { margin-top: var(--sp-3); color: var(--risk); font-weight: 600; font-size: var(--fs-sm); }

/* ---------- Entrada, configuração inicial e troca obrigatória de senha ---------- */
.auth-mode .app { grid-template-columns: minmax(0, 1fr); }
.auth-mode .sidebar, .auth-mode .titles, .auth-mode .bottomnav { display: none; }
.auth-mode .head { position: static; }
.auth-mode .topbar { border-bottom: 0; }
.auth-mode .footnote { text-align: center; }
.auth { max-width: 460px; margin: 0 auto var(--sp-6); padding: 0; overflow: hidden; }
.auth-brand { background: var(--brand-black); display: flex; justify-content: center; padding: var(--sp-6) var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--accent); }
.auth-brand img { width: 170px; height: auto; display: block; }
.auth-body { padding: var(--sp-6); }
.auth h2 { font-size: var(--fs-xl); font-weight: 700; margin-bottom: var(--sp-2); }
.auth form { margin-bottom: var(--sp-4); }
.auth form > button { width: 100%; }
.auth-body > .muted { font-size: var(--fs-xs); }

/* ---------- Navegação do celular (barra inferior + "Mais") ---------- */
.bottomnav, .sheet, .sheet-backdrop { display: none; }
.theme-seg { display: flex; border: 1px solid var(--nav-line); border-radius: var(--radius-sm); padding: 2px; background: var(--nav-active-bg); margin-top: var(--sp-2); }
.theme-seg button { flex: 1; border: 0; background: transparent; color: var(--nav-text); letter-spacing: 0; text-transform: none; }
.theme-seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

@media (max-width: 1100px) {
  .g-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: var(--sp-3) var(--sp-4); gap: var(--sp-3); }
  .topbar h1 { font-size: var(--fs-lg); }
  #message:not(:empty) { padding: var(--sp-3) var(--sp-4); }
  .content { padding: var(--sp-4); }
  .card { padding: var(--sp-4); }
  .auth { padding: 0; }
  .footnote { padding: var(--sp-4) var(--sp-4) 96px; }
  .auth-mode .footnote { padding-bottom: var(--sp-4); }
  button, td button { min-height: var(--tap); }
  .kpi .meta a, .card-h .more { min-height: var(--tap); }
  td summary { min-height: var(--tap); }
  .bottomnav { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--nav-bg); border-top: 1px solid var(--accent); padding: 4px 4px max(4px, env(safe-area-inset-bottom)); }
  .bottomnav a, .bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; min-width: 0; padding: 0 2px; color: var(--nav-muted); text-decoration: none; font-size: 10.5px; font-weight: 600; letter-spacing: 0; text-transform: none; background: none; border: 0; cursor: pointer; border-radius: var(--radius-sm); }
  .bottomnav [aria-current="page"] { color: var(--nav-text); }
  .bottomnav [aria-current="page"] .icon { color: var(--accent); }
  .bottomnav .more-btn { color: var(--nav-text); border: 1px solid var(--accent); background: var(--nav-active-bg); margin: 4px 2px; min-height: 48px; }
  .bottomnav .more-btn .icon { color: var(--accent); width: 18px; height: 18px; }
  .bottomnav .more-btn[aria-expanded="true"] .icon { transform: rotate(180deg); }
  .sheet-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 40; }
  .sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 85vh; overflow-y: auto; background: var(--nav-bg); color: var(--nav-text); border-top: 2px solid var(--accent); border-radius: 12px 12px 0 0; padding: var(--sp-4) var(--sp-4) calc(var(--sp-6) + env(safe-area-inset-bottom)); }
  .sheet.open { display: block; }
  .sheet .nav-link { min-height: 52px; }
  .sheet .nav-label { margin-top: var(--sp-3); }
  .item-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .item-row .field:first-child { grid-column: 1 / -1; }

  /* tabelas viram lista de cartões: rótulo + valor, ação visível, sem rolagem lateral */
  table.stack { display: block; }
  .stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .stack tbody { display: block; }
  .stack tr { display: block; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-1) var(--sp-3) var(--sp-2); margin-bottom: var(--sp-3); }
  .stack tbody tr:hover { background: var(--bg); }
  .stack td { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); padding: 7px 0; border: 0; text-align: right; }
  .stack td::before { content: attr(data-label); flex: none; font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; text-align: left; }
  .stack td .v { min-width: 0; overflow-wrap: anywhere; }
  .stack td.nw { white-space: normal; }
  .stack td.act { display: flex; gap: var(--sp-2); padding: var(--sp-3) 0 var(--sp-1); }
  .stack td.act::before { content: none; }
  .stack td.act .v { display: flex; flex: 1; gap: var(--sp-2); flex-wrap: wrap; justify-content: stretch; overflow-wrap: normal; }
  .stack td.act button { flex: 1 1 120px; min-height: var(--tap); }
  .stack td.act .v > button + button { margin-left: 0; }
  .stack td.empty { display: none; }
}
@media (max-width: 620px) {
  .inad { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .inad .big { font-size: 1.9rem; }
  .inad .more { grid-column: 1; }
}
@media (max-width: 520px) {
  .kpi .val { font-size: 1.5rem; margin: var(--sp-1) 0; }
  .g-kpi { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .g-kpi .kpi { padding: var(--sp-3) var(--sp-4); }
  .topbar .titles { flex: 1 1 100%; }
  .auth-mode .topbar { padding-bottom: 0; }
  .top-actions { width: 100%; }
  #identity { margin-right: auto; min-width: 0; }
  .identity .who { text-align: left; }
}
@media print { .sidebar, .bottomnav, .head { display: none; } }
