/* Tokens no padrão shadcn/ui, com a paleta verde do PowerPoint */
:root {
  --green-1: #86BC25; --green-2: #43B02A; --green-3: #26890D; --green-4: #046A38;
  --background: #ffffff; --foreground: #0b0b0b;
  --card: #ffffff; --muted: #f4f5f2; --muted-foreground: #5f6359;
  --border: #e3e5df; --input: #d6d9d1; --ring: var(--green-2);
  --primary: var(--green-1); --primary-foreground: #000; --primary-hover: #79ab1f;
  --accent-text: var(--green-4);
  --header: #000000; --header-foreground: #ffffff;
  --warn-bg: #fff8e6; --warn-border: #f1d48a; --warn-fg: #7a5200;
  --err-bg: #fdecec; --err-border: #f2b5b5; --err-fg: #9b1c1c;
  --info-bg: #eef7e4; --info-border: #c6e3a3; --info-fg: var(--green-4);
  --surface: #ffffff; --strong: #333833;
  color-scheme: light; /* controles nativos e janelas seguem o tema da página, não o do sistema */
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --background: #0d0f0c; --foreground: #eef0ea;
  --card: #151813; --muted: #0d0f0c; --muted-foreground: #9ca394;
  --border: #2a2f26; --input: #3a4134; --primary-hover: #97cc36;
  --accent-text: var(--green-1);
  --warn-bg: #2a2210; --warn-border: #5c4a1c; --warn-fg: #f2cf7a;
  --err-bg: #2d1414; --err-border: #6b2a2a; --err-fg: #f5a3a3;
  --info-bg: #15240d; --info-border: #2f5219; --info-fg: #b5e07a;
  --surface: #1b1f19; --strong: #d6dad0;
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --background: #0d0f0c; --foreground: #eef0ea;
  --card: #151813; --muted: #0d0f0c; --muted-foreground: #9ca394;
  --border: #2a2f26; --input: #3a4134; --primary-hover: #97cc36;
  --accent-text: var(--green-1);
  --warn-bg: #2a2210; --warn-border: #5c4a1c; --warn-fg: #f2cf7a;
  --err-bg: #2d1414; --err-border: #6b2a2a; --err-fg: #f5a3a3;
  --info-bg: #15240d; --info-border: #2f5219; --info-fg: #b5e07a;
  --surface: #1b1f19; --strong: #d6dad0;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--muted); color: var(--foreground); font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }

/* header */
.topbar { background: var(--header); color: var(--header-foreground); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding-block: 14px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.brand h1 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.brand h1 .dot { color: var(--green-1); }
.brand small { color: #b9bdb3; font-size: 12px; }
.seg { display: inline-flex; background: #1c1c1c; border-radius: 8px; padding: 3px; }
.seg button { border: 0; background: transparent; color: #cfd2ca; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; }
.seg button.on { background: var(--green-1); color: #000; }
.seg button { display: inline-flex; align-items: center; gap: 4px; }
.seg button svg.i { width: 15px; height: 15px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.topbar .btn-ghost { color: #e8eae4; border-color: #3a3a3a; }
.topbar .btn-ghost:hover { background: #1c1c1c; }
.ref { font-size: 12px; color: #b9bdb3; border: 1px solid #3a3a3a; border-radius: 999px; padding: 2px 10px; }

/* containers */
.wrap { max-width: 1240px; margin: 0 auto; padding-block: 20px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.kpi.total { box-shadow: 0 0 0 1px var(--border); }
.inline-msg { font-size: 12px; color: var(--err-fg); }
.tipo-form { display: inline-flex; gap: 6px; align-items: center; }
.tipo-form .input { width: 90px; height: 30px; }
.layout { display: grid; gap: 20px; }
body.mode-panel .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 460px); align-items: start; }
body.mode-panel .col-result { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; border-radius: var(--radius); }
body.mode-wizard .layout { max-width: 880px; margin: 0 auto; }
body.mode-wizard .step:not(.active) { display: none; }
body.mode-panel .stepper, body.mode-panel .wizard-nav { display: none; }
.col-inputs { display: grid; gap: 20px; min-width: 0; }
@media (max-width: 980px) {
  body.mode-panel .layout { grid-template-columns: 1fr; }
  body.mode-panel .col-result { position: static; max-height: none; }
}

/* card (shadcn) */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.card-head { display: grid; gap: 4px; }
.card-title { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.card-title .num { width: 24px; height: 24px; border-radius: 6px; background: var(--green-1); color: #000; display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; }
.card-desc { color: var(--muted-foreground); font-size: 13px; }

/* form */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.field { display: grid; gap: 6px; align-content: start; }
.field label { font-weight: 600; font-size: 13px; }
.help { font-size: 12px; color: var(--muted-foreground); line-height: 1.4; }
.help b { color: var(--strong); font-weight: 600; }
.input { height: 38px; width: 100%; border: 1px solid var(--input); border-radius: 8px; background: var(--surface); padding: 0 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px rgba(67,176,42,.2); }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); font-size: 13px; pointer-events: none; }
.input-prefix .input { padding-left: 34px; }

/* switch (shadcn) */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; min-height: 38px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; background: var(--input); border-radius: 999px; transition: background .15s; cursor: pointer; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--green-2); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(67,176,42,.3); }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: var(--surface); border-color: var(--input); }
.btn-outline:hover { background: var(--muted); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--muted); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-icon { width: 30px; padding: 0; justify-content: center; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

details.adv summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-text); list-style: none; display: inline-flex; gap: 6px; align-items: center; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv[open] summary svg { transform: rotate(90deg); }
details.adv .grid { margin-top: 14px; }

/* alerts */
.alert { border: 1px solid; border-radius: 8px; padding: 10px 12px; display: grid; grid-template-columns: 18px 1fr; gap: 10px; font-size: 13px; }
.alert svg.i { margin-top: 2px; }
.alert strong { display: block; font-weight: 700; }
.alert.info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-fg); }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.alert.err { background: var(--err-bg); border-color: var(--err-border); color: var(--err-fg); }
.alerts { display: grid; gap: 8px; }

/* history table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--muted); font-size: 12px; font-weight: 700; color: var(--strong); white-space: nowrap; vertical-align: bottom; }
th small { display: block; font-weight: 400; color: var(--muted-foreground); }
tr:last-child td { border-bottom: 0; }
.hist td .input { height: 32px; min-width: 88px; padding: 0 8px; font-size: 13px; }
.hist td.mes .input { min-width: 92px; }
.hist tr.outlier td { background: var(--warn-bg); }
.hist tr.outlier td.mes .input { border-color: var(--warn-border); }
.hist tfoot td { background: var(--muted); font-weight: 700; font-size: 12px; text-align: right; padding: 8px; }
.hist tfoot td:first-child { text-align: left; }
.th-del { display: inline-flex; align-items: center; gap: 4px; }
.th-del button { border: 0; background: none; cursor: pointer; padding: 0; color: var(--muted-foreground); }

.hist td.chk { text-align: center; }
.hist td.chk input { width: 16px; height: 16px; accent-color: var(--green-3); cursor: pointer; }
.drop { display: flex; gap: 14px; align-items: center; border: 2px dashed var(--input); border-radius: 10px; padding: 14px 16px; cursor: pointer; background: var(--muted); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--green-2); background: var(--info-bg); }
.drop > svg { color: var(--green-3); flex: none; }
.drop strong { display: block; font-size: 14px; }
dialog#dlgImport { background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-radius: 12px; padding: 0; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog#dlgImport::backdrop { background: rgba(0,0,0,.45); }
dialog#dlgImport table td, dialog#dlgImport table th { font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.periodos { display: grid; gap: 10px; }
.periodo { display: grid; grid-template-columns: 1fr 140px; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.periodo .t { font-weight: 600; font-size: 13px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--muted); color: var(--strong); border: 1px solid var(--border); margin-left: 6px; }
.badge.red { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-border); }
.badge.green { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-border); }

/* stepper (inspirado no "Stepper with Square Badges" — 21st.dev) */
.stepper { display: flex; align-items: center; gap: 0; margin: 0 auto 4px; max-width: 880px; width: 100%; }
.stepper .s { display: flex; align-items: center; gap: 10px; cursor: pointer; background: none; border: 0; padding: 4px 0; text-align: left; }
.stepper .b { width: 32px; height: 32px; border-radius: 8px; border: 2px solid var(--input); background: var(--surface); display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--muted-foreground); transition: all .2s; flex: none; }
.stepper .s.done .b { background: var(--green-3); border-color: var(--green-3); color: #fff; }
.stepper .s.active .b { background: var(--green-1); border-color: var(--green-1); color: #000; }
.stepper .lbl { font-size: 13px; font-weight: 600; color: var(--muted-foreground); }
.stepper .s.active .lbl, .stepper .s.done .lbl { color: var(--foreground); }
.stepper .line { flex: 1; height: 2px; background: var(--input); margin: 0 12px; border-radius: 2px; position: relative; overflow: hidden; min-width: 16px; }
.stepper .line::after { content: ""; position: absolute; inset: 0; background: var(--green-3); transform: scaleX(0); transform-origin: left; transition: transform .3s; }
.stepper .line.done::after { transform: scaleX(1); }
@media (max-width: 640px) { .stepper .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
.wizard-nav { display: flex; justify-content: space-between; gap: 8px; }

/* result */
.res { gap: 16px; }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
body.mode-panel .kpis { grid-template-columns: 1fr 1fr; }
body.mode-panel .kpi.total { grid-column: 1 / -1; }
.kpi { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface); min-width: 0; }
.kpi .l { font-size: 12px; color: var(--muted-foreground); font-weight: 600; }
.kpi .v { font-size: 20px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 11px; color: var(--muted-foreground); }
.kpi.total { background: #000; color: #fff; border-color: #000; }
.kpi.total .l, .kpi.total .s { color: #c9ccc3; }
.kpi.total .v { color: var(--green-1); font-size: 26px; }
@media (max-width: 640px) { .kpis { grid-template-columns: 1fr; } }

.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.flow > div { padding: 8px 12px; display: grid; gap: 2px; border-right: 1px solid var(--border); min-width: 0; }
.flow > div:last-child { border-right: 0; background: var(--info-bg); }
.flow span { font-size: 11px; font-weight: 700; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .04em; }
.flow b { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow .neg b { color: var(--err-fg); }
.flow .eq b { color: var(--info-fg); }
@media (max-width: 520px) { .flow { grid-template-columns: 1fr 1fr; } .flow > div:nth-child(2) { border-right: 0; } .flow > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); } }
.tag { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 4px; vertical-align: 1px; background: var(--muted); color: var(--muted-foreground); border: 1px solid var(--border); }
.tag.tax { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-border); }
.section-t { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-text); margin: 4px 0 -6px; }
.lines { display: grid; }
.line-i { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.line-i .n { font-size: 13px; font-weight: 600; }
.line-i .m { font-size: 12px; color: var(--muted-foreground); grid-column: 1; font-variant-numeric: tabular-nums; }
.line-i .v { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; grid-row: 1 / span 2; grid-column: 2; align-self: center; white-space: nowrap; }
.line-i.neg .v { color: var(--err-fg); }
.line-i.tot { border-bottom: 0; border-top: 2px solid var(--foreground); margin-top: 2px; }
.line-i.tot .n, .line-i.tot .v { font-weight: 800; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted-foreground); }
.kv dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
ul.prem { margin: 0; padding-left: 18px; font-size: 13px; color: var(--strong); display: grid; gap: 4px; }
.disclaimer { font-size: 12px; color: var(--muted-foreground); border-top: 1px solid var(--border); padding-top: 12px; }
.empty { text-align: center; color: var(--muted-foreground); padding: 28px 8px; font-size: 13px; }
.res-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media print {
  @page { size: A4; margin: 12mm; }
  /* impressão sempre em cores claras, mesmo com o tema escuro ativo */
  :root, :root[data-theme] {
    --background: #fff; --foreground: #0b0b0b; --card: #fff; --muted: #f4f5f2; --muted-foreground: #5f6359;
    --border: #d9dcd4; --input: #d6d9d1; --accent-text: var(--green-4); --surface: #fff; --strong: #333833;
    --warn-bg: #fff8e6; --warn-border: #f1d48a; --warn-fg: #7a5200;
    --err-bg: #fdecec; --err-border: #f2b5b5; --err-fg: #9b1c1c;
    --info-bg: #eef7e4; --info-border: #c6e3a3; --info-fg: var(--green-4);
    color-scheme: light;
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; }
  .topbar .seg, .topbar .btn, .stepper, .wizard-nav, .btn, .no-print, dialog { display: none !important; }
  .topbar { background: #fff; color: #000; border-bottom: 3px solid var(--green-1); }
  .topbar-inner { padding: 0 0 8px; }
  .brand small, .ref { color: #5f6359; border-color: #d9dcd4; }
  .wrap { padding: 12px 0 0; max-width: none; }
  .layout { display: block !important; max-width: none !important; margin-top: 0 !important; }
  .col-inputs { display: none !important; }
  .col-result { position: static !important; max-height: none !important; overflow: visible !important; }
  body .step[data-step="4"] { display: flex !important; }
  /* o cartão de resultado passa de uma página: ele pode quebrar, os blocos internos não */
  .card { box-shadow: none; border: 0; padding: 0; gap: 12px; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .kpi.total { grid-column: auto !important; }
  .kpis, .flow, .alert, .line-i, .kv, ul.prem, .disclaimer { break-inside: avoid; }
  .section-t { break-after: avoid; }
}

/* ---- acessibilidade e celular ---- */
h1, h2 { margin: 0; }
h2.card-title { font-size: 16px; }
h2.card-title:focus { outline: none; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--green-1); color: #000; font-weight: 700; padding: 10px 14px; border-radius: 8px; text-decoration: none; }
.skip:focus { top: 8px; }
main:focus { outline: none; }
a { color: var(--accent-text); }
:where(button, a, summary, input[type="checkbox"], .drop):focus-visible { outline: 3px solid var(--green-2); outline-offset: 2px; }
.drop:focus-within { border-color: var(--green-2); }
.rodape { max-width: 1240px; margin: 0 auto; padding-block: 8px 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); color: var(--muted-foreground); font-size: 13px; display: grid; gap: 4px; }
.rodape p { margin: 0; }
/* alvos de toque maiores em telas de toque (WCAG 2.5.8) */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { height: 40px; }
  .btn-icon { width: 40px; }
  .hist td .input { height: 40px; }
  .seg button { min-height: 40px; }
  .hist td.chk input { width: 22px; height: 22px; }
  .input { font-size: 16px; } /* evita o zoom automático do iPhone ao focar */
}
@media (max-width: 640px) {
  .topbar-inner { gap: 10px; }
  .brand { flex-direction: column; gap: 2px; width: 100%; }
  .brand small { font-size: 11px; }
  .card { padding: 18px 16px; }
  .wizard-nav .btn { flex: 1; justify-content: center; }
  .periodo { grid-template-columns: 1fr; }
  .kpi .v { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.rodape .lembrar { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; color: var(--foreground); cursor: pointer; }
.rodape .lembrar input { width: 18px; height: 18px; accent-color: var(--green-3); }

/* ---- páginas de texto (privacidade) ---- */
.doc .card { max-width: 760px; margin: 0 auto; gap: 14px; }
.doc h1 { font-size: 26px; letter-spacing: -.02em; text-wrap: balance; }
.doc h2 { font-size: 17px; margin-top: 8px; }
.doc p, .doc li { max-width: 68ch; line-height: 1.65; }
.doc ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.doc .vig { color: var(--muted-foreground); margin: -8px 0 0; font-size: 13px; }
.doc code { font-size: 13px; background: var(--muted); padding: 1px 5px; border-radius: 4px; }
.doc .btn { text-decoration: none; justify-content: center; }
.topbar .h1 { font-size: 18px; font-weight: 700; margin: 0; }
.topbar a.home { color: var(--header-foreground); text-decoration: none; }

/* ---- marca Quita Certa ---- */
.brand { align-items: center; gap: 12px; }
.brand .logo { width: 44px; height: 44px; flex: none; color: var(--header-foreground); }
.brand-txt { display: grid; gap: 1px; }
.brand-txt h1 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.brand-txt small { color: #c9ccc3; font-size: 13px; }

/* ---- abas de modo: Por etapas / Painel Geral ---- */
.modos { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 auto 18px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
body.mode-wizard .modos { max-width: 880px; }
.modo { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border: 0; background: transparent; cursor: pointer; text-align: left; position: relative; color: var(--muted-foreground); transition: background .15s, color .15s; }
.modo + .modo { border-left: 1px solid var(--border); }
.modo:hover { background: var(--muted); }
.modo::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--green-1); transform: scaleX(0); transition: transform .2s; }
.modo[aria-pressed="true"] { color: var(--foreground); background: var(--info-bg); }
.modo[aria-pressed="true"]::after { transform: scaleX(1); }
.modo-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--muted); border: 1px solid var(--border); }
.modo-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.modo[aria-pressed="true"] .modo-ic { background: var(--green-1); border-color: var(--green-1); color: #000; }
.modo-txt { display: grid; gap: 1px; min-width: 0; }
.modo-txt b { font-size: 16px; }
.modo-txt small { font-size: 12.5px; color: var(--muted-foreground); }
@media (max-width: 640px) {
  .modo { padding: 12px; gap: 10px; flex-direction: column; text-align: center; }
  .modo-txt small { display: none; }
  .modo-ic { width: 36px; height: 36px; }
  .brand { flex-direction: row; }
  .brand .logo { width: 38px; height: 38px; }
  .brand-txt h1 { font-size: 19px; }
}

/* linha fora do período: não entra no cálculo */
.hist tr.fora td { opacity: .5; }
.hist tr.fora td.mes .input { text-decoration: line-through; }

/* ---- abas de períodos do histórico ---- */
.abas-hist { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.aba-hist { flex: none; display: grid; gap: 1px; text-align: left; padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted-foreground); cursor: pointer; min-width: 150px; transition: background .15s, border-color .15s; }
.aba-hist b { font-size: 13.5px; color: var(--foreground); }
.aba-hist small { font-size: 11.5px; }
.aba-hist:hover { background: var(--muted); }
.aba-hist[aria-selected="true"] { border-color: var(--green-2); background: var(--info-bg); box-shadow: inset 0 -3px 0 var(--green-1); }
.aba-hist[aria-selected="true"] small { color: var(--info-fg); }
.aba-hist.fora { border-style: dashed; }
.aba-hist.fora[aria-selected="true"] { border-color: var(--warn-border); background: var(--warn-bg); box-shadow: inset 0 -3px 0 var(--warn-border); }
.aba-dica { margin: 8px 0 0; }
#histTabs:empty { display: none; }

/* tempo de casa (calculado, só leitura) */
.tempo-casa { display: flex; align-items: center; min-height: 38px; padding: 0 12px; border-radius: 8px; background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info-fg); font-weight: 700; font-size: 15px; }
.tempo-casa.erro { background: var(--err-bg); border-color: var(--err-border); color: var(--err-fg); }
