/* ===================================================================== tokens */
:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #f9f9f7;
  --surface-3: #f1f0ec;
  --border: #e3e1da;
  --border-strong: #cfccc3;
  --text: #1a1a18;
  --text-2: #52514e;
  --muted: #7c7a73;
  --brand: #eba84f;          /* laranja da planilha */
  --brand-ink: #8a5a14;
  --brand-soft: #fcf1df;
  --total-soft: #e8f5eb;     /* verde da planilha, suavizado */
  --total-line: #b7e0c0;
  --total-ink: #1f5a2b;
  --pos: #006300;
  --neg: #c42b2b;
  --focus: #2a78d6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
  --div-pos: #2a78d6;
  --div-neg: #e34948;
  --gridline: #e1e0d9;
  --axis: #c3c2b7;
  --critical: #d03b3b;
  --good: #0ca30c;
  --warning: #fab219;
  --band-sel: rgba(42, 120, 214, .07);
  --shadow: 0 1px 2px rgba(20, 20, 10, .05);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0f0f0e; --surface: #1a1a19; --surface-2: #202020; --surface-3: #282826;
    --border: #2f2f2d; --border-strong: #42423e;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #95938b;
    --brand-ink: #f0b866; --brand-soft: #35270f;
    --total-soft: #15291a; --total-line: #24502f; --total-ink: #9fdcad;
    --pos: #3ccf55; --neg: #f07a7a; --focus: #5598e7;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --series-4: #c98500; --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --div-pos: #3987e5; --div-neg: #e66767;
    --gridline: #2c2c2a; --axis: #42423e; --band-sel: rgba(57, 135, 229, .08);
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0e; --surface: #1a1a19; --surface-2: #202020; --surface-3: #282826;
  --border: #2f2f2d; --border-strong: #42423e;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #95938b;
  --brand-ink: #f0b866; --brand-soft: #35270f;
  --total-soft: #15291a; --total-line: #24502f; --total-ink: #9fdcad;
  --pos: #3ccf55; --neg: #f07a7a; --focus: #5598e7;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  --series-4: #c98500; --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --div-pos: #3987e5; --div-neg: #e66767;
  --gridline: #2c2c2a; --axis: #42423e; --band-sel: rgba(57, 135, 229, .08);
  --shadow: none;
}

/* ===================================================================== base */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
.muted { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
svg { display: block; }

/* ===================================================================== layout */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 16px;
  padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand); color: #1a1a18; font-weight: 750; font-size: 14px; flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 14px; }
.brand-text span { font-size: 12px; color: var(--muted); }
.year-pick { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px; font-size: 12px; color: var(--muted); }
.year-pick select { flex: 1; max-width: 130px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  text-decoration: none; color: var(--text-2); font-weight: 500;
}
.nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px; }
.save-status { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.save-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.save-status[data-s="pend"]::before, .save-status[data-s="saving"]::before { background: var(--warning); }
.save-status[data-s="err"]::before { background: var(--critical); }
.save-status[data-s="err"] { color: var(--neg); }
.status-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.nuvem-status {
  font: inherit; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
}
.nuvem-status[hidden] { display: none; }
span.nuvem-status { cursor: default; font-size: inherit; color: var(--text-2); }
button.nuvem-status:hover span { text-decoration: underline; }
.nuvem-status svg { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--good); stroke-width: 1.7; stroke-linejoin: round; }
.nuvem-status[data-s="pendente"] svg, .nuvem-status[data-s="sincronizando"] svg, .nuvem-status[data-s="iniciando"] svg { stroke: var(--warning); }
.nuvem-status[data-s="offline"] svg { stroke: var(--muted); stroke-dasharray: 2.5 2; }
.nuvem-status[data-s="erro"] svg { stroke: var(--critical); }
.nuvem-status[data-s="erro"] { color: var(--neg); }
.dl-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; }
.dl-kv dt { color: var(--muted); }
.dl-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
/* versão web: tela de login sem o menu lateral */
body.sem-sessao .app { grid-template-columns: minmax(0, 1fr); }
body.sem-sessao .side { display: none; }
.login-card .brand-mark { width: 44px; height: 44px; font-size: 17px; }
.login-card h1 { margin: 4px 0 0; }
.login-form { display: grid; gap: 12px; width: 100%; margin-top: 8px; text-align: left; }
.login-form input { width: 100%; height: 38px; }
.login-form .btn { justify-content: center; height: 38px; }
.login-nota { font-size: 12px; margin: 4px 0 0; }

