:root {
  /* Layout: coluna única de celular. O "cano" do topo (contas fixas, dia a dia, vazando) é o único elemento forte;
     o resto é lista de cupom fiscal, quieta, com valores em fonte de máquina. */
  --bg: #EEF1F6;
  --surface: #FFFFFF;
  --sunken: #E3E8F1;
  --ink: #131A2B;
  --muted: #566078;
  --line: #D4DAE7;
  --accent: #1D4ED8;
  --on-accent: #FFFFFF;
  --accent-soft: #E1E9FC;
  --leak: #C2410C;
  --leak-soft: #FDE8DC;
  --ok: #15734A;
  --ok-soft: #DCF2E6;
  --warn: #8A5A08;
  --warn-soft: #FBEBCB;
  --s-gasto: #257de0;
  --s-ganho: #008a17;
  --s-a: #6a4ce2;
  --s-b: #00b894;
  --s-mute: #7C879E;
  --on-leak: #ffffff;
  --axis: #B5BDCC;
  --display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --num: 'DM Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D121E; --surface: #161C2B; --sunken: #0A0E18; --ink: #E7EBF4; --muted: #9AA4BB; --line: #283146;
    --accent: #8AA5FF; --on-accent: #0B1020; --accent-soft: #1B2747;
    --leak: #FF8A5B; --leak-soft: #3B2016; --ok: #56CF93; --ok-soft: #12301F; --warn: #F1B755; --warn-soft: #362A0E;
    --s-gasto: #338ced; --s-ganho: #0aac23; --s-a: #9887ef; --s-b: #00a888; --s-mute: #7A86A0; --on-leak: #0b0b0b; --axis: #4A5470;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D121E; --surface: #161C2B; --sunken: #0A0E18; --ink: #E7EBF4; --muted: #9AA4BB; --line: #283146;
  --accent: #8AA5FF; --on-accent: #0B1020; --accent-soft: #1B2747;
  --leak: #FF8A5B; --leak-soft: #3B2016; --ok: #56CF93; --ok-soft: #12301F; --warn: #F1B755; --warn-soft: #362A0E;
  --s-gasto: #338ced; --s-ganho: #0aac23; --s-a: #9887ef; --s-b: #00a888; --s-mute: #7A86A0; --on-leak: #0b0b0b; --axis: #4A5470;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--body); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
h2 { font: 700 18px/1.2 var(--display); letter-spacing: -0.01em; text-wrap: balance; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.fill { fill: currentColor; stroke: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- estrutura ---------- */
.app { position: relative; height: 100%; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; background: var(--bg); }
.top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.month { display: flex; align-items: center; gap: 2px; min-width: 0; }
.month strong { font: 700 19px/1.1 var(--display); letter-spacing: -0.01em; padding: 0 2px; white-space: nowrap; }
.month .icon-btn { width: 32px; }
.m-label { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
button.m-label { padding: 3px 4px; border: 0; border-radius: 8px; background: transparent; color: inherit; }
button.m-label:hover { background: var(--sunken); }
button.m-label .m-period { text-decoration: underline dotted; text-underline-offset: 3px; }
.m-period { font: 500 11.5px/1 var(--num); letter-spacing: -0.02em; color: var(--muted); white-space: nowrap; }
.note-now { font-size: 14px; font-weight: 600; color: var(--ink); }
.m-short { display: none; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.top-btn { height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; }
.top-actions .icon-btn { width: 36px; height: 36px; border-radius: 18px; }
.top-btn.on, .top-actions .icon-btn.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.month strong::first-letter { text-transform: uppercase; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); }
.icon-btn:hover { background: var(--sunken); }
.me { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font: 700 14px/1 var(--body); color: #fff; }
.avatar.who-a { background: var(--s-a); }
.avatar.who-b { background: var(--s-b); }
#view { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 14px; padding: 14px 16px 104px; }
#view > * { flex: none; }
#view:focus { outline: none; }
#view.no-fab { padding-bottom: 16px; }
.tabs { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); }
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; padding: 8px 1px 9px; border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; border-top: 2px solid transparent; margin-top: -1px; }
.tabs button[aria-current="page"] { color: var(--accent); border-top-color: var(--accent); }
.tabs .ic { width: 22px; height: 22px; }
.fab { position: absolute; right: 16px; bottom: 76px; display: flex; align-items: center; gap: 6px; height: 52px; padding: 0 20px 0 14px; border: 0; border-radius: 26px; background: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: 0 6px 18px rgba(19, 26, 43, .28); }
.fab:active { transform: translateY(1px); }

/* ---------- peças ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.seg { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--sunken); }
.seg button { flex: 1; min-width: 0; height: 38px; padding: 0 8px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 15px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(19, 26, 43, .16); }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 13px; font-weight: 600; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.chip.leak { background: var(--leak-soft); color: var(--leak); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border: 1px solid var(--accent); border-radius: 12px; background: var(--accent); color: var(--on-accent); font-weight: 700; text-align: center; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line); font-weight: 600; }
.btn.danger { background: transparent; color: var(--leak); border-color: var(--leak); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row .btn { flex: 1 1 140px; }
.banner { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--r); background: var(--warn-soft); color: var(--ink); border: 1px solid transparent; }
.banner strong { color: var(--warn); }
.banner .link { align-self: flex-start; }
.link { padding: 0; border: 0; background: none; color: var(--accent); font-weight: 700; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.section-title { margin-top: 6px; }

/* ---------- resumo ---------- */
.hero { gap: 10px; padding: 18px 16px 16px; }
.big { display: flex; align-items: baseline; gap: 6px; font-family: var(--display); font-weight: 800; letter-spacing: -0.035em; line-height: .95; font-variant-numeric: tabular-nums; }
.big .cur { font-size: 22px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.big .int { font-size: clamp(46px, 15vw, 68px); }
.big .dec { font-size: 24px; font-weight: 600; color: var(--muted); letter-spacing: -0.01em; }
.big.is-leak .int { color: var(--leak); }
.cmp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 15px; color: var(--muted); }
.pipe { display: flex; gap: 2px; height: 26px; margin: 8px 0 20px; }
.pipe span { position: relative; min-width: 6px; height: 100%; }
.pipe span:first-child { border-radius: 13px 0 0 13px; }
.pipe span:last-child { border-radius: 0 13px 13px 0; }
.pipe span:only-child { border-radius: 13px; }
.p-fixed { background: var(--s-mute); }
.p-var { background: var(--s-gasto); }
.p-leak { background: var(--leak); }
.drip { position: absolute; top: 100%; width: 8px; height: 8px; margin-top: 4px; background: var(--leak); border-radius: 0 50% 50% 50%; transform: rotate(45deg); animation: drip 3.2s ease-in infinite; }
.drip.d1 { left: 22%; }
.drip.d2 { left: 62%; animation-delay: 1.5s; }
@keyframes drip { 0%, 55% { transform: translateY(0) rotate(45deg); opacity: 1; } 90% { transform: translateY(12px) rotate(45deg); opacity: 0; } 100% { transform: translateY(0) rotate(45deg); opacity: 0; } }
.legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.legend li { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; color: var(--muted); }
.legend .lab { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.legend .lab i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .num { font-size: 14px; color: var(--ink); font-weight: 500; }
.teaser { display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px; border: 1px solid var(--leak); border-radius: var(--r); background: var(--leak-soft); color: var(--leak); text-align: left; font-weight: 600; }
.teaser .txt { flex: 1; color: var(--ink); }
.teaser strong { color: var(--leak); font-family: var(--num); font-weight: 500; letter-spacing: -0.02em; }
.who-row { display: flex; flex-direction: column; gap: 5px; }
.who-row .top-line { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.who-row .name { font-weight: 600; }
.bar { position: relative; height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--s-gasto); min-width: 2px; }
.bar.who-a > span { background: var(--s-a); }
.bar.who-b > span { background: var(--s-b); }
.bar.over > span { background: var(--leak); }
.bar.near > span { background: var(--warn); }
.cats { display: flex; flex-direction: column; }
.cat { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 12px 0; border: 0; border-top: 1px dashed var(--line); background: none; text-align: left; }
.cat:first-child { border-top: 0; padding-top: 2px; }
.cat:last-child { padding-bottom: 2px; }
.cat .top-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.cat .name { font-weight: 600; }
.cat .sub { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--muted); }
.days { display: flex; align-items: flex-end; gap: 2px; height: 64px; padding-top: 4px; }
.days i { flex: 1; min-width: 2px; border-radius: 2px 2px 0 0; background: var(--s-gasto); opacity: .55; }
.days i.max { opacity: 1; }
.days i.zero { background: var(--line); opacity: 1; }
.days i.future { background: transparent; border-bottom: 1px dashed var(--line); }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.kv + .kv { border-top: 1px dashed var(--line); padding-top: 10px; }
.empty { align-items: flex-start; }

/* ---------- lançamentos ---------- */
.searchbox { position: relative; display: flex; }
.searchbox .ic { position: absolute; left: 12px; top: 13px; color: var(--muted); pointer-events: none; }
.searchbox .input { padding-left: 42px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--muted); font-weight: 600; font-size: 14px; }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.list { padding: 4px 16px; gap: 0; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 14px 0 6px; font-size: 13px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); border-top: 1px solid var(--line); }
.day-head:first-child { border-top: 0; }
.day-head .num { text-transform: none; font-weight: 400; }
.tx { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 0; border: 0; border-top: 1px dashed var(--line); background: none; text-align: left; }
.day-head + .tx { border-top: 0; }
.tx-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tx-desc { font-weight: 600; overflow-wrap: anywhere; }
.tx-meta { font-size: 13px; color: var(--muted); }
.tx-amt { padding-top: 1px; font-size: 15px; }
.tx.is-in .tx-amt { color: var(--ok); }
.tx.is-x .tx-desc, .tx.is-x .tx-amt { color: var(--muted); }
.tx.is-unc .tx-meta { color: var(--warn); font-weight: 600; }
.foot { text-align: center; font-size: 14px; }

/* ---------- vazamentos ---------- */
.finding { padding: 0; gap: 0; }
.finding summary { display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 16px; cursor: pointer; list-style: none; border-left: 4px solid var(--leak); border-radius: var(--r) 0 0 var(--r); }
.finding summary::-webkit-details-marker { display: none; }
.finding.signal summary { border-left-color: var(--warn); }
.finding .f-title { flex: 1; font: 700 16px/1.25 var(--display); }
.finding .f-amt { color: var(--leak); font-size: 15px; }
.finding.signal .f-amt { color: var(--warn); }
.finding .chev { width: 18px; height: 18px; color: var(--muted); transition: transform .15s; }
.finding[open] .chev { transform: rotate(180deg); }
.f-body { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 16px 20px; }
.f-items li { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-top: 1px dashed var(--line); }
.f-items .top-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.f-items .name { font-weight: 600; overflow-wrap: anywhere; }
.f-items .sub { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.f-items .link { font-size: 13px; }
.year { padding: 10px 12px; border-radius: 10px; background: var(--sunken); font-size: 14px; }

/* ---------- formulários e folhas ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .lab { font-size: 14px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 16px; }
textarea.input { min-height: 120px; resize: vertical; font-family: var(--num); font-size: 14px; }
.input.money { font-family: var(--num); font-size: 22px; letter-spacing: -0.02em; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.quick { padding: 12px; border-radius: 12px; background: var(--accent-soft); }
.quick .hint { font-size: 14px; color: var(--ink); min-height: 20px; }
.error { color: var(--leak); font-weight: 600; font-size: 14px; }
.inst-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inst-row .input { width: 76px; text-align: center; }
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(8, 12, 22, .55); }
.sheet-panel { width: 100%; max-width: 640px; max-height: 94%; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 14px 16px 20px; background: var(--bg); border-radius: 20px 20px 0 0; animation: rise .18s ease-out; }
@keyframes rise { from { transform: translateY(28px); } to { transform: none; } }
.sheet-panel > * { flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head h2 { font-size: 20px; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-weight: 700; font-size: 17px; text-align: left; }
.pick[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.toast { position: fixed; left: 50%; bottom: 84px; z-index: 30; transform: translateX(-50%); max-width: min(92%, 420px); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 15px; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.on { opacity: 1; }

/* ---------- extratos ---------- */
.steps { display: flex; flex-direction: column; gap: 14px; }
.imp-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 4px 10px; align-items: start; padding: 12px 0; border-top: 1px dashed var(--line); }
.imp-row:first-child { border-top: 0; }
.imp-row input[type="checkbox"] { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); }
.imp-row .tx-main { gap: 4px; }
.imp-row select { grid-column: 2 / 4; min-height: 40px; padding: 6px 10px; font-size: 14px; }
.imp-row.off .tx-desc, .imp-row.off .tx-amt { color: var(--muted); }
.imp-row.is-in .tx-amt { color: var(--ok); }
.sticky-actions { position: sticky; bottom: -16px; z-index: 2; margin: 0 -16px -16px; padding: 12px 16px; background: var(--bg); border-top: 1px solid var(--line); }
.sticky-actions .btn:first-child { flex: 3 1 190px; }
.sticky-actions .btn.quiet { flex: 1 1 100px; }

