:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6e69;
  --border: rgba(11, 11, 11, 0.12);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: #cde2fb;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #0d9488;
  --good: #006300;
  --good-bg: #dcf2dc;
  --warn-bg: #fdf0d2;
  --warn: #7a5200;
  --bad: #d03b3b;
  --bad-bg: #fbe3e3;
  --holiday: #b3500a;
  --m-up: #fad9c2;
  --m-near: #e4e3dd;
  --m-down: #c9e0f8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* Escuro: no automático, quando o aparelho está escuro; e sempre que a pessoa escolhe Escuro (theme.js). Os dois blocos têm os mesmos valores. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #262624;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #9a9890;
    --border: rgba(255, 255, 255, 0.12);
    --grid: #2c2c2a;
    --axis: #383835;
    --accent: #3987e5;
    --accent-soft: #1c3a5e;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #14b8a6;
    --good: #0ca30c;
    --good-bg: #12301a;
    --warn-bg: #3a2c0c;
    --warn: #fab219;
    --bad: #e66767;
    --bad-bg: #3d1a1a;
    --holiday: #ff9d4d;
    --m-up: #5a2f12;
    --m-near: #35352f;
    --m-down: #173a60;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --series-3: #14b8a6;
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #262624;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #9a9890;
  --border: rgba(255, 255, 255, 0.12);
  --grid: #2c2c2a;
  --axis: #383835;
  --accent: #3987e5;
  --accent-soft: #1c3a5e;
  --series-1: #3987e5;
  --series-2: #d95926;
  --good: #0ca30c;
  --good-bg: #12301a;
  --warn-bg: #3a2c0c;
  --warn: #fab219;
  --bad: #e66767;
  --bad-bg: #3d1a1a;
  --holiday: #ff9d4d;
  --m-up: #5a2f12;
  --m-near: #35352f;
  --m-down: #173a60;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 15px/1.45 var(--font); -webkit-tap-highlight-color: transparent; }
h1 { font-size: 1.35rem; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; color: var(--ink-2); }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
[hidden] { display: none !important; }

/* Layout */
#app { min-height: 100vh; }
main { max-width: 980px; margin: 0 auto; padding: 16px 16px calc(88px + env(safe-area-inset-bottom)); }
#nav { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; display: flex; background: var(--surface);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
#nav .brand { display: none; }
#nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px;
  color: var(--muted); text-decoration: none; font-size: .72rem; }
#nav a.active { color: var(--accent); }
#nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 900px) {
  #nav { top: 0; right: auto; width: 210px; flex-direction: column; border-top: 0; border-right: 1px solid var(--border); padding: 16px 10px; gap: 2px; }
  #nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; padding: 4px 10px 18px; }
  #nav .brand img { width: 32px; height: 32px; border-radius: 8px; }
  #nav a { flex: none; flex-direction: row; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: .95rem; }
  #nav a.active { background: var(--accent-soft); }
  #nav ~ main, #nav ~ #status-bar { margin-left: max(226px, calc((100vw - 980px) / 2 + 105px)); }
  main { padding-bottom: 32px; }
}
#status-bar { background: var(--warn-bg); color: var(--warn); padding: 8px 16px; font-size: .9rem; text-align: center; }

