/* Quatra Capital
   Layout: back-office com menu lateral preto fixo (como o fundo do logo) e conteúdo em superfícies claras.
   Destaque em dourado, tirado do logo; números em colunas alinhadas. */
:root {
  --bg: #F3F3F1; --surface: #FFFFFF; --surface-2: #F8F8F6; --ink: #141310; --ink-2: #55524B; --ink-3: #85817A;
  --line: #E3E1DC; --line-2: #CFCCC5;
  --side: #0D0D0F; --side-2: #1C1B1E; --side-ink: #ABA59A; --side-hi: #FFFFFF;
  --accent: #876628; --accent-hi: #C9A45C; --accent-ink: #FFFFFF; --accent-soft: #F3EBDA;
  --good: #1D6B3E; --good-soft: #DFF0E5; --warn: #8A5A00; --warn-soft: #FBEBCB; --bad: #A8321F; --bad-soft: #F7DED9;
  --lowm: #C2531B; --lowm-soft: #FBE7DA;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --grid: #ECEAE6; --axis: #C4C0B8; --shadow: 0 1px 2px rgba(20, 19, 16, .05), 0 4px 16px rgba(20, 19, 16, .04);
  --f-display: 'Schibsted Grotesk', 'Segoe UI', system-ui, sans-serif;
  --f-body: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --r: 8px; --side-w: 248px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0B0C; --surface: #141416; --surface-2: #1B1B1E; --ink: #ECE9E3; --ink-2: #A7A298; --ink-3: #78736B; --line: #27262A; --line-2: #36343B;
    --side: #070708; --side-2: #19181C; --side-ink: #9C968B;
    --accent: #D3B06A; --accent-hi: #D3B06A; --accent-ink: #1A1306; --accent-soft: #372C17;
    --good: #6FCB93; --good-soft: #163626; --warn: #E9B45C; --warn-soft: #3A2C12; --bad: #F09A8A; --bad-soft: #3E1E19; --lowm: #F08A4B; --lowm-soft: #3A2213;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --grid: #232226; --axis: #3A383F; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B0B0C; --surface: #141416; --surface-2: #1B1B1E; --ink: #ECE9E3; --ink-2: #A7A298; --ink-3: #78736B; --line: #27262A; --line-2: #36343B;
  --side: #070708; --side-2: #19181C; --side-ink: #9C968B;
  --accent: #D3B06A; --accent-hi: #D3B06A; --accent-ink: #1A1306; --accent-soft: #372C17;
  --good: #6FCB93; --good-soft: #163626; --warn: #E9B45C; --warn-soft: #3A2C12; --bad: #F09A8A; --bad-soft: #3E1E19; --lowm: #F08A4B; --lowm-soft: #3A2213;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --grid: #232226; --axis: #3A383F; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
img { max-width: 100%; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); letter-spacing: -.01em; margin: 0; text-wrap: balance; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dim { color: var(--ink-3); } .small { font-size: 13px; } .neg { color: var(--bad); } .pos { color: var(--good); }
.code { font-family: var(--f-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.code-lg { font-family: var(--f-mono); font-weight: 500; }
.sub-line { display: block; color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.trunc { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.grow { flex: 1; }

/* ---------- Marca ---------- */
.mono-mark { --s: 30px; display: inline-grid; grid-template-columns: 1fr 1fr; gap: calc(var(--s) * .1); width: var(--s); height: var(--s); flex: none; }
.mono-mark i { display: block; border-radius: 2px; background: currentColor; opacity: .32; }
.mono-mark i:first-child { background: var(--accent-hi); opacity: 1; }
.mono-mark i:last-child { opacity: .9; }
.wordmark { font-family: var(--f-display); font-weight: 700; font-size: 18px; letter-spacing: -.02em; line-height: 1; display: inline-flex; gap: 5px; }
.wordmark b { font-weight: 500; opacity: .75; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.logo-img { display: block; height: 40px; width: auto; max-width: 100%; object-fit: contain; }
.logo-img.custom { height: auto; max-height: 48px; max-width: 200px; }

/* ---------- Estrutura ---------- */
.shell { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; z-index: 40;
  padding: max(18px, env(safe-area-inset-top, 0px)) 12px max(14px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); overflow-y: auto; }
.side .brand { color: var(--side-hi); padding: 6px 10px 24px; }
.side .logo-img { height: 50px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.nav-h { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #77726A; padding: 6px 12px 4px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 6px; color: var(--side-ink); text-decoration: none; font-weight: 500; font-size: 14px; }
.nav a:hover { background: var(--side-2); color: var(--side-hi); }
.nav a[aria-current="page"] { background: var(--side-2); color: var(--side-hi); box-shadow: inset 3px 0 0 var(--accent-hi); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid #242328; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 6px 0 10px; }
.me-av { width: 32px; height: 32px; border-radius: 50%; background: var(--side-2); color: var(--accent-hi); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.me-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.me-t b { color: var(--side-hi); font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-t span { font-size: 12px; }
.me .icon-btn { margin-left: auto; color: var(--side-ink); }
.me .icon-btn:hover { background: var(--side-2); color: var(--side-hi); }
.content { margin-left: var(--side-w); min-width: 0; }
.topbar { display: none; }
.scrim { display: none; }
#main:focus { outline: none; }
.page { max-width: 1280px; margin: 0 auto; padding-block: 28px 64px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 20px; }

/* ---------- Cabeçalho da página ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ph-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.page-head h1 { font-size: 28px; font-weight: 700; line-height: 1.15; }
.ph-sub { margin: 0; color: var(--ink-2); max-width: 78ch; }
.ph-sub a { color: inherit; font-weight: 500; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); text-decoration: none; font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.crumb .ic { width: 15px; height: 15px; }
.crumb:hover { color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.h2 { font-size: 16px; font-weight: 600; }
.h3 { font-size: 14px; font-weight: 600; margin: 18px 0 8px; font-family: var(--f-body); }
.sec-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 6px;
  padding: 8px 14px; font-weight: 600; font-size: 14px; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 38px; }
.btn:hover { border-color: var(--ink-3); }
.btn .ic { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { background: transparent; border-color: transparent; color: var(--bad); padding-inline: 8px; }
.btn.danger-ghost:hover { background: var(--bad-soft); }
.btn.small { padding: 5px 10px; font-size: 13px; min-height: 32px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.flip .ic { transform: scaleX(-1); }

/* ---------- Números de destaque ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stats.s4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats.s3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats.s2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; min-width: 0; box-shadow: var(--shadow); }
.st-label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.st-value { font-family: var(--f-display); font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; overflow-wrap: anywhere; }
.st-sub { font-size: 12.5px; color: var(--ink-3); }
.stat.neg .st-value { color: var(--bad); }
.stat.warn { border-color: var(--lowm); box-shadow: inset 3px 0 0 var(--lowm); }
.stats.mini .stat { box-shadow: none; background: var(--surface-2); padding: 10px 12px; }
.stats.mini .st-value { font-size: 17px; }

/* ---------- Alertas ---------- */
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r); text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); }
.alert .ic { width: 18px; height: 18px; }
.alert.bad { background: var(--bad-soft); border-color: transparent; } .alert.bad .ic { color: var(--bad); }
.alert.warn { background: var(--warn-soft); border-color: transparent; } .alert.warn .ic { color: var(--warn); }
.alert.soft .ic { color: var(--lowm); }
.alert span:nth-child(2) { flex: 1; }
.al-go { font-weight: 600; color: var(--accent); font-size: 13.5px; }

/* ---------- Cartões e painel ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; box-shadow: var(--shadow); }
.card-head { display: flex; flex-direction: column; gap: 2px; }
.card-head.row { flex-direction: row; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.card h2 { font-size: 16px; font-weight: 600; }
.card .sub { margin: 0; color: var(--ink-2); font-size: 13px; max-width: 70ch; }
.card-foot { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash .span2 { grid-column: 1 / -1; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps li > div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.steps li span:not(.st-ic) { color: var(--ink-2); font-size: 13.5px; }
.st-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); flex: none; }
.steps li.done .st-ic { background: var(--good-soft); color: var(--good); }
.steps li.done b { color: var(--ink-2); }

/* ---------- Gráficos ---------- */
.f0 { --c: var(--ink-3); } .f1 { --c: var(--s1); } .f2 { --c: var(--s2); } .f3 { --c: var(--s3); } .f4 { --c: var(--s4); } .f5 { --c: var(--s5); } .f6 { --c: var(--s6); } .f7 { --c: var(--s7); } .f8 { --c: var(--s8); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; flex: none; width: 16px; height: 3px; border-radius: 2px; background: var(--c); }
.key-sq { width: 10px; height: 10px; border-radius: 2px; }
.key-dash { background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 7px); }
.chart { position: relative; min-width: 0; }
.chart-svg { display: block; max-width: 100%; }
.grid { stroke: var(--grid); stroke-width: 1; } .grid.base { stroke: var(--axis); }
.tick { fill: var(--ink-3); font-size: 11px; font-family: var(--f-body); }
.elabel { fill: var(--ink-2); font-size: 11px; font-weight: 600; font-family: var(--f-body); }
.today { stroke: var(--axis); stroke-width: 1; }
.ln { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ln.dash { stroke-dasharray: 5 5; }
.area { fill: var(--c); opacity: .1; }
.dot, .hdot { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.cross { stroke: var(--ink-3); stroke-width: 1; }
.bar { fill: var(--c); } .bar.proj { opacity: .5; }
.band { fill: var(--ink); opacity: .05; }
.hit { fill: transparent; touch-action: pan-y; cursor: crosshair; }
.tip { position: absolute; z-index: 5; pointer-events: none; min-width: 180px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 6px 18px rgba(0, 0, 0, .14); }
.tip .thead { font-weight: 600; margin-bottom: 4px; }
.tip .tag { font-weight: 500; color: var(--ink-3); font-size: 11.5px; }
.trow { display: flex; align-items: center; gap: 6px; line-height: 1.65; }
.trow b { margin-left: auto; padding-left: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.trow.sep { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.tv { font-size: 13px; }
.tv summary { cursor: pointer; color: var(--accent); font-weight: 600; width: max-content; }
.tv-wrap { overflow-x: auto; max-height: 280px; margin-top: 6px; }
.tv table { border-collapse: collapse; width: 100%; }
.tv th { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); text-align: left; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tv td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tv .num { text-align: right; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.b-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; margin-bottom: 5px; }
.b-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.b-name > span { overflow-wrap: anywhere; }
.b-val { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; display: flex; gap: 8px; }
.b-pct { color: var(--ink-3); font-weight: 400; min-width: 46px; text-align: right; }
.b-track { height: 8px; background: var(--grid); border-radius: 0 4px 4px 0; }
.b-fill { height: 100%; background: var(--c); border-radius: 0 4px 4px 0; }
.b-sub { display: block; font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* ---------- Tabelas ---------- */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card .tbl-wrap { border: 0; box-shadow: none; border-radius: 0; margin: 0 -20px; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 20px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tfoot td { border-top: 1px solid var(--line-2); border-bottom: 0; font-weight: 600; background: var(--surface-2); }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl td.act { text-align: right; white-space: nowrap; width: 1%; }
.tbl.clickable tbody tr { cursor: pointer; }
.tbl.clickable tbody tr:hover td { background: var(--surface-2); }
.tbl tr.row-lowm td:first-child { box-shadow: inset 3px 0 0 var(--lowm); }
.tbl tr.row-bad td { background: color-mix(in srgb, var(--bad-soft) 55%, transparent); }
.empty-state { background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r); padding: 28px 20px; text-align: center; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.card .empty-state { border: 0; background: var(--surface-2); }
.empty-state p { margin: 0; max-width: 60ch; }

/* ---------- Selos ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; line-height: 1.6; background: var(--surface-2); color: var(--ink-2); }
.chip.good { background: var(--good-soft); color: var(--good); } .chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.off { background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); } .chip.acc { background: var(--accent-soft); color: var(--accent); }
.lowm { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; font-size: 11.5px; font-weight: 600; color: var(--lowm); white-space: nowrap; vertical-align: 1px; }
.lowm::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lowm); }
.chips .lowm { margin-left: 2px; padding: 2px 9px; border-radius: 999px; background: var(--lowm-soft); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 600; margin-left: 4px; }

/* ---------- Filtros ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input[type="search"] { border: 1px solid var(--line-2); background: var(--surface); border-radius: 6px; padding: 7px 10px; min-height: 38px; }
.filters input[type="search"] { flex: 1; min-width: 200px; max-width: 360px; }
.seg-group { display: inline-flex; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg-btn { border: 0; background: transparent; padding: 7px 14px; font-weight: 500; font-size: 13.5px; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.month-nav { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; padding: 0 2px; }
.month-nav span { min-width: 150px; text-align: center; font-weight: 500; font-size: 13.5px; }
.month-nav .icon-btn { width: 32px; height: 34px; }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; margin: 0; border: 0; padding: 0; }
.field label, .field legend { font-size: 13px; font-weight: 600; color: var(--ink); padding: 0; }
.req { color: var(--bad); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: 6px; padding: 9px 11px; min-height: 42px; font-size: 15px; }
.field textarea { min-height: 0; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); outline-offset: 0; }
.field input:disabled { background: var(--surface-2); color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--ink-3); margin: 0; }
.field.invalid input { border-color: var(--bad); } .field.invalid .hint { color: var(--bad); }
.field.lowm-field input { border-color: var(--lowm); background: var(--lowm-soft); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.span2 { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; margin: 12px 0 4px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.check.inline { margin: 0; font-size: 13.5px; }
.seg-field { margin-bottom: 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg-opt span { display: inline-block; padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 6px; font-size: 14px; font-weight: 500; background: var(--surface); cursor: pointer; }
.seg-opt input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-err { margin: 0; color: var(--bad); font-weight: 500; font-size: 14px; }
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.row-actions .form-err { margin-right: auto; }
.kv { margin: 0; display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.kv .kv-total { border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 9px 0; }
.kv .kv-total dt { color: var(--ink); font-weight: 600; } .kv .kv-total dd { font-weight: 700; font-size: 16px; }
.kv.plain dd { text-align: left; } .kv.plain > div { flex-direction: column; gap: 1px; }
.kv.tight > div { padding: 4px 0; font-size: 13.5px; }
.preview { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; margin-top: 14px; }
.preview > div { display: flex; justify-content: space-between; gap: 12px; }
.preview span { color: var(--ink-2); } .preview b { font-variant-numeric: tabular-nums; font-weight: 500; }
.preview .pv-total { border-top: 1px solid var(--line-2); padding-top: 6px; margin-top: 2px; } .preview .pv-total b { font-weight: 700; }
.notice { margin: 0; padding: 12px 14px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--ink); }
.notice.bad { background: var(--bad-soft); border-color: transparent; }

/* ---------- Operação: formulário com resumo ao lado ---------- */
.op-form { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.form-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.calc-col { position: sticky; top: 20px; }
.calc-card h2 { font-size: 16px; }
.lowm-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 6px; background: var(--lowm-soft); color: var(--ink); font-size: 13.5px; }
.lowm-note .ic { color: var(--lowm); margin-top: 1px; }
.mini-tbl { max-height: 320px; overflow: auto; border-top: 1px solid var(--line); }
.mini-tbl table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.mini-tbl th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 7px 6px 7px 0; border-bottom: 1px solid var(--line); }
.mini-tbl td { padding: 5px 6px 5px 0; border-bottom: 1px solid var(--line); }
.mini-tbl .num { text-align: right; }
.trow-ed { display: grid; grid-template-columns: 130px minmax(0, 1fr) 160px 140px 36px; gap: 10px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--line); }
.trow-ed .field.grow { grid-row: 2; grid-column: 1 / 5; }
.tbl td.wcli { min-width: 180px; }
.trow-ed .rm { margin-bottom: 3px; }
#add-tit { align-self: flex-start; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.doc-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Sócios e contas ---------- */
.socios-grid, .contas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.socio-card, .conta-card { gap: 12px; }
.socio-card.me { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent), var(--shadow); }
.inativo { opacity: .65; }
.sc-top, .cc-top { display: flex; gap: 12px; align-items: flex-start; }
.sc-top h2, .cc-top h2 { font-size: 15.5px; line-height: 1.3; }
.sc-top > div, .cc-top > div { flex: 1; min-width: 0; }
.cc-top > .ic { width: 22px; height: 22px; color: var(--ink-3); margin-top: 2px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; color: #fff; background: var(--c); flex: none; }
.sc-cap { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--surface-2); border-radius: 6px; }
.sc-val { font-family: var(--f-display); font-size: 21px; font-weight: 600; }
.sc-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; }
.link-list li > span { flex: 1; min-width: 0; }
.link-list li b { font-variant-numeric: tabular-nums; font-weight: 500; }
.link-list a { display: flex; gap: 8px; align-items: center; flex: 1; color: var(--ink); text-decoration: none; }
.link-list a b { margin-left: auto; }
.link-list a:hover { color: var(--accent); }

/* ---------- Relatórios ---------- */
.rep-index .rep-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.rep-item { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.rep-item:hover { border-color: var(--accent); }
.rep-item b { font-family: var(--f-display); font-size: 16px; font-weight: 600; }
.rep-item span { color: var(--ink-2); font-size: 13.5px; }
.rep-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.rep-filtro { margin: -8px 0 0; color: var(--ink-2); font-size: 13px; }
.rep-tbl td, .rep-tbl th { white-space: nowrap; }
.print-head, .print-title { display: none; }
.cfg-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cfg-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.logo-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.logo-prev { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-radius: 6px; background: var(--side); color: #fff; min-height: 72px; }
.logo-prev .logo-img { height: 44px; }
.logo-acts { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* ---------- Folha lateral ---------- */
.sheet-bd { position: fixed; inset: 0; z-index: 60; background: rgba(8, 16, 22, .5); display: flex; justify-content: flex-end; }
.sheet { width: min(560px, 100%); height: 100%; background: var(--surface); display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0, 0, 0, .18); }
.sheet.wide { width: min(900px, 100%); }
.sheet form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: max(18px, env(safe-area-inset-top, 0px)) max(22px, env(safe-area-inset-right, 0px)) 14px 22px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 19px; }
.sh-sub { margin: 3px 0 0; color: var(--ink-2); font-size: 13.5px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 18px max(22px, env(safe-area-inset-right, 0px)) 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.sheet-body .tbl-wrap { box-shadow: none; }
.sheet-body > p { margin: 0; }
.sheet-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px max(22px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) 22px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.sf-right { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.del-zone { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.del-q { font-weight: 600; font-size: 14px; }
body.sheet-open { overflow: hidden; }
.toasts { position: fixed; z-index: 80; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 500; font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); transition: opacity .3s, transform .3s; }
.toast.warn { background: var(--warn); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, var(--side) 0 38vh, var(--bg) 38vh); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 30px 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 10px 40px rgba(16, 27, 35, .08); }
.login-brand { display: flex; justify-content: center; padding: 6px 0 4px; }
.login-brand .logo-img { height: 132px; }
.login-brand .logo-img.custom { height: auto; max-height: 120px; }
.login-card h1 { font-size: 18px; font-weight: 600; margin-top: 4px; }

/* ---------- Documentos ---------- */
body.doc-mode .side, body.doc-mode .topbar { display: none; }
body.doc-mode .content { margin-left: 0; }
.doc-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px max(20px, env(safe-area-inset-right, 0px)) 10px max(20px, env(safe-area-inset-left, 0px)); background: var(--surface); border-bottom: 1px solid var(--line); }
.doc-note { max-width: 210mm; margin: 14px auto 0; padding: 10px 14px; border-radius: 6px; background: var(--warn-soft); font-size: 13.5px; }
.papers { padding: 24px 16px 60px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.paper { width: 210mm; max-width: 100%; min-height: 140mm; background: #fff; color: #111; padding: 18mm 18mm 16mm; box-shadow: 0 2px 16px rgba(0, 0, 0, .12); font-size: 12.5px; line-height: 1.55; font-family: var(--f-body); }
.doc-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 14px; border-bottom: 2px solid #111; }
.dh-brand .logo-img { height: 46px; }
.dh-brand { display: flex; align-items: center; gap: 10px; }
.dh-emp { display: flex; flex-direction: column; text-align: right; font-size: 11px; color: #444; }
.dh-emp b { font-size: 12.5px; color: #111; }
.doc-title { font-family: var(--f-display); font-size: 18px; text-transform: uppercase; letter-spacing: .03em; margin: 18px 0 14px; color: #111; }
.doc-title span { font-family: var(--f-mono); font-weight: 500; font-size: 15px; color: #444; margin-left: 8px; }
.doc-sub { font-size: 15px; margin-bottom: 12px; color: #111; }
.doc-partes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.doc-parte { display: flex; flex-direction: column; border: 1px solid #ccc; border-radius: 4px; padding: 8px 10px; font-size: 11.5px; color: #333; }
.doc-parte b { font-size: 13px; color: #111; }
.dp-rot { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #777; font-weight: 600; }
.doc-tbl { width: 100%; border-collapse: collapse; font-size: 11px; margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.doc-tbl th { background: #F1EFEA; text-align: left; font-weight: 600; padding: 6px; border: 1px solid #ccc; }
.doc-tbl td { padding: 5px 6px; border: 1px solid #ccc; vertical-align: top; }
.doc-tbl tfoot td { font-weight: 700; background: #F7F6F3; }
.doc-tbl .num { text-align: right; white-space: nowrap; }
.doc-sum { margin-left: auto; border-collapse: collapse; min-width: 320px; font-size: 12px; font-variant-numeric: tabular-nums; }
.doc-sum td { padding: 4px 0 4px 16px; } .doc-sum td:first-child { padding-left: 0; }
.doc-sum .num { text-align: right; }
.doc-sum .tot td { border-top: 1.5px solid #111; font-weight: 700; padding-top: 6px; font-size: 13px; }
.doc-p { margin: 10px 0; text-align: justify; } .doc-p.small { font-size: 11.5px; }
.cl { font-family: var(--f-body); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 0; color: #111; }
.sigs { display: grid; gap: 28px; margin-top: 46px; } .sigs.two { grid-template-columns: 1fr 1fr; }
.sig { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: 11.5px; color: #333; }
.sig-line { width: 100%; border-top: 1px solid #111; margin-bottom: 6px; }
.sig b { color: #111; font-size: 12px; }
.np { min-height: 0; border: 2px solid #111; }
.np-top { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: stretch; margin-bottom: 16px; }
.np-title { font-family: var(--f-display); font-size: 22px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; align-self: center; color: #111; }
.np-box { border: 1px solid #111; border-radius: 4px; padding: 5px 10px; display: flex; flex-direction: column; min-width: 100px; }
.np-box span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: #666; font-weight: 600; }
.np-box b { font-size: 14px; font-variant-numeric: tabular-nums; }
.np-box.big { background: #F1EFEA; } .np-box.big b { font-size: 17px; }
.np-text { font-size: 13.5px; line-height: 1.8; margin: 0 0 8px; text-align: justify; }
.np-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 14px; font-size: 12px; }
.np-grid > div { display: flex; flex-direction: column; }
.np .sigs { margin-top: 38px; }

/* ---------- Telas menores ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .op-form { grid-template-columns: minmax(0, 1fr); }
  .calc-col { position: static; }

}
@media (max-width: 960px) {
  .side { transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility .2s; }
  body.nav-open .side { transform: none; visibility: visible; box-shadow: 10px 0 30px rgba(0, 0, 0, .25); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(8, 16, 22, .45); }
  .content { margin-left: 0; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--side); color: #fff;
    padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(8px, env(safe-area-inset-left, 0px)); }
  body:not(.doc-mode)::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 31; background: var(--side); }
  .topbar .icon-btn { color: #fff; } .topbar .icon-btn:hover { background: var(--side-2); }
  .topbar .chip { margin-left: auto; background: var(--side-2); color: var(--side-ink); box-shadow: none; }
  .topbar .logo-img { height: 32px; }
  .dash, .cfg-grid { grid-template-columns: minmax(0, 1fr); }
  .stats, .stats.s4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .page { padding-block: 18px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); gap: 16px; }
  .page-head h1 { font-size: 23px; }
  .card { padding: 16px; }
  .card .tbl-wrap { margin: 0 -16px; }
  .stats.s3, .stats.s2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-value { font-size: 18px; }
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .trow-ed { grid-template-columns: 1fr 1fr; }
  .trow-ed .field.grow { grid-row: auto; grid-column: 1 / -1; }
  .trow-ed .rm { grid-column: 1 / -1; grid-row: auto; justify-self: end; }
  .filters input[type="search"] { max-width: none; }
  .month-nav span { min-width: 120px; }
  .tbl-wrap:not(.wide) { overflow: visible; background: transparent; border: 0; box-shadow: none; }
  .tbl-wrap:not(.wide) .tbl, .tbl-wrap:not(.wide) .tbl tbody, .tbl-wrap:not(.wide) .tbl tfoot, .tbl-wrap:not(.wide) .tbl tr, .tbl-wrap:not(.wide) .tbl td { display: block; }
  .tbl-wrap:not(.wide) .tbl thead { display: none; }
  .tbl-wrap:not(.wide) .tbl tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; padding: 10px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
  .card .tbl-wrap:not(.wide) { margin: 0; }
  .card .tbl-wrap:not(.wide) .tbl tr { background: var(--surface-2); border-color: var(--line); }
  .tbl-wrap:not(.wide) .tbl td { padding: 0 !important; border: 0 !important; background: transparent !important; text-align: left; min-width: 0; }
  .tbl-wrap:not(.wide) .tbl td::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
  .tbl-wrap:not(.wide) .tbl td[data-label=""]::before { display: none; }
  .tbl-wrap:not(.wide) .tbl td:first-child { grid-column: 1 / -1; }
  .tbl-wrap:not(.wide) .tbl td.act { grid-column: 1 / -1; text-align: left; width: auto; }
  .tbl-wrap:not(.wide) .tbl .num { white-space: normal; }
  .tbl-wrap:not(.wide) .tbl tfoot tr { background: var(--surface-2); }
  .tbl-wrap:not(.wide) .tbl tr.row-lowm { box-shadow: inset 3px 0 0 var(--lowm); }
  .tbl-wrap:not(.wide) .tbl tr.row-lowm td:first-child { box-shadow: none; }
  .sheet-bd { align-items: flex-end; }
  .sheet, .sheet.wide { height: 94%; border-radius: 14px 14px 0 0; }
  .doc-partes, .np-grid, .sigs.two { grid-template-columns: 1fr; }
  .paper { padding: 18px 16px; }
  .np-top { grid-template-columns: 1fr 1fr; } .np-title { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Impressão ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  :root { color-scheme: light; }
  body { background: #fff !important; color: #111; font-size: 11px; }
  .side, .topbar, .scrim, .no-print, .ph-actions, .doc-bar, .doc-note, .toasts, .sheet-bd, .crumb, .tv { display: none !important; }
  .content { margin: 0 !important; }
  .page { padding: 0 !important; max-width: none; gap: 10px; }
  .papers { padding: 0; gap: 0; display: block; }
  .paper { box-shadow: none; width: auto; min-height: 0; padding: 0; page-break-after: always; break-after: page; }
  .paper:last-child { page-break-after: auto; break-after: auto; }
  .np { border: 2px solid #111; padding: 10mm; margin-bottom: 8mm; page-break-after: auto; break-inside: avoid; }
  .report-page .page-head { display: none; }
  .print-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #111; padding-bottom: 8px; }
    .print-head .logo-img { height: 34px; }
  .pr-meta { display: flex; flex-direction: column; text-align: right; font-size: 10px; }
  .print-title { display: block; font-size: 16px; margin-top: 6px; }
  .tbl-wrap { border: 0 !important; box-shadow: none !important; overflow: visible !important; }
  .tbl { font-size: 9.5px; }
  .tbl th { background: #F1EFEA !important; color: #333; padding: 5px 6px; }
  .tbl td { padding: 4px 6px; }
  .tbl th:first-child, .tbl td:first-child { padding-left: 6px; }
  .tbl th:last-child, .tbl td:last-child { padding-right: 6px; }
  .tbl tr { break-inside: avoid; }
  .tbl tr.row-bad td { background: #FBE9E6 !important; }
}