/* ---------- ajustes ---------- */
.budget { display: grid; grid-template-columns: 1fr 138px; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px dashed var(--line); }
.budget:first-of-type { border-top: 0; }
.budget .input { min-height: 42px; font-family: var(--num); font-size: 15px; text-align: right; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags button { height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); font-size: 14px; font-weight: 600; }

@media (max-width: 400px) {
  .legend { grid-template-columns: 1fr; gap: 6px; }
  .legend li { flex-direction: row; justify-content: space-between; align-items: baseline; font-size: 14px; }
}
@media (max-width: 399px) {
  .m-full { display: none; }
  .m-short { display: inline; }
}
@media (max-width: 350px) {
  .tabs button { font-size: 10px; }
  .top-btn { padding: 0 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .drip, .sheet-panel { animation: none; }
  .finding .chev, .toast { transition: none; }
}

/* ---------- voltar, categorias ---------- */
.back { align-self: flex-start; text-decoration: none; font-size: 15px; }
.link.danger { color: var(--leak); align-self: flex-start; }
.link-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.danger-box { padding: 12px; border-radius: 12px; background: var(--leak-soft); }
.cat-list { display: flex; flex-direction: column; }
.hol-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.hol { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px dashed var(--line); }
.hol:first-child { border-top: 0; padding-top: 2px; }
.hol-date { flex: none; width: 52px; font-weight: 600; }
div.cat-row .icon-btn { flex: none; }
.cat-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 11px 0; border: 0; border-top: 1px dashed var(--line); background: none; text-align: left; }
.cat-row:first-child { border-top: 0; padding-top: 2px; }
.cat-row .ic { width: 18px; height: 18px; color: var(--muted); }