/* Cards & forms */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 22px; box-shadow: var(--shadow); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
label { display: block; font-size: .82rem; color: var(--ink-2); margin-bottom: 4px; font-weight: 600; }
.field { margin-bottom: 12px; min-width: 0; }
.dup-link { display: block; margin-bottom: 12px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-weight: 600; text-decoration: none; }
.dup-link[hidden] { display: none; }
.rep-full { grid-column: 1 / -1; }
.b-check { width: 26px; padding-right: 0 !important; }
.b-check input { width: 18px; height: 18px; margin: 0; cursor: pointer; touch-action: none; }
tr.b-row:has(.b-pick:checked) td { background: var(--accent-soft); }
.sg { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 6px; align-items: start; padding: 10px 0; border-top: 1px solid var(--border); }
.sg > input, .sg-family-head > input { width: 18px; height: 18px; margin: 2px 0 0; cursor: pointer; }
.sg summary { cursor: pointer; overflow-wrap: anywhere; }
.sg-name { font-weight: 600; }
.sg .sub { display: block; margin-top: 2px; }
.sg-body .table-wrap { margin-top: 6px; }
.sg-family { background: var(--accent-soft); border-radius: 10px; padding: 10px; margin: 10px 0; }
.sg-family-head { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; padding-bottom: 8px; }
.alias-rows { max-height: 55vh; overflow-y: auto; padding-right: 4px; }
.imp-queue { max-height: 55vh; overflow-y: auto; }
.imp-queue .grow { overflow-wrap: anywhere; }
.imp-st { white-space: nowrap; }
.imp-failed { margin-bottom: 10px; color: var(--bad); }
.pick-chips { display: flex; flex-direction: column; gap: 8px; }
.pick-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; overflow-wrap: anywhere; }
.pick-chip input { width: 18px; height: 18px; margin: 0; flex: none; }
.bulk-info .link[hidden] { display: none; }
.hub { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.hub-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: .9rem; }
.hub-tile:hover { background: var(--accent-soft); }
.hub-n { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hub-tile .hub-d { color: var(--ink-2); font-size: .8rem; }
.sub-n { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: var(--warn-bg); color: var(--warn); font-size: .72rem; line-height: 18px; text-align: center; vertical-align: middle; }
.sub-n:empty { display: none; }
.fl-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fl-filters input[type=search] { flex: 1 1 200px; min-width: 0; }
.fl-filters select { flex: 0 1 auto; width: auto; }
.fl-list .fl-ico { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); font-size: 1.05rem; }
.fl-list li { align-items: flex-start; gap: 10px; }
.fl-list .sub a { overflow-wrap: anywhere; }
.fl-list .fl-why { color: var(--warn); }
.fl-list .actions { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .fl-list li { flex-wrap: wrap; } .fl-list .actions { width: 100%; justify-content: flex-start; } }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* Divisão do casal (Início) */
.home-card-title { margin: 0 0 10px; font-size: 1.05rem; }
.home-move { margin: 10px 0 0; }
.cp-first .card-head h2 { display: none; }
.cp-first .card-head { justify-content: flex-end; }
.home-range { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.home-range[hidden] { display: none; }
.home-range input { width: auto; min-width: 0; padding: 4px 6px; flex: 0 1 150px; }
.home-ctl:has(.home-range:not([hidden])) { flex-wrap: wrap; }
@media (max-width: 560px) { .home-range { flex: 1 1 100%; } .home-range input { flex: 1 1 0; max-width: none; } }
.cp-wrap { position: relative; max-width: 340px; margin: 4px auto 0; }
.cp-gauge { display: block; width: 100%; height: auto; overflow: visible; }
.cp-gauge path { cursor: default; }
.cp-center { position: absolute; left: 0; right: 0; bottom: 4px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1px; }
.cp-center strong { font-size: 1.5rem; line-height: 1.2; }
.cp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.cp-col { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.cp-who { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.cp-who i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.cp-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-who .muted { margin-left: auto; }
.cp-row { display: flex; justify-content: space-between; gap: 6px; font-size: .9rem; }
.cp-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cp-modes { border: 0; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.cp-modes legend { font-weight: 600; margin-bottom: 4px; padding: 0; }
.cp-modes label { display: flex; align-items: baseline; gap: 6px; font-weight: 400; }
.cp-fixed { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-left: 22px; }
.cp-fixed input[type=range] { flex: 1 1 160px; }
.cp-fixed.off { opacity: .45; }
@media (max-width: 420px) { .cp-cols { grid-template-columns: 1fr; } }
.rf-zone {min-height: 90px; max-height: 160px; overflow: auto; border: 2px dashed var(--border); border-radius: 10px; padding: 10px; font-size: .9rem; color: var(--muted); }
.rf-zone:empty::before { content: "Cole aqui (Ctrl+V) ou solte o arquivo da página"; }
.rf-zone:focus { outline: none; border-color: var(--accent); }
.cmp h3 { margin: 0 0 6px; font-size: .95rem; }
.cmp ul { margin: 6px 0 0; padding-left: 18px; font-size: .85rem; }
.cmp .diff { color: var(--warn); font-weight: 700; }
@media (max-width: 560px) { .cmp { grid-template-columns: 1fr; } }
.nav-ico { position: relative; display: inline-flex; font-style: normal; }
.nav-badge { position: absolute; top: -5px; left: 14px; min-width: 16px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: .62rem; font-weight: 700; line-height: 16px; text-align: center; }
.nav-badge[hidden] { display: none; }
#nav-toggle, #nav-theme, #nav-eye { display: none; }
/* No celular: quatro abas e "Mais", com as outras cinco na mesma ordem. No computador, todas no menu. */
#nav-more { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .72rem; cursor: pointer; }
#nav-more.active { color: var(--accent); }
@media (max-width: 899px) { #nav a[data-more] { display: none; } }
@media (min-width: 900px) { #nav #nav-more { display: none; } }
.more-list { display: grid; gap: 4px; margin: 8px 0 12px; }
.more-list a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.more-list a.active { background: var(--accent-soft); color: var(--accent); }
.more-list svg { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.more-list .nav-ico { display: inline-flex; font-style: normal; }
.theme-svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.home-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.home-theme { width: 36px; height: 36px; padding: 0; justify-content: center; }
@media (min-width: 900px) {
  .home-actions .home-theme { display: none; }
  #nav-theme, #nav-eye { display: flex; align-items: center; gap: 12px; margin-top: auto; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: .95rem; cursor: pointer; text-align: left; }
  #nav-theme:hover, #nav-eye:hover { background: var(--accent-soft); color: var(--ink); }
  #nav-eye + #nav-theme, #nav-theme + #nav-toggle { margin-top: 0; }
  body.nav-mini #nav-theme, body.nav-mini #nav-eye { justify-content: center; padding-left: 0; padding-right: 0; }
  body.nav-mini #nav-theme span, body.nav-mini #nav-eye span { display: none; }
  #nav-toggle { display: flex; align-items: center; justify-content: center; margin-top: auto; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
  #nav-toggle:hover { background: var(--accent-soft); color: var(--ink); }
  #nav-toggle svg { transition: transform .15s; }
  body.nav-mini #nav { width: 64px; padding-left: 8px; padding-right: 8px; }
  body.nav-mini #nav a { justify-content: center; padding: 10px 0; }
  body.nav-mini #nav a > span, body.nav-mini #nav .brand span { display: none; }
  body.nav-mini #nav .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  body.nav-mini #nav-toggle svg { transform: rotate(180deg); }
  body.nav-mini #nav ~ main, body.nav-mini #nav ~ #status-bar { margin-left: max(76px, calc((100vw - 980px) / 2 + 38px)); }
  body.wide #nav ~ main { max-width: none; margin-left: 226px; margin-right: 0; }
  body.wide.nav-mini #nav ~ main { margin-left: 64px; }
}
#list.selecting [data-id]:not(.selected) .drag-h { display: none; }
.rep-pick { flex: none; width: 18px; height: 18px; margin: 0 2px 0 0; align-self: center; cursor: pointer; touch-action: none; }
.selecting .pick { touch-action: none; }
body.drag-selecting { user-select: none; cursor: cell; }
@media (hover: hover) {
  .selecting li.selected, .selecting tr.selected, .hbar-detail li:has(.rep-pick:checked) { cursor: grab !important; user-select: none; }
}
.hbar-detail li:has(.rep-pick:checked) { background: var(--accent-soft); }
.link-btn { border: 0; padding: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.drop-new { padding: 2px 0 8px; }
.drop-group button.drop-add, .drop-new .drop-add { border: 1px dashed var(--accent); border-radius: 8px; background: transparent; color: var(--accent); font: inherit; font-size: .85rem; padding: 6px 10px; cursor: pointer; }
.drop-group button.drop-add.drop-on, .drop-new .drop-add.drop-on { background: var(--accent); color: var(--accent-ink); }
.drag-cell { width: 26px; padding-left: 0 !important; padding-right: 0 !important; }
.desp-tbl tr.grp.drop-on td { background: var(--accent); color: var(--accent-ink); }
.sug-sec { margin: 18px 0 4px; font-size: 1.02rem; }
.sug-docs { margin: 6px 0 0; padding: 0; list-style: none; overflow-wrap: anywhere; }
.sug-vars { margin: 8px 0 0; padding: 0; list-style: none; }
.sug-vars label { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; }
.sug-vars .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sug-vars input { flex: none; width: 18px; height: 18px; }
.ano-wrap { overflow: auto; max-height: calc(100vh - 190px); }
#ano-card { padding-left: 10px; padding-right: 10px; }
#ano-zoom { margin-right: auto; }
.ano-tbl { width: auto; min-width: 100%; font-size: .84rem; }
.ano-tbl th, .ano-tbl td { white-space: nowrap; padding: 7px 8px; }
.ano-tbl tbody th, .ano-tbl tfoot th { text-transform: none; letter-spacing: 0; font-size: .84rem; color: var(--ink); font-weight: 500; white-space: normal; min-width: 150px; max-width: 200px; overflow-wrap: anywhere; }
.ano-tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.ano-tbl th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.ano-tbl thead th:first-child { z-index: 2; }
.ano-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: 8px 0 4px; }
.ano-opts .home-switch { padding: 4px 0; font-size: .88rem; }
.ano-marks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ano-mark { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--ink-2); font: inherit; font-size: .82rem; cursor: pointer; }
.ano-mark i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border); }
.ano-mark i.m-up { background: var(--m-up); } .ano-mark i.m-near { background: var(--m-near); } .ano-mark i.m-down { background: var(--m-down); }
.ano-mark.on { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.ano-note { margin: 0 0 6px; }
.ano-tbl td.m-up { background: var(--m-up) !important; }
.ano-tbl td.m-near { background: var(--m-near) !important; }
.ano-tbl td.m-down { background: var(--m-down) !important; }
.ano-avg { font-weight: 600; border-left: 1px solid var(--border); }
.ano-eye { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; margin-right: 2px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; vertical-align: middle; }
.ano-eye:hover { background: var(--surface-2); color: var(--ink); }
.ano-eye svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ano-eye-gap { display: inline-block; width: 26px; }
/* linha fora da soma: cinza claro, inteira; a primeira coluna continua opaca para não vazar ao rolar */
.ano-tbl tr.ano-off th, .ano-tbl tr.ano-off td { background: var(--surface-2); color: color-mix(in srgb, var(--ink) 38%, var(--surface-2)) !important; font-weight: 400 !important; }
.ano-tbl tr.ano-off .dot { opacity: .35; }
.ano-tbl tr.ano-off .chev, .ano-tbl tr.ano-off .muted { color: inherit; }
.ano-tbl .chev { display: inline-block; width: 14px; color: var(--ink-2); }
.ano-tbl .dot { margin-right: 5px; }
.ano-tbl tr.click { cursor: pointer; }
.ano-tbl tr.click:hover td { background: var(--accent-soft); }
.ano-l0 th, .ano-l0 td { font-weight: 700 !important; }
.ano-l1 th { padding-left: 22px !important; }
.ano-l2 th { padding-left: 38px !important; color: var(--ink-2) !important; }
.ano-total { font-weight: 700; border-left: 1px solid var(--border); }
.ano-tbl tfoot th, .ano-tbl tfoot td { font-weight: 700; border-top: 2px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
.ano-tbl tfoot th { z-index: 2; }
.drag-h { flex: none; align-self: center; padding: 8px 8px 8px 2px; color: var(--muted); cursor: grab; touch-action: none; user-select: none; font-size: 1.05rem; line-height: 1; }
.drag-h:hover { color: var(--ink); }
body.dragging { user-select: none; cursor: grabbing; }
.drag-src { opacity: .5; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 41; display: none; max-width: 220px; padding: 6px 10px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: .85rem; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drag-ghost.on { display: block; }
.drop-sheet { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; top: 34vh; overflow-y: auto; padding: 12px 14px 24px; background: var(--surface); border-top: 2px solid var(--accent); box-shadow: 0 -6px 24px rgba(0, 0, 0, .35); touch-action: none; }
.drop-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.drop-head .btn { margin-left: auto; }
.drop-group { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 0; border-top: 1px solid var(--border); }
.drop-group button { border: 1px solid var(--border); border-radius: 8px; background: var(--page); color: var(--ink); font: inherit; font-size: .85rem; padding: 6px 10px; cursor: pointer; }
.drop-t { font-weight: 700; }
.drop-t .dot { margin-right: 5px; }
.drop-s { color: var(--ink-2) !important; }
/* Durante o arrasto: destinos coloridos; sob o ponteiro, cor cheia com contorno */
.drop-group button.drop-t, .drop-group button.drop-s, .hbar.drop-target { background: var(--accent-soft); border-color: var(--accent); }
.hbar.drop-target { border-radius: 6px; box-shadow: inset 0 0 0 1px var(--accent); cursor: copy; }
.desp-tbl tr.grp.drop-target td { background: var(--accent-soft); box-shadow: inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); cursor: copy; }
.drop-on, .drop-group button.drop-on, .hbar.drop-on { background: var(--accent) !important; color: var(--accent-ink) !important; outline: 3px solid var(--ink); outline-offset: 1px; }
.hbar.drop-on .lbl, .hbar.drop-on .val, .hbar.drop-on .muted, .hbar.drop-on .chev, .desp-tbl tr.grp.drop-on td .muted, .desp-tbl tr.grp.drop-on td .chev { color: var(--accent-ink) !important; }
.hbar.drop-on .fill { background: var(--accent-ink); }
.desp-tbl tr.grp.drop-target.drop-on td { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 3px 0 var(--ink), inset 0 -3px 0 var(--ink); }
.drag-ghost.ready { max-width: 420px; background: var(--ink); color: var(--surface); font-weight: 600; }
@media (min-width: 900px) { .drop-sheet { left: auto; top: 0; width: 340px; border-top: 0; border-left: 2px solid var(--accent); box-shadow: -6px 0 24px rgba(0, 0, 0, .3); } }
.sug-link { background: var(--accent-soft); color: var(--ink); }
.sug-box { margin-top: 8px; display: grid; gap: 8px; }
.sug { display: inline-flex; max-width: 100%; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface); }
.sug button { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: .88rem; min-height: 34px; cursor: pointer; }
.sug-pick { padding: 4px 6px 4px 12px; overflow-wrap: anywhere; text-align: left; }
.sug-no { padding: 4px 11px 4px 7px; color: var(--ink-2) !important; }
.sug button:hover { background: var(--accent-soft); }
.sug-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sug-info { margin: 4px 0 0; padding-left: 18px; overflow-wrap: anywhere; }
.sug-box p { margin: 0; }
.sug-name { overflow-wrap: anywhere; }
.sug-apply { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.sug-apply input { flex: 1 1 180px; min-width: 0; }
.dup-group .list li { align-items: center; }
.dup-group .list .title, .dup-group .list .sub { white-space: normal; overflow-wrap: anywhere; }
.wd { color: var(--muted); font-size: .85em; }
.wd.wkend, .day-head.wkend { color: var(--accent); font-weight: 700; }
.wd.feriado, .day-head.feriado { color: var(--holiday); font-weight: 700; }
/* Despesas previstas */
.badge.plan { background: var(--warn-bg); color: var(--warn); font-weight: 600; white-space: nowrap; }
tr.plan .num strong, li.plan .num strong { font-weight: 500; font-style: italic; color: var(--ink-2); }
.pv-row { flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.pv-info { flex: 1 1 260px; min-width: 0; }
.pv-info .title, .pv-info .sub { white-space: normal; overflow-wrap: anywhere; }
.pv-act { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
input[type="text"].pv-val { width: 96px; flex: none; min-height: 0; height: 34px; padding: 4px 8px; text-align: right; }
.pv-hint { margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: var(--accent-soft); color: var(--ink); font-size: .85rem; overflow-wrap: anywhere; }
.pv-hint.warn { background: var(--warn-bg); }
.pv-hint .btn { margin-left: 4px; }
.check[hidden] { display: none; }
.rep-qty { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.rep-qty label { margin: 0; }
.rep-qty input[type="number"] { width: 72px; flex: none; min-height: 0; height: 36px; text-align: center; }
/* Despesas fixas */
.home-var-sub { display: block; }
.cat-pick .fix-top { font-weight: 600; margin-top: 6px; }
.cat-pick .fix-sub { padding-left: 24px; color: var(--ink-2); }
.part-of { font-size: .75rem; font-weight: 400; color: var(--muted); white-space: nowrap; }
/* Topo de Despesas */
.desp-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.desp-title h1 { margin: 0; }
.desp-total { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.desp-total strong { font-size: 1.2rem; }
.desp-period { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.desp-period .month-nav .link { min-width: 150px; text-decoration: none; }
.desp-range { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; }
.desp-range input[type=date] { width: 9.5rem; flex: none; min-width: 0; min-height: 0; height: 36px; padding: 4px 8px; font-size: .88rem; }
.ed-top { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; margin-bottom: 4px; background: var(--page); }
.desp-filters { display: flex; gap: 8px; margin-bottom: 12px; }
.rep-filters { margin: 10px 0 0; }
.rep-filters #daymenu .menu-pop { right: auto; left: 0; }
.page-head + .rep-filters { margin: 0 0 12px; }
.desp-filters input[type="search"] { flex: 1 1 60%; min-width: 0; }
#catfilter { flex: 0 1 auto; min-width: 0; max-width: 55%; display: flex; }
.filter-btn { white-space: nowrap; font-weight: 500; }
.filter-reset[hidden] { display: none; }
.menu > summary.filter-btn { font-weight: 500; }
.menu > summary.filter-btn.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.filter-chip { display: flex; align-items: stretch; min-width: 0; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent); }
.filter-chip button { border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; padding: 6px 8px; }
.filter-chip #catbtn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-weight: 600; }
.filter-chip #catclear { flex: none; min-width: 36px; border-left: 1px solid var(--accent); font-weight: 700; }
.cat-inline { display: none; margin-top: 2px; color: var(--ink-2); }
.desp-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; font-weight: 700; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; min-width: 200px; display: flex; flex-direction: column; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow), 0 6px 20px rgba(0, 0, 0, .25); }
.menu-pop button { border: 0; background: none; color: var(--ink); font: inherit; text-align: left; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.menu-pop button:hover { background: var(--accent-soft); }
.menu-pop button[hidden] { display: none; }
/* lista nativa dá lugar ao painel com busca: o toque é tratado pelo app */
select:has(option[value="__nova"]), select#mv { pointer-events: none; }
.cat-pick-row.first { box-shadow: inset 0 0 0 1px var(--accent); }
.cat-pick-row.cat-new { color: var(--accent); }
.cat-pick-head { display: flex; align-items: stretch; }
.cat-pick-head .cat-pick-row { flex: 1; min-width: 0; }
.cat-pick-exp { flex: none; min-width: 52px; border: 0; background: none; color: var(--ink-2); font: inherit; cursor: pointer; border-radius: 8px; }
.cat-pick-exp:hover { background: var(--accent-soft); }
.cat-pick-exp[hidden], .cat-pick-subs[hidden] { display: none; }
.cat-pick-subs { display: flex; flex-direction: column; }
.cat-exp { flex: none; width: 28px; height: 28px; padding: 0; border: 0; background: none; color: var(--ink-2); font-size: 1rem; cursor: pointer; }
.cat-count { flex: none; min-width: 52px; }
#cats li[hidden] { display: none; }
.rep-new { margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.cat-pick { max-height: 52vh; overflow-y: auto; margin: 10px 0; display: flex; flex-direction: column; }
.cat-pick-row { display: flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; padding: 9px 8px; border-radius: 8px; cursor: pointer; }
.cat-pick-row[hidden] { display: none; }
.cat-pick-row:hover { background: var(--accent-soft); }
.cat-pick-row.on { background: var(--accent); color: var(--accent-ink); }
.cat-pick-row.all { font-weight: 700; }
.cat-pick-row.sub { padding-left: 28px; color: var(--ink-2); }
.cat-pick-row.sub.on { color: var(--accent-ink); }
.cat-pick-row:not(.sub):not(.all) { font-weight: 600; }
.grp-drag { display: inline-block; width: 20px; padding: 0 !important; font-size: .95rem; vertical-align: baseline; }
.grp-edit { border: 0; background: none; cursor: pointer; font-size: .8rem; padding: 2px 6px; margin-left: 2px; }
@media (hover: hover) { .grp-edit, .grp-drag { opacity: 0; } tr.grp:hover .grp-edit, tr.grp:hover .grp-drag, .grp-edit:focus, .grp-drag:focus { opacity: 1; } }
@media (max-width: 640px) {
  .desp-filters { flex-wrap: wrap; }
  .desp-filters input[type="search"] { flex: 1 1 100%; }
  #catfilter { max-width: 60%; }
  #daymenu .menu-pop { right: auto; left: 0; }
  .desp-tbl .wd { display: block; line-height: 1.1; }  /* dia da semana acima da data, para sobrar espaço */
  .desp-tbl .cat-col { display: none; }  /* em Categorias, o título do grupo já diz; nas outras, fica abaixo da loja */
  .desp-tbl .cat-inline { display: block; }
  .desp-tbl tr.grp.sub td { padding-left: 14px; }
  .desp-tbl tr.grp.grp-label td { padding-left: 14px; }
  .desp-tbl tr.grp.store td { padding-left: 44px; }
  .desp-tbl td.lvl1 { padding-left: 10px; }
  .desp-tbl td.lvl2 { padding-left: 26px; }
  .desp-tbl td.lvl3 { padding-left: 44px; }
  .desp-range input[type=date] { flex: 1 1 0; width: 0; }
  .desp-period #scope { display: flex; width: 100%; }
  .desp-period #scope button { flex: 1; padding-left: 4px; padding-right: 4px; }
  .desp-period #pnav { width: 100%; }
  .desp-period .month-nav { justify-content: space-between; }
  .desp-toolbar #view-mode { flex: 1; flex-wrap: nowrap; display: flex; }
  .desp-toolbar #view-mode button { flex: 1; padding-left: 4px; padding-right: 4px; }
}
.home-hello { margin-bottom: 12px; }
.home-hello p { margin: 0; }
.home-hello h1 { margin: 2px 0 0; }
.home-ctl { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.home-ctl { flex-wrap: nowrap; }
.home-ctl .month-nav { flex: 1; min-width: 0; justify-content: flex-end; }
.home-ctl .month-nav strong { min-width: 0; font-size: .92rem; }
.home-ctl .btn.icon { flex-shrink: 0; min-width: 36px; padding-left: 6px; padding-right: 6px; }
.home-donut { position: relative; width: min(100%, 240px); margin: 0 auto 10px; }
.home-donut svg { display: block; width: 100%; height: auto; }
.home-arc { cursor: pointer; }
.home-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.home-center strong { font-size: 1.3rem; }
.home-sentence { text-align: center; margin: 0 0 12px; }
.home-legend { list-style: none; margin: 0 auto; padding: 0; max-width: 480px; }
.home-legend li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--border); }
.home-legend li.click { cursor: pointer; }
.home-legend li.click:hover { background: var(--accent-soft); }
.home-legend i { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.home-legend .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.home-pct { min-width: 34px; text-align: right; }
.home-card .link { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
/* Despesas: comparação com a mediana do ano */
.med-card summary { cursor: pointer; }
.med-total, .med-top { display: flex; align-items: baseline; gap: 10px; }
.med-total { padding: 8px 0; border-bottom: 1px solid var(--border); }
.med-list { list-style: none; margin: 0; padding: 0; }
.med-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.med-row.sub { padding-left: 18px; }
.med-row.click { cursor: pointer; }
.med-row .dot { margin-right: 6px; }
.med-v { font-size: .82rem; white-space: nowrap; min-width: 92px; text-align: right; color: var(--muted); }
.med-v.up { color: var(--bad); font-weight: 600; }
.med-v.down { color: var(--ink-2); }
.med-bar { position: relative; height: 8px; margin: 6px 0 4px; border-radius: 4px; background: var(--surface-2); }
.med-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.med-bar b { position: absolute; top: -3px; bottom: -3px; width: 2.5px; margin-left: -1px; background: var(--ink); box-shadow: 0 0 0 1.5px var(--surface); border-radius: 1px; }
/* Despesas › Produtos */
.pr-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pr-list { list-style: none; margin: 0; padding: 0; }
.pr-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.pr-head { display: flex; align-items: flex-start; gap: 10px; }
.pr-head .grow { min-width: 0; }
.pr-head .title { overflow-wrap: anywhere; }
.pr-head .dot { margin-right: 6px; }
.pr-head .right { text-align: right; flex-shrink: 0; }
.pr-bar { height: 5px; margin: 6px 0 0; }
.pr-buys { list-style: none; margin: 8px 0 0; padding: 0 0 0 16px; }
.pr-buys li { display: flex; align-items: baseline; gap: 10px; padding: 5px 0; font-size: .9rem; border-top: 1px dashed var(--border); }
.pr-buys li .grow { min-width: 0; overflow-wrap: anywhere; }
/* Limites de gasto */
.lim-month h3 { font-size: .95rem; margin: 12px 0 2px; }
.lim-list { list-style: none; margin: 0; padding: 0; }
.lim-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.lim-row .dot { margin-right: 6px; }
.lim-tag { font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.lim-tag.over { background: var(--bad-bg); color: var(--bad); }
.lim-tag.warn { background: var(--warn-bg); color: var(--warn); }
.lim-tag.ok { background: var(--good-bg); color: var(--good); }
.lim-over { color: var(--bad); }
.lim-bar i.plan { background: repeating-linear-gradient(135deg, var(--c) 0 3px, transparent 3px 6px); opacity: .7; }
.lim-form { max-height: 52vh; overflow: auto; margin-bottom: 8px; }
.lim-field { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.lim-field.sub { padding-left: 18px; }
.lim-field label { margin: 0; font-size: .92rem; flex: 1 1 auto; min-width: 0; }
.lim-form .lim-field input[type="text"] { width: 120px; max-width: 40%; flex: 0 0 120px; }
.home-filt { flex-shrink: 0; white-space: nowrap; }
.home-filt.on { border-color: var(--accent); color: var(--accent); }
/* celular: Mês/Ano/Período e Filtros numa linha; o mês (ou as datas) na de baixo, com espaço para o nome */
@media (max-width: 560px) {
  .home-ctl { flex-wrap: wrap; }
  .home-ctl .month-nav, .home-ctl .home-range { order: 3; flex: 1 1 100%; justify-content: space-between; }
}
dialog .home-out:first-of-type { border-top: 0; }
.home-out { max-width: 480px; margin: 12px auto 0; padding-top: 8px; border-top: 1px solid var(--border); }
.home-out p { margin: 0 0 2px; }
.home-switch { display: flex; align-items: center; gap: 10px; padding: 7px 4px; margin: 0; font-size: .95rem; font-weight: 400; color: var(--ink); cursor: pointer; }
.home-switch .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
input.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 38px; height: 22px; margin: 0; border-radius: 11px; background: var(--border); cursor: pointer; transition: background .15s; }
input.switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .4); transition: transform .15s; }
input.switch:checked { background: var(--accent); }
input.switch:checked::before { transform: translateX(16px); }
.cat-pick-row .grow { flex: 1; min-width: 0; }
.cat-check { visibility: hidden; font-weight: 700; }
.cat-pick-row.on .cat-check { visibility: visible; }
.home-launch-title { margin: 18px 0 10px; }
.home-launch .choices { grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 700px) { .home-launch .choices { grid-template-columns: repeat(5, 1fr); } }
.home-launch .choice { padding: 12px 6px; align-items: center; text-align: center; gap: 4px; }
.home-launch .choice span { display: none; }
.home-launch .choice strong { font-size: .84rem; }
.dup-hint { margin: 0 0 8px; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--ink); }
.dup-store { margin: 0 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dup-line { font-size: .8rem; margin-top: 4px; padding-left: 8px; border-left: 2px solid var(--border); overflow-wrap: anywhere; }
.dup-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
@media (max-width: 640px) { .dup-group .list li { flex-wrap: wrap; } .dup-group .list li > .grow { flex-basis: 100%; } .dup-acts { width: 100%; } }
.dup-pick { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.choice-stack { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.choice-stack .btn { width: 100%; justify-content: center; }
.dup-sec { margin-bottom: 14px; }
.dup-sec summary { cursor: pointer; font-weight: 600; padding: 8px 2px; margin-bottom: 6px; color: var(--ink-2); }
.ac-wrap { position: relative; }
.ac { position: absolute; z-index: 15; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; max-height: 270px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.ac[hidden] { display: none; }
.ac li { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: 8px; cursor: pointer; overflow-wrap: anywhere; }
.ac li:hover, .ac li[aria-selected="true"] { background: var(--accent-soft); }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month],
input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
textarea { min-height: 110px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 600; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 34px; padding: 5px 10px; font-size: .85rem; }
.btn.icon { min-height: 36px; width: 36px; padding: 0; }
.btn[disabled] { opacity: .55; cursor: progress; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions.end { justify-content: flex-end; }

/* Segmented control */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 9px 14px; min-height: 42px; cursor: pointer; color: var(--ink-2); font-weight: 600; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

/* Entry choices */
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 700px) { .choices { grid-template-columns: repeat(4, 1fr); } }
.choice { display: flex; flex-direction: column; gap: 6px; padding: 18px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; text-align: left; box-shadow: var(--shadow); color: var(--ink); }
.choice:hover { border-color: var(--accent); }
.choice svg { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.choice strong { font-size: 1rem; }
.choice span { font-size: .82rem; color: var(--muted); }

/* Items editor */
.items { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--surface); }
.item-top { display: grid; grid-template-columns: 1fr 90px 110px 36px; gap: 8px; align-items: end; }
.item-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.item label { font-size: .72rem; margin-bottom: 2px; }
.item input, .item select { min-height: 40px; padding: 7px 9px; }
/* Itens em tabela: um produto por linha; no celular, a 2ª linha tem quantidade, preço de cada, categoria e pessoa */
.items-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.items.compact { gap: 0; border-top: 1px solid var(--border); }
.items.compact .item.row { display: grid; grid-template-columns: 1fr 100px; gap: 4px 8px; padding: 7px 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: none; }
.items.compact input { min-height: 34px; padding: 5px 8px; }
.items.compact .r-desc { font-weight: 600; }
.items.compact .r-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.items.compact .r-qty { width: 50px; flex: none; }
.r-unit { flex: 1 1 auto; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; min-width: 0; }
.r-unit.off { visibility: hidden; }
.items.compact .r-up { width: 72px; flex: none; color: var(--muted); }
.items.compact .r-meta { flex-wrap: nowrap; }
.chip-sel { position: relative; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; font-size: .8rem; max-width: 130px; min-width: 0; min-height: 32px; flex: 0 1 auto; background: var(--surface); cursor: pointer; margin: 0; }
.chip-sel.r-mem { max-width: 84px; }
.items .chip-sel { font-size: .8rem; margin: 0; }
.chip-sel select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; opacity: 0; cursor: pointer; }
.chip-sel:focus-within { outline: 2px solid var(--accent, #2f6fdb); outline-offset: 1px; }
.chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.chip-sel.empty, .chip-sel.warn { border-color: var(--warn); color: var(--warn); }
.items.compact .r-rm { min-height: 32px; width: 32px; padding: 0; flex: none; }
@media (min-width: 720px) {
  .items.compact .item.row { grid-template-columns: 1fr 50px 120px 140px 90px 110px 32px; align-items: center; }
  .items.compact .r-meta { display: contents; }
  .items.compact .r-val { order: 1; }
  .items.compact .r-rm { order: 2; }
}
@media (max-width: 520px) {
  .item-top { grid-template-columns: 1fr 1fr 36px; }
  .item-top .f-desc { grid-column: 1 / -1; }
}
.badge { display: inline-block; font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); vertical-align: middle; }
.badge.ia { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
.total-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0 0; border-top: 1px solid var(--border); margin-top: 12px; flex-wrap: wrap; }
.schedule { font-size: .85rem; color: var(--ink-2); margin-top: 6px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list li.click { cursor: pointer; }
.list li.click:hover { background: var(--surface-2); }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { font-size: .8rem; color: var(--muted); }
.list.settings li { flex-wrap: wrap; gap: 8px; }
.list.settings input[type=text] { flex: 1 1 150px; width: auto; min-width: 0; }
.list.settings label { display: flex; align-items: center; gap: 6px; }
.list.settings input[type=number] { min-height: 38px; padding: 6px 8px; }
.day-head { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 14px 4px 2px; }
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-nav strong, .month-nav .link { min-width: 130px; text-align: center; }
.month-nav .link { border: 0; background: none; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; padding: 8px 4px; text-decoration: underline dotted; text-underline-offset: 4px; }
.list.settings li.subcat { padding-left: 28px; }
.list.settings input.cat-grp { flex: 0 1 130px; min-width: 90px; font-size: .88rem; }
.sub-mark { color: var(--ink-2); width: 34px; text-align: center; flex: none; }
.hbar.sub { opacity: .8; font-size: .9em; padding-left: 14px; }
.paste-any { width: 100%; margin-top: 12px; justify-content: center; }
#drop-zone { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 18%, transparent); backdrop-filter: blur(2px); pointer-events: none; }
#drop-zone.on { display: flex; }
#drop-zone > div { background: var(--surface); color: var(--ink); border: 2px dashed var(--accent); border-radius: 16px;
  padding: 28px 36px; font-size: 1.2rem; font-weight: 700; text-align: center; }
#drop-zone small { font-weight: 400; color: var(--ink-2); font-size: .85rem; }
.batch-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; overflow-wrap: anywhere; }
.batch-title .btn { font-weight: 400; }
.sug-h { font-size: .9rem; margin: 4px 0 2px; color: var(--ink-2); }
.sug-low { margin-top: 10px; }
.sug-low summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
#catsug .list li { flex-wrap: wrap; }
#catsug .grow { min-width: 180px; }
.th-sort { border: 0; background: none; font: inherit; font-weight: 700; color: inherit; padding: 4px 0; cursor: pointer; white-space: nowrap; }
.th-sort::after { content: attr(data-arrow); margin-left: 4px; font-size: .75em; }
.th-sort:not(.on) { color: var(--ink-2); }
.th-sort:not(.on)::after { opacity: .55; }
.th-sort:hover { text-decoration: underline; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.card-head h2 { margin: 0; }
.seg.small button { padding: 5px 10px; min-height: 34px; font-size: .82rem; }
.row-ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.month-head { display: flex; justify-content: space-between; font-size: .85rem; color: var(--ink-2); border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0 !important; }
.month-nav { position: relative; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tbl th { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.table-wrap { overflow-x: auto; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 1.6rem; font-weight: 700; }
.kpi .l { font-size: .8rem; color: var(--muted); }

/* Charts */
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar .track { height: 18px; position: relative; }
.hbar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .val { color: var(--ink); font-variant-numeric: tabular-nums; }
.hbar.open-able { cursor: pointer; border-radius: 6px; }
.hbar.open-able:hover { background: var(--accent-soft); }
.hbar.open-able:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hbar .chev { display: inline-block; width: 14px; color: var(--ink-2); }
#cat-tools .btn { font-weight: 400; }
.hbar-detail { border-left: 3px solid var(--border); margin: 0 0 6px 6px; padding: 0 0 0 10px; }
.hbar-detail .list li { padding: 8px 4px; }
.detail-sum { display: flex; justify-content: space-between; padding: 6px 4px 0; border-top: 1px solid var(--border); }
.card:has(.hbar-detail:not([hidden])) { grid-column: 1 / -1; }  /* painel aberto: a lista usa toda a largura */
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
svg.chart .grid { stroke: var(--grid); stroke-width: 1; }
svg.chart .base { stroke: var(--axis); stroke-width: 1; }
svg.chart .s1 { fill: var(--series-1); }
svg.chart .s2 { fill: var(--series-2); }
svg.chart .s3 { fill: var(--series-3); }
svg.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; }
svg.chart .pt { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
svg.chart .hit { fill: transparent; cursor: default; }
svg.chart .hit:hover + .hl, svg.chart .hl.on { opacity: 1; }
.legend { display: flex; gap: 16px; font-size: .82rem; color: var(--ink-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
#tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--page); padding: 6px 9px; border-radius: 8px;
  font-size: .8rem; opacity: 0; transition: opacity .1s; max-width: 240px; }
#tooltip.on { opacity: 1; }

/* Toast & modal */
#toast { position: fixed; z-index: 60; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: all .2s; pointer-events: none;
  max-width: calc(100vw - 32px); font-size: .92rem; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--bad); color: #fff; }
#toast.act { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
body.bulk-open #toast { bottom: calc(200px + env(safe-area-inset-bottom)); }

/* Despesas em tabela */
.desp-tbl td { vertical-align: middle; }
.desp-tbl .title { font-weight: 600; }
.desp-tbl tr.click { cursor: pointer; }
.desp-tbl tr.click:hover td { background: var(--accent-soft); }
.desp-tbl tr.grp { cursor: pointer; user-select: none; }
.desp-tbl tr.grp:hover td { background: var(--accent-soft); }
.desp-tbl .chev { display: inline-block; width: 18px; color: var(--ink-2); }
.grp-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-bottom: 6px; }
.desp-tbl tr.grp td { background: var(--page); font-weight: 700; padding-top: 12px; }
.desp-tbl tr.grp.sub td { font-weight: 600; padding-top: 6px; padding-left: 28px; color: var(--ink-2); }
/* grupo de subcategorias ("Em casa"): título com subtotal, sem abrir e fechar */
.desp-tbl tr.grp.grp-label { cursor: default; }
.desp-tbl tr.grp.grp-label:hover td { background: var(--page); }
.desp-tbl tr.grp.grp-label td { font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; padding-top: 10px; padding-left: 28px; color: var(--muted); }
.hbar.grp-head { padding-left: 14px; font-size: .9em; }
.hbar.grp-head .fill { opacity: .45; }
.hbar.deep { padding-left: 28px; }
/* níveis: categoria › subcategoria › loja › despesa, cada um mais à direita */
.desp-tbl tr.grp.store td { font-weight: 500; padding-top: 6px; padding-left: 76px; color: var(--ink-2); }
.desp-tbl td.lvl1 { padding-left: 24px; }
.desp-tbl td.lvl2 { padding-left: 50px; }
.desp-tbl td.lvl3 { padding-left: 76px; }
.desp-tbl .grp-sum { float: right; }
.desp-tbl .dot { margin-right: 6px; }
.desp-tbl .nowrap, .nowrap { white-space: nowrap; }
.desp-tbl .pick-cell { width: 0; padding: 0; }
.selecting .desp-tbl .pick-cell { width: 34px; padding: 8px 6px; }
@media (hover: hover) { .desp-tbl tr:hover .pick-cell { width: 34px; padding: 8px 6px; } }
.cat-chip { border: 0; background: none; font: inherit; color: inherit; padding: 2px 0; cursor: pointer; text-align: left; }
.cat-chip:hover { text-decoration: underline; }
@media (max-width: 700px) {
  .desp-tbl .opt, .desp-tbl .yr { display: none; }
  .desp-tbl { font-size: .84rem; }
  .desp-tbl th, .desp-tbl td { padding: 7px 4px; }
  .desp-tbl .title { overflow-wrap: break-word; hyphens: auto; }  /* quebra entre palavras, sem cortar um nome ao meio */
  .desp-tbl .small.muted { display: none; }
}

/* Seleção em lote (Despesas) */
.pick { display: none; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink-2); cursor: pointer;
  align-items: center; justify-content: center; font-size: 13px; color: var(--accent-ink); }
.selecting .pick { display: flex; }
@media (hover: hover) { #list li:hover .pick, #list tr:hover .pick { display: flex; opacity: .6; } #list .pick:hover { opacity: 1; } }
.pick[aria-checked="true"] { background: var(--accent); border-color: var(--accent); opacity: 1 !important; }
.pick[aria-checked="true"]::after { content: "✓"; font-weight: 700; }
.selecting li.selected, .selecting tr.selected td { background: var(--accent-soft); }
.selecting li { user-select: none; }
#bulk-bar, .bulk-bar { position: fixed; z-index: 20; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); background: var(--surface);
  border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0,0,0,.12); padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
#bulk-bar[hidden], .bulk-bar[hidden] { display: none; }
.bulk-info { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; }
.bulk-info .link { margin-left: auto; border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; font-size: .85rem; }
.bulk-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: .9rem; color: var(--ink); }
label.check input { width: auto; margin-top: 3px; }
.bulk-actions .btn { justify-content: center; }
body.bulk-open main { padding-bottom: 180px; }
@media (min-width: 900px) {
  #bulk-bar, .bulk-bar { left: max(226px, calc((100vw - 980px) / 2 + 105px)); right: auto; width: min(760px, calc(100vw - 260px)); bottom: 16px;
    border: 1px solid var(--border); border-radius: 14px; flex-direction: row; align-items: center; justify-content: space-between; }
  .bulk-actions { display: flex; }
  body.bulk-open #toast { bottom: 96px; }
}
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 18px; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }

.login { max-width: 400px; margin: 8vh auto 0; }
.login .logo { width: 64px; height: 64px; border-radius: 16px; display: block; margin: 0 auto 12px; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* painel do Início buscando os dados: círculo girando e o aviso, no lugar do conteúdo */
.hp-loading { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; color: var(--ink-2); font-size: .9rem; }
.hp-loading .spinner { color: var(--accent); flex: none; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.empty { text-align: center; color: var(--muted); padding: 28px 8px; }
.receipt-thumb { max-width: 100%; max-height: 320px; border-radius: 8px; border: 1px solid var(--border); }
details summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* Pedidos da Amazon e receitas */
.list li.amz-row { display: block; padding: 12px 0; }
.amz-head { display: flex; justify-content: space-between; gap: 8px; }
.amz-match { margin: 6px 0; }
.amz-items { list-style: none; margin: 6px 0; padding: 0; }
.amz-items li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 200px); gap: 8px; align-items: center; padding: 4px 0; }
.amz-name { overflow-wrap: break-word; min-width: 0; }
.amz-items select { width: 100%; min-width: 0; }
.amz-pick { display: grid; gap: 4px; margin: 6px 0; }
.amz-card { max-width: 280px; margin: 6px 0; }
.prod-filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.prod-filters > * { width: 100%; min-width: 0; }
.home-hello-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.home-hello-row .btn { flex: none; }
.list.doc-list li { flex-wrap: wrap; }
.doc-list .grow { min-width: 200px; overflow-wrap: anywhere; }
.prod-sort { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.prod-sort select { flex: 1 1 160px; min-width: 0; max-width: 260px; }
.rep-copies { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow-y: auto; }
.inc-pay { max-width: 280px; }
.inc-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 6px 0; cursor: pointer; }
.inc-row .inc-type { grid-column: 2 / -1; max-width: 240px; }
.inc-bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-top: 12px; }
.prod-list { max-height: 340px; overflow-y: auto; }
.prod-list li { cursor: pointer; }
.prod-list li.on { background: var(--surface-2); }
.prod-list .title { overflow-wrap: anywhere; }
.prod-detail { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.prod-detail h3 { margin: 0 0 8px; overflow-wrap: anywhere; }
.prod-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.prod-stats > div { display: flex; flex-direction: column; min-width: 0; }
.prod-parts { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 6px; }
.prod-parts li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.prod-parts span { overflow-wrap: anywhere; min-width: 0; }
.prod-pick { display: grid; gap: 6px; max-height: 300px; overflow-y: auto; margin-bottom: 8px; }
@media (max-width: 560px) { .prod-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .prod-filters > :first-child { grid-column: 1 / -1; } .prod-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cmp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 8px 0; }
.cmp-grid > section { border: 1px solid var(--border); border-radius: 8px; padding: 10px; min-width: 0; }
.cmp-grid h3 { margin: 0 0 2px; font-size: 14px; }
.cmp-grid p { margin: 0 0 6px; }
.cmp-grid .amz-items li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.cmp-keep { display: grid; gap: 6px; margin: 8px 0; }
.cmp-keep p { margin: 0; }
.cmp-keep-row { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.cmp-keep-row > span { flex: 0 0 110px; }
.cmp-keep-row label { overflow-wrap: anywhere; min-width: 0; }
.inc-total { font-size: 1.6rem; font-weight: 700; margin: 4px 0; }
.bat-neg { color: var(--bad); }
.bat-kpis .kpi .v { font-size: clamp(1.05rem, 4.4vw, 1.6rem); }
@media (max-width: 480px) {
  .bat-kpis .kpi:last-child { grid-column: 1 / -1; }
  #nav a { font-size: .62rem; min-width: 0; }  /* oito abas: o texto menor evita que os nomes se encostem */
}
.bat-note { margin: -4px 0 14px; }
.bat-verdict { margin: -2px 0 8px; font-weight: 600; }
svg.chart .est { opacity: .4; }
/* gráficos de apoio às decisões (v0.17) */
svg.chart .line.dash { stroke-dasharray: 6 4; }
svg.chart .ref-line { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 5 4; fill: none; }
svg.chart .lim-line { stroke: var(--ink-2); stroke-width: 1; }
svg.chart .ref-txt { fill: var(--ink-2); }
svg.chart .dv-name { fill: var(--ink); font-size: 12px; }
svg.chart .dv-val { fill: var(--ink-2); font-size: 12px; }
svg.chart .promo-ring { fill: none; stroke: var(--good); stroke-width: 2; }
svg.chart.pace text { font-size: 12px; }
.lg-dash { height: 0 !important; width: 16px !important; border-top: 2px dashed; border-radius: 0 !important; vertical-align: 3px !important; background: none !important; }
svg.spark { display: block; overflow: visible; }
svg.spark path { fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.pace-ok { color: var(--good); }
.chart-sub { margin: 16px 0 6px; font-size: .9rem; font-weight: 600; }
.chart-sub .muted { font-weight: 400; }
.lim-row.click { cursor: pointer; }
.lim-pace { margin: 8px 0 4px; }
.lim-pace p { margin: 4px 0 0; font-size: .85rem; }
.cm-row { padding: 8px 0; }
.cm-row + .cm-row { border-top: 1px solid var(--border); }
.pr-pareto { margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.cov-card .legend { margin-top: 4px; }
.ano-tbl .ano-trend { padding-left: 8px; padding-right: 8px; }
.ano-tbl .ano-trend svg { margin: 0 auto; }
svg.chart .line.est { opacity: 1; stroke-dasharray: 5 4; }
.bat-tbl td.bat-est { font-style: italic; }
.bat-est-opts { margin: 0 0 12px; }
.bat-base { display: flex; align-items: center; gap: 6px; margin: 0; font-size: .88rem; }
.bat-base select { width: auto; min-height: 0; height: 34px; padding: 2px 6px; }
.fx-list { margin: 12px 0 6px; max-height: 42vh; overflow-y: auto; }
.fx-list li { display: flex; align-items: center; gap: 8px; }
.fx-row { display: flex; flex: 1; min-width: 0; align-items: center; gap: 8px; margin: 0; font-weight: 400; cursor: pointer; }
.fx-row input { flex: none; width: 18px; height: 18px; min-height: 0; }
.fx-row .title, .fx-row .sub { display: block; overflow-wrap: anywhere; }
.fx-list .pv-val { flex: none; width: 96px; text-align: right; }
.fx-sum { margin: 4px 0 8px; font-weight: 600; }
.bat-tbl tbody th, .bat-tbl tfoot th { min-width: 210px; max-width: 280px; }
@media (max-width: 600px) { .bat-tbl tbody th, .bat-tbl tfoot th { min-width: 170px; max-width: 190px; } }
.bat-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bat-range label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: .9rem; }
.bat-range input { width: auto; min-height: 0; height: 38px; padding: 4px 8px; }
.bat-tbl tfoot th, .bat-tbl tfoot td { position: static; }
.bat-tbl tfoot th { position: sticky; left: 0; bottom: auto; }
.bat-tbl tfoot tr + tr th, .bat-tbl tfoot tr + tr td { border-top: 0; font-weight: 500; color: var(--ink-2); }
.bat-tbl tfoot tr + tr td.bat-neg { color: var(--bad); }
.bat-sub { margin: 14px 0 4px; font-size: .82rem; color: var(--ink-2); }
.bat-hit { cursor: pointer !important; }
.bat-line { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 10px; padding: 6px 0; }
.bat-track { display: block; height: 14px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bat-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.bat-tbl .ano-l1 th { font-weight: 600; }
.bat-tbl .ano-l2 th { padding-left: 38px !important; color: var(--ink) !important; }
.bat-tbl .ano-l3 th { padding-left: 54px !important; color: var(--ink-2); }
@media (max-width: 560px) { .amz-items li { grid-template-columns: minmax(0, 1fr); } .cmp-grid { grid-template-columns: minmax(0, 1fr); } }

/* Investimentos: de quem é cada movimento */
.inv-owner { max-width: 11rem; padding: 6px 8px; min-height: 38px; font-size: .85rem; }
@media (max-width: 600px) { .list li:has(.inv-owner) { flex-wrap: wrap; } .list li:has(.inv-owner) .grow { flex-basis: 100%; } }
/* Seletor Família / pessoa, no topo das telas de números */
#who-bar { max-width: 980px; margin: 0 auto; padding: 12px 16px 0; }
@media (min-width: 900px) { #nav ~ #who-bar { margin-left: max(226px, calc((100vw - 980px) / 2 + 105px)); } body.nav-mini #nav ~ #who-bar { margin-left: max(76px, calc((100vw - 980px) / 2 + 38px)); } }
#who-bar:not([hidden]) + main { padding-top: 8px; }
.who-in { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.who-in .seg button { padding: 6px 14px; min-height: 38px; }
.who-note { color: var(--accent); font-weight: 600; }
body.who-on #who-bar .seg[aria-label="Ver os números de"] { border-color: var(--accent); }
/* Barra padrão: período, pessoa e "pela data", a mesma em todas as telas de números */
.ctl-in { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; }
.ctl-in .seg button { padding: 5px 10px; min-height: 34px; }
.ctl-main, .ctl-more { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.ctl-sum { display: none; }
@media (max-width: 700px) {
  .ctl-in { gap: 6px 8px; }
  .ctl-main { flex-basis: 100%; justify-content: center; }
  .ctl-sum { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
  .ctl-in.open .ctl-sum { order: 2; }
  .ctl-in .ctl-more { order: 3; }
  .ctl-in .ctl-extra { order: 2; margin-left: auto; }
  .ctl-in .who-note { order: 4; }
  .ctl-in:not(.open) .ctl-more { display: none; }
  .ctl-more { flex-basis: 100%; }
}
.ctl-nav { gap: 2px; }
.ctl-nav .btn.icon { min-height: 34px; min-width: 34px; }
.ctl-label { font-weight: 700; white-space: nowrap; padding: 4px 6px; }
.ctl-range { display: inline-flex; align-items: center; gap: 6px; }
.ctl-range input { max-width: 9.5rem; padding: 6px 8px; }
.ctl-reg select { padding: 6px 28px 6px 10px; min-height: 34px; font-size: .88rem; }
.ctl-extra { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.ctl-extra:empty { display: none; }
/* olho de ocultar valores: sempre na ponta direita da barra, em todas as telas */
.ctl-eye { margin-left: auto; min-height: 34px; min-width: 34px; color: var(--muted); }
.ctl-eye:hover { color: var(--ink); }
.ctl-eye[aria-pressed="true"] { color: var(--accent); }
.ctl-extra:not(:empty) ~ .ctl-eye { margin-left: 0; }
.ctl-in.ctl-solo { display: flex; justify-content: flex-end; background: none; border-color: transparent; padding: 0; }
@media (max-width: 700px) { .ctl-in .ctl-eye { order: 2; } .ctl-in .ctl-sum ~ .ctl-eye { margin-left: auto; } .ctl-in .ctl-extra:not(:empty) ~ .ctl-eye { margin-left: 0; } }
@media (max-width: 600px) { .ctl-in .seg button { padding: 5px 8px; font-size: .82rem; } .ctl-extra { margin-left: 0; } }
/* Grupos da barra lateral: o caminho do dinheiro (só no computador) */
.nav-grp { display: none; }
@media (min-width: 900px) {
  #nav .nav-grp { display: block; margin: 12px 12px 2px; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3, var(--muted)); }
  #nav .nav-grp:empty { margin: 6px 0; }
  body.nav-mini #nav .nav-grp { margin: 6px 0; font-size: 0; border-top: 1px solid var(--border); }
}
/* Leitor ao vivo do QR Code (tela cheia, sobre tudo) */
.qr-live { position: fixed; inset: 0; z-index: 1100; background: #000; color: #fff; overflow: hidden; }
.qr-live video, .qr-live .qr-mark { position: absolute; inset: 0; width: 100%; height: 100%; }
.qr-live video { object-fit: cover; }
.qr-live .qr-mark { pointer-events: none; }
.qr-frame { position: absolute; left: 50%; top: 45%; width: min(70vw, 60vh, 320px); aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid rgba(255, 255, 255, .85); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); pointer-events: none; transition: border-color .15s; }
.qr-live.ok .qr-frame { border-color: #3ecf6e; }
.key-live .qr-frame { width: min(92vw, 560px); aspect-ratio: 4 / 1; border-radius: 12px; } /* a chave é uma faixa larga de números */
.qr-msg { position: absolute; left: 16px; right: 16px; top: calc(16px + env(safe-area-inset-top)); margin: 0; padding: 10px 14px; border-radius: 10px; background: rgba(0, 0, 0, .65); color: #fff; text-align: center; font-weight: 600; }
.qr-live.ok .qr-msg { background: #1c7f45; }
.qr-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; justify-content: center; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.qr-bar .btn { flex: 1; max-width: 160px; justify-content: center; }

/* Relatório do que chegou da extensão */
.amz-rel { width: 100%; border-collapse: collapse; font-size: .9rem; }
.amz-rel tbody tr { cursor: pointer; }
.amz-rel tbody tr:hover { background: var(--hover, rgba(127,127,127,.08)); }
.amz-rel td:first-child { white-space: nowrap; }
.nowrap { white-space: nowrap; }
.list li.amz-row.flash { outline: 2px solid var(--accent, #3b82f6); outline-offset: 4px; border-radius: 6px; transition: outline-color .3s; }
@media (max-width: 640px) { .amz-rel th:nth-child(4), .amz-rel td:nth-child(4) { display: none; } }
.list li.amz-row .amz-warn, .amz-items li.amz-warn { display: block; background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 8px 10px; margin: 6px 0; }

/* aviso em destaque (limite de pessoas, beta) */
.note-warn { background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 8px 10px; }
.fb-item .sub { white-space: pre-wrap; }
.fb-reply { background: var(--soft, rgba(127,127,127,.12)); border-radius: 6px; padding: 6px 10px; margin-top: 6px; white-space: pre-wrap; }

/* Ajustes em abas */
.subtabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 14px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { flex: none; position: relative; padding: 10px 14px; color: var(--ink-2); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.subtabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.subtabs a:hover { color: var(--ink); }
.subtabs .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-left: 6px; vertical-align: middle; }

/* Membros da família */
.mem-list li { gap: 12px; }
.mem-list li.off .title, .mem-list li.off .avatar { opacity: .55; }
.mem-list .title { white-space: normal; }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.pays-chip { color: var(--good); font-weight: 600; }
.switch-row { display: flex; align-items: flex-start; gap: 12px; margin: 12px 0; cursor: pointer; }
.switch-row input.switch { margin-top: 2px; }
.switch-row > span { display: flex; flex-direction: column; gap: 2px; }
.switch-row .small { font-weight: 400; }
.field .hint { margin: 4px 0 0; }
.access-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-top: 12px; }
.access-box h3 { margin: 0 0 6px; font-size: 1rem; }

/* Entrada: Google e "ou" */
.google-btn { width: 100%; background: var(--surface); border: 1px solid var(--border); color: var(--ink); text-decoration: none; font-weight: 600; }
.or-line { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.or-line::before, .or-line::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* Duas etapas */
.steps { padding-left: 20px; }
.steps li { margin-bottom: 10px; }
.totp-key { display: block; margin-top: 6px; padding: 8px 10px; border-radius: 6px; background: var(--surface-2); font-size: 1rem; letter-spacing: .06em; word-break: break-all; user-select: all; }
.codes { background: var(--surface-2); border-radius: 8px; padding: 10px 14px; font-size: 1rem; letter-spacing: .08em; line-height: 1.7; columns: 2; user-select: all; }

/* Baixar os dados */
.data-dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; align-items: center; margin: 8px 0; }
@media (max-width: 560px) { .data-dl { grid-template-columns: 1fr; } .data-dl .small { margin-bottom: 6px; } }


/* ---------- Siga Seu Dinheiro (v0.18) ---------- */
/* Ícone da categoria: quadradinho com o fundo claro da cor dela */
.cat-ico { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; flex: none; margin-right: 8px; vertical-align: middle;
  color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.cat-ico svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.home-legend li .cat-ico { margin-right: 0; }
.cat-ico-btn { background: none; border: 1px solid var(--border); border-radius: 10px; padding: 3px; cursor: pointer; min-height: 0; }
.cat-ico-btn .cat-ico { margin: 0; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; margin: 8px 0 12px; }
.icon-pick { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.icon-pick.on { border-color: var(--accent); background: var(--accent-soft); }
.icon-pick .cat-ico { margin: 0; width: 32px; height: 32px; }
.icon-pick .cat-ico svg { width: 20px; height: 20px; }
/* Organizar painéis do Início */
.org-list { list-style: none; padding: 0; margin: 8px 0; }
.org-row { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.org-row.off .grow { color: var(--muted); text-decoration: line-through; }
.org-row .btn.icon.small { min-width: 34px; min-height: 34px; padding: 0; }
/* O que mudou este mês */
.sig-list { list-style: none; padding: 0; margin: 6px 0 0; }
.sig { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.sig:last-child { border-bottom: 0; }
.sig a { color: inherit; text-decoration: none; }
.sig a:hover { text-decoration: underline; }
.sig-i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 700; flex: none; background: var(--accent-soft); color: var(--accent); }
.sig.atencao .sig-i { background: var(--warn-bg, #fdf1de); color: var(--warn, #a8650a); }
.sig.bom .sig-i { background: color-mix(in srgb, var(--series-3) 18%, transparent); color: var(--series-3); }
/* Para onde vai o dinheiro */
.fut-hero { font-size: 1.6rem; font-weight: 700; line-height: 1.15; margin: 2px 0 4px; }
.fut-hero.good { color: var(--series-3); }
.fut-hero.bad { color: var(--bad); }
/* Contas fixas */
.bill-list { list-style: none; padding: 0; margin: 8px 0 0; }
.bill-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.bill-row:last-child { border-bottom: 0; }
.bill-row .title { display: flex; align-items: center; flex-wrap: wrap; gap: 0 4px; }
.bill-row .right { text-align: right; display: grid; gap: 4px; justify-items: end; }
.bill-row.paga .num { color: var(--muted); }
.bill-row.atrasada .lim-tag { font-weight: 700; }
.bill-edits { list-style: none; padding: 0; margin: 6px 0 10px; }
.bill-edit { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.bill-edit-top { display: flex; gap: 8px; align-items: center; }
.bill-edit-top input[type=text] { flex: 1 1 auto; min-width: 0; width: auto; }
.bill-edit-top input[type=checkbox] { flex: none; width: auto; }
.bill-edit-fields { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 6px; }
.bill-edit-fields input[type=number] { width: 4.2rem; }
.bill-edit-fields input[inputmode=decimal] { width: 7rem; }
.bill-edit.sug:has([data-pick]:not(:checked)) { opacity: .55; }
/* Primeiros passos */
.steps-bar { margin: 8px 0 4px; }
.steps-list { list-style: none; padding: 0; margin: 6px 0 0; }
.steps-list li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; }
.steps-list a { color: inherit; text-decoration: none; display: grid; gap: 1px; }
.step-mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: .75rem; flex: none; margin-top: 1px; }
.steps-list li.ok .step-mark { background: var(--series-3); border-color: var(--series-3); color: #fff; }
.steps-list li.ok strong { text-decoration: line-through; color: var(--muted); }
/* Saídas */
.saidas-head { margin-bottom: 6px; }
.desp-total-line { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 8px; }
.desp-total-line strong { font-size: 1.3rem; }
.med-h { font-size: .95rem; margin: 14px 0 6px; }
.med-var { margin: 0; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 4px 10px; font-size: .85rem; cursor: pointer; }
.chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
#method-chips:empty { display: none; }
/* Extratos: quanto está detalhado */
.det-bar { height: 10px; margin: 8px 0; }
.det-list { list-style: none; padding: 0; margin: 0 0 10px; }
.det-list li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.det-list li .dot { margin-right: 6px; }
/* Entradas */
.inc-kpis { grid-template-columns: 1fr; }
.inc-groups { list-style: none; padding: 0; margin: 8px 0 0; }
.inc-group { padding: 8px 0; border-bottom: 1px solid var(--border); }
.inc-group:last-child { border-bottom: 0; }
.inc-head { display: flex; align-items: center; gap: 8px; }
.inc-pct { width: 3rem; text-align: right; }
.inc-items { margin-top: 6px; }
.inc-ways { grid-template-columns: repeat(2, 1fr) !important; }
/* Meus preços: último preço contra a média */
.pr-trend.up { color: var(--bad); font-weight: 600; }
.pr-trend.down { color: var(--series-3); font-weight: 600; }
/* Contas fixas: calendário e meses do ano */
.bills-nav { justify-content: flex-start; gap: 6px; margin: 8px 0 4px; }
.bills-nav .small { margin-left: auto; }
.cal { margin-top: 6px; }
.cal-h, .cal-g { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-h span { font-size: .7rem; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-d { min-height: 64px; border: 1px solid var(--border); border-radius: 8px; padding: 3px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-d.off { border: 0; }
.cal-d.wkend, .cal-d.feriado { background: color-mix(in srgb, var(--border) 35%, transparent); }
.cal-d.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-n { font-size: .72rem; color: var(--muted); }
.cal-ev { display: block; width: 100%; text-align: left; border: 0; border-radius: 4px; padding: 1px 4px; font-size: .68rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  background: var(--accent-soft); color: var(--accent); font-family: inherit; min-height: 0; }
.cal-ev.paga { background: color-mix(in srgb, var(--series-3) 18%, transparent); color: var(--series-3); text-decoration: line-through; }
.cal-ev.atrasada { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); font-weight: 700; }
.cal-ev.parcial, .cal-ev.prevista { background: color-mix(in srgb, #eda100 20%, transparent); color: #b07800; }
.cal-ev.no_cartao { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--ink-2, var(--muted)); }
.cal-ev.fatura { background: transparent; border: 1px dashed var(--muted); color: var(--muted); cursor: default; }
.cal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; background: var(--accent-soft); }
.cal-dot.paga { background: var(--series-3); } .cal-dot.atrasada { background: var(--bad); } .cal-dot.no_cartao { background: var(--muted); }
.cal-dot.fatura { background: transparent; border: 1px dashed var(--muted); }
@media (max-width: 600px) { .cal-d { min-height: 52px; } .cal-ev { font-size: .6rem; padding: 0 2px; } }
.bill-months { display: inline-flex; gap: 2px; flex-wrap: wrap; }
.bm { width: 26px; height: 26px; min-height: 0; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: .75rem; cursor: pointer; color: var(--ink); }
.bm.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.bill-help { margin: 0 0 8px; padding-left: 18px; }
.bill-edit-fields select { max-width: 12rem; }
/* Titulares das contas (Investimentos): o nome não fica embaixo do seletor */
.list li:has([data-inv-holder]) { flex-wrap: wrap; }
.list li:has([data-inv-holder]) .grow { flex: 1 1 12rem; min-width: 0; }
.list li:has([data-inv-holder]) select { flex: 0 1 14rem; max-width: 100%; }
.cal-dot.prevista { background: #eda100; }

/* Repetir salário e entradas a confirmar */
.rp-list li { padding: 0; }
.rp-item { display: flex; align-items: center; gap: 10px; padding: 8px 2px; cursor: pointer; }
.rp-item .title, .rp-item .sub { display: block; }
.pend-note { margin: 0 0 10px; }
.pend-card { border-left: 3px solid var(--warn); }

/* Diálogo de uma conta fixa: espaço entre os meses e o que vem embaixo */
dialog .bill-edit-fields:last-of-type { margin-bottom: 14px; }
.bd-active { margin: 18px 0 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.bd-foot { margin-top: 16px; }

/* O que mudou este mês: recolher o quadro e fechar cada aviso */
.sig-box > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.sig-box > summary::-webkit-details-marker { display: none; }
.sig-box > summary::after { content: "▾"; margin-left: auto; color: var(--ink-3, var(--ink-2)); font-size: .9rem; }
.sig-box:not([open]) > summary::after { content: "▸"; }
.sig-box:not([open]) > summary { margin-bottom: 0; }
.sig-x { flex: none; border: 0; background: none; color: var(--ink-2); font-size: 1.1rem; line-height: 1; padding: 2px 6px; border-radius: 6px; cursor: pointer; opacity: .6; }
.sig-x:hover, .sig-x:focus-visible { opacity: 1; background: var(--surface-2); }

/* Painéis do Início: ↑ ↓ e recolher, no título de cada painel */
.hp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-head.hp-head { justify-content: flex-start; }
.card-head.hp-head > :nth-child(2):not(.hp-tools) { margin-left: auto !important; }
.hp-tools { margin-left: auto; display: inline-flex; gap: 2px; flex: none; font-weight: 400; position: relative; }
.card-head.hp-head > :nth-child(2):not(.hp-tools) ~ .hp-tools { margin-left: 0; }
.hp-btn { border: 0; background: none; color: var(--ink-2); width: 28px; height: 28px; border-radius: 6px; font-size: .95rem; line-height: 1; cursor: pointer; padding: 0; }
.hp-btn:hover, .hp-btn:focus-visible { background: var(--surface-2); color: var(--ink); }
.hp-btn:disabled { opacity: .25; cursor: default; background: none; }
.home-card.folded .hp-hide { display: none !important; }
.home-card.folded .hp-head { margin-bottom: 0; }
/* recolhido: no título ficam só o nome e o ⋯; Ajustar, Ver metas, 3/6/12 meses só com ele aberto */
.home-card.folded .card-head.hp-head > :not(.hp-tools):not(h2):not(:has(h2)) { display: none !important; }
.home-card.folded .hp-head { flex-wrap: nowrap; }
.home-card.folded .card-head.hp-head > .hp-tools { margin-left: auto; }
.sig-n { display: none; }
.folded .sig-n { display: inline-block; }

/* Balanço: a estimativa explicada, só quando o período chega ao mês atual */
.bat-est-box { padding: 12px 14px; }
.bat-est-more { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 8px 0 0 50px; }
.bat-est-more select { margin-left: 4px; }
.bat-est-more label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.bat-est-more select { width: auto; margin: 0; padding: 4px 8px; }
.hp-x { font-size: 1.15rem; margin-left: 2px; }
.hp-x:hover, .hp-x:focus-visible { color: var(--bad); }

/* Extratos: ordenar a lista de importações */
.st-sort { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; flex-wrap: wrap; }
.st-sort label { margin: 0; font-weight: 400; color: var(--ink-2); }
.st-sort select { width: auto; margin: 0; padding: 4px 8px; }

/* Metas */
.goals { list-style: none; padding: 0; margin: 0; }
.goal { padding: 10px 0; border-bottom: 1px solid var(--border); }
.goal:last-child { border-bottom: 0; }
.goal-top { display: flex; align-items: center; gap: 8px; }
.goal-bar { margin: 6px 0 4px; }
.goal-bar i { background: var(--series-3); }
.goal.concluida .goal-bar i { background: var(--good, var(--series-3)); }
.goal-sub { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; color: var(--ink-2); }
.goal-acts { margin-top: 6px; }
.goals.compact .goal { padding: 7px 0; cursor: pointer; }

/* Quanto vale hoje: atualizar vários valores */
.hu-list li { gap: 10px; }
.hu-list .title, .hu-list .sub { display: block; }
.hu-list .pv-val { max-width: 130px; }

/* Sua semana: o que foi comprado, numa linha abaixo da loja */
.wk-what { display: block; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Resumo › Por categoria: previstas mais claras (fora da soma), busca e despesas encontradas */
.rep-planned { opacity: .55; }
.rep-planned:hover, .rep-planned:focus-within { opacity: .85; }
.rep-q { width: 100%; margin: 6px 0 4px; }
.rep-found { margin: 0 0 10px; }
.rep-det-tools { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 6px; }
.rep-det-tools label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.rep-det-tools select { width: auto; padding: 4px 8px; font-size: .85rem; }
.rep-grp { display: flex; gap: 4px; align-items: baseline; margin: 10px 0 2px; padding-top: 6px; border-top: 1px solid var(--border); }
.rep-grp .num { margin-left: auto; }
.gl-links { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.gl-links legend { font-weight: 600; font-size: .9rem; padding: 0 4px; }
.gl-link { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.gl-link label.check { flex: 1; align-items: center; }
.gl-link input[data-gl-part] { width: 110px; }
.goal-link { margin: 4px 0 0; }
.res-saved { margin: 4px 0 0; }
.cal-ev.investe { background: color-mix(in srgb, var(--series-3) 18%, transparent); color: var(--ink); border: 1px solid var(--series-3); }
.cal-ev.investe.feito { opacity: .6; }
.cal-dot.investe { background: var(--series-3); }
.beh-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; margin: 0 0 8px; }
.beh-bar i { display: block; height: 100%; }
.beh-fixo { background: var(--series-1); }
.beh-dia_a_dia { background: var(--series-2); }
.beh-periodico { background: var(--series-3); }
.beh-eventual { background: var(--series-4, var(--muted)); }
.beh-g { border-top: 1px solid var(--border); padding: 6px 0; }
.beh-g summary { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.beh-g summary .num { margin-left: auto; }
.beh-g .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.beh-row { align-items: center; }
.pr-focus { flex-wrap: wrap; gap: 8px; }
.pr-grp { border-top: 1px solid var(--border); padding: 6px 0; }
.pr-grp summary { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.pr-grp summary .num { margin-left: auto; }
.pr-grp .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pr-spread { color: var(--ink); }
.b3-cls { border-top: 1px solid var(--border); padding: 6px 0; }
.b3-cls summary { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.b3-cls .med-bar { margin: 4px 0 2px; }
.inv-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.b3-cls summary { display: block; list-style: none; }
.b3-cls summary::-webkit-details-marker { display: none; }
.b3-sum { display: flex; align-items: center; gap: 8px; }
.b3-sum .chev { width: 1em; color: var(--muted); }
.b3-pct { min-width: 3.2em; text-align: right; }
.b3-bar { display: block; margin: 4px 0 2px; }
.b3-assets li .grow { min-width: 0; }

.sec-tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 12px; border-radius: 12px; background: var(--accent-soft); }
.sec-tabs a { flex: 1; text-align: center; padding: 8px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; font-weight: 600; }
.sec-tabs a.on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
/* Seu mês: uma tela por vez */
.sm-card { text-align: center; padding: 22px 18px; }
.sm-dots { display: flex; gap: 4px; margin-bottom: 22px; }
.sm-dots i { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.sm-dots i.on { background: var(--accent); }
.sm-l { margin: 0; color: var(--muted); font-size: 1rem; }
.sm-v { margin: 6px 0; font-size: 2.2rem; font-weight: 800; line-height: 1.15; }
.sm-v.bad { color: var(--warn); }
.sm-d { min-height: 3.2em; margin: 8px 0 18px; }
.sm-call { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); border-color: var(--accent); }
#hphrase a { font-size: .85rem; font-weight: 400; margin-left: 6px; }
/* Cartões que rolam para o lado (Sua semana, A pagar) */
.hs { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; padding: 6px 2px 10px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.hs-card { flex: 0 0 min(70%, 220px); scroll-snap-align: start; display: flex; flex-direction: column; gap: 4px; min-height: 124px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); color: var(--ink); text-decoration: none; text-align: left; }
a.hs-card:hover, .hs-card.click:hover { border-color: var(--accent); }
.hs-card.click { cursor: pointer; }
.hs-k { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-t { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-d { font-size: .8rem; color: var(--ink-2, var(--muted)); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hs-v { margin-top: auto; font-size: 1.25rem; font-weight: 800; }
.hs-card .btn { align-self: flex-start; }
.hs-card.hero { background: var(--accent-soft); border-color: transparent; }
.hs-card.hero .hs-v { font-size: 1.6rem; margin-top: 2px; }
.hs-card.vence { border-left: 4px solid #eda100; }
.hs-card.atrasada { border-left: 4px solid var(--bad); }
.hs-card.more { justify-content: center; align-items: center; flex-basis: 150px; color: var(--accent); font-weight: 600; border-style: dashed; }
/* Contas do mês: barra do que já foi pago e o dia tocado */
.bills-nav { margin: 6px 0 10px; }
.bills-prog { height: 8px; margin: 8px 0 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.bills-prog i { display: block; height: 100%; border-radius: 4px; background: var(--series-3); }
.cal-d[data-day] { cursor: pointer; }
.cal-d.sel { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 600px) {  /* no celular, cada conta vira um ponto colorido; tocar no dia mostra as contas */
  .cal-d { min-height: 46px; flex-direction: row; flex-wrap: wrap; align-content: flex-start; justify-content: center; gap: 3px; padding: 4px 2px; border-radius: 10px; }
  .cal-n { width: 100%; text-align: center; font-size: .82rem; color: var(--ink); }
  .cal-d.has .cal-n { font-weight: 700; }
  .cal-ev { flex: none; width: 8px; height: 8px; padding: 0; border-radius: 50%; font-size: 0; pointer-events: none; background: var(--accent); }
  .cal-ev.paga { background: var(--series-3); } .cal-ev.atrasada { background: var(--bad); }
  .cal-ev.parcial, .cal-ev.prevista { background: #eda100; } .cal-ev.no_cartao { background: var(--muted); }
  .cal-ev.fatura { background: transparent; border: 1px dashed var(--muted); }
  .cal-ev.investe { background: transparent; border: 2px solid var(--series-3); }
}
/* Trilha de Mês: do total ao produto */
.tr-eq { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 12px; font-size: .95rem; }
.tr-eq .good strong { color: var(--series-3); } .tr-eq .bad strong { color: var(--warn); }
.tr-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-bottom: 8px; font-size: .88rem; }
.tr-crumbs span { color: var(--muted); }
.tr-total { margin: 0; font-size: 1.7rem; font-weight: 800; line-height: 1.2; }
.tr-total .small { font-weight: 400; }
.tr-list { display: grid; gap: 2px; margin-top: 8px; }
.tr-row { display: block; width: 100%; padding: 9px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.tr-row.static { cursor: default; }
button.tr-row:hover { background: var(--accent-soft); }
.tr-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tr-n { min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; overflow-wrap: anywhere; }
.tr-bar { display: block; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.tr-bar i { display: block; height: 100%; border-radius: 3px; background: var(--series-2, var(--accent)); }
.tr-crumbs button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
.subtabs[hidden] { display: none; }

/* Conferir: caixa de tarefas */
.cf-tasks { display: grid; gap: 4px; }
.cf-task { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.cf-task:hover { background: var(--accent-soft); }
.cf-task .grow { display: flex; flex-direction: column; }
.cf-task .hub-n { min-width: 2.2em; text-align: center; }

.tr-q { width: 100%; margin: 0 0 10px; }

.hp-how { margin: -4px 0 12px; font-size: .9rem; }
.hp-how summary { cursor: pointer; color: var(--accent); }
.hs-card.barato { border-left: 4px solid var(--series-3); }
.hs-card .bills-prog { margin: 6px 0 0; }
#fu-phrase a, #hphrase a { font-size: .85rem; font-weight: 400; margin-left: 6px; }

.brand-tag { margin: -4px 0 10px; font-size: .8rem; letter-spacing: .03em; color: var(--accent); }

.b3-year td, .b3-year th { white-space: nowrap; font-size: .82rem; padding: 5px 8px; }
.b3-year .b3y-cls th { text-align: left; background: var(--accent-soft); }
.b3-year .b3y-tot th { border-top: 2px solid var(--border); }
.b3-year td:first-child, .b3-year th:first-child { position: sticky; left: 0; background: var(--surface); }

/* Início: folha de caderno (pauta azul clara, margem vermelha e textura de papel) e a rosca do quanto sobra */
:root { --paper: #fbf8ef; --paper-line: rgba(42, 120, 214, .14); --paper-margin: rgba(208, 59, 59, .28);
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .25 .12 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --paper: #141412; --paper-line: rgba(120, 170, 230, .07); --paper-margin: rgba(230, 103, 103, .16);
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 .05 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); } }
:root[data-theme="dark"] { --paper: #141412; --paper-line: rgba(120, 170, 230, .07); --paper-margin: rgba(230, 103, 103, .16);
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 .05 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
body.caderno { background-color: var(--paper);
  background-image: var(--paper-grain), linear-gradient(90deg, transparent 31px, var(--paper-margin) 31px, var(--paper-margin) 33px, transparent 33px), repeating-linear-gradient(180deg, transparent 0 27px, var(--paper-line) 27px 28px);
  background-size: 180px 180px, 100% 100%, 100% 28px; background-attachment: scroll; }
@media (min-width: 900px) { body.caderno { background-image: var(--paper-grain), linear-gradient(90deg, transparent 71px, var(--paper-margin) 71px, var(--paper-margin) 73px, transparent 73px), repeating-linear-gradient(180deg, transparent 0 27px, var(--paper-line) 27px 28px); } }
body.caderno .home-card, body.caderno .hp-card, body.caderno .sm-call { box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 6px 18px rgba(60, 50, 20, .08); }
.hp-card h2 { font-size: 1.15rem; }
.hp-in { font-weight: 400; margin-left: 6px; }
.hp-body { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.hp-body .home-donut { width: 180px; margin: 0; flex-shrink: 0; }
.hp-body .home-center strong { font-size: 1.05rem; color: var(--good); }
.hp-body.bad .home-center strong { color: var(--bad); }
.hp-leg { flex: 1; min-width: 200px; max-width: 320px; margin: 0; }
.hp-leg li { padding: 6px 2px; }
.hp-leg li:first-child { border-top: 0; }@media (max-width: 600px) {
  .hp-body .home-donut { width: 160px; }
  .hp-leg { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; min-width: 0; max-width: none; flex-basis: 100%; }
  .hp-leg li { flex-wrap: wrap; row-gap: 0; gap: 0 8px; border-top: 0; padding: 5px 0; }
  .hp-leg li .num { flex-basis: 100%; padding-left: 20px; font-weight: 600; }
}
/* v0.48: rosca entrou × saiu, orçamento simples, escada das parcelas, simulador de aposentadoria */
.hp-ring { background: transparent !important; border: 2px solid var(--ink-2); box-sizing: border-box; }
@media (max-width: 600px) { .hp-leg.hp-leg3 { grid-template-columns: 1fr 1fr 1fr; column-gap: 8px; } .hp-leg3 li .num { padding-left: 0; font-size: .9rem; } }
.lim-days { margin: 4px 0 8px; font-size: 1.05rem; }
.lim-simple { list-style: none; margin: 0; padding: 0; }
.lim-simple li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 8px; padding: 7px 0; border-top: 1px solid var(--border); }
.lim-simple li:first-child { border-top: 0; }
.lim-simple .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lim-simple .lim-bar { grid-column: 1 / -1; margin: 0; }
.lim-simple .num { font-weight: 600; font-size: .92rem; }
.lim-simple .lim-over { color: var(--bad); }
.stair-big { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0 12px; }
.stair-big > div { flex: 1 1 140px; display: flex; flex-direction: column; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.stair-big strong { font-size: 1.3rem; line-height: 1.2; }
.stair { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding-bottom: 18px; position: relative; }
.stair-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; }
.stair-col i { display: block; width: 100%; max-width: 26px; background: #6250d6; border-radius: 4px 4px 0 0; }
.stair-col.heavy i { background: #eb6834; }
.stair-col span { position: absolute; bottom: -18px; font-size: .68rem; color: var(--muted); }
.ap-bar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; gap: 2px; background: var(--surface-2); }
.ap-bar i { display: block; height: 100%; }
.ap-leg { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 4px; padding: 0; font-size: .88rem; }
.ap-leg li { display: flex; align-items: center; gap: 6px; }
.ap-leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ap-in { margin-top: 10px; }
.ap-in summary { cursor: pointer; color: var(--accent); }
.ap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 12px; margin-top: 8px; }
.ap-grid .field { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: .88rem; }.ap-h { font-size: .95rem; margin: 14px 0 0; }
.ap-fp { margin: 2px 0 10px; }.ap-who { list-style: none; margin: 4px 0 0; padding: 0; }
.ap-who li { padding: 8px 0; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.ap-who li:first-child { border-top: 0; }
.ap-who li > .small { flex-basis: 100%; }
.ap-rep { font-size: .82rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; }
.ap-sx { max-width: 220px; margin: 6px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }

/* Simulador de aposentadoria: um bloco por pessoa */
.ap-person { padding: 10px 0 12px; border-top: 1px solid var(--border); }
.ap-person:first-child { border-top: 0; padding-top: 2px; }
.ap-ph { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.ap-tot { margin: 2px 0 8px; }
.ap-tot strong { font-size: 1.45rem; }
.ap-pbar { position: relative; display: flex; height: 22px; border-radius: 7px; gap: 2px; background: var(--surface-2); }
.ap-pbar i { display: block; height: 100%; }
.ap-pbar i:first-child { border-radius: 7px 0 0 7px; }
.ap-mark { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); }
.ap-leg i.ap-mk { width: 3px; height: 14px; border-radius: 2px; background: var(--ink); }
.ap-src { color: var(--accent); }
.ap-paste { margin: 2px 0 8px; }
.ap-paste summary { cursor: pointer; color: var(--accent); }
.ap-todo { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.ap-todo ul { margin: 0; padding-left: 18px; }
.ap-todo li + li { margin-top: 4px; }
/* Saídas por dia em calendário */
.scals { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.scal-t { margin: 0 0 4px; display: flex; justify-content: space-between; align-items: baseline; }
.scal-g { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.scal-d { min-height: 44px; border: 1px solid var(--border); border-radius: 8px; padding: 3px 4px; display: flex; flex-direction: column; justify-content: space-between; background: var(--surface); color: var(--ink); font: inherit; text-align: left; }
.scal-d.off { border-color: transparent; background: none; }
.scal-d.has { cursor: pointer; background: color-mix(in srgb, var(--accent) var(--w), var(--surface)); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.scal-d.has:hover { outline: 2px solid var(--accent); outline-offset: -1px; }
.scal-d.today { box-shadow: inset 0 0 0 2px var(--accent); }
.scal-n { font-size: .7rem; color: var(--muted); }
.scal-v { font-size: .72rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scal-d.hot .scal-v, .scal-d.hot .scal-n { color: #fff; }
.scal-d.peak { position: relative; }
.scal-d.peak::after, .scal-pk { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--surface); }
.scal-d.peak::after { position: absolute; top: 3px; right: 3px; }
/* previstas no calendário de Saídas: âmbar, como no calendário de contas; fora da soma e da escala */
.scal-d.prev { border: 1px dashed #eda100; background: color-mix(in srgb, #eda100 10%, var(--surface)); }
button.scal-d.prev { cursor: pointer; }
button.scal-d.prev:hover { outline: 2px solid #eda100; outline-offset: -1px; }
.scal-p { align-self: flex-start; font-size: .66rem; font-weight: 600; line-height: 1.3; padding: 0 3px; border-radius: 4px; white-space: nowrap; overflow: hidden; max-width: 100%; color: #7a5300; background: color-mix(in srgb, #eda100 30%, var(--surface)); }
.scal-pt { color: #9a6a00; }
.scal-pl { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border: 1px dashed #eda100; background: color-mix(in srgb, #eda100 30%, var(--surface)); vertical-align: -1px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .scal-p { color: #ffd277; } :root:not([data-theme="light"]) .scal-pt { color: #f0b84a; } }
:root[data-theme="dark"] .scal-p { color: #ffd277; } :root[data-theme="dark"] .scal-pt { color: #f0b84a; }

/* Futuro › Seu plano */
.plan-hero { padding: 18px 20px; }
.plan-k { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.plan-hero .fut-hero { margin: 2px 0 8px; }
.plan-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 18px; }
.plan-chip { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.plan-chip:hover { border-color: var(--accent); }
.plan-chip > b, .plan-eyebrow > b { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .8rem; }
.plan-chip.ok > b { background: color-mix(in srgb, var(--series-3) 22%, transparent); color: var(--series-3); }
.plan-chip > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plan-chip .small { color: var(--muted); }
.plan-step { scroll-margin-top: 70px; margin-bottom: 14px; }
/* tarefa do mês de cada degrau: cumprir e marcar como feita */
.plan-task { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0 0 10px; padding: 12px 14px; border: 1px dashed var(--accent); border-radius: 12px; background: var(--accent-soft); }
.plan-task-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 260px; }
.plan-task-tx .plan-k { margin: 0; }
.plan-task-act { display: flex; gap: 6px; flex-wrap: wrap; }
.plan-task.done { border-style: solid; border-color: color-mix(in srgb, var(--series-3) 45%, transparent); background: color-mix(in srgb, var(--series-3) 10%, var(--surface)); }
.plan-task.done strong { color: var(--series-3); }
.plan-task.bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.plan-eyebrow { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font-weight: 700; }
.plan-eyebrow .muted { font-weight: 400; }
.plan-eyebrow .btn { margin-left: auto; }
@media (max-width: 760px) { .plan-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Bloqueio do app */
.ctl-lock { min-height: 34px; min-width: 34px; color: var(--muted); }
.ctl-lock:hover { color: var(--ink); }
@media (max-width: 700px) { .ctl-in .ctl-lock { order: 3; } }
body.app-locked #app, body.app-locked #tooltip { visibility: hidden; }
#lock-screen { position: fixed; inset: 0; z-index: 100; background: var(--page); display: flex; align-items: center; justify-content: center;
  padding: 16px; padding-top: calc(16px + env(safe-area-inset-top)); overflow-y: auto; }
.lock-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px 20px; text-align: center; }
.lock-card h2 { margin: 8px 0 4px; }
.lock-card form { text-align: left; margin-top: 12px; }
.lock-logo { width: 56px; height: 56px; border-radius: 14px; }
.lock-wide { width: 100%; margin-top: 8px; }
.lock-bio { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; }
.lock-bio svg, .btn-ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-ico { width: 18px; height: 18px; vertical-align: -4px; margin-right: 6px; }
.lock-out { margin: 16px 0 0; }
.inline-ico { width: 15px; height: 15px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lock-h3 { font-size: 15px; margin: 16px 0 6px; }
.lock-keys { list-style: none; margin: 0 0 12px; padding: 0; }
.lock-keys li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.lock-keys li > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* ---------- Orçamento que mostra o ponto (veio do Onde Gastei) ---------- */
.bud-list { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.bud-top { display: flex; align-items: baseline; gap: 8px; font-weight: 600; }
.bud-top .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.bud-delta { font-weight: 700; color: var(--good); white-space: nowrap; }
.bud.over .bud-delta { color: var(--bad); }
.bud-bar { position: relative; height: 26px; margin: 4px 0 2px; border-radius: 6px; background: var(--surface-2); overflow: visible; }
.bud-bar > i { position: absolute; top: 0; bottom: 0; display: block; }
.bud-fill { left: 0; border-radius: 6px 0 0 6px; background: color-mix(in srgb, var(--bc, var(--ink)) 55%, var(--surface)); display: flex !important; align-items: center; justify-content: flex-end; }
.bud-fill b { padding: 0 8px; font-size: .82rem; font-weight: 700; color: var(--ink); white-space: nowrap; }
.bud-plan { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--bc, var(--ink)) 55%, var(--surface)) 0 4px, transparent 4px 8px); }
.bud-over { background: var(--bad); border-radius: 0 6px 6px 0; display: flex !important; align-items: center; justify-content: flex-end; }
.bud-over b { padding: 0 8px; font-size: .82rem; font-weight: 700; color: #fff; white-space: nowrap; }
.bud-mark { width: 0; border-left: 2px dashed var(--ink); top: -4px !important; bottom: -4px !important; }
.bud-out { position: absolute; top: 50%; transform: translateY(-50%); padding-left: 6px; font-size: .82rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.bud-foot { display: flex; justify-content: space-between; gap: 8px; }
.bud.big .bud-bar { height: 34px; }
.bud.big .bud-fill b, .bud.big .bud-over b { font-size: .95rem; }
.bud.big .bud-top { font-weight: 500; color: var(--muted); font-size: .9rem; }
.bud-k { font-weight: 800; }
.bud-k.ok { color: var(--good); }
.bud-k.over { color: var(--bad); }
.hp-total { margin: 4px 0 10px; display: flex; align-items: baseline; gap: 8px; }
.hp-total strong { font-size: 1.9rem; font-weight: 800; }
.sm-list { list-style: none; padding: 0; margin: 10px 0 0; text-align: left; }
.sm-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); }
.sm-good { color: var(--good); }
.sm-pbar { flex-basis: 100%; height: 8px; border-radius: 4px; background: var(--surface-2); }
.sm-pbar i { display: block; height: 100%; border-radius: 4px; background: color-mix(in srgb, var(--ink) 30%, var(--surface)); }

/* orçamento: a ordem da lista, ao lado dos dias que faltam */
.bud-sortrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.bud-sortrow .lim-days { margin: 0; }
.bud-sort { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.bud-sort select { width: auto; min-height: 0; height: 30px; padding: 2px 8px; font-size: .85rem; }
/* diálogos: o × fica sempre à vista no alto, mesmo rolando o conteúdo */
.dlg-x { position: sticky; top: -18px; float: right; z-index: 2; margin: -8px -8px 0 8px; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.dlg-x:hover { background: var(--surface-2); }

/* O nome do app é um link para o Início */
#nav .brand { color: var(--ink); text-decoration: none; }
@media (min-width: 900px) { #nav .brand { border-radius: 10px; } #nav .brand:hover { background: var(--surface-2); } }
/* Trilha: chave das previstas e a parte prevista de cada linha, em âmbar */
.tr-tools { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; }
.tr-prev { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; font-weight: 500; }
.tr-pv { color: var(--warn); font-weight: 600; }
/* conta achada nas despesas: a mesma caixa das contas, sem o estilo das sugestões de apelido (.sug) */
.bill-edit.sug { display: block; max-width: none; border-radius: 10px; overflow: visible; }

/* Para onde foi o dinheiro: ajustes ao lado de Ver gráficos; o total do período em letra grande */
.hp-acts { display: inline-flex; gap: 6px; align-items: center; }
#hspend .hp-total { flex-wrap: wrap; margin: 2px 0 6px; }
#hspend .hp-total strong { font-size: 2.1rem; }

/* Onde Gastei: Início de quem lança (botões grandes e as últimas notas lançadas) */
.ln-launch { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 6px 0 14px; }
.ln-big { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 92px; padding: 12px 8px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--ink); text-align: center; cursor: pointer; text-decoration: none; font: inherit; }
.ln-big svg { width: 28px; height: 28px; }
.ln-big strong { font-size: .92rem; }
.ln-big.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ln-big:disabled { opacity: .5; cursor: default; }
@media (max-width: 560px) { .ln-launch { grid-template-columns: repeat(3, 1fr); gap: 8px; } .ln-big { min-height: 72px; padding: 8px 4px; } .ln-big strong { font-size: .82rem; }
  .ln-big.primary { grid-column: 1 / -1; min-height: 76px; flex-direction: row; } .ln-big.primary strong { font-size: 1rem; } }
.ln-pend { border-color: #d99a1e; }
.ln-list li { align-items: center; gap: 10px; cursor: pointer; }
.ln-thumb { flex: none; width: 48px; height: 48px; padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-2, var(--surface)); cursor: zoom-in; }
.ln-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ln-ico { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: #fff; }
.ln-ico svg { width: 22px; height: 22px; }
.ln-st { color: #1baf7a; font-weight: 600; }
.ln-st.warn { color: #e34948; }
.ln-st.man { color: var(--ink-2); font-weight: 400; }
.ln-photo { display: block; max-width: 100%; max-height: 50vh; margin: 8px auto; border-radius: 8px; border: 1px solid var(--border); }
.ln-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ln-items { max-height: 40vh; overflow: auto; }
.home-hello-row h1 { white-space: nowrap; }
.ln-new { animation: ln-new 2.4s ease-out; }
@keyframes ln-new { 0%, 40% { background: color-mix(in srgb, #1baf7a 22%, transparent); } 100% { background: transparent; } }

/* Perfis do app: Lançador de notas, Analista de despesas e Analista total */
.perfis { display: grid; gap: 8px; }
.perfil { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.perfil.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.perfil.on strong::after { content: " ✓"; color: var(--accent); }
.perfil-btn { width: 100%; justify-content: space-between; margin-top: 8px; }
.perfil-chip { white-space: nowrap; }
/* Lançador: o QR Code é o jeito principal; fica em destaque, na largura toda */
.ln-home .choices { margin-bottom: 4px; }
.ln-home #c-qr { grid-column: 1 / -1; order: -1; flex-direction: row; justify-content: center; min-height: 64px; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ln-home #c-qr strong { font-size: 1rem; }
.ln-home #c-qr svg { color: var(--accent-ink); stroke: currentColor; width: 26px; height: 26px; }

/* Falar ou digitar o gasto: o texto e, ao lado, o microfone grande */
.say-row { display: flex; gap: 10px; align-items: stretch; margin-top: 10px; }
.say-row textarea { flex: 1; min-width: 0; font-size: 1.05rem; }
.say-mic { flex: none; width: 72px; border-radius: 16px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer;
  display: grid; place-items: center; }
.say-mic svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.say-mic.on { animation: say-pulse 1.2s ease-in-out infinite; }
@keyframes say-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 50% { box-shadow: 0 0 0 10px transparent; } }

/* Resumo da nota (QR Code ou chave), na câmera, em Notas a lançar e na escolha da chave */
.nsum { display: grid; gap: 2px; }
.nsum-store { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.kf-h { font-size: .9rem; margin: 12px 0 4px; }
.kfacts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: .9rem; }
.kfacts dt { color: var(--muted, #888); }
.kfacts dd { margin: 0; overflow-wrap: anywhere; }
.nsum-dup { color: #d99a1e; font-weight: 600; }
.qr-found { position: absolute; left: 12px; right: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); padding: 14px; border-radius: 14px;
  background: var(--surface); color: var(--ink); box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.qr-found .qr-saved { color: #1baf7a; font-weight: 600; margin: 8px 0 0; }
.qr-found-acts { display: flex; gap: 8px; margin-top: 10px; }
.qr-found-acts .btn { flex: 1; justify-content: center; }
.pend-list li { align-items: center; gap: 10px; }
.pend-acts { display: flex; flex-direction: column; gap: 6px; flex: none; }
.key-pick { display: grid; gap: 8px; margin: 8px 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* Fontes achadas (câmera ou foto): cada código com o número dele na tela, o que traz e o botão de usar */
.src-tray { position: absolute; left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); max-height: 52vh; overflow: auto;
  padding: 10px 12px; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.src-head { margin: 0 0 6px; font-size: .85rem; font-weight: 600; }
.src-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.src-tray .src-list { margin: 0; }
.src { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--border); border-radius: 12px; }
.src-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  background: #3ecf6e; color: #000; }
.src-kind { font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.src-val { word-break: break-all; }
.src-acts { flex: none; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.src .grow { flex: 1; min-width: 0; }
#f-doc-info.warn { color: var(--warn); }
.tip-text { font-size: 1rem; line-height: 1.5; margin: 6px 0 14px; }

/* ---------- A cena do Início de quem lança ---------- */
.lhero { position: relative; margin: -16px -16px 0; padding: 14px 16px 26px; overflow: hidden; color: #fff; isolation: isolate;
  --sky1: #3d7fe0; --sky2: #79aef2; background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 62%, transparent 100%); }
.lhero[data-time="manha"] { --sky1: #e07a45; --sky2: #f4b47a; }
.lhero[data-time="noite"] { --sky1: #17224d; --sky2: #3a3f7e; }
:root[data-theme="dark"] .lhero { --sky1: #1f3f7a; --sky2: #2b4f8c; }
:root[data-theme="dark"] .lhero[data-time="manha"] { --sky1: #8a4a2c; --sky2: #9e6a45; }
:root[data-theme="dark"] .lhero[data-time="noite"] { --sky1: #121a3d; --sky2: #262b5c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lhero { --sky1: #1f3f7a; --sky2: #2b4f8c; }
  :root:not([data-theme="light"]) .lhero[data-time="manha"] { --sky1: #8a4a2c; --sky2: #9e6a45; }
  :root:not([data-theme="light"]) .lhero[data-time="noite"] { --sky1: #121a3d; --sky2: #262b5c; } }
.lh-sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.lh-sun { position: absolute; top: -40px; right: -30px; width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 170, .75) 0, rgba(255, 220, 140, .25) 35%, transparent 70%); animation: lh-glow 6s ease-in-out infinite; }
.lhero[data-time="noite"] .lh-sun { background: radial-gradient(circle, rgba(235, 235, 255, .45) 0, rgba(200, 210, 255, .12) 35%, transparent 70%); }
.lh-cloud { position: absolute; height: 26px; border-radius: 20px; background: rgba(255, 255, 255, .28); filter: blur(4px); }
.lh-cloud.c1 { top: 70px; width: 120px; animation: lh-cloud 46s linear infinite; }
.lh-cloud.c2 { top: 130px; width: 80px; opacity: .7; animation: lh-cloud 64s linear infinite -30s; }
.lhero[data-time="noite"] .lh-cloud { background: rgba(255, 255, 255, .08); }
@keyframes lh-cloud { from { transform: translateX(-140px); } to { transform: translateX(110vw); } }
@keyframes lh-glow { 50% { transform: scale(1.12); opacity: .8; } }
.lh-top { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }
.lh-circle, .lh-top .top-icons .btn.icon { width: 44px; height: 44px; min-height: 44px; border-radius: 50%; border: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(10, 20, 45, .55); color: #fff; box-shadow: 0 6px 14px rgba(5, 15, 40, .3), inset 0 1px 0 rgba(255, 255, 255, .15); cursor: pointer; flex: none; }
.lh-circle svg, .lh-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lh-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.lh-title strong { font-size: 1.12rem; line-height: 1.2; }
.lh-title span { font-size: .8rem; opacity: .8; }
.lh-top .top-icons { display: inline-flex; gap: 10px; margin-left: auto; }
.lh-big { display: flex; align-items: center; gap: 10px; margin: 4px 0 0; text-shadow: 0 2px 10px rgba(5, 15, 40, .25); }
.lh-big strong { font-size: 3.1rem; line-height: 1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.lh-big span { font-size: .92rem; font-weight: 600; line-height: 1.25; opacity: .95; }
.lh-scene { display: block; width: 100%; max-width: 440px; height: auto; margin: -6px auto 0; overflow: visible; }
.lhero .lh-big > *, .lh-stats strong { transition: opacity .4s; }
.lhero:not(.filled) .lh-big > * { opacity: 0; }
.lh-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: -10px 0 22px; position: relative; }
.lh-stat { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); min-width: 0; }
.lh-stat > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.lh-stat small { color: var(--muted); font-size: .78rem; }
.lh-stat strong { font-size: .98rem; line-height: 1.25; }
.lh-ico { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.lh-ico.c-blue { background: rgba(42, 120, 214, .14); color: #2a78d6; }
.lh-ico.c-amber { background: rgba(230, 150, 30, .16); color: #d98a12; }
@media (min-width: 900px) { .lhero { margin: 0 0 0; border-radius: 24px; padding: 20px 26px 30px; } .lh-scene { max-width: 520px; } }
/* movimento: o celular flutua, a linha lê o QR, o ✓ aparece; brilhos piscam */
.lh-phone { animation: lh-float 5s ease-in-out infinite; }
@keyframes lh-float { 50% { transform: translateY(-4px); } }
.lh-receipt { animation: lh-float 6s ease-in-out infinite -2s; }
.lh-beam { animation: lh-scan 3.6s ease-in-out infinite; }
@keyframes lh-scan { 0% { transform: translateY(0); opacity: 1; } 55% { transform: translateY(38px); opacity: 1; } 62%, 100% { transform: translateY(38px); opacity: 0; } }
.lh-ok { transform-box: fill-box; transform-origin: center; animation: lh-ok 3.6s ease-in-out infinite; }
@keyframes lh-ok { 0%, 58% { transform: scale(0); opacity: 0; } 68% { transform: scale(1.15); opacity: 1; } 76%, 92% { transform: scale(1); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
.lh-spark path { transform-box: fill-box; transform-origin: center; animation: lh-tw 3s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes lh-tw { 0%, 100% { transform: scale(.4); opacity: .3; } 50% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lh-phone, .lh-receipt, .lh-beam, .lh-spark path, .lh-cloud, .lh-sun { animation: none; } .lh-ok { animation: none; transform: none; opacity: 1; } }
body.top-merged .lhero { margin-top: -16px; }

/* ---------- Mais silêncio entre os quadros ---------- */
.home-launch .choices { gap: 12px; }
.home-launch { margin-bottom: 22px; }
.page-head { margin-bottom: 18px; }
.desp-filters { margin-bottom: 22px; }

/* ---------- Topo no celular: o olho e o cadeado na linha do título ---------- */
.top-icons { display: none; }
@media (max-width: 899px) {
  body.top-merged #who-bar { display: none; }
  .top-icons { display: inline-flex; gap: 8px; align-items: center; }
  .top-icons .btn.icon { width: 40px; height: 40px; min-height: 40px; padding: 0; justify-content: center; }
  /* Início: "Olá" e o olho/cadeado na 1ª linha; o título e o perfil/tema na 2ª */
  .home-hello-row:has(.top-icons) { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "hi icons" "h1 acts"; align-items: center; row-gap: 8px; margin-top: 0; }
  .home-hello-row:has(.top-icons) > div:not(.home-actions) { display: contents; }
  .home-hello-row:has(.top-icons) > div:not(.home-actions) > p { grid-area: hi; }
  .home-hello-row:has(.top-icons) > div:not(.home-actions) > h1 { grid-area: h1; margin: 0; }
  .home-hello-row .top-icons { grid-area: icons; justify-self: end; }
  .home-hello-row:has(.top-icons) .home-actions { grid-area: acts; justify-self: end; }
  .ed-top .actions .top-icons { margin-left: 4px; }
  .ed-top .rep-txt { display: none; }
}

/* ---------- ⓘ: explicação que abre com um toque ---------- */
.hint-btn { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: 4px; padding: 0; border: 1.5px solid currentColor;
  border-radius: 50%; background: none; color: var(--muted); font: italic 700 .72rem/1 Georgia, serif; vertical-align: 2px; cursor: pointer; opacity: .8; }
.hint-btn[aria-expanded="true"] { color: var(--accent); opacity: 1; }
.hint-btn::after { content: ""; position: absolute; inset: -12px; }
.hint-btn { position: relative; }

/* ---------- Gastos: chave das previstas ---------- */
.prev-switch { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.title .badge.plan { margin-right: 4px; vertical-align: 1px; }
.page-head h1 + p.small { margin: 4px 0 0; }

/* ---------- Puxar para baixo para atualizar ---------- */
html, body { overscroll-behavior-y: contain; }
.ptr { position: fixed; top: env(safe-area-inset-top, 0px); left: 50%; z-index: 60; transform: translate(-50%, -64px); opacity: 0; display: flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--ink); font-size: .85rem; font-weight: 600; pointer-events: none; transition: transform .25s, opacity .25s; }
.ptr-ico { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent, #2a78d6); color: #fff; font-size: .95rem; transition: transform .2s; }
.ptr.ready .ptr-ico { transform: rotate(180deg); }
.ptr.busy .ptr-ico { animation: ptr-spin .8s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* ---------- Ordem dos lançados: um ícone só, a explicação fica no title ---------- */
.ln-head-r { display: inline-flex; align-items: center; gap: 12px; }
.ln-order { display: inline-flex; align-items: center; gap: 1px; height: 34px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer; font-size: .8rem; }
.ln-order:hover { color: var(--accent); border-color: var(--accent); }
.ln-order svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#ln-recent .card-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
#ln-recent .card-head h2 { min-width: 0; }

/* ---------- Nota já lançada: bem visível na câmera e na despesa aberta ---------- */
.src.src-dup { border-color: #e0a526; background: rgba(240, 170, 40, .08); }
.src-dupflag { display: inline-block; margin-bottom: 4px; padding: 3px 10px; border-radius: 999px; background: #e9a21b; color: #fff; font-weight: 700; font-size: .82rem; }
.dup-open { background: var(--warn-bg); color: var(--warn); font-weight: 600; }

/* ---------- Notas para conferir o valor ---------- */
.nv-list li { flex-wrap: wrap; }
.nv-acts { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; justify-content: flex-end; }

/* ---------- O painel do alto nos outros perfis ---------- */
.lh-plus { margin-left: auto; }
.lh-cur { font-size: 1.3rem; font-weight: 600; margin-right: 4px; opacity: .9; letter-spacing: 0; }
.lhero[data-kind="despesas"] .lh-big strong, .lhero[data-kind="total"] .lh-big strong { font-size: 2.7rem; white-space: nowrap; }
.lhero.neg .lh-big strong { color: #ffd2d2; }
.lh-stat strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lh-ico.c-green { background: rgba(27, 175, 122, .15); color: #15936a; }
.lh-ico.c-red { background: rgba(227, 73, 72, .14); color: #d23c3b; }
.ds-pin { animation: ds-drop 4.8s ease-in-out infinite; }
.ds-pinsh { transform-box: fill-box; transform-origin: center; animation: ds-sh 4.8s ease-in-out infinite; }
@keyframes ds-drop { 0%, 100% { transform: translateY(-6px); } 50% { transform: translateY(2px); } }
@keyframes ds-sh { 0%, 100% { transform: scale(.75); opacity: .2; } 50% { transform: scale(1.05); opacity: .4; } }
.ds-card { animation: lh-float 6s ease-in-out infinite -1s; }
.ds-coin1 { animation: lh-float 5s ease-in-out infinite -2.5s; }
.tt-coin { animation: tt-drop 3.6s ease-in infinite; }
@keyframes tt-drop { 0% { transform: translateY(-26px); opacity: 0; } 15% { opacity: 1; } 62% { transform: translateY(24px); opacity: 1; } 72%, 100% { transform: translateY(30px); opacity: 0; } }
.tt-pig { animation: lh-float 6s ease-in-out infinite; }
.tt-arrow { stroke-dasharray: 150; animation: tt-draw 4.8s ease-in-out infinite; filter: drop-shadow(0 3px 6px rgba(5, 15, 40, .3)); }
@keyframes tt-draw { 0% { stroke-dashoffset: 150; } 45%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 150; } }
@media (prefers-reduced-motion: reduce) { .ds-pin, .ds-pinsh, .ds-card, .ds-coin1, .tt-coin, .tt-pig, .tt-arrow { animation: none; } .tt-arrow { stroke-dashoffset: 0; } }

/* ---------- O período dentro do painel do Início ---------- */
.lh-plus { order: 3; }
.lh-top:has(.top-icons) .lh-plus { margin-left: 0; }
@media (max-width: 420px) { .lh-top { gap: 8px; } .lh-top .top-icons { gap: 8px; } .lh-circle, .lh-top .top-icons .btn.icon { width: 40px; height: 40px; min-height: 40px; } }
.hero-ctl { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.hc-pill, .hc-glass { display: inline-flex; align-items: center; height: 36px; border-radius: 999px; color: #fff;
  background: rgba(255, 255, 255, .17); border: 1px solid rgba(255, 255, 255, .3); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.hc-pill button, .hc-glass { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.hc-glass { background: rgba(255, 255, 255, .17); border: 1px solid rgba(255, 255, 255, .3); }
.hc-step { width: 34px; height: 100%; font-size: 1.25rem; line-height: 1; padding: 0; }
.hc-label { font-weight: 600; font-size: .92rem; padding: 0 2px; height: 100%; }
.hc-label.solo { padding: 0 16px; }
.hc-now { padding: 0 14px; font-size: .85rem; font-weight: 600; }
.hc-opts { width: 36px; justify-content: center; padding: 0; position: relative; }
.hc-opts svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hc-opts #hfiltn { display: none; }
.hc-opts.on::after { content: ""; position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; border-radius: 50%; background: #ffc145; box-shadow: 0 0 0 2px rgba(0, 0, 0, .15); }
.hc-pill button:focus-visible, .hc-glass:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.hc-who { font-size: .8rem; font-weight: 600; opacity: .92; }
.hero-opts h3 { margin: 16px 0 6px; }
.hero-opts h2 + h3, .hero-opts h2 + p { margin-top: 4px; }
.hero-opts .ctl-range { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; }
.lh-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-ctl.hero-opts { display: block; margin: 0; }
.hero-opts .seg { flex-wrap: wrap; }
.hero-opts > .btn { width: 100%; }

/* ---------- Tela da despesa: o principal grande, o resto recolhido ---------- */
.ed-top { gap: 10px; }
.ed-top .ed-title { flex: 1; min-width: 0; margin: 0; font-size: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-top .actions { flex-wrap: nowrap; gap: 8px; }
.ed-top .btn.icon, .ed-items .btn.icon { display: inline-flex; align-items: center; justify-content: center; }
.ed-top .btn.icon svg, .ed-items .btn.icon svg, .r-rm svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ed-top .ed-back { border-radius: 50%; }
.ed-top .ed-del { color: var(--danger, #d64545); }
.ed-by { margin: -2px 0 10px; }
.ed-main { display: flex; flex-direction: column; gap: 12px; }
.ed-amount { display: flex; align-items: baseline; justify-content: center; gap: 6px; margin: 4px 0 0; cursor: text; }
.ed-amount .ed-cur { font-size: 1.3rem; font-weight: 600; color: var(--muted); }
.ed-amount input { width: 8.5ch; min-width: 0; font-size: 2.3rem; font-weight: 800; text-align: center; border: 0; border-bottom: 2px solid var(--border);
  border-radius: 0; background: none; padding: 0 2px 2px; min-height: 0; color: var(--ink); letter-spacing: -.5px; field-sizing: content; min-width: 4ch; max-width: 100%; }
.ed-amount input:focus { outline: none; border-bottom-color: var(--accent); }
.ed-store { margin: 0; }
.ed-store input { font-size: 1.1rem; font-weight: 600; text-align: center; }
.ed-when { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; justify-content: center; }
.ed-when .ed-day { padding: 0 12px; }
.ed-date { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); margin: 0; }
.ed-date svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.ed-date input { border: 0; background: none; min-height: 38px; padding: 4px 6px 4px 0; width: 8.6rem; min-width: 0; }
.ed-day, .flag { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--ink-2); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; margin: 0; }
.ed-day.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.ed-methods { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; flex-wrap: nowrap; border-radius: 14px; }
.ed-methods button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 6px; min-height: 58px; font-size: .74rem; min-width: 0; }
.ed-methods button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ed-methods button span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ed-credit { margin: 0; }
.ed-credit .field { margin: 0; }
.ed-main .schedule { margin: -4px 0 0; text-align: center; color: var(--muted); }
.ed-main .schedule:empty { display: none; }
.ed-flags { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-flags .flag { margin: 0; padding: 0 12px; border-style: dashed; font-weight: 500; }
.ed-flags .flag input { position: absolute; opacity: 0; pointer-events: none; }
.ed-flags .flag:has(input:checked) { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.ed-flags .flag:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.ed-flags .flag[hidden] { display: none; }
.ed-flag-txt { margin: -4px 0 0; }
.ed-flag-txt #f-done { margin-left: 6px; }
.rep-box { padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.ed-more { border-top: 1px solid var(--border); padding-top: 4px; }
.ed-more > summary { display: flex; align-items: baseline; gap: 8px; padding: 8px 0; cursor: pointer; list-style: none; }
.ed-more > summary::-webkit-details-marker { display: none; }
.ed-more > summary::before { content: "▸"; color: var(--muted); }
.ed-more[open] > summary::before { content: "▾"; }
.ed-more-t { font-weight: 600; white-space: nowrap; }
.ed-more #ed-more-sum { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ed-more[open] #ed-more-sum { display: none; }
.ed-more > .field:first-of-type { margin-top: 4px; }
.ed-items-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ed-items-head h2 { margin: 0; }
.ed-items-head .items-bar { margin: 0; flex-wrap: nowrap; }
.ed-items .btn.icon.small { width: 34px; min-height: 34px; }
.ed-bulk { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.ed-bulk[hidden] { display: none; }
.ed-bulk .chip-sel { max-width: none; }
.r-rm { background: none; border-color: transparent; color: var(--muted); }
.r-rm:hover { color: var(--danger, #d64545); }
.r-rm[hidden] { display: none; }
.ed-add { margin-top: 10px; }
.ed-sum { margin-top: 8px; }
.ed-sum:empty { display: none; }
.ed-save { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 5; margin-top: 12px; }
.ed-save .btn { width: 100%; min-height: 50px; font-size: 1.02rem; border-radius: 14px; gap: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.ed-save svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 900px) { .ed-save { bottom: 12px; max-width: 360px; margin-left: auto; } }
/* sugestões de apelido na tela da despesa: uma linha que rola de lado, sem a lista de endereços */
.ed-store .sug-box .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ed-store .sug-box .chips .sug { flex: none; }
.ed-store .sug-box > ul.sug-info { display: none; }
.ed-store .sug-tools { justify-content: center; }
/* itens na lista: quantidade estreita; a categoria fica com o espaço que sobra */
@media (max-width: 899px) {
  .ed-items .items.compact .r-qty { width: 42px; text-align: center; }
  .ed-items .r-unit.off { display: none; }
  .ed-items .items.compact .r-cat { max-width: none; flex: 1 1 auto; }
  .ed-items .chip-sel.r-mem { max-width: 96px; }
}
.ed-flags { gap: 6px; flex-wrap: nowrap; }
.ed-flags .flag { padding: 0 10px; font-size: .84rem; min-height: 36px; gap: 5px; white-space: nowrap; }

/* cartão e parcelas: duas etiquetas pequenas */
.ed-credit { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.ed-credit[hidden], .ed-credit .chip-sel[hidden] { display: none; }
.ed-chip { max-width: 60%; min-height: 36px; font-size: .86rem; padding: 4px 12px; gap: 6px; }
.ed-chip svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ed-chip::after { content: "▾"; color: var(--muted); font-size: .75rem; }
.ed-chip .chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-sort { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ed-sort svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cs-all { display: flex; align-items: center; gap: 10px; margin: 10px 2px 0; font-weight: 600; cursor: pointer; }

/* toques com vida: o ícone escolhido pula, a etiqueta ligada estala */
@keyframes ed-pop { 0% { transform: scale(1); } 40% { transform: scale(1.18) translateY(-2px); } 100% { transform: scale(1); } }
.ed-methods button.on svg, .ed-day.on, .ed-flags .flag:has(input:checked) > span { animation: ed-pop .32s ease-out; }
.ed-amount input:focus { animation: none; }

/* a comemoração ao salvar */
.cheer { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(0, 0, 0, .28); animation: ch-in .18s ease-out; }
.cheer.out { opacity: 0; transition: opacity .3s; }
.cheer-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 18px 26px 16px; border-radius: 22px; background: var(--surface); color: var(--ink);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .35); animation: ch-card .35s cubic-bezier(.2, 1.4, .4, 1); }
.cheer-card svg { width: 132px; height: 110px; overflow: visible; }
.cheer-card strong { font-size: 1.25rem; }
.cheer-card span { color: var(--muted); font-size: .9rem; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-note { animation: ch-note .45s .05s cubic-bezier(.5, 0, .7, 1) both; }
.ch-ok { transform-origin: 96px 30px; animation: ch-ok .35s .4s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes ch-in { from { opacity: 0; } }
@keyframes ch-card { from { transform: scale(.7); opacity: 0; } }
@keyframes ch-note { from { transform: translateY(-40px); } to { transform: translateY(26px); } }
@keyframes ch-ok { from { transform: scale(0); } }
@media (prefers-reduced-motion: reduce) { .ed-methods button.on svg, .ed-day.on, .ed-flags .flag > span { animation: none !important; } }
.ed-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.ed-foot .ed-add { margin: 0; }
.ed-foot .ed-bulk { margin: 0; }
.ed-sort.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }

/* ---------- O painel ilustrado no alto da despesa ---------- */
.ed-hero { padding-bottom: 18px; margin-bottom: 4px; }
.ed-hero .lh-top { gap: 10px; }
.ed-hero .lh-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-hero .lh-circle svg { width: 21px; height: 21px; }
.ed-hero .ed-del { color: #ffb8b8; }
.ed-hero .lh-top .top-icons { margin-left: 0; gap: 10px; }
@media (max-width: 420px) { .ed-hero .lh-circle, .ed-hero .lh-top .top-icons .btn.icon { width: 40px; height: 40px; min-height: 40px; } .ed-hero .lh-top, .ed-hero .lh-top .top-icons { gap: 7px; } }
.ed-hero-row { display: flex; align-items: center; gap: 6px; }
.ed-hero .ed-amount { flex: 1; min-width: 0; justify-content: flex-start; margin: 0; }
.ed-hero .ed-amount .ed-cur { color: #fff; opacity: .85; }
.ed-hero .ed-amount input { color: #fff; text-align: left; border-bottom-color: rgba(255, 255, 255, .45); text-shadow: 0 2px 10px rgba(5, 15, 40, .25); font-size: 2.6rem; }
.ed-hero .ed-amount input::placeholder { color: rgba(255, 255, 255, .6); }
.ed-hero .ed-amount input:focus { border-bottom-color: #fff; }
.ed-scene { flex: none; width: 150px; height: auto; overflow: visible; }
.ed-note { animation: ed-note 3.6s ease-in-out infinite; }
@keyframes ed-note { 0%, 100% { transform: translateY(-8px); } 50% { transform: translateY(4px); } }
.ed-coin { transform-box: fill-box; transform-origin: center; animation: ed-coin 4s ease-in-out infinite; }
@keyframes ed-coin { 0%, 100% { transform: translateY(0) rotateY(0); } 50% { transform: translateY(-6px) rotateY(180deg); } }
.ed-cardf { animation: lh-float 5s ease-in-out infinite -1.5s; }
@media (prefers-reduced-motion: reduce) { .ed-note, .ed-coin, .ed-cardf { animation: none; } }
.ed-hero-row { margin-top: 10px; }
.chip-sel.empty { padding: 4px 10px; text-align: left; }  /* não herda o espaço das telas vazias (.empty) */

/* Gastos e Tudo: os atalhos para as telas de dentro, em vidro, no pé do painel; os cartões Entrou e Saiu também abrem a tela */
.lh-links { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.lh-links .hc-glass { height: 34px; padding: 0 14px; font-size: .88rem; font-weight: 600; text-decoration: none; }
.lh-links .hc-glass:hover { background: rgba(255, 255, 255, .26); }
a.lh-stat-go { color: inherit; text-decoration: none; }
a.lh-stat-go > i { margin-left: auto; font-style: normal; font-size: 1.3rem; color: var(--muted); }
a.lh-stat-go:hover { border-color: var(--accent); }
/* Telas de dentro de Gastos e de Tudo: a seta de volta ao painel */
.area-tabs { max-width: 980px; margin: 0 auto; padding: 12px 16px 0; }
.area-tabs[hidden] { display: none; }
.area-back { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; text-decoration: none; }
.area-back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 900px) {
  #nav ~ #area-tabs { margin-left: max(226px, calc((100vw - 980px) / 2 + 105px)); }
  body.nav-mini #nav ~ #area-tabs { margin-left: max(76px, calc((100vw - 980px) / 2 + 38px)); }
}
a.lh-stat-go > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
/* Valores ocultos (olho): os campos de valor também ficam em bolinhas; ao tocar para editar, o número aparece */
html.hide-values input[inputmode="decimal"]:not(:focus):not([data-k="quantity"]) { -webkit-text-security: disc; text-security: disc; }

/* O olho flutuante: aparece no canto de cima ao rolar a tela, para esconder os valores a qualquer momento */
.eye-float { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 60; width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--ink);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25); backdrop-filter: blur(8px); cursor: pointer;
  opacity: 0; transform: scale(.7); pointer-events: none; transition: opacity .18s, transform .18s; }
.eye-float.on { opacity: 1; transform: none; pointer-events: auto; }
.eye-float[aria-pressed="true"] { color: var(--accent); }
.eye-float svg { width: 22px; height: 22px; }
body.app-locked .eye-float { display: none; }

/* O cabeçalho ilustrado de Entradas e Saídas: o céu do Início num cartão, com o título, a cena e as ações em vidro */
.pg-hero { margin: 0 0 12px; border-radius: 22px; padding: 14px 16px 14px; }
.pg-hero[data-kind="entradas"] { --sky1: #1f8a68; --sky2: #49b98c; }
.pg-hero[data-kind="saidas"] { --sky1: #2b5fb8; --sky2: #5a8fe0; }
:root[data-theme="dark"] .pg-hero[data-kind="entradas"] { --sky1: #14513f; --sky2: #23705a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pg-hero[data-kind="entradas"] { --sky1: #14513f; --sky2: #23705a; } }
.pg-row { display: flex; align-items: center; gap: 8px; }
.pg-text { flex: 1; min-width: 0; text-shadow: 0 2px 10px rgba(5, 15, 40, .25); }
.pg-text h1 { margin: 0; font-size: 1.9rem; line-height: 1.1; color: #fff; letter-spacing: -.02em; }
.pg-text p { margin: 6px 0 0; font-size: .86rem; line-height: 1.35; opacity: .92; }
.pg-scene { flex: none; width: 128px; height: auto; overflow: visible; }
.pg-act { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0; }
.pg-act .btn { height: 34px; min-height: 34px; padding: 0 14px; border-radius: 999px; font-size: .86rem; font-weight: 600; color: #fff; text-decoration: none;
  background: rgba(255, 255, 255, .17); border: 1px solid rgba(255, 255, 255, .3); box-shadow: none; }
.pg-act .btn:hover { background: rgba(255, 255, 255, .26); }
.pg-act .btn.primary { background: #fff; color: #17406e; border-color: #fff; }
.pg-hero[data-kind="entradas"] .pg-act .btn.primary { color: #136b4c; }
.pg-act .btn.icon { width: 34px; padding: 0; }
.pg-act .month-nav { display: inline-flex; align-items: center; gap: 6px; }
.pg-act .month-nav strong { color: #fff; }
.pg-arrow { animation: pg-bob 3.4s ease-in-out infinite; }
.pg-fall { animation: pg-fall 2.8s ease-in infinite; }
.pg-rise { animation: pg-rise 2.8s ease-out infinite; }
@keyframes pg-bob { 50% { transform: translateY(-4px); } }
@keyframes pg-fall { 0% { transform: translateY(-10px); opacity: 0; } 25% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(22px); opacity: 0; } }
@keyframes pg-rise { 0% { transform: translateY(18px); opacity: 0; } 25% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pg-arrow, .pg-fall, .pg-rise { animation: none; } }
@media (max-width: 420px) { .pg-scene { width: 104px; } .pg-text h1 { font-size: 1.6rem; } }
@media (min-width: 900px) { .pg-hero { padding: 18px 24px 18px; } .pg-scene { width: 150px; } }

/* Para onde foi o dinheiro: o nome da categoria ao lado da fatia */
.home-donut.lab { width: min(100%, 410px); }
.home-donut.lab svg { overflow: visible; }
.home-lab { font-size: 13.5px; font-weight: 600; fill: var(--ink); pointer-events: none; }
.home-lab-line { fill: none; stroke-width: 1.6; stroke-linecap: round; pointer-events: none; }

/* o seletor de período dentro do cabeçalho de Entradas e Saídas, como em Gastos */
.pg-hero .lh-top { margin-bottom: 8px; }
.pg-title h1 { margin: 0; font-size: 1.8rem; line-height: 1.1; color: #fff; letter-spacing: -.02em; text-shadow: 0 2px 10px rgba(5, 15, 40, .25); }
.pg-hero .hero-ctl { position: relative; z-index: 1; margin: 0 0 4px; }
.pg-hero .pg-text p { margin: 0; }
@media (max-width: 420px) { .pg-title h1 { font-size: 1.55rem; } }

/* A faixa fixa do período: aparece ao rolar, quando o seletor do cabeçalho sai de vista */
.ctl-float { position: fixed; top: 0; left: 0; z-index: 55; padding: calc(10px + env(safe-area-inset-top)) 64px 10px 16px; color: #fff;
  background: linear-gradient(120deg, var(--sky1, #2a78d6), var(--sky2, #5aa2f0)); box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  border-radius: 0 0 18px 18px; transform: translateY(-110%); transition: transform .2s; pointer-events: none; }
.ctl-float.on { transform: none; pointer-events: auto; }
.ctl-float .hero-ctl { margin: 0; flex-wrap: nowrap; }
.ctl-float .hc-who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
body.app-locked .ctl-float { display: none; }
/* com a faixa, o olho flutuante fica sem a borda e o fundo próprios, sobre ela */
body.ctl-float-on .eye-float { background: rgba(10, 20, 45, .45); color: #fff; border-color: rgba(255, 255, 255, .3); box-shadow: none; top: calc(6px + env(safe-area-inset-top)); }

body.ctl-float-on .eye-float { right: auto; }

.pg-hero[data-kind="conferir"] { --sky1: #4b3fb0; --sky2: #7f6fe6; }
:root[data-theme="dark"] .pg-hero[data-kind="conferir"] { --sky1: #2f2775; --sky2: #4a3f9e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pg-hero[data-kind="conferir"] { --sky1: #2f2775; --sky2: #4a3f9e; } }

/* Arquivos de origem: Reler e SEFAZ ficam na própria linha, como ícones */
.src-files > summary { display: flex; align-items: center; gap: 8px; }
.src-files > summary::-webkit-details-marker { display: none; }
.src-files > summary::before { content: "▸"; display: inline-block; transition: transform .15s; }
.src-files[open] > summary::before { transform: rotate(90deg); }
.src-files > summary .grow { flex: 1; min-width: 0; }
.src-btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--accent); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.src-btn svg { width: 18px; height: 18px; }
.src-btn:disabled { opacity: .5; }

/* excluir um arquivo da despesa (lixeira no fim da linha) e as cópias repetidas */
.src-del { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--bad); cursor: pointer; }
.src-del svg { width: 18px; height: 18px; }
.src-btn.warn { color: var(--bad); }
.src-files .fl-list .actions { display: flex; align-items: center; gap: 8px; width: 100%; }

/* ---------- O painel: cartões de bater o olho (Saídas, Entradas, Início) ---------- */
.dash { display: grid; gap: 12px; margin-top: 12px; }
.dash > .card, .dash-grid > * { margin: 0; }
.dash-say { padding: 14px 16px; border-left: 5px solid var(--good); }
.dash-say p { margin: 0; font-size: 1.02rem; line-height: 1.45; }
.dash-say.mood-warn { border-left-color: var(--warn); }
.dash-say.mood-over { border-left-color: var(--bad); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 899px) { .dash-grid > :last-child:nth-child(odd) { grid-column: span 2; } }
@media (min-width: 900px) { .dash-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }
.dash-tile { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; color: inherit; text-decoration: none; min-width: 0; }
a.dash-tile:hover { border-color: var(--accent); }
.dt-head { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.dt-head svg { width: 17px; height: 17px; flex: none; }
.dt-say { margin: 2px 0 0; font-weight: 600; font-size: .95rem; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dt-big { font-size: 1.6rem; font-weight: 700; line-height: 1.15; margin-top: 2px; }
.dt-viz { margin-top: auto; padding-top: 6px; display: grid; gap: 4px; }
.mini-bars { display: flex; align-items: flex-end; gap: 4px; height: 38px; }
.mini-bars span { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.mini-bars i { display: block; width: 100%; border-radius: 4px 4px 2px 2px; background: color-mix(in srgb, var(--accent) 40%, var(--grid)); }
.split-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; }
.split-bar i { display: block; height: 100%; }
.split-leg { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .74rem; color: var(--muted); }
.split-leg span { display: inline-flex; align-items: center; gap: 4px; }
.split-leg b, .arc-legend b { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.share-bar { height: 10px; border-radius: 6px; background: var(--grid); overflow: hidden; }
.share-bar i { display: block; height: 100%; border-radius: 6px; }
.dash-arc > svg { width: 100%; max-width: 380px; display: block; margin: 6px auto 0; }
.arc-legend { display: grid; gap: 4px; font-size: .85rem; margin-top: 6px; }
.arc-legend > span { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.arc-legend b.sun { background: #f7b51e; }
.dash-lims .card-head { margin-bottom: 6px; }
.lim-row { padding: 8px 0; border-top: 1px solid var(--border); }
.lim-row:first-of-type { border-top: 0; }
.lim-top { display: flex; gap: 8px; align-items: baseline; font-weight: 600; }
.lim-top .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lim-w { font-size: .82rem; white-space: nowrap; }
.lim-w.ok { color: var(--good); } .lim-w.warn { color: var(--warn); } .lim-w.over { color: var(--bad); }
.lim-track { position: relative; height: 8px; border-radius: 6px; margin: 8px 0 4px;
  background: linear-gradient(90deg, #1baf7a 0%, #8fcf4a 40%, #f2c230 58%, #f08a24 66.7%, #e34948 80%, #b0234a 100%); }
.lim-track .lim-100 { position: absolute; left: 66.67%; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: .45; border-radius: 1px; }
.lim-track b { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--ink); transform: translate(-50%, -50%); box-sizing: border-box; }
.dash-days { overflow: hidden; }
.dd-scroll { overflow-x: auto; margin: 8px -14px 0; padding: 0 14px 4px; scrollbar-width: thin; }
.dd-inner { position: relative; }
.dd-cols { display: flex; }
.dd-col { width: 54px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .78rem; color: var(--muted); }
.dd-col .dd-n { font-weight: 700; color: var(--ink); font-size: .95rem; }
.dd-col.now .dd-wd, .dd-col.now .dd-n { color: var(--accent); }
.dd-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 2px; }
.dd-line { display: block; overflow: visible; }
.dd-v { font-size: 11px; fill: var(--ink); font-weight: 600; }
.dn-list { list-style: none; margin: 6px 0 0; padding: 0; }
.dn-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.dn-list li:first-child { border-top: 0; }
.dn-list .dn-day { width: 70px; flex: none; font-size: .85rem; font-weight: 600; text-transform: capitalize; }
.dn-list .dn-ico { width: 22px; height: 22px; color: var(--accent); flex: none; }
.dn-list .dn-ico.in { color: var(--good); }
.dn-list .dn-ico svg { width: 100%; height: 100%; }
.dn-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.dn-list li.late .dn-day, .dn-list li.late .dn-ico { color: var(--bad); }
.dn-list li.soft { color: var(--muted); }
.dash-months .dm-bars { display: flex; gap: 8px; height: 120px; align-items: stretch; margin: 10px 0 6px; }
.dm-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .75rem; color: var(--muted); }
.dm-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.dm-pair i { display: block; width: 40%; max-width: 18px; border-radius: 4px 4px 1px 1px; min-height: 2px; }
.dm-pair i.in { background: #1baf7a; } .dm-pair i.out { background: #e34948; }
.dash-fresh { text-align: center; margin: 4px 0 0; }
.home-card > .card { margin: 0; padding: 0; border: 0; box-shadow: none; background: none; }
#hfresh .dash-fresh { margin-top: 14px; }
/* o céu do cabeçalho segue o mês: limpo quando vai bem, entardecer na atenção, carregado quando passou */
.pg-hero[data-mood="warn"] { --sky1: #b8611c; --sky2: #e9a23b; }
.pg-hero[data-mood="over"] { --sky1: #4a4f63; --sky2: #7d6a7e; }
:root[data-theme="dark"] .pg-hero[data-mood="warn"] { --sky1: #6b3a12; --sky2: #8f5a1f; }
:root[data-theme="dark"] .pg-hero[data-mood="over"] { --sky1: #2b2e3a; --sky2: #47394a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pg-hero[data-mood="warn"] { --sky1: #6b3a12; --sky2: #8f5a1f; }
  :root:not([data-theme="light"]) .pg-hero[data-mood="over"] { --sky1: #2b2e3a; --sky2: #47394a; }
}

.keep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 10px 0 14px; max-height: 60vh; overflow: auto; }
.keep-ph { display: grid; gap: 4px; border: 2px solid var(--border); border-radius: 12px; padding: 6px; cursor: pointer; position: relative; }
.keep-ph input { position: absolute; top: 10px; left: 10px; width: 20px; height: 20px; accent-color: var(--accent); }
.keep-ph img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; background: var(--grid); }
.keep-ph:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ver a foto da nota: cabe na tela; com zoom, rola para os lados */
dialog.img-view { width: min(100vw, 1100px); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: auto; padding: 0; border-radius: 0; display: flex; flex-direction: column; background: var(--page); }
@media (min-width: 900px) { dialog.img-view { height: 92dvh; border-radius: 16px; } }
dialog.img-view .iv-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; padding-right: 56px; border-bottom: 1px solid var(--border); }
dialog.img-view .iv-bar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.img-view .iv-wrap { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; background: #111; }
dialog.img-view .iv-wrap.zoomed { display: block; }
dialog.img-view .iv-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; touch-action: manipulation; cursor: zoom-in; }
dialog.img-view .iv-wrap.zoomed img { cursor: zoom-out; }
dialog.img-view > .dlg-x { position: absolute; top: 8px; right: 10px; margin: 0; float: none; }
dialog.img-view { overflow: hidden; }
dialog.img-view .iv-wrap { width: 100%; min-width: 0; }
dialog.img-view .iv-bar { flex: none; min-width: 0; }

/* Painéis do Início: o menu ⋯ (subir, descer, recolher, esconder); tocar no título recolhe */
.hp-more { font-size: 1.25rem; letter-spacing: 1px; color: var(--ink-3, var(--ink-2)); }
.hp-pop { min-width: 190px; font-size: .95rem; text-transform: none; letter-spacing: normal; }
.hp-pop[hidden] { display: none; }
.hp-head { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hp-head a, .hp-head button, .hp-head select, .hp-head input { cursor: pointer; }
/* o ⋯ fica no canto de cima, na linha do nome, mesmo quando os botões do título descem para a linha de baixo */
.hp-head { position: relative; padding-right: 36px; }
.hp-head > .hp-tools { position: absolute; top: 50%; right: 0; margin: 0 !important; transform: translateY(-50%); }
.card-head.hp-head:has(> :nth-child(2):not(.hp-tools)) > .hp-tools { top: 0; transform: none; }
.hp-head > .hp-tools { z-index: 6; }
.home-card > .dash-days, .home-card > .dash-next { overflow: visible; }

/* nota da SEFAZ sem os produtos: fotografar a nota traz os itens */
.ed-photo-hint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); }
.ed-photo-hint > span { display: inline-flex; flex: none; }
.ed-photo-hint > span svg { width: 24px; height: 24px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ed-photo-hint p { flex: 1 1 180px; margin: 0; }

/* Gastos por dia: os dias que vêm, com o previsto */
.dd-col.ahead .dd-wd, .dd-col.ahead .dd-n { opacity: .55; }
.dd-col.ahead .dd-dot { background: none; border: 1.5px dashed var(--grid); box-sizing: border-box; }
.dd-v.ahead { opacity: .6; font-style: italic; }
.dd-legend { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; }
.dd-dash { width: 18px; height: 0; border-top: 2px dashed var(--accent); opacity: .6; flex: none; }

/* Gastos por dia: cada dia abre a lista dele */
.dd-col[data-dd] { cursor: pointer; border-radius: 10px; -webkit-tap-highlight-color: transparent; }
.dd-col[data-dd]:hover, .dd-col[data-dd]:focus-visible { background: var(--surface-2); outline: none; }
.dd-list { list-style: none; margin: 0; padding: 0; }
.dd-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.dd-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dl-ico { display: inline-flex; flex: none; color: var(--accent); }
.dl-ico svg { width: 18px; height: 18px; }
.dd-tot { display: flex; justify-content: space-between; margin: 10px 0 0; }

/* Arquivos de origem: fotografar a nota de novo */
.src-add { padding: 10px 0 2px; }
.src-add .src-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Início no computador: painel de quadros (12 colunas; a altura de cada quadro vira linhas de 8px) */
.dash-only, .dash-only-big, .dash-rs { display: none; }
@media (min-width: 1100px) and (hover: hover) and (pointer: fine) { .dash-only-big { display: inline; } }
@media (min-width: 1100px) {
body.dash main { padding-left: 24px; padding-right: 24px; }
body.dash .dash-only { display: block; }
body.dash #hpanels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 8px; column-gap: 18px; row-gap: 0; grid-auto-flow: row dense; align-items: start; }
body.dash #hpanels > .home-card { grid-column: span var(--w, 6); grid-row: span var(--rows, 30); margin: 0; min-width: 0; position: relative; height: var(--h, auto); }
body.dash #hpanels > .home-card.dash-fixed { overflow: auto; }
body.dash #hpanels > .home-card.folded { height: auto; overflow: visible; }
body.dash #hpanels > .home-card .hp-head { cursor: grab; }
body.dash-dragging, body.dash-dragging * { cursor: grabbing !important; user-select: none; }
body.dash #hpanels > .home-card.dash-moving { opacity: .55; outline: 2px dashed var(--accent); outline-offset: 2px; }
body.dash #hpanels > .home-card.dash-sizing { outline: 2px solid var(--accent); outline-offset: 2px; user-select: none; }
body.dash .dash-rs { display: block; position: absolute; right: 3px; bottom: 3px; width: 18px; height: 18px; cursor: nwse-resize; opacity: 0; transition: opacity .15s;
  background: linear-gradient(135deg, transparent 50%, var(--muted) 50%, var(--muted) 60%, transparent 60%, transparent 72%, var(--muted) 72%, var(--muted) 82%, transparent 82%); z-index: 5; }
body.dash #hpanels > .home-card:hover .dash-rs, body.dash .dash-sizing .dash-rs { opacity: .8; }
body.dash #hpanels > .home-card.folded .dash-rs { display: none; }
body.dash .lhero { position: relative; }
body.dash .lh-scene { position: absolute; right: 48px; top: 50%; transform: translateY(-50%); width: 300px; max-width: 30%; margin: 0; }
}

/* Prévia da fatura */
.ft-mini { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; padding: 8px 0; }
.ft-mini + .ft-mini { border-top: 1px solid var(--border); }
.ft-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.ft-name svg, .ft-card h2 svg, .ft-d svg { width: 18px; height: 18px; vertical-align: -3px; color: var(--accent); }
.ft-big { display: block; font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.ft-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 10px 0 6px; }
.ft-bar span { display: block; height: 100%; }
.ft-p { background: #7a5af0; }
.ft-n { background: #2a78d6; }
.ft-e { background: repeating-linear-gradient(135deg, #e0a100 0 4px, transparent 4px 7px); box-shadow: inset 0 0 0 1.5px #e0a100; }
.ft-leg { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.ft-leg li { display: flex; align-items: center; gap: 6px; }
.ft-leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ft-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ft-top > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.ft-hist { display: flex; align-items: flex-end; gap: 8px; }
.ft-col { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 34px; }
.ft-stack { display: flex; flex-direction: column; justify-content: flex-start; width: 18px; border-radius: 4px 4px 0 0; background: var(--grid); overflow: hidden; }
.ft-col.now .ft-stack { background: var(--accent); }
.ft-stack .ft-e { display: block; width: 100%; }
.ft-v { font-size: .7rem; color: var(--muted); }
.ft-sec { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.ft-sec h3 { font-size: .98rem; margin: 0 0 6px; }
.ft-sec details + details { margin-top: 8px; }
.ft-sec summary { cursor: pointer; padding: 4px 0; }
.ft-list { list-style: none; margin: 6px 0 0; padding: 0; }
.ft-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ft-list li:last-child { border-bottom: 0; }
.ft-list .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; text-overflow: ellipsis; }
.ft-d { flex: none; width: 42px; color: var(--muted); font-size: .85rem; }
.ft-ok { color: #1baf7a; font-weight: 700; }
.warn-t { margin: 0 0 6px; }
.ft-after { margin: -8px 4px 22px; }

/* Lançar de várias importações: Ignorar ao lado do Lançar */
.sg-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Orçamento: a categoria abre a janela dela; o gráfico do orçamento no Início */
.bud-click { cursor: pointer; border-radius: 10px; }
.bud-click:hover { background: var(--surface-2, rgba(0,0,0,.03)); }
.bud-click:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bc-list a { display: flex; flex-direction: column; min-width: 0; }
#hbudchart select { max-width: 55%; }
/* Fatura: a seguinte, em uma linha */
.ft-mini.ft-more { padding-top: 8px; }
.ft-mini .ft-mid { font-weight: 700; font-size: 1.1rem; }
/* Quadros do alto: escolher quais, trocar por dia/semana/mês pelo ícone */
.lh-stats-cfg { position: absolute; right: 4px; bottom: -20px; font-size: .78rem; color: var(--muted); }
.lh-ico-btn { border: 0; cursor: pointer; padding: 0; transition: transform .15s; }
.lh-ico-btn:hover { transform: scale(1.08); }
.lh-stat { position: relative; }
.hs-opts { display: grid; gap: 8px; margin: 8px 0 14px; }
body.dash .lh-stats[data-hstats] { grid-template-columns: repeat(12, minmax(0, 1fr)); }
body.dash .lh-stats[data-hstats] > .lh-stat { grid-column: span var(--w, 6); }
body.dash .lh-stat:hover .dash-rs, body.dash .lh-stat.dash-sizing .dash-rs { opacity: .8; }
body.dash .lh-stat.dash-sizing { outline: 2px solid var(--accent); outline-offset: 2px; user-select: none; }

/* redimensionar sem trancos: o quadro fica por cima enquanto arrasta */
body.dash #hpanels > .home-card.dash-sizing, body.dash .lh-stat.dash-sizing { z-index: 20; box-shadow: 0 12px 32px rgba(0,0,0,.18); transition: none; }

/* quadros do alto: título em cima do valor, mesmo com a alça de largura no fim; o botão de escolher numa linha própria */
.lh-stat > .lh-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lh-stat .lh-txt strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lh-stats > .lh-stats-cfg { position: static; grid-column: 1 / -1; justify-self: end; margin: -6px 4px 0; padding: 2px 4px; background: none; border: 0; cursor: pointer; text-decoration: underline; }
@media (hover: none) { .lh-stat .dash-rs { display: none; } }
@media (max-width: 600px) {
  .lh-stat { padding: 12px; gap: 10px; }
  .lh-stat .lh-ico { flex: none; }
  .lh-stat .lh-txt strong { white-space: normal; overflow-wrap: anywhere; font-size: .95rem; }
}

/* pedidos online: a linha "Todos os produtos", que põe uma categoria só em todos */
.amz-items li.amz-all { border-bottom: 1px dashed var(--border); padding-bottom: 8px; margin-bottom: 4px; }

/* ---- Compras online (#/extensao) ---- */
.ext-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); }
.ext-hero-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ext-hero-ico svg { width: 30px; height: 30px; }
.ext-hero-txt { flex: 1; min-width: 200px; }
.ext-hero-txt h2 { margin: 0 0 2px; }
.ext-hero-txt p { margin: 0; }
.ext-hero-btns .btn, .ext-loja-btns .btn, .ext-tile .hub-n { display: inline-flex; align-items: center; gap: 6px; }
.ext-hero-btns svg, .ext-loja-btns svg, [data-ext-copy] svg { width: 16px; height: 16px; }
.ext-page svg, .ext-hero svg, .ext-steps svg, .ext-list svg, .ext-h svg, .ext-loja svg, .ext-note svg, .ext-tile svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ext-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.ext-grid .card { margin: 0; }
.ext-h { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin: 0 0 10px; }
.ext-h svg { width: 20px; height: 20px; color: var(--accent); }
.ext-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ext-step { display: flex; gap: 12px; align-items: flex-start; }
.ext-step p { margin: 2px 0 0; }
.ext-step-ico { position: relative; width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ext-step-ico svg { width: 20px; height: 20px; }
.ext-step-ico b { position: absolute; right: -5px; top: -5px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--accent); color: #fff; font-size: .68rem; display: flex; align-items: center; justify-content: center; }
.ext-step code { background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; }
[data-ext-copy] { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.ext-sec { font-size: 1.05rem; margin: 22px 0 10px; }
.ext-lojas { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.ext-lojas .card { margin: 0; display: flex; flex-direction: column; }
.ext-loja-head { display: flex; align-items: center; gap: 12px; }
.ext-loja-head > div { display: flex; flex-direction: column; }
.ext-logo { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1rem; flex: none; }
.ext-amazon .ext-logo { background: #232f3e; color: #ff9900; font-size: 1.4rem; }
.ext-mercadolivre .ext-logo { background: #ffe600; color: #2d3277; }
.ext-ifood .ext-logo { background: #ea1d2c; color: #fff; }
.ext-pend { color: var(--accent); font-weight: 600; }
.ext-loja > p { flex: 1; margin: 10px 0 12px; }
.ext-loja-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ext-priv { margin-top: 14px; }
.ext-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ext-list li { display: flex; gap: 8px; align-items: flex-start; }
.ext-list svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--ok, #1a9a5a); }
.ext-list li:nth-last-child(-n+2) svg { color: var(--muted); }
.ext-note { display: flex; gap: 10px; align-items: center; }
.ext-note svg { width: 22px; height: 22px; flex: none; color: var(--accent); }
.ext-tile .hub-n svg { width: 26px; height: 26px; color: var(--accent); }

/* pedidos online: vincular a uma despesa já lançada, pela busca */
[data-ls-range] { margin: 8px 0; }
.ls-same { display: flex; gap: 6px; align-items: center; margin: 4px 0 8px; }
.ls-list { max-height: 50vh; overflow: auto; margin: 0; }
.ls-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ls-row .grow { flex: 1; min-width: 0; }
.ls-keep { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 8px 10px; background: var(--accent-soft); border-radius: 8px; }

/* contas do mês: os cartões "A pagar" acompanham o tamanho do calendário (cerca de 2 dias e meio de largura), sem crescer quando ele é reduzido */
.hs.hs-bills { gap: 8px; padding: 4px 2px 8px; }
.hs-bills .hs-card { flex: 0 0 clamp(118px, 36%, 180px); min-height: 0; gap: 2px; padding: 8px 10px; border-radius: 10px; }
.hs-bills .hs-k { font-size: .62rem; }
.hs-bills .hs-t { font-size: .82rem; }
.hs-bills .hs-v { margin-top: 2px; font-size: .95rem; }
.hs-bills .hs-card .btn { margin-top: 4px; padding: 3px 10px; min-height: 0; font-size: .75rem; }

/* pedidos online: filtro dos pedidos em aberto com e sem aviso */
.card.amz-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; }

/* orçamento: ajustar o limite da categoria ali mesmo, e o quadro que pisca ao receber a categoria tocada */
.bud-adj { margin: 10px 0 4px; display: grid; gap: 4px; }
.bud-adj-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bud-adj-row input { width: 110px; flex: none; }
.bud-desp { margin-top: 10px; }
.bud-desp summary { cursor: pointer; padding: 4px 0; }
@keyframes cardFlash { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 0 transparent; } }
.card.flash { animation: cardFlash 1.4s ease-out; }
#hbudchart { scroll-margin-top: 70px; }

/* Quadro com altura escolhida (painel ajustável) e espaço sobrando: o gráfico de rosca cresce para ocupar a altura
   e o que ainda sobra fica repartido entre total, gráfico, frase e lista */
body.dash #hpanels > #hspend.dash-fixed { display: flex; flex-direction: column; }
body.dash #hspend.dash-fixed > #hbody { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: space-evenly; }
body.dash #hspend.dash-fixed > #hbody > * { flex: none; }
body.dash #hspend.dash-fixed #hbody > .home-donut { flex: 1 1 auto; min-height: 180px; max-height: 440px; width: 100%; max-width: 560px; margin: 0 auto; container-type: size; }
body.dash #hspend.dash-fixed #hbody > .home-donut svg { width: 100%; height: 100%; }
body.dash #hspend.dash-fixed #hbody > .home-donut .home-center strong { font-size: clamp(1.3rem, 7.5cqmin, 2.1rem); }

/* Contas do mês com altura escolhida e espaço sobrando: o espaço fica acima e abaixo do calendário, não todo no pé do quadro */
body.dash #hpanels > #hbills.dash-fixed { display: flex; flex-direction: column; }
body.dash #hpanels > #hbills.dash-fixed > * { flex: none; }
body.dash #hpanels > #hbills.dash-fixed > .cal { margin-top: auto; margin-bottom: auto; }

/* ⓘ ao lado do título: a explicação do quadro aparece ao passar o mouse ou tocar */
.info-i { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; margin-left: 4px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: help; vertical-align: middle; }
.info-i:hover, .info-i:focus-visible { color: var(--accent); background: var(--accent-soft); }

/* Próximos dias: a última linha leva a todas as próximas */
.dn-list li.dn-all { justify-content: center; padding: 8px 0 2px; }
.dn-list li.dn-all a { font-weight: 600; font-size: .9rem; }

/* Arquivos de origem: o ícone e o texto numa linha, os botões logo abaixo (no computador o texto não fica espremido) */
.src-files .fl-list li { flex-wrap: wrap; }
.src-files .fl-list li > .grow { flex: 1 1 0; min-width: 0; }
.src-files .fl-list li > .actions { padding-left: 44px; }
@media (max-width: 640px) { .src-files .fl-list li > .actions { padding-left: 0; } }

/* Início: Pesquisar despesas, Painel de gastos e Gastos por trilha */
#hsearch .tr-q { width: 100%; margin: 8px 0 0; }
.hs-list .ft-d { display: inline-flex; flex-direction: column; line-height: 1.15; }
.hs-list .hs-y { font-size: .7rem; color: var(--muted); }
.hp-say { margin: 0; padding-left: 12px; border-left: 5px solid var(--good); font-size: 1.02rem; line-height: 1.45; }
.hp-say.mood-warn { border-left-color: var(--warn); }
.hp-say.mood-over { border-left-color: var(--bad); }
/* os blocos do Painel viram quadros do Início: o quadro é o cartão */
.home-card > .dash-tile { border: 0; padding: 0; background: none; border-radius: 0; height: 100%; }
.home-card > .dash-tile .dt-big { font-size: 1.6rem; }
#htrail .tr-crumbs { margin-top: 6px; }

/* no celular, os quatro quadros pequenos do Painel ficam dois a dois */
body:not(.dash) #hpanels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 12px; }
body:not(.dash) #hpanels > * { grid-column: 1 / -1; min-width: 0; }
body:not(.dash) #hpanels > .hp-mini { grid-column: auto; padding: 12px; }
body:not(.dash) .hp-mini .dt-big { font-size: 1.2rem; }
body:not(.dash) .hp-mini .dt-say { font-size: .85rem; }
body:not(.dash) .hp-mini .dt-head { flex-wrap: nowrap; white-space: nowrap; font-size: .72rem; min-width: 0; }
body:not(.dash) .hp-mini .dt-head span { overflow: hidden; text-overflow: ellipsis; }

/* Falar ou digitar: Lançar largo e, embaixo, os outros caminhos em botões com ícone */
.say-go { width: 100%; margin-top: 4px; min-height: 48px; font-size: 1.05rem; }
.say-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; color: var(--muted); font-size: .85rem; }
.say-or::before, .say-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.say-alt { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.say-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 8px; min-height: 84px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; }
.say-tile:hover, .say-tile:focus-visible { border-color: var(--accent); }
.say-tile svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Lançar a nota pela chave: resumo curto e opções grandes, empilhadas */
.kf-sum { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.kf-name { font-size: 1.1rem; }
.kf-more { margin: 8px 0 4px; }
.kf-more summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.k-opts { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.k-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; text-align: left; font: inherit; color: var(--ink);
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; }
.k-opt .grow { display: flex; flex-direction: column; }
.k-opt .small { color: var(--muted); }
.k-opt.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.k-opt.on .small { color: var(--accent-ink); opacity: .85; }
.k-ico { font-size: 1.4rem; width: 28px; text-align: center; }
/* despesa nova lida de uma foto: refazer a leitura */
.ed-redo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.ed-redo .btn { display: inline-flex; align-items: center; gap: 6px; }
.ed-redo svg { width: 16px; height: 16px; }
/* O que usar desta foto: cada informação lida com a sua caixa; os itens: trocar, acrescentar ou não usar */
.rd-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); cursor: pointer; }
.rd-row input { width: 20px; height: 20px; flex: none; }
.rd-items { margin: 10px 0 4px; }
.rd-items ul { margin: 6px 0 10px; padding-left: 18px; max-height: 30vh; overflow: auto; }

/* desconto do item: um selo % no canto do valor; tocar abre preço - desconto = pago */
.r-valw { position: relative; display: block; min-width: 0; }
.r-valw .r-val { width: 100%; }
.r-disc { position: absolute; top: -7px; left: -7px; width: 22px; height: 22px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid var(--surface); background: var(--good, #1a8a4a); color: #fff; font: 800 .72rem/1 system-ui, sans-serif; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.r-disc.on { outline: 2px solid var(--good, #1a8a4a); outline-offset: 1px; }
.r-disc.static { position: static; width: 18px; height: 18px; border: 0; font-size: .65rem; vertical-align: -3px; cursor: default; }
.r-disc-sum { white-space: nowrap; }
.r-dpanel { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px 10px; margin-top: 2px; border-radius: 10px; background: var(--good-bg, var(--surface-2)); font-size: .88rem; }
.r-dpanel label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.r-dpanel input { width: 84px; min-height: 32px; padding: 4px 8px; }
.r-dpanel [data-undisc] { margin-left: auto; }
@media (min-width: 720px) { .items.compact .r-valw { order: 1; } }
/* editando o desconto com o teclado aberto: espaço embaixo para o painel poder subir acima do teclado e do Salvar */
#items:has(.r-dpanel input:focus) { margin-bottom: 50vh; }

/* janela do desconto de cada item */
.disc-many-l { display: block; margin-top: 4px; }
.dm-list { display: flex; flex-direction: column; max-height: 55vh; overflow: auto; }
.dm-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.dm-row .grow { min-width: 0; overflow-wrap: anywhere; }
.dm-in { display: inline-flex; align-items: center; gap: 4px; margin: 0; flex: none; }
.dm-in input { width: 84px; min-height: 36px; padding: 4px 8px; }