.view { padding: 24px 28px 48px; min-width: 0; outline: none; }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.cols { display: grid; gap: 16px; margin-bottom: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); }
@media (max-width: 1180px) { .cols-2, .cols-hero { grid-template-columns: minmax(0, 1fr); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ===================================================================== controls */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 550; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--text); color: var(--surface); border-color: var(--text); }
.btn-primary:hover { background: var(--text-2); border-color: var(--text-2); }
.btn-danger { color: var(--neg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-icon {
  width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 7px; border: 1px solid transparent;
  background: transparent; cursor: pointer; color: var(--text-2); padding: 0;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn-icon.danger:hover { color: var(--neg); }
select, input[type="text"], input[type="number"], input[type="file"], textarea {
  height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); padding: 0 10px; min-width: 0;
}
input[type="file"] { padding: 4px; height: auto; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 550; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

.pills { display: flex; gap: 4px; flex-wrap: wrap; }
.pill {
  height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 13px; color: var(--text-2);
}
.pill:hover { background: var(--surface-3); }
.pill.on { background: var(--text); border-color: var(--text); color: var(--surface); font-weight: 600; }
.pill.atual:not(.on) { border-color: var(--brand); }

.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--border); margin-bottom: 14px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs a {
  display: flex; flex-direction: column; gap: 1px; padding: 8px 14px 10px; text-decoration: none; color: var(--text-2);
  border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 550;
}
.tabs a .tab-total { font-size: 12px; color: var(--muted); font-weight: 450; font-variant-numeric: tabular-nums; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-bottom-color: var(--brand); }

/* ===================================================================== tiles */
.hero { display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.hero .label { color: var(--text-2); font-weight: 550; }
.hero .value { font-size: 48px; font-weight: 650; letter-spacing: -.02em; line-height: 1.05; }
.hero .detail { color: var(--muted); font-size: 13px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 550; }
.status svg { width: 16px; height: 16px; flex: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.tile .label { color: var(--text-2); font-size: 13px; }
.tile .value { font-size: 22px; font-weight: 650; margin-top: 4px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .delta { font-size: 12px; margin-top: 2px; color: var(--muted); }
.tile input.value-input { font-size: 20px; font-weight: 650; height: 38px; width: 100%; margin-top: 4px; text-align: left; }
.tiles-row { margin-bottom: 16px; }

/* ===================================================================== charts */
.chart { width: 100%; position: relative; }
.chart text { font-family: var(--font); }
.chart .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .tick-sel { fill: var(--text); font-weight: 650; }
.chart .lbl { font-size: 12px; fill: var(--text-2); }
.chart .val { font-size: 12px; fill: var(--text); font-variant-numeric: tabular-nums; font-weight: 550; }
.chart .gridline { stroke: var(--gridline); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .band-sel { fill: var(--band-sel); }
.chart .s1 { fill: var(--series-1); }
.chart .s2 { fill: var(--series-2); }
.chart .s3 { fill: var(--series-3); }
.chart .dpos { fill: var(--div-pos); }
.chart .dneg { fill: var(--div-neg); }
.chart .hit { cursor: pointer; }
.chart .hit:hover + .hover-mark, .chart .hit:hover { fill: rgba(127,127,127,.06); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-1 { background: var(--series-1); } .sw-2 { background: var(--series-2); } .sw-3 { background: var(--series-3); }
.sw-pos { background: var(--div-pos); } .sw-neg { background: var(--div-neg); }

.seg { display: flex; gap: 2px; height: 28px; margin: 6px 0 12px; }
.seg > div { border-radius: 4px; min-width: 0; display: flex; align-items: center; padding-left: 8px; font-size: 12px; font-weight: 600; color: #fff; overflow: hidden; white-space: nowrap; }
.seg-list { display: grid; gap: 6px; }
.seg-list div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.seg-list div .num { margin-left: auto; }
.seg-list i { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.tip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.12); min-width: 150px; max-width: 280px;
}
.tip b { display: block; margin-bottom: 4px; font-size: 13px; }
.tip .tr { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tip .tr span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tip .tr .num { font-weight: 600; }

/* ===================================================================== lists */
.top-list { display: grid; gap: 2px; }
.top-list .li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.top-list .li:last-child { border-bottom: 0; }
.top-list .li .n { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-list .li .c { font-size: 12px; color: var(--muted); grid-column: 1; }
.top-list .li .num { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-weight: 600; }
.kv { display: grid; gap: 6px; }
.kv div { display: flex; justify-content: space-between; gap: 10px; }
.kv div span:first-child { color: var(--text-2); }
.kv .tot { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; font-weight: 650; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 16px; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.empty { padding: 22px; text-align: center; color: var(--muted); }

/* ===================================================================== grade de lançamentos */
.grid-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.grid-inner { position: relative; width: max-content; min-width: 100%; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
.grid th, .grid td { border-bottom: 1px solid var(--border); padding: 0; height: 34px; }
.grid thead th {
  position: sticky; top: 0; z-index: 3; background: var(--surface-2); font-size: 12px; font-weight: 650; color: var(--text-2);
  text-align: right; padding: 0 10px; border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
.grid thead th.mes-atual { color: var(--brand-ink); box-shadow: inset 0 -2px 0 var(--brand); }
.grid .c-nome { position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 260px; max-width: 300px; text-align: left; border-right: 1px solid var(--border); }
.grid thead th.c-nome { z-index: 4; background: var(--surface-2); text-align: left; }
.grid td.c-mes { width: 104px; min-width: 104px; }
.grid td.mes-atual { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.grid .c-tot { min-width: 118px; padding: 0 12px; text-align: right; font-weight: 600; border-left: 1px solid var(--border); white-space: nowrap; }
.grid .c-acao { width: 72px; min-width: 72px; text-align: right; padding-right: 6px; white-space: nowrap; }
.grid input.cell {
  width: 100%; height: 33px; border: 0; border-radius: 0; background: transparent; text-align: right; padding: 0 10px;
  font-variant-numeric: tabular-nums;
}
.grid input.cell:hover { background: var(--surface-3); }
.grid input.cell:focus { outline: 2px solid var(--focus); outline-offset: -2px; background: var(--surface); }
.grid input.cell.invalid { outline: 2px solid var(--critical); outline-offset: -2px; }
.grid input.item-name, .grid input.cat-name {
  width: 100%; height: 32px; border: 0; background: transparent; padding: 0 10px 0 26px; border-radius: 0;
}
.grid input.item-name:hover, .grid input.cat-name:hover { background: var(--surface-3); }
.grid input.item-name:focus, .grid input.cat-name:focus { outline: 2px solid var(--focus); outline-offset: -2px; background: var(--surface); }
.grid tr.cat td { background: var(--surface-2); font-weight: 650; height: 36px; border-top: 1px solid var(--border); }
.grid tr.cat td.c-nome { background: var(--surface-2); }
.grid tr.cat input.cat-name { font-weight: 650; padding-left: 10px; color: var(--brand-ink); }
.grid tr.cat td.sub { text-align: right; padding: 0 10px; color: var(--text-2); font-weight: 600; font-size: 13px; }
.grid tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--total-soft); color: var(--total-ink); font-weight: 700; text-align: right; padding: 0 10px; border-top: 1px solid var(--total-line); border-bottom: 0; }
.grid tfoot td.c-nome { z-index: 3; text-align: left; background: var(--total-soft); }
.grid tr.item:hover td.c-nome { background: var(--surface-3); }
.grid tr.item .c-acao .btn-icon { opacity: .35; }
.grid tr.item:hover .c-acao .btn-icon, .grid tr.item:focus-within .c-acao .btn-icon { opacity: 1; }
.fill-btn {
  position: absolute; z-index: 5; height: 20px; padding: 0 6px; border-radius: 5px; border: 1px solid var(--focus);
  background: var(--focus); color: #fff; font-size: 11px; font-weight: 600; cursor: pointer; display: none; white-space: nowrap;
}
.fill-btn.show { display: block; }
.grid-hint { font-size: 12px; color: var(--muted); margin-top: 10px; display: flex; gap: 18px; flex-wrap: wrap; }
.grid-hint kbd { font: inherit; font-size: 11px; padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); }

/* tabela de leitura (visão geral) */
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl thead th { background: var(--surface-2); font-size: 12px; color: var(--text-2); text-align: right; font-weight: 650; position: sticky; top: 0; }
.tbl th:first-child, .tbl td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tbl thead th:first-child { background: var(--surface-2); z-index: 2; }
.tbl td { text-align: right; }
.tbl tr.tot td { background: var(--total-soft); color: var(--total-ink); font-weight: 700; border-top: 1px solid var(--total-line); }
.tbl tr.tot td.neg { color: var(--neg); }
.tbl tr.forte td { font-weight: 700; }
.tbl tr.sep td { border-top: 2px solid var(--border-strong); }
.tbl td.zero { color: var(--muted); }
.tbl .mes-atual { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }

/* tabelas editáveis (dívidas, metas...) */
table.edit { border-collapse: collapse; width: 100%; }
.edit th { text-align: left; font-size: 12px; color: var(--text-2); font-weight: 650; padding: 6px 6px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.edit th.num { text-align: right; }
.edit td { padding: 3px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.edit td input[type="text"], .edit td select { width: 100%; height: 32px; border-color: transparent; background: transparent; padding: 0 6px; }
.edit td input[type="text"]:hover, .edit td select:hover { border-color: var(--border); }
.edit td input[type="text"]:focus, .edit td select:focus { border-color: var(--focus); background: var(--surface); outline: none; box-shadow: 0 0 0 1px var(--focus); }
.edit td input.money { text-align: right; font-variant-numeric: tabular-nums; }
.edit td.ck { width: 64px; text-align: center; }
.edit td.ac { width: 40px; text-align: right; }
.edit td.calc { text-align: right; padding-right: 10px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.edit tr.done input[type="text"] { text-decoration: line-through; color: var(--muted); }
.edit tfoot td { font-weight: 700; padding: 10px 10px; border-bottom: 0; background: var(--total-soft); color: var(--total-ink); }
.edit tfoot td.num { text-align: right; }
.edit-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.masked { letter-spacing: .05em; color: var(--text-2); padding: 0 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--series-1) 16%, transparent); overflow: hidden; min-width: 70px; }
.progress > div { height: 100%; background: var(--series-1); border-radius: 99px; }
.list-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.list-cards .card-head input { font-weight: 650; font-size: 15px; border-color: transparent; padding: 0 6px; flex: 1; }
.list-cards .card-head input:hover { border-color: var(--border); }

/* ===================================================================== menus, modal, toasts */
.menu {
  position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; padding: 4px;
  box-shadow: 0 10px 28px rgba(0,0,0,.16); min-width: 220px;
}
.menu button { display: flex; width: 100%; align-items: center; gap: 8px; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-3); outline: none; }
.menu button.danger { color: var(--neg); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.modal { border: 1px solid var(--border-strong); border-radius: 12px; padding: 0; background: var(--surface); color: var(--text); width: min(480px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal::backdrop { background: rgba(10, 10, 8, .45); }
.modal .m-head { padding: 16px 20px 0; }
.modal .m-body { padding: 12px 20px; display: grid; gap: 12px; color: var(--text-2); }
.modal .m-foot { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; }
.modal label.field select, .modal label.field input { width: 100%; }
.radio-list { display: grid; gap: 8px; }
.radio-list label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.radio-list label:has(input:checked) { border-color: var(--focus); background: var(--band-sel); }
.radio-list small { display: block; color: var(--muted); }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 70; }
.toast { background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 360px; animation: tin .18s ease-out; }
.toast.err { background: var(--critical); color: #fff; }
@keyframes tin { from { transform: translateY(6px); opacity: 0; } }

/* ===================================================================== responsivo */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand-text span { display: none; }
  .year-pick { padding: 0; margin-left: auto; }
  .year-pick > span { display: none; }
  .nav { flex-direction: row; order: 5; width: 100%; overflow-x: auto; gap: 4px; }
  .nav a { white-space: nowrap; padding: 6px 10px; }
  .nav a svg { display: none; }
  .side-foot { margin: 0; padding: 0; }
  .view { padding: 16px 16px 40px; }
  .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .hero .value { font-size: 40px; }
  .grid-wrap { max-height: none; }
  .grid .c-nome { min-width: 170px; }
}
@media print {
  .side, .head-actions, .fill-btn, .c-acao { display: none !important; }
  .app { display: block; }
  .grid-wrap, .tbl-wrap { max-height: none; overflow: visible; }
}

/* ===================================================================== perfis */
.chart .s4 { fill: var(--series-4); } .chart .s5 { fill: var(--series-5); } .chart .s6 { fill: var(--series-6); }
.chart .s7 { fill: var(--series-7); } .chart .s8 { fill: var(--series-8); }
.sw-4 { background: var(--series-4); } .sw-5 { background: var(--series-5); } .sw-6 { background: var(--series-6); }
.sw-7 { background: var(--series-7); } .sw-8 { background: var(--series-8); }
.seg > div.sw-4 { color: #0b0b0b; }

.perfil-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-2); cursor: pointer; text-align: left; line-height: 1.2;
}
.perfil-btn:hover { background: var(--surface-3); }
.perfil-btn > span:first-child { display: inline-flex; }
.perfil-btn .perfil-nome { flex: 1; min-width: 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perfil-btn .perfil-nome small { display: block; font-size: 11px; color: var(--muted); font-weight: 450; }
.perfil-btn > svg { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: #fff; font-weight: 700; font-size: 13px; line-height: 1; vertical-align: middle;
}
.avatar.sm { width: 20px; height: 20px; font-size: 10px; }
.avatar.lg { width: 52px; height: 52px; font-size: 21px; }
.av-0 { background: var(--series-1); } .av-1 { background: var(--series-2); } .av-2 { background: var(--series-3); }
.av-3 { background: var(--series-4); color: #0b0b0b; } .av-4 { background: var(--series-5); } .av-5 { background: var(--series-6); }
.av-6 { background: var(--series-7); } .av-7 { background: var(--series-8); }
.av-fam { background: var(--brand); color: #1a1a18; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 4px; font-weight: 600; }

.lock { display: grid; place-items: center; min-height: 65vh; }
.lock-card { width: min(400px, 100%); text-align: center; display: grid; gap: 10px; justify-items: center; padding: 30px 26px; }
.lock-form { display: flex; gap: 8px; width: 100%; margin-top: 6px; }
.lock-form input { flex: 1; }
.pin-input { font-size: 18px; letter-spacing: .35em; text-align: center; height: 40px !important; }
.erro { color: var(--neg); min-height: 1.3em; margin: 0; font-size: 13px; }
.lock-outros { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: center; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--border); width: 100%; }

.perfis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.perfil-card .topo { display: flex; align-items: center; gap: 14px; }
.perfil-card .info { flex: 1; min-width: 0; display: grid; gap: 6px; }
.perfil-card input.nome { font-weight: 650; font-size: 16px; border-color: transparent; padding: 0 6px; margin-left: -6px; }
.perfil-card input.nome:hover { border-color: var(--border); }
.perfil-card .acoes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.badge svg { width: 13px; height: 13px; }
.badge-on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.alert > svg[style] { width: 18px; height: 18px; color: var(--text-2); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.edit .btn-ghost .avatar { margin-right: 2px; }

@media (max-width: 900px) {
  .perfil-btn { width: auto; padding: 5px 8px; order: 2; }
  .perfil-btn .perfil-nome small { display: none; }
  .nav-sep { display: none; }
}