/* ---------- gráficos ---------- */
.fig { margin: 0; }
.fig figcaption { display: flex; flex-direction: column; gap: 4px; }
.rank { display: flex; flex-direction: column; gap: 2px; }
.rank-row { display: flex; flex-direction: column; gap: 5px; width: 100%; padding: 8px 0; border: 0; background: none; text-align: left; }
.rank-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rank-top .name { font-weight: 600; overflow-wrap: anywhere; }
.rank-top .pct { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-bar { display: block; height: 10px; }
.rank-bar > span { display: block; height: 100%; min-width: 3px; border-radius: 0 4px 4px 0; background: var(--s-gasto); }
.rank-row:hover .rank-bar > span, .rank-row:focus-visible .rank-bar > span { filter: brightness(1.15); }
.rank-sub { font-size: 13px; color: var(--muted); }
.segbar { display: flex; gap: 2px; height: 28px; }
.seg-part { display: flex; align-items: center; min-width: 4px; padding-left: 8px; border-radius: 4px; color: #fff; font-size: 13px; white-space: nowrap; }
.seg-part b { font-weight: 700; }
.seg-part.who-a, .sw.who-a { background: var(--s-a); }
.seg-part.who-b, .sw.who-b { background: var(--s-b); }
.s-gasto { background: var(--s-gasto); }
.s-ganho { background: var(--s-ganho); }
.seg-legend { display: flex; flex-direction: column; gap: 6px; }
.seg-legend li { display: flex; align-items: baseline; gap: 8px; font-size: 15px; }
.seg-legend .name { flex: 1; min-width: 0; }
.seg-legend.row { flex-direction: row; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
.seg-legend.row .name { flex: none; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; align-self: center; }
.stat { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.stat-val { font: 700 34px/1 var(--body); letter-spacing: -0.02em; }
.meter { height: 10px; border-radius: 5px; background: var(--accent-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 5px; background: var(--s-gasto); }
.meter.near { background: var(--warn-soft); }
.meter.near > span { background: var(--warn); }
.meter.over { background: var(--leak-soft); }
.meter.over > span { background: var(--leak); }
.readout { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-size: 14px; color: var(--muted); }
.readout .when { width: 100%; font-weight: 700; color: var(--ink); }
.readout .val { display: inline-flex; align-items: center; gap: 6px; }
.readout strong { color: var(--ink); font-weight: 500; }
.key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.chart { position: relative; height: 170px; margin: 10px 0 0 48px; }
.tick { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); }
.tick.base { border-top-color: var(--axis); }
.tick span { position: absolute; right: 100%; top: 0; margin-right: 8px; transform: translateY(-50%); font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.plot { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.grp { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0; border: 0; background: none; }
.col { width: 20px; max-width: 40%; min-height: 2px; border-radius: 4px 4px 0 0; }
.grp.two .col { width: 14px; }
.col.zero { min-height: 0; }
.grp:not(.on) .col { opacity: .5; }
.grp:hover .col, .grp:focus-visible .col { opacity: 1; }
.xaxis { display: flex; margin-left: 48px; }
.xaxis span { flex: 1; padding-top: 6px; text-align: center; font-size: 12px; color: var(--muted); }
.xaxis span.on { color: var(--ink); font-weight: 700; }
.tbl summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.tbl table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 6px 0; text-align: right; border-top: 1px solid var(--line); font-weight: 400; }
.tbl th:first-child { text-align: left; }
.tbl thead th { color: var(--muted); font-weight: 600; border-top: 0; }

/* ---------- versão instalada: tela de entrada e sinal de sincronização ---------- */
.gate { position: fixed; inset: 0; z-index: 40; display: flex; justify-content: center; overflow-y: auto; padding: 28px 16px 40px; background: var(--bg); }
.gate-card { width: 100%; max-width: 440px; margin: auto 0; display: flex; flex-direction: column; gap: 16px; }
.gate-card > * { flex: none; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.brand h1 { font: 800 28px/1.05 var(--display); letter-spacing: -0.02em; }
.brand-mark { position: relative; width: 46px; height: 30px; flex: none; }
.brand-mark i { position: absolute; top: 0; width: 30px; height: 30px; border-radius: 50%; }
.brand-mark i:first-child { left: 0; background: var(--s-a); }
.brand-mark i:last-child { right: 0; background: var(--s-b); opacity: .88; }
.who-box { display: flex; flex-direction: column; gap: 12px; min-width: 0; margin: 0; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.who-box legend { padding: 0 6px; font: 700 15px/1.2 var(--display); }
a.btn { text-decoration: none; }
.gate .btn { width: 100%; }
/* aro no avatar enquanto há mudança esperando para subir ou o servidor está fora de alcance */
body[data-sync="pend"] .me .avatar, body[data-sync="off"] .me .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--warn); }
