/* =====================================================================
   MeaRatio — estilos
   Cores da marca: Preto Ratio (#111111) como cor principal e Branco como secundária,
   tal como o logótipo. No tema escuro invertem-se. Tema claro/escuro.
   Mobile primeiro. Contraste AA, foco sempre visível, respeita "menos movimento".
   ===================================================================== */

:root {
  color-scheme: light;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #ececef;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #111111;
  --text-2: #3f3f46;
  --muted: #6b6b74;
  --accent: #111111;          /* Preto Ratio */
  --accent-hover: #3f3f46;    /* Grafite */
  --accent-soft: #ececef;
  --accent-text: #111111;
  --on-accent: #ffffff;       /* Branco */
  --good: #047857;
  --good-soft: #e8f8f1;
  --warn: #a35200;
  --warn-soft: #fff6e5;
  --bad: #be123c;
  --bad-soft: #fff0f2;
  --hero-bg: #111111;
  --hero-text: #ffffff;
  --hero-muted: #a1a1aa;
  --hero-track: rgba(255, 255, 255, .14);
  --ring: 0 0 0 3px rgba(17, 17, 17, .28);
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .05);
  --shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 2px 8px rgba(24, 24, 27, .04);
  --shadow-lg: 0 20px 50px rgba(24, 24, 27, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --font: Inter, "Inter var", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --bottomnav: 64px;
  --sidebar: 248px;
  --fs: 15px;
  /* Gráficos — paleta categórica validada (daltonismo e contraste) para o tema claro */
  --s1: #111111;   /* Preto Ratio */
  --s2: #f47230;   /* laranja */
  --s3: #2563eb;   /* azul */
  --s4: #f2a600;   /* amarelo */
  --cx-grid: #ececef;
  --cx-axis: #c4c4cc;
  --cx-band: rgba(24, 24, 27, .045);
  /* papéis */
  /* Grupos: paleta «Ardósia» — preto da marca e tons suaves */
  --c-needs: #111111;    /* Preto Ratio */
  --c-debt: #5b7083;     /* azul-ardósia */
  --c-savings: #9caf88;  /* verde-musgo */
  --c-wants: #e2c77e;    /* mostarda pálida */
  /* Moeda e ponto do símbolo: preto por defeito, verde com tudo distribuído, vermelho de aviso acima da receita */
  --mark: var(--text);
  --mark-full: #00c853;
  --mark-over: #ff1744;
  /* Verde e vermelho claros (mesmo tom) para ícones e selos */
  --pos-soft: #8bff8a;
  --pos-ink: #0b3d12;
  --neg-soft: #ff8a8a;
  --neg-ink: #4a0b0b;    /* moeda e ponto do símbolo: tudo sob controlo */
  --c-free: #ececef;   /* por distribuir: parte vazia da barra */
  --c-income: var(--s3);
  --c-planned: var(--s1);
  --c-none: #a1a1aa;   /* Cinza: sem categoria */
  --c-none-fill: repeating-linear-gradient(135deg, #85858e 0 2px, #dcdce0 2px 4px);
  --c-actual: var(--s2);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0f;
  --surface: #141418;
  --surface-2: #1b1b21;
  --surface-3: #24242c;
  --border: #2a2a33;
  --border-strong: #3a3a45;
  --text: #f4f4f5;
  --text-2: #d4d4d8;
  --muted: #a1a1aa;
  --accent: #ffffff;          /* Branco */
  --accent-hover: #e4e4e7;
  --accent-soft: rgba(255, 255, 255, .1);
  --accent-text: #ffffff;
  --on-accent: #111111;       /* Preto Ratio */
  --good: #34d399;
  --good-soft: rgba(52, 211, 153, .12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .12);
  --bad: #fb7185;
  --bad-soft: rgba(251, 113, 133, .12);
  --hero-bg: #1b1b21;
  --hero-text: #ffffff;
  --hero-muted: #a1a1aa;
  --hero-track: rgba(255, 255, 255, .16);
  --ring: 0 0 0 3px rgba(255, 255, 255, .4);
  --shadow-sm: none;
  --shadow: 0 0 0 1px rgba(255, 255, 255, .03);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  /* Gráficos — mesmos tons, ajustados para o fundo escuro */
  --s1: #f4f4f5;
  --c-none: #71717a;
  --c-none-fill: repeating-linear-gradient(135deg, #8a8a93 0 2px, #2e2e36 2px 4px);
  --c-needs: #f4f4f5;
  --c-debt: #8fa3b8;
  --c-savings: #a9bc96;
  --c-wants: #e8cf8a;
  --mark-full: #22e37a;
  --mark-over: #ff4d6d;
  --c-free: #24242c;
  --s2: #e8603c;
  --s3: #5c7cfa;
  --s4: #f2b705;
  --cx-grid: #24242c;
  --cx-axis: #3d3d48;
  --cx-band: rgba(255, 255, 255, .05);
}

[data-text="large"] { --fs: 17.5px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: var(--fs); }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  font-size: 1rem; line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  font-feature-settings: "cv11", "ss01";
}
body.no-scroll { overflow: hidden; }
a { color: var(--accent-text); text-underline-offset: 2px; }
h1 { font-size: 1.55rem; line-height: 1.25; margin: 0; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 1rem; margin: 0 0 .85rem; font-weight: 650; letter-spacing: -.005em; }
h3 { font-size: .9rem; margin: 1.1rem 0 .5rem; color: var(--text-2); font-weight: 600; }
p { margin: 0 0 .75rem; }
code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 6px; font-family: var(--mono); font-size: .88em; }
code.big { font-size: 1.1rem; padding: .25rem .6rem; }
kbd {
  font-family: var(--mono); font-size: .72rem; line-height: 1; padding: .2rem .38rem; border-radius: 6px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface); color: var(--muted);
  white-space: nowrap;
}
.ico { width: 1.15em; height: 1.15em; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { color: var(--muted); font-size: .86rem; margin: .5rem 0; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline { display: inline; }
.loading { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.spacer { flex: 1; }
.num, .tnum { font-variant-numeric: tabular-nums; }

/* Foco visível em tudo (teclado) */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.in:focus-visible, .form input:focus-visible, .form select:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent); }

.skip-link {
  position: fixed; left: .75rem; top: -4rem; z-index: 100; background: var(--accent); color: var(--on-accent);
  padding: .6rem 1rem; border-radius: 10px; font-weight: 600; text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: .75rem; }

/* ---------- Botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--radius-sm);
  padding: .55rem .95rem; font: inherit; font-size: .93rem; font-weight: 600; cursor: pointer; text-decoration: none;
  min-height: 42px; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--accent-text); }
.btn-ghost:hover { background: var(--accent-soft); border-color: transparent; }
.btn-small { padding: .32rem .7rem; min-height: 34px; font-size: .86rem; }
.btn-block { width: 100%; }
.btn-add { color: var(--accent-text); border-style: dashed; box-shadow: none; }
.btn-light { background: #fff; color: #18181b; border-color: #fff; }
.linklike { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: .35rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto;
  border: 1px solid transparent; background: transparent; color: var(--text-2); font-size: 1.2rem; line-height: 1;
  cursor: pointer; text-decoration: none; padding: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .ico { width: 20px; height: 20px; }

.in, .form input, .form select {
  width: 100%; font: inherit; font-size: .95rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .55rem .7rem; min-height: 44px;
  transition: border-color .12s, box-shadow .12s;
}
.in:hover, .form input:hover, .form select:hover { border-color: var(--muted); }
.in::placeholder { color: var(--muted); opacity: .8; }
.in.invalid { border-color: var(--bad); background: var(--bad-soft); }
.in-money, .in-pct { text-align: right; font-variant-numeric: tabular-nums; }
.in-wrap { display: flex; align-items: center; gap: .4rem; }
.in-wrap .in { flex: 1; min-width: 0; }
.in-suffix { color: var(--muted); font-size: .86rem; white-space: nowrap; }
select.in { appearance: none; -webkit-appearance: none; padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 1rem center, right .7rem center; background-size: 5px 5px; background-repeat: no-repeat; }

.fld { display: grid; gap: .35rem; align-content: start; min-width: 0; }
.fld-label { font-size: .84rem; font-weight: 600; color: var(--text-2); }
.fld-hint { color: var(--muted); font-size: .8rem; }
.fld + .fld { margin-top: .9rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .9rem; }
.two .fld + .fld { margin-top: 0; }
.form-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: .6rem; }
.form-grid .fld + .fld { margin-top: 0; }

/* ---------- Páginas simples (entrar, conta, admin) ---------- */
.simple-top {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem;
  padding: .75rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.simple-nav { display: flex; gap: 1.1rem; align-items: center; font-size: .92rem; flex-wrap: wrap; }
.simple-nav a, .simple-nav .linklike { color: var(--text-2); text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; }
.simple-nav a:hover, .simple-nav .linklike:hover { color: var(--text); }
.page-auth { min-height: 100vh; background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent) no-repeat, var(--bg); }
.page-auth .simple-top { background: transparent; border: 0; justify-content: center; padding-top: 2.5rem; }
.simple-card { max-width: 420px; width: calc(100% - 2rem); margin: 1.5rem auto 3rem; background: var(--surface); padding: 1.75rem; border-radius: 18px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.simple-card h1 { font-size: 1.4rem; margin-bottom: .25rem; }
.simple-wide { max-width: 1100px; margin: 1.75rem auto 3rem; padding: 0 1.25rem; }
.simple-wide > h1 { margin-bottom: .4rem; }
.simple-wide .grid-2 { margin-top: 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.02rem; letter-spacing: -.01em; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; color: var(--text); }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-word { font-weight: 400; letter-spacing: -.015em; }
.brand-word b { font-weight: 700; }
.form { display: grid; gap: .9rem; margin: 1.1rem 0; }
.form label { display: grid; gap: .35rem; font-weight: 600; font-size: .9rem; color: var(--text-2); }
.form label small { font-weight: 400; color: var(--muted); }
.form label.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.form label.check input { width: 18px; height: 18px; min-height: 0; margin-top: .15rem; accent-color: var(--accent); }
.form-links { text-align: center; font-size: .9rem; color: var(--muted); }
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); margin: .8rem 0; border: 1px solid transparent; font-size: .93rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-ok { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.alert-erro { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.app-flash { margin: 1rem 1rem 0; }
.plain-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .45rem; }
.panel-danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)) !important; }
.row-muted td { color: var(--muted); }
.actions { white-space: nowrap; }
.actions form { margin: .1rem; }

/* ---------- Estrutura da aplicação ---------- */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .5rem;
  padding: .55rem .9rem; padding-top: max(.55rem, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.search-btn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: .55rem; height: 40px; padding: 0 .75rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 10px;
  font: inherit; font-size: .9rem; cursor: pointer; text-align: left; box-shadow: var(--shadow-sm);
}
.search-btn:hover { border-color: var(--border-strong); color: var(--text-2); }
.search-txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.year-pick select {
  appearance: none; -webkit-appearance: none; height: 40px; padding: 0 1.9rem 0 .7rem; border-radius: 10px;
  border: 1px solid var(--border); background-color: var(--surface); color: var(--text); font: inherit; font-weight: 650; font-size: .92rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right .95rem center, right .65rem center; background-size: 5px 5px; background-repeat: no-repeat;
}
.save-state { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.save-state.busy::before { content: "● "; color: var(--warn); }
.save-state.done::before { content: "✓ "; color: var(--good); }
[data-theme="dark"] .only-light, :root:not([data-theme="dark"]) .only-dark { display: none; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; border-radius: 50%; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: .9rem;
}
.usermenu-panel {
  position: absolute; right: 0; top: 46px; background: var(--surface); color: var(--text); min-width: 240px;
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: .4rem; display: grid; z-index: 40;
}
.usermenu-panel a, .usermenu-panel button {
  display: flex; align-items: center; gap: .6rem; text-align: left; padding: .6rem .7rem; border-radius: 9px; color: var(--text);
  text-decoration: none; background: none; border: 0; font: inherit; font-size: .92rem; cursor: pointer; width: 100%;
}
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--surface-2); }
.usermenu-panel .ico { color: var(--muted); }
.usermenu-name { padding: .55rem .7rem .7rem; font-weight: 650; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.usermenu-name small { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; }

/* Barra inferior (telemóvel) */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a, .bottomnav button {
  display: grid; justify-items: center; align-content: center; gap: 3px; min-height: var(--bottomnav);
  color: var(--muted); text-decoration: none; font: inherit; font-size: .7rem; font-weight: 600;
  background: none; border: 0; cursor: pointer; position: relative;
}
.bottomnav .ico { width: 22px; height: 22px; }
.bottomnav .active { color: var(--accent-text); }
.bottomnav .active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }

/* ---------- Vistas ---------- */
.view { max-width: 1160px; margin: 0 auto; padding: 1rem; padding-bottom: calc(var(--bottomnav) + 5.5rem); }
.view:focus { outline: none; }
.stack { display: grid; gap: 1rem; min-width: 0; }
.view-head { display: grid; gap: .3rem; padding: .25rem 0 .25rem; }
.view-head p { margin: 0; color: var(--muted); }
.view-head h1:focus { outline: none; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.big-num { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.grid-2, .grid-main { display: grid; gap: 1rem; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .9rem 1rem; min-width: 0; text-align: left; font: inherit; color: inherit; position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; left: 0; top: .9rem; bottom: .9rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--border-strong); }
.kpi-btn { cursor: pointer; transition: border-color .12s, transform .12s; }
.kpi-btn:hover { border-color: var(--border-strong); }
.kpi-good::before { background: var(--good); }
.kpi-warn::before { background: var(--warn); }
.kpi-bad::before { background: var(--bad); }
.kpi-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 1.3rem; font-weight: 700; margin: .15rem 0; font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow-wrap: anywhere; }
.kpi-sub { font-size: .8rem; color: var(--muted); }
.state { margin: .9rem 0 0; padding: .6rem .8rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem; background: var(--surface-2); color: var(--text-2); display: flex; gap: .5rem; align-items: center; }
.state-good { background: var(--good-soft); color: var(--good); }
.state-bad { background: var(--bad-soft); color: var(--bad); }
.state-neutral { background: var(--surface-2); color: var(--text-2); }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.empty { text-align: center; padding: 1.4rem .5rem; color: var(--text-2); }
.empty p { margin: 0 0 .9rem; }
.empty-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.starter { border: 1.5px dashed var(--border-strong); box-shadow: none; text-align: center; background: transparent; }
.starter p { margin-top: -.3rem; }

/* ---------- Resumo do mês ---------- */
.hero-lbl { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stackbar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-3); margin: 1rem 0 .7rem; gap: 2px; }
.stack-seg { display: block; height: 100%; min-width: 3px; border-radius: 2px; }
.stack-free { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--good) 35%, transparent) 0 3px, transparent 3px 6px); }
.legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .82rem; color: var(--muted); }
.legend b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .45rem; vertical-align: 1px; }
.dot-free { background: color-mix(in srgb, var(--good) 45%, transparent); }

/* Navegação de meses */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.nav-arrow { width: 42px; height: 42px; background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.nav-arrow:hover { border-color: var(--border-strong); }
.nav-arrow.disabled { opacity: .35; pointer-events: none; }
.month-title { display: flex; align-items: baseline; gap: .45rem; }
.month-title select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; font: inherit; font-size: 1.55rem; font-weight: 700;
  letter-spacing: -.02em; color: var(--text); padding: 0 1.2rem 0 .2rem; min-height: 0; cursor: pointer; border-radius: 8px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right .4rem center, right .05rem center; background-size: 6px 6px; background-repeat: no-repeat;
}
.month-title select option { font-size: 1rem; }
.month-year { font-size: 1.15rem; color: var(--muted); font-weight: 600; }

/* Controlo segmentado */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg-btn {
  border: 0; background: transparent; font: inherit; font-size: .9rem; font-weight: 600; color: var(--muted); border-radius: 9px;
  padding: .42rem .85rem; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem; min-height: 36px;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--border); }
[data-theme="dark"] .seg-btn.active { background: var(--surface-3); box-shadow: none; }
.seg-badge { font-size: .72rem; background: var(--surface-3); border-radius: 99px; padding: .05rem .45rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.seg-btn.active .seg-badge { background: var(--accent-soft); color: var(--accent-text); }
.seg-tabs { display: flex; width: 100%; }
.seg-tabs .seg-btn { flex: 1; justify-content: center; }
.seg-small .seg-btn { padding: .32rem .65rem; min-height: 32px; font-size: .85rem; }

/* ---------- Listas ---------- */
.list-tools { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .5rem; }
.list-tools .search { flex: 1 1 10rem; width: auto; min-height: 36px; }
.cat-block { margin-top: 1rem; }
.cat-head {
  display: flex; justify-content: space-between; align-items: center; font-size: .78rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 .25rem .4rem;
}
.cat-total { font-variant-numeric: tabular-nums; color: var(--text-2); text-transform: none; letter-spacing: 0; font-size: .86rem; font-weight: 600; }
.list { display: grid; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.item { display: flex; align-items: center; border-bottom: 1px solid var(--border); min-height: 58px; transition: background .12s; }
.item:last-child { border-bottom: 0; }
.item-main {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  background: none; border: 0; font: inherit; color: inherit; text-align: left; padding: .65rem .9rem .65rem .6rem; cursor: pointer; min-height: 58px;
}
.item-main:focus-visible { outline-offset: -3px; }
.item > .item-main:first-child { padding-left: .95rem; }
.item:hover { background: var(--surface-2); }
.item-text { display: grid; min-width: 0; gap: .05rem; }
.item-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-amt { display: grid; justify-items: end; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-sub { font-size: .76rem; font-weight: 600; }
.item.is-paid .item-title { color: var(--muted); }
.item.is-paid .item-amt > span:first-child { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.item.is-late .item-meta { color: var(--bad); }
.item .check {
  flex: 0 0 auto; width: 26px; height: 26px; margin-left: .85rem; border-radius: 50%; border: 2px solid var(--border-strong);
  background: var(--surface); color: #fff; font-weight: 800; font-size: .82rem; cursor: pointer; display: grid; place-items: center; padding: 0;
  transition: background .12s, border-color .12s;
}
.item .check:hover { border-color: var(--good); }
.item .check.on { background: var(--good); border-color: var(--good); color: var(--surface); }
.list-foot { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.list-more { display: block; padding: .75rem .95rem; font-weight: 600; text-decoration: none; font-size: .9rem; }
.fab {
  position: fixed; right: 1rem; bottom: calc(var(--bottomnav) + 1rem + env(safe-area-inset-bottom)); z-index: 25;
  width: 56px; height: 56px; border-radius: 16px; border: 0; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 40%, transparent);
}
.fab .ico { width: 26px; height: 26px; stroke-width: 2.2; }
.fab:hover { background: var(--accent-hover); }

/* Dicas */
.tips { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.tip { display: grid; gap: .25rem; padding: .7rem .85rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: .9rem; }
.tip a { font-weight: 600; text-decoration: none; font-size: .86rem; }
.tip-good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.tip-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.tip-bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }

/* ---------- Etiquetas e barras ---------- */
.tag { display: inline-flex; align-items: center; padding: .12rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tag-good { background: var(--good-soft); color: var(--good); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-bad { background: var(--bad-soft); color: var(--bad); }
.bar { display: block; width: 100%; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: .5rem 0; }
.bar-big { height: 8px; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .35s ease; }
.bar-good .bar-fill { background: var(--good); }
.bar-warn .bar-fill { background: var(--warn); }
.bar-bad .bar-fill { background: var(--bad); }
.order { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); font-weight: 700; font-size: .8rem; color: var(--text-2); }

/* Análise */
.gcards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.gcard { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .8rem; min-width: 0; }
.gcard-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .3rem; font-weight: 600; font-size: .88rem; }
.gcard-top > span:first-child { min-width: 0; }
.gcard-num { font-size: 1.15rem; font-weight: 700; margin-top: .35rem; font-variant-numeric: tabular-nums; display: grid; letter-spacing: -.02em; }
.gcard-num small { font-size: .8rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.catbars { display: grid; gap: .75rem; }
.catbar-top { display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; margin-bottom: .3rem; }
.catbar-top b { font-variant-numeric: tabular-nums; font-weight: 650; }
.hbar { display: block; position: relative; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.hbar-plan, .hbar-real { position: absolute; left: 0; top: 0; height: 100%; border-radius: 99px; }
.hbar-plan { background: color-mix(in srgb, var(--accent) 22%, var(--surface-3)); }
.hbar-real { background: var(--accent); height: 50%; top: 25%; }
.catbars .catbar .hbar .hbar-real:only-child { height: 100%; top: 0; }
.hbar-real.over { background: var(--bad); }

/* ---------- Cartão escuro de destaque (dívidas, fundo) ---------- */
.panel-hero { background: var(--hero-bg); color: var(--hero-text); border-color: transparent; position: relative; overflow: hidden; }
.panel-hero::after { content: ""; position: absolute; inset: auto -20% -60% auto; width: 60%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(closest-side, rgba(255,255,255,.09), transparent); pointer-events: none; }
.panel-hero > * { position: relative; z-index: 1; }
[data-theme="dark"] .panel-hero { border-color: var(--border-strong); }
.panel-hero .hero-lbl, .panel-hero .muted { color: var(--hero-muted); }
.panel-hero .bar { background: var(--hero-track); }
.panel-hero .bar-good .bar-fill { background: #34d399; }
.panel-hero .bar-warn .bar-fill { background: #fbbf24; }
.panel-hero .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; box-shadow: none; }
.panel-hero .btn:hover { background: rgba(255,255,255,.18); }
.panel-hero .btn-primary { background: #fff; border-color: #fff; color: #111111; }
.panel-hero .btn-primary:hover { background: #e4e4e7; }
.debt-hero p { margin: .35rem 0 1rem; color: var(--hero-muted); }
.debt-hero-big { font-size: 2.1rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.15; }
.debt-hero-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.debt-hero-row > div { display: grid; }
.debt-hero-row strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.debt-hero.done p { margin-bottom: 0; }
.debt-cards { display: grid; gap: .65rem; }
.debt-card {
  display: grid; gap: .2rem; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1rem; transition: border-color .12s;
}
.debt-card:hover { border-color: var(--border-strong); }
.debt-card.focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.debt-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.debt-name { font-weight: 650; display: grid; }
.debt-name small { font-weight: 400; color: var(--muted); font-size: .82rem; }
.debt-bal { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.debt-prog { display: flex; align-items: center; gap: .6rem; }
.debt-prog .bar { flex: 1; }
.debt-facts { display: flex; flex-wrap: wrap; gap: .2rem 1rem; font-size: .82rem; color: var(--muted); }
.debt-facts b { color: var(--text-2); font-weight: 600; }
.stepper { display: grid; grid-template-columns: auto 1fr auto; gap: .4rem; align-items: center; }
.stepper .btn { min-width: 54px; }
.plan-info { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: 1rem; }
.plan-info div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: .6rem .75rem; display: grid; font-size: .8rem; }
.plan-info strong { font-size: 1rem; font-variant-numeric: tabular-nums; }

/* ---------- Metas ---------- */
.ef { display: grid; gap: 1rem; }
.ef-big { font-size: 2rem; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ef-big small { font-size: 1rem; font-weight: 500; color: var(--hero-muted); letter-spacing: 0; }
.ef p { margin: .35rem 0 0; }
.ef-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.goal-cards { display: grid; gap: .65rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.goal-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .35rem; display: grid; gap: .3rem; }
.goal-main { display: grid; gap: .2rem; text-align: left; font: inherit; color: inherit; background: none; border: 0; padding: .55rem; cursor: pointer; border-radius: 9px; }
.goal-main:hover { background: var(--surface); }
.goal-top { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.goal-name { font-weight: 650; }
.goal-num { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.goal-num small { font-size: .82rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.goal-card > .btn { justify-self: start; margin: 0 .55rem .55rem; }
.calc-list { display: grid; margin-top: .3rem; }
.calc-line { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.calc-line:last-child { border-bottom: 0; }
.calc-line strong { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 650; }
.calc-line.strong strong { font-size: 1.08rem; color: var(--accent-text); }
.scen-base { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; background: var(--surface-2); border: 1px solid var(--border); padding: .65rem .85rem; border-radius: 10px; margin-bottom: .9rem; font-size: .88rem; font-variant-numeric: tabular-nums; }

/* Secções recolhíveis */
.collapse { padding: 0; }
.collapse > summary {
  list-style: none; cursor: pointer; padding: 1rem 1.1rem; font-weight: 650; display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-radius: var(--radius);
}
.collapse > summary::-webkit-details-marker { display: none; }
.collapse > summary small { display: block; font-weight: 400; color: var(--muted); font-size: .84rem; }
.collapse > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .2s; flex: 0 0 auto; }
.collapse[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.collapse-body { padding: 0 1.1rem 1.1rem; display: grid; gap: .5rem; min-width: 0; }

/* Relatório */
.months-list { display: grid; gap: .1rem; }
.mrow { display: grid; grid-template-columns: 2.7rem 1fr auto; gap: .75rem; align-items: center; padding: .5rem .4rem; border-radius: 10px; text-decoration: none; color: inherit; }
.mrow:hover { background: var(--surface-2); }
.mrow-name { font-weight: 650; font-size: .9rem; }
.mrow-bars { display: grid; gap: 3px; }
.mb { display: block; height: 6px; border-radius: 99px; }
.mb-inc { background: var(--c-income); }
.mb-plan { background: var(--c-planned); }
.mrow-bal { font-weight: 650; font-variant-numeric: tabular-nums; font-size: .88rem; min-width: 4.8rem; text-align: right; }

/* Configuração */
.group-card { position: relative; }
.group-card::before { content: ""; position: absolute; left: 1.1rem; right: 1.1rem; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--gc, var(--accent)); }
.group-edit { display: grid; grid-template-columns: 1fr auto 6.5rem; gap: .5rem; align-items: end; }
.group-edit .fld + .fld { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }
.cat-chip { border: 1px solid var(--border); background: var(--surface-2); border-radius: 99px; padding: .4rem .85rem; font: inherit; font-size: .88rem; cursor: pointer; color: var(--text); min-height: 36px; }
.cat-chip:hover { border-color: var(--accent); color: var(--accent-text); }
.cat-chip.add { border-style: dashed; background: transparent; color: var(--accent-text); font-weight: 600; }
.rules { margin: 0; padding-left: 1.2rem; display: grid; gap: .4rem; }

/* Menu "Mais" */
.more-list { display: grid; gap: .3rem; }
.more-link {
  display: grid; text-align: left; padding: .8rem .95rem; border-radius: 12px; text-decoration: none; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); font: inherit; font-weight: 600; cursor: pointer;
}
.more-link small { font-weight: 400; color: var(--muted); }

/* ---------- Janela (folha) ---------- */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(9, 9, 11, 0); display: flex; align-items: flex-end; justify-content: center;
  transition: background .18s;
}
.sheet-overlay.open { background: rgba(9, 9, 11, .5); }
.sheet {
  background: var(--surface); color: var(--text); width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .22s cubic-bezier(.2,.8,.2,1); padding-bottom: env(safe-area-inset-bottom);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.sheet-overlay.open .sheet { transform: none; }
.sheet-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--border-strong); margin: .55rem auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: .55rem 1.1rem .3rem; }
.sheet-head h2 { margin: 0; font-size: 1.1rem; }
.sheet-body { padding: .6rem 1.1rem 1.1rem; overflow-y: auto; }
.sheet-foot { border-top: 1px solid var(--border); padding: .8rem 1.1rem; }
.sheet-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.sheet-actions .kbd-hint { font-size: .78rem; color: var(--muted); }
.sheet-form { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem .75rem; }
.sheet-form .fld + .fld { margin-top: 0; }
.sheet-form .full { grid-column: 1 / -1; }

/* ---------- Paleta de comandos (Ctrl+K) ---------- */
.palette-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(9,9,11,.5); display: flex; justify-content: center; align-items: flex-start; padding: 8vh 1rem 1rem; }
.palette {
  width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 76vh;
}
.palette-search { display: flex; align-items: center; gap: .6rem; padding: .25rem 1rem; border-bottom: 1px solid var(--border); }
.palette-search .ico { color: var(--muted); width: 20px; height: 20px; }
.palette-input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 1.05rem; color: var(--text); padding: .9rem 0; min-width: 0; }
.palette-input:focus { outline: none; }
.palette-list { overflow-y: auto; padding: .4rem; margin: 0; list-style: none; }
.palette-group { font-size: .74rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: .6rem .65rem .3rem; }
.palette-item { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 10px; cursor: pointer; color: var(--text); }
.palette-item .ico { color: var(--muted); }
.palette-item .p-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .p-meta { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.palette-item.active { background: var(--accent-soft); color: var(--accent-text); }
.palette-item.active .ico { color: var(--accent-text); }
.palette-empty { padding: 1.5rem; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 1rem; padding: .55rem 1rem; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted); flex-wrap: wrap; }
.palette-foot span { display: inline-flex; gap: .35rem; align-items: center; }

/* Lista de atalhos e preferências */
.kbd-list { display: grid; gap: .1rem; margin: 0; }
.kbd-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.kbd-row:last-child { border-bottom: 0; }
.kbd-keys { display: inline-flex; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }
.kbd-keys kbd { font-size: .78rem; padding: .25rem .45rem; color: var(--text-2); }
.kbd-section { font-size: .76rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 1rem 0 .2rem; }
.kbd-section:first-child { margin-top: 0; }
.pref-row { display: grid; gap: .45rem; margin-bottom: 1.1rem; }
.pref-row .fld-label { font-size: .9rem; }
.pref-row .seg { width: 100%; }
.pref-row .seg-btn { flex: 1; justify-content: center; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.table th, .table td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table thead th { font-size: .74rem; font-weight: 650; color: var(--muted); background: var(--surface-2); }
.table tfoot th { background: var(--surface-2); font-weight: 650; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 700; }
.table .row-active td { background: var(--accent-soft); font-weight: 600; }
.table.wide { min-width: 900px; }
.sticky-first .table th:first-child, .sticky-first .table td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; box-shadow: 1px 0 0 var(--border); }
.sticky-first .table thead th:first-child, .sticky-first .table tfoot th:first-child { background: var(--surface-2); }
.table.matrix .in { min-height: 34px; padding: .3rem .45rem; width: 4.6rem; }
.table.matrix .hcell .in { width: 3.5rem; }
.table.matrix th, .table.matrix td { padding: .4rem .45rem; }
.hcell { display: inline-flex; align-items: center; gap: .3rem; }

/* Tabela editável (cenários) */
.etable { font-size: .9rem; }
.ebody { display: grid; gap: .55rem; }
.erow.ehead { display: none; }
.erow { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem .6rem; position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .75rem; }
.ecell { min-width: 0; display: grid; gap: .2rem; align-content: start; }
.ecell .lbl { font-size: .76rem; color: var(--muted); font-weight: 600; }
.ecell .calc { font-variant-numeric: tabular-nums; padding: .25rem 0; }
.ecell.pos .calc { color: var(--good); }
.ecell.neg .calc { color: var(--bad); }
.erow .c-name { grid-column: 1 / -1; }
.erow .c-name .in { padding-right: 2.8rem; }
.erow .c-del { position: absolute; top: .35rem; right: .35rem; }
.etable .btn-add { margin-top: .6rem; }

/* ---------- Gráficos ---------- */
.chart-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; min-width: 0; }
.chart-box.flat { box-shadow: none; border: 0; padding: 0; background: transparent; }
.chart-box h3 { margin-top: 0; color: var(--text); font-size: .95rem; }
.chart-canvas { position: relative; height: 240px; }

/* ---------- Selecionar e somar ---------- */
.item .selbox {
  flex: 0 0 auto; width: 22px; height: 22px; margin-left: .9rem; border-radius: 7px; border: 2px solid var(--border-strong);
  background: var(--surface); display: grid; place-items: center; pointer-events: none;
}
.item.is-selected { background: var(--accent-soft); }
.item.is-selected .selbox { background: var(--accent); border-color: var(--accent); }
.item.is-selected .selbox::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent); transform: rotate(-45deg) translate(1px, -1px); }
.item.selecting:hover { background: var(--surface-2); }
.item.selecting.is-selected:hover { background: var(--accent-soft); }
.sel-hint { margin: 0 0 .2rem; }
.cat-head-btn { width: 100%; background: none; border: 0; font: inherit; font-size: .78rem; cursor: pointer; text-align: left; border-radius: 8px; padding-top: .3rem; padding-bottom: .45rem; }
.cat-head-btn:hover { background: var(--surface-2); color: var(--text); }
.selbar {
  position: fixed; left: .75rem; right: .75rem; z-index: 26;
  bottom: calc(var(--bottomnav) + .75rem + env(safe-area-inset-bottom));
  max-width: 720px; margin: 0 auto; background: #111111; color: #ffffff; border-radius: 16px;
  padding: .8rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .8rem; box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .selbar { background: #26262c; border: 1px solid rgba(255,255,255,.1); }
.selbar-info { display: grid; min-width: 0; }
.selbar-count { font-size: .78rem; color: #a1a1aa; }
.selbar-total { font-size: 1.4rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.selbar-sub { display: flex; flex-wrap: wrap; gap: .1rem .9rem; font-size: .8rem; color: #d4d4d8; }
.selbar-hint { font-weight: 600; font-size: .92rem; }
.selbar-actions { display: flex; gap: .4rem; flex: 0 0 auto; }
.selbar .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; box-shadow: none; }
.selbar .btn:hover { background: rgba(255,255,255,.18); }
.selbar .btn-light { background: #fff; color: #18181b; border-color: #fff; }
.view:has(.selbar) { padding-bottom: calc(var(--bottomnav) + 8rem); }

/* ---------- Aviso flutuante ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bottomnav) + 1rem); transform: translate(-50%, 20px); opacity: 0; visibility: hidden;
  background: #111111; color: #ffffff; padding: .7rem 1rem; border-radius: 12px; transition: transform .2s, opacity .2s;
  z-index: 90; max-width: calc(100% - 2rem); box-shadow: var(--shadow-lg); font-size: .92rem; font-weight: 500;
}
[data-theme="dark"] .toast { background: #f4f4f5; color: #18181b; }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.bad { background: var(--bad); color: #fff; }

/* ---------- Ecrãs pequenos ---------- */
@media (max-width: 520px) {
  .search-txt, .search-kbd { display: none; }
  .search-btn { flex: 0 0 40px; justify-content: center; padding: 0; }
  .topbar .spacer-mobile { flex: 1; }
  .kpi-value { font-size: 1.12rem; }
  .debt-hero-big { font-size: 1.75rem; }
  .group-edit { grid-template-columns: 1fr 1fr; }
  .group-edit .grow { grid-column: 1 / -1; }
  .save-state { display: none; }
  .topbar .year-pick { margin-left: auto; }
}

/* Em ecrãs táteis não faz sentido mostrar teclas */
@media (hover: none) {
  .side-nav kbd, .search-kbd, .kbd-hint { display: none !important; }
}

@media (min-width: 640px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gcards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ef { grid-template-columns: 1fr auto; align-items: end; }
  .sheet-overlay { align-items: center; padding: 1rem; }
  .sheet { max-width: 560px; border-radius: 18px; transform: translateY(16px) scale(.98); opacity: 0; transition: transform .18s, opacity .18s; }
  .sheet-overlay.open .sheet { transform: none; opacity: 1; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 1.1rem; }
}

/* ---------- Computador: menu lateral ---------- */
@media (min-width: 1024px) {
  :root { --bottomnav: 0px; }
  .bottomnav, .brand-mobile { display: none; }
  .shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .sidebar {
    display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 0; height: 100vh;
    padding: 1.1rem .85rem; border-right: 1px solid var(--border); background: var(--surface);
  }
  .sidebar .brand { padding: .2rem .55rem; }
  .side-nav { display: grid; gap: .15rem; }
  .side-nav a, .side-btn {
    display: flex; align-items: center; gap: .7rem; padding: .55rem .65rem; border-radius: 10px; color: var(--text-2);
    text-decoration: none; font-weight: 550; font-size: .93rem; background: none; border: 0; font-family: inherit; cursor: pointer; text-align: left; width: 100%;
  }
  .side-nav a span, .side-btn span { flex: 1; }
  .side-nav .ico, .side-btn .ico { width: 19px; height: 19px; color: var(--muted); }
  .side-nav a:hover, .side-btn:hover { background: var(--surface-2); color: var(--text); }
  .side-nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
  .side-nav a.active .ico { color: var(--accent-text); }
  .side-nav kbd { opacity: 0; transition: opacity .12s; }
  .side-nav a:hover kbd, .side-nav a:focus-visible kbd { opacity: 1; }
  .side-foot { margin-top: auto; display: grid; gap: .15rem; padding-top: .75rem; border-top: 1px solid var(--border); }
  .topbar { padding: .65rem 1.5rem; gap: .65rem; }
  .search-btn { max-width: 440px; }
  .topbar .save-state { margin-left: auto; }
  .view { padding: 1.5rem 1.5rem 5rem; }
  .app-flash { margin: 1rem 1.5rem 0; }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .grid-main { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
  .fab { bottom: 2rem; right: 2rem; }
  .toast { bottom: 2rem; }
  .chart-canvas { height: 280px; }
  .debt-hero-big { font-size: 2.5rem; }
  .selbar { bottom: 1.5rem; left: calc(var(--sidebar) + 1.5rem); right: 1.5rem; }

  .ebody { gap: 0; }
  .erow, .erow.ehead {
    display: grid; grid-template-columns: var(--cols); gap: .4rem; align-items: center;
    background: none; border: 0; border-radius: 0; border-bottom: 1px solid var(--border); padding: .3rem 0;
  }
  .erow.ehead { font-size: .76rem; color: var(--muted); font-weight: 600; }
  .erow .ecell { grid-column: auto !important; }
  .erow .c-del { position: static; }
  .ecell .lbl { display: none; }
  .ecell.a-r, .ecell.a-r .calc { text-align: right; justify-content: end; }
  .erow .in { min-height: 36px; padding: .35rem .5rem; }
  .erow .c-name .in { padding-right: .5rem; }
}

@media (min-width: 900px) and (max-width: 1023px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

/* ---------- Menos movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
[data-motion="reduce"] *, [data-motion="reduce"] *::before, [data-motion="reduce"] *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }

/* ---------- Contraste forçado (Windows) ---------- */
@media (forced-colors: active) {
  .btn, .in, .panel, .kpi, .list, .seg-btn.active { border: 1px solid CanvasText; }
  .bar-fill, .stack-seg, .hbar-real { forced-color-adjust: none; }
}


/* =====================================================================
   Gráficos e barras (charts.js)
   ===================================================================== */
.chart-card { padding: 1.1rem 1.1rem .6rem; }
.chart-card.flat { box-shadow: none; }
.cx { margin: 0; min-width: 0; }
.cx-head { display: grid; gap: .25rem; margin-bottom: .75rem; }
.cx-title { margin: 0; font-size: 1rem; font-weight: 650; color: var(--text); }
.cx-sub { margin: 0; font-size: .84rem; color: var(--muted); }
.cx-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; list-style: none; margin: .35rem 0 0; padding: 0; font-size: .82rem; color: var(--text-2); }
.cx-legend li { display: inline-flex; align-items: center; gap: .45rem; }
.cx-key { display: inline-block; flex: 0 0 auto; }
.cx-key-rect { width: 10px; height: 10px; border-radius: 3px; }
.cx-key-line { width: 16px; height: 3px; border-radius: 2px; }
.cx-plot { position: relative; width: 100%; border-radius: 8px; }
.cx-plot:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.cx-svg { display: block; overflow: visible; font-family: var(--font); }
.cx-grid { stroke: var(--cx-grid); stroke-width: 1; shape-rendering: crispEdges; }
.cx-axis { stroke: var(--cx-axis); stroke-width: 1; shape-rendering: crispEdges; }
.cx-tick { fill: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cx-band { fill: var(--cx-band); }
.cx-hit { fill: transparent; cursor: default; outline: none; }
.cx-clickable .cx-hit { cursor: pointer; }
.cx-hit:focus-visible { stroke: var(--accent); stroke-width: 2; fill: var(--cx-band); }
.cx-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cx-area { opacity: .1; }
.cx-cross { stroke: var(--cx-axis); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
.cx-dot { stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.cx-overlay { fill: transparent; cursor: crosshair; }
.cx-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 150px; max-width: 260px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: .55rem .7rem; font-size: .82rem; display: grid; gap: .25rem;
}
.cx-tip[hidden] { display: none; }
.cx-tip-title { font-weight: 650; color: var(--text-2); margin-bottom: .1rem; }
.cx-tip-row { display: grid; grid-template-columns: 14px auto 1fr; align-items: center; gap: .45rem; }
.cx-tip-row strong { font-variant-numeric: tabular-nums; font-weight: 700; }
.cx-tip-row span:last-child { color: var(--muted); }
.cx-tip-key { width: 12px; height: 3px; border-radius: 2px; }
.cx-tip-key-none { background: transparent; }
.cx-table { margin-top: .5rem; border-top: 1px solid var(--border); padding-top: .4rem; }
.cx-table summary { cursor: pointer; font-size: .84rem; color: var(--accent-text); font-weight: 600; padding: .3rem 0; width: max-content; border-radius: 6px; }
.cx-table .table-wrap { margin-top: .4rem; max-height: 320px; overflow: auto; }
.cx-table th[scope=row] { font-weight: 600; }

/* Barra segmentada (distribuição da receita) */
.cx-seg-wrap { position: relative; margin: 1rem 0 .7rem; }
.cx-seg { display: flex; gap: 2px; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.cx-seg-part { display: block; height: 100%; min-width: 4px; outline: none; transition: filter .12s, transform .12s; }
.cx-seg-part:hover, .cx-seg-part:focus-visible { filter: brightness(1.12) saturate(1.1); }
.cx-seg-part:focus-visible { box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 2px var(--accent); }
.cx-seg-free { background: var(--c-free); box-shadow: inset 0 0 0 1px var(--border-strong); border-radius: 0 99px 99px 0; }
.cx-seg-empty { font-size: 0; }

/* ---------- Resumo do mês (Início e Orçamento) ---------- */
.hero-top { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1rem 1.5rem; align-items: center; }
.hero-compact .hero-top { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.hero-main { display: grid; gap: .15rem; min-width: 0; }
.hero-main-head { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.hero-big { display: block; font-size: 2.4rem; line-height: 1.08; font-weight: 750; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin-top: .2rem; overflow-wrap: anywhere; }
.hero-big.neg { color: var(--bad); }
.hero-sub { margin: .15rem 0 0; color: var(--muted); font-size: .86rem; }
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .16rem .55rem; border-radius: 99px; font-size: .72rem; font-weight: 650; line-height: 1.4; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-good { background: var(--pos-soft); color: var(--pos-ink); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-neutral { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.hero-side { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.hero-stat { display: grid; gap: .1rem; padding: .8rem .95rem; min-width: 0; }
.hero-stat + .hero-stat { border-left: 1px solid var(--border); }
.hero-stat dt { display: flex; align-items: center; gap: .45rem; font-size: .76rem; font-weight: 600; color: var(--muted); }
.hero-stat dd { margin: 0; }
.hs-val { font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hs-sub { font-size: .76rem; color: var(--muted); font-weight: 500; }
.hs-ico { width: 20px; height: 20px; padding: 4px; border-radius: 6px; stroke-width: 2.4; }
.hs-in { color: var(--pos-ink); background: var(--pos-soft); }
.hs-out { color: var(--neg-ink); background: var(--neg-soft); }
.hero-dist { margin-top: 1.25rem; }
.hero-dist-head { display: flex; justify-content: space-between; gap: .5rem; font-size: .7rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.hero-dist .cx-seg-wrap { margin: .6rem 0 .8rem; }
.hero-dist .cx-seg { height: 12px; gap: 3px; background: transparent; }
.hero-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); column-gap: 1.5rem; }
.hl-item { display: flex; align-items: center; gap: .55rem; min-width: 0; padding: .4rem 0; border-top: 1px solid var(--border); font-size: .84rem; }
.hl-key { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 3px; }
.hl-key-free { background: var(--c-free); box-shadow: inset 0 0 0 1px var(--border-strong); }
.hl-name { flex: 1; min-width: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-val { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hl-pct { min-width: 2.7em; text-align: right; color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.hl-zero { opacity: .55; }
.hero-paid { display: flex; align-items: center; gap: .95rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.hp-col { display: grid; min-width: 0; }
.hp-col strong { font-size: 1.08rem; font-weight: 700; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.hp-rest { margin-left: auto; text-align: right; }
.ring-wrap { position: relative; flex: 0 0 auto; width: 54px; height: 54px; }
.ring { display: block; width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--surface-3); stroke-width: 5; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.2,.8,.2,1); }
.ring-txt { position: absolute; inset: 0; display: grid; place-items: center; font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums; }
[data-motion="reduce"] .ring-fill { transition: none; }
@media (max-width: 640px) {
  .hero-top { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .hero-big { font-size: 2rem; }
  .hero-legend { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 380px) {
  .hero-stat { padding: .7rem .75rem; }
  .hs-val { font-size: 1.05rem; }
}
.cx-tip-seg { top: 18px; left: 0; min-width: 0; white-space: nowrap; }

/* Medidor (progresso). O fundo é um tom claro da mesma cor. */
.cx-meter { --m: var(--accent); position: relative; display: block; width: 100%; height: 8px; border-radius: 99px; margin: .5rem 0; background: color-mix(in srgb, var(--m) 16%, var(--surface-3)); }
.cx-meter-sm { height: 6px; }
.cx-meter-lg { height: 10px; }
.cx-meter-fill { display: block; height: 100%; border-radius: 99px; background: var(--m); transition: width .4s cubic-bezier(.2,.8,.2,1); }
.cx-meter-good { --m: var(--good); }
.cx-meter-warn { --m: var(--warn); }
.cx-meter-bad { --m: var(--bad); }
.cx-meter-target { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--text); box-shadow: 0 0 0 2px var(--surface); }
.panel-hero .cx-meter { background: rgba(255,255,255,.16); }
.panel-hero .cx-meter-good { --m: #34d399; }
.panel-hero .cx-meter-warn { --m: #fbbf24; }
.gcard .cx-meter { margin: .65rem 0 .45rem; }
.gcard-meta { display: flex; align-items: center; gap: .4rem; }
.meta-key { display: inline-block; width: 2px; height: 12px; border-radius: 2px; background: var(--text); flex: 0 0 auto; }
.hero-paid .cx-meter { margin: 0; }

/* Planeado vs real por categoria */
.catbars { display: grid; gap: .9rem; }
.catbar-top { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; font-size: .9rem; margin-bottom: .35rem; }
.catbar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catbar-vals { white-space: nowrap; font-variant-numeric: tabular-nums; }
.catbar-vals b { font-weight: 650; }
.catbar-note { font-size: .78rem; margin-top: .25rem; font-weight: 600; }
.pvr { position: relative; display: block; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pvr-plan { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: color-mix(in srgb, var(--c-planned) 22%, var(--surface-3)); }
.pvr-real { position: absolute; left: 0; top: 2px; bottom: 2px; border-radius: 99px; background: var(--c-planned); }
.pvr-solo { top: 0; bottom: 0; }
.pvr-over { position: absolute; top: 2px; bottom: 2px; border-radius: 0 99px 99px 0; margin-left: 2px; background: var(--bad); }
.pvr-legend { margin-bottom: .9rem; }
.pvr-key { display: inline-block; width: 16px; height: 8px; border-radius: 99px; margin-right: .4rem; vertical-align: 0; }
.pvr-key-plan { background: color-mix(in srgb, var(--c-planned) 22%, var(--surface-3)); }
.pvr-key-real { background: var(--c-planned); }
.pvr-key-over { background: var(--bad); }

/* Relatório: lista de meses */
.mb-inc { background: var(--c-income) !important; }
.mb-plan { background: var(--c-planned) !important; }
.mb { height: 7px; border-radius: 0 4px 4px 0; }

@media (forced-colors: active) {
  .cx-meter-fill, .cx-seg-part, .pvr-real, .pvr-plan, .pvr-over { forced-color-adjust: none; }
}

.debt-prog .cx-meter { flex: 1; margin: 0; }
.debt-prog > span:last-child { white-space: nowrap; }

/* =====================================================================
   2.5 — despesas fixas, limites, anexos, avisos e histórico
   ===================================================================== */
/* Sino de avisos */
.bell-btn { position: relative; }
.bell-badge {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
  background: var(--bad); color: #fff; font-size: .66rem; font-weight: 750; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface); font-variant-numeric: tabular-nums;
}
.bell-badge[hidden] { display: none; }
[data-theme="dark"] .bell-badge { color: #0b0b0f; }

/* Campos: caixa de seleção nas janelas */
.fld-bool { display: flex; align-items: flex-start; gap: .65rem; cursor: pointer; }
.fld-bool > span { display: grid; gap: .15rem; }
.in-check { width: 20px; height: 20px; margin: .1rem 0 0; accent-color: var(--accent); flex: none; }

/* Parte de baixo da janela do lançamento */
.sheet-extras { display: grid; gap: .75rem; margin-top: .25rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.extra-box {
  display: flex; align-items: center; gap: .75rem; padding: .7rem .8rem; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface-2);
}
.extra-box > .ico { width: 20px; height: 20px; color: var(--accent-text); flex: none; }
.extra-box .grow { flex: 1; min-width: 0; display: grid; gap: .1rem; }
.extra-box small { color: var(--muted); font-size: .8rem; }
.extra-head { display: flex; align-items: center; gap: .5rem; }
.extra-head .ico { width: 18px; height: 18px; color: var(--muted); }
.badge { font-size: .72rem; background: var(--surface-3); border-radius: 99px; padding: .05rem .45rem; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Anexos */
.att-box { display: grid; gap: .6rem; }
.att-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.att { display: flex; align-items: center; gap: .65rem; padding: .4rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.att-thumb {
  width: 52px; height: 52px; flex: none; border-radius: 9px; overflow: hidden; background: var(--surface-3);
  display: grid; place-items: center; color: var(--text-2); text-decoration: none;
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-file { gap: 0; font-size: .64rem; font-weight: 750; letter-spacing: .04em; color: var(--bad); }
.att-file .ico { width: 20px; height: 20px; }
.att-info { flex: 1; min-width: 0; display: grid; gap: .1rem; }
.att-info a { color: var(--text); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.att-info a:hover { text-decoration: underline; }
.att-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.att-actions .fld-hint { margin: 0; }

/* Marcas nos lançamentos (fixa, anexos) */
.flag { display: inline-flex; align-items: center; gap: .15rem; margin-left: .4rem; color: var(--muted); font-size: .74rem; font-weight: 600; vertical-align: -1px; }
.flag .ico { width: 14px; height: 14px; }
.ico-inline { width: 15px; height: 15px; vertical-align: -2px; }
.item-ico { display: grid; place-items: center; width: 44px; flex: none; color: var(--accent-text); padding-left: .4rem; }
.item-ico .ico { width: 18px; height: 18px; }
.item.is-off .item-title, .item.is-off .item-amt { color: var(--muted); }
.item-title .tag { margin-left: .4rem; vertical-align: 1px; }

/* Limites por categoria */
.limit-line { display: grid; gap: .25rem; margin: 0 .25rem .55rem; }
.limit-line small { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.limit-line.limit-warn small { color: var(--warn); }
.limit-line.limit-bad small { color: var(--bad); font-weight: 600; }
.limits { display: grid; gap: .9rem; }
.limit-row .limit-line { margin: .35rem 0 0; }
.limit-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-weight: 600; }

/* Exportar */
.export-bar { gap: .4rem; }
.export-bar .btn .ico, .toolbar .btn .ico { width: 16px; height: 16px; }
.view-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; }

/* Avisos */
.notif-wrap { display: grid; gap: .8rem; }
.notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.notif {
  width: 100%; display: flex; gap: .7rem; align-items: flex-start; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .8rem;
}
.notif:hover { background: var(--surface-2); }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: .4rem; flex: none; background: var(--border-strong); }
.notif-bad .notif-dot { background: var(--bad); }
.notif-warn .notif-dot { background: var(--warn); }
.notif-neutral .notif-dot { background: var(--accent); }
.notif-text { display: grid; gap: .15rem; min-width: 0; }
.notif-text > span { color: var(--text-2); font-size: .88rem; }
.notif:not(.unread) { background: transparent; }
.notif:not(.unread) strong { font-weight: 550; color: var(--text-2); }
.notif:not(.unread) .notif-dot { opacity: .35; }

/* Histórico */
.hist-day + .hist-day { margin-top: 1.1rem; }
.hist-date { font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .45rem; }
.hist-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.hist-item { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem .85rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.hist-item:last-child { border-bottom: 0; }
.hist-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.hist-ico .ico { width: 16px; height: 16px; }
.hist-insert { background: var(--good-soft); color: var(--good); }
.hist-delete { background: var(--bad-soft); color: var(--bad); }
.hist-update { background: var(--accent-soft); color: var(--accent-text); }
.hist-body { flex: 1; min-width: 0; display: grid; gap: .2rem; }
.hist-title { font-weight: 600; overflow-wrap: anywhere; }
.hist-details { margin: 0; padding-left: 1.05rem; color: var(--text-2); font-size: .85rem; display: grid; gap: .1rem; overflow-wrap: anywhere; }
.hist-item .btn .ico { width: 15px; height: 15px; }
.hist-item.is-undone .hist-title { text-decoration: line-through; color: var(--muted); }
.hist-item.is-undone .hist-details { opacity: .6; }
@media (max-width: 560px) {
  .hist-item { flex-wrap: wrap; }
  .hist-item > .btn, .hist-item > .tag { margin-left: calc(30px + .75rem); }
}
[hidden] { display: none !important; }
@media (min-width: 1024px) {
  .side-foot .side-btn.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
  .side-foot .side-btn.active .ico { color: var(--accent-text); }
}

/* Gráfico com a forma do logótipo */
.hero-dist-body { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 1.25rem; align-items: center; margin-top: .75rem; }
.hero-dist-body .hero-legend { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.logo-chart { display: block; width: 100%; height: auto; overflow: visible; }
.lc-track { fill: none; stroke: var(--c-free); }
.lc-seg { fill: none; transition: opacity .15s; }
.logo-chart:hover .lc-seg { opacity: .55; }
.logo-chart .lc-seg:hover { opacity: 1; }
.lc-coin, .lc-dot { fill: var(--mark); transition: fill .45s ease; }
.lc-full { --mark: var(--mark-full); }
.lc-over { --mark: var(--mark-over); }
.lc-halo { fill: none; stroke: var(--mark); stroke-width: 10; opacity: 0; transform-box: fill-box; transform-origin: center; pointer-events: none; }
.lc-coin-g, .lc-dot { transform-box: fill-box; transform-origin: center; }
/* Entrada: o anel desenha-se da esquerda para a direita e a moeda aparece no fim */
.lc-anim .lc-track, .lc-anim .lc-seg { stroke-dasharray: 1; animation: lcDraw var(--t, .9s) cubic-bezier(.35,.7,.25,1) var(--d, 0s) both; }
.lc-anim .lc-coin-g { animation: lcPop .55s cubic-bezier(.3,1.6,.5,1) 1.05s both; }
.lc-anim .lc-dot { animation: lcPop .45s cubic-bezier(.3,1.6,.5,1) 1.2s both; }
@keyframes lcDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes lcPop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* Mudança de estado: onda à volta da moeda (verde = tudo distribuído, vermelho = aviso) */
.lc-pulse-full .lc-halo { animation: lcHalo .9s ease-out 2; }
.lc-pulse-full .lc-coin-g { animation: lcBounce .6s cubic-bezier(.3,1.6,.5,1); }
.lc-pulse-over .lc-halo { animation: lcHalo 1s ease-out 3; }
.lc-pulse-over .lc-coin-g { animation: lcShake .45s ease-in-out 2; }
@keyframes lcHalo { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(2); opacity: 0; } }
@keyframes lcBounce { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes lcShake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
/* Anel do «Pago» enche ao abrir; legenda entra suavemente */
.ring-anim .ring-fill { animation: ringIn 1s cubic-bezier(.35,.7,.25,1) .2s both; }
@keyframes ringIn { from { stroke-dashoffset: var(--len); } }
.hero-anim .hl-item { animation: hlIn .4s ease both; animation-delay: calc(.25s + var(--i, 0) * .06s); }
@keyframes hlIn { from { opacity: 0; transform: translateY(4px); } }
.pill-full { background: var(--pos-soft); color: var(--pos-ink); }
.pill-over { background: var(--neg-soft); color: var(--neg-ink); }
.hero-big.neg { color: var(--mark-over); }
@media (max-width: 640px) {
  .hero-dist-body { grid-template-columns: 1fr; justify-items: center; }
  .hero-dist-body .logo-chart { width: 170px; }
  .hero-dist-body .hero-legend { width: 100%; }
}

/* Caixa com o valor no gráfico do símbolo */
.lc-wrap { position: relative; width: 100%; }
.lc-hit { fill: none; stroke: transparent; cursor: default; }
.lc-seg, .lc-hit, .lc-coin-g { outline: none; cursor: pointer; }
.lc-seg:focus-visible { filter: drop-shadow(0 0 0 var(--accent)); opacity: 1; }
.logo-chart:hover .lc-seg, .logo-chart:focus-within .lc-seg { opacity: .45; }
.logo-chart .lc-seg:hover, .logo-chart .lc-seg:focus { opacity: 1; }
.lc-tip {
  position: absolute; z-index: 5; min-width: 140px; max-width: 220px; pointer-events: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(17,17,17,.14), 0 2px 6px rgba(17,17,17,.06); padding: .55rem .7rem; display: grid; gap: .1rem;
  animation: lcTipIn .14s ease-out;
}
.lc-tip[hidden] { display: none; }
.lc-tip::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; margin-left: -5px; background: inherit; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); transform: rotate(45deg); }
.lc-tip-head { display: flex; align-items: center; gap: .45rem; font-size: .76rem; font-weight: 600; color: var(--muted); }
.lc-tip-key { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.lc-tip-val { font-size: 1.1rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.lc-tip-val:empty { display: none; }
.lc-tip-sub { font-size: .76rem; color: var(--muted); }
@keyframes lcTipIn { from { opacity: 0; transform: translateY(4px); } }
[data-theme="dark"] .lc-tip { box-shadow: 0 12px 34px rgba(0,0,0,.55); }

/* =====================================================================
   Paleta do site (2.8.6) — minimalista: preto e branco da marca, fundos neutros,
   cor só em pontos pequenos (estados), no gráfico dos grupos e na moeda do símbolo.
   ===================================================================== */
:root{--good:#15803d;--good-soft:#ecffeb;--bad:#d92d20;--bad-soft:#ffeded;--warn:#b45309;--warn-soft:#fff7e6;
--pos-soft:#8bff8a;--pos-ink:#0b3d12;--neg-soft:#ff8a8a;--neg-ink:#4a0b0b;--att-soft:#ffd98a;--att-ink:#4a3300;
--s1:#111111;--s2:#5b7083;--s3:#34c759;--c-income:#34c759;--c-planned:#111111;--c-actual:#5b7083}
[data-theme="dark"]{--good:#8bff8a;--good-soft:rgba(139,255,138,.12);--bad:#ff8a8a;--bad-soft:rgba(255,138,138,.12);--warn:#ffd98a;--warn-soft:rgba(255,217,138,.12);
--s1:#f4f4f5;--s2:#8fa3b8;--s3:#8bff8a;--c-income:#8bff8a;--c-planned:#f4f4f5;--c-actual:#8fa3b8}

/* Variante minimalista: fundos neutros, cor só em pontos pequenos */
:root{--dot-pos:#22c55e;--dot-neg:#ff3b3b;--dot-warn:#f5b400;--good:#15803d;--bad:#d92d20;--warn:#b45309}
[data-theme="dark"]{--dot-pos:#8bff8a;--dot-neg:#ff8a8a;--dot-warn:#ffd98a;--good:#8bff8a;--bad:#ff8a8a;--warn:#ffd98a}
.tip,.tip-good,.tip-warn,.tip-bad{position:relative;background:var(--surface);border-color:var(--border);padding-left:1.9rem}
.tip::before{content:"";position:absolute;left:.85rem;top:1.05rem;width:7px;height:7px;border-radius:50%;background:var(--border-strong)}
.tip-good::before{background:var(--dot-pos)}.tip-warn::before{background:var(--dot-warn)}.tip-bad::before{background:var(--dot-neg)}
.kpi::before{display:none}
.pill,.pill-good,.pill-full,.pill-over,.pill-neutral{background:var(--surface-2);color:var(--text-2);box-shadow:inset 0 0 0 1px var(--border)}
.pill-good::before,.pill-full::before{background:var(--dot-pos)}.pill-over::before{background:var(--dot-neg)}.pill-neutral::before{background:var(--border-strong)}
.hs-in,.hs-out{background:var(--surface-3)}.hs-in{color:var(--good)}.hs-out{color:var(--bad)}
.hero-side{background:transparent}


/* ---------- Barras das dívidas (20 blocos de 5%) ---------- */
.dm { display: grid; gap: .4rem; }
.dm-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .82rem; color: var(--muted); }
.dm-txt b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.dm-pct { font-size: .95rem; font-weight: 750; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.dm-blocks { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; height: 12px; }
.dm-b { border-radius: 3px; background: var(--surface-3); }
.dm-b.on { background: var(--text); animation: dmBlock .3s ease both; }
.dm-big .dm-blocks { height: 16px; gap: 4px; }
.dm-big .dm-pct { font-size: 1.1rem; }
@keyframes dmBlock { from { opacity: 0; transform: scaleY(.4); } }
/* No cartão escuro do topo: branco sobre translúcido */
.panel-hero .dm-head, .panel-hero .dm-txt { color: var(--hero-muted); }
.panel-hero .dm-txt b, .panel-hero .dm-pct { color: #fff; }
.panel-hero .dm-b { background: rgba(255,255,255,.14); }
.panel-hero .dm-b.on { background: #fff; }
.panel-hero .dm { margin-top: 1.1rem; }
/* Cartões das dívidas mais limpos */
.debt-card { display: grid; gap: .7rem; }
.debt-bal { font-size: 1.45rem; }
.pill-focus { background: var(--text); color: var(--surface); box-shadow: none; }
.pill-focus::before { background: var(--dot-warn); }

/* ---------- Metas (2.9.0) ---------- */
.gcards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.gcard { position: relative; display: grid; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, box-shadow .2s; }
.gcard:hover { border-color: var(--border-strong); }
.gcard-main { display: grid; gap: .7rem; text-align: left; font: inherit; color: inherit; background: none; border: 0; padding: 1rem 1rem .8rem; cursor: pointer; }
.gcard-top { display: flex; align-items: center; gap: .7rem; }
.gcard-ico { position: relative; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.gcard-title { display: grid; flex: 1; min-width: 0; }
.gcard-title strong { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard-title small { font-size: .78rem; color: var(--muted); }
.gcard-num { font-size: 1.45rem; font-weight: 750; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.gcard-num small { font-size: .84rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.gcard-lines { display: grid; gap: .25rem; font-size: .84rem; color: var(--text-2); }
.gcard-lines b { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.gcard-lines em { font-style: normal; font-weight: 600; }
.pos-txt { color: var(--good); }
.gcard-prio { font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 6px; background: var(--text); color: var(--surface); }
.gcard-prio-line { font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.gcard-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .7rem 1rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.gcard-linked { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--text-2); font-weight: 550; }
.gcard-linked .ico { width: 15px; height: 15px; }
/* blocos a vermelho quando passa do limite */
.dm-over .dm-b.on { background: var(--mark-over); }
.dm-over .dm-pct { color: var(--mark-over); }
/* gastar menos: mês a mês */
.gm-months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.gm-m { display: grid; gap: 3px; justify-items: center; }
.gm-m i { width: 100%; height: 12px; border-radius: 3px; background: var(--surface-3); }
.gm-m small { font-size: .62rem; color: var(--muted); font-weight: 600; }
.gm-ok i { background: var(--text); }
.gm-over i { background: var(--mark-over); }
.gm-future i { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
/* fundo de emergência em meses */
.efm { display: grid; gap: .45rem; margin: .8rem 0 .2rem; }
.efm-blocks { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; }
.efm-b { display: grid; gap: 4px; justify-items: center; }
.efm-b > i { display: block; justify-self: stretch; height: 18px; border-radius: 5px; }
.efm-b > i { background: linear-gradient(var(--text), var(--text)) no-repeat left / var(--w, 0%) 100%, var(--surface-3); }
.efm-b small { font-size: .66rem; font-weight: 600; color: var(--muted); }
.panel-hero .efm .dm-head, .panel-hero .efm .dm-txt { color: var(--hero-muted); }
.panel-hero .efm .dm-txt b, .panel-hero .efm .dm-pct { color: #fff; }
.panel-hero .efm-b small { color: var(--hero-muted); }
/* nova meta: escolher o tipo */
.goal-choose { display: grid; gap: .6rem; }
.gc-opt { display: flex; gap: .85rem; align-items: center; text-align: left; font: inherit; color: inherit; padding: .9rem 1rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.gc-opt:hover, .gc-opt:focus-visible { border-color: var(--text); }
.gc-opt span:last-child { display: grid; gap: .1rem; }
.gc-opt small { color: var(--muted); font-size: .84rem; }
.gc-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; background: var(--surface-2); flex: 0 0 auto; }
/* histórico e ligação (janela da meta) */
.goal-extras { display: grid; gap: .8rem; margin-top: .4rem; }
.gx-block { border: 1px solid var(--border); border-radius: 12px; padding: .75rem .85rem; display: grid; gap: .55rem; }
.gx-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.gx-link { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .88rem; }
.gx-link .ico { width: 15px; height: 15px; }
.gx-list { list-style: none; margin: 0; padding: 0; display: grid; max-height: 240px; overflow: auto; }
.gx-list li { display: grid; grid-template-columns: auto 1fr auto auto; gap: .6rem; align-items: center; padding: .4rem 0; border-top: 1px solid var(--border); font-size: .86rem; }
.gx-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.gx-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gx-note small { color: var(--muted); }
.gx-list strong { font-variant-numeric: tabular-nums; }
.gx-del { width: 28px; height: 28px; }
.gspark { width: 100%; height: 64px; display: block; }
.gspark-line { fill: none; stroke: var(--text); stroke-width: 2; vector-effect: non-scaling-stroke; }
.gspark-area { fill: color-mix(in srgb, var(--text) 7%, transparent); }
.gspark-target { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
/* marcos: 25/50/75% e meta conseguida */
.gcard-halo { position: absolute; inset: -2px; border-radius: 14px; border: 3px solid var(--text); opacity: 0; pointer-events: none; }
.gc-celebrate { animation: gcGlow 1.6s ease-out 1; }
.gc-celebrate .gcard-halo { animation: gcHalo 1s ease-out 2; }
.gc-celebrate .dm-b.on { animation: gcBlocks .5s ease-in-out 2; }
.gc-done .gcard-halo { border-color: var(--mark-full); }
.gc-done { animation: gcGlowDone 1.8s ease-out 1; }
@keyframes gcHalo { from { transform: scale(1); opacity: .7; } to { transform: scale(1.9); opacity: 0; } }
@keyframes gcGlow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--text) 30%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
@keyframes gcGlowDone { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mark-full) 55%, transparent); border-color: var(--mark-full); } 100% { box-shadow: 0 0 0 18px transparent; } }
@keyframes gcBlocks { 50% { transform: scaleY(1.35); } }
@media (max-width: 640px) { .gcards { grid-template-columns: 1fr; } }
.panel-hero .efm-b > i { background: linear-gradient(#fff, #fff) no-repeat left / var(--w, 0%) 100%, rgba(255,255,255,.14); }
.gm-now i { background: transparent; box-shadow: inset 0 0 0 2px var(--text); }

/* ---------- Definições (2.10.0) ---------- */
.cfg-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.cfg-nav { position: sticky; top: 76px; display: grid; gap: .2rem; padding: .4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.cfg-nav-a { display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem; border-radius: 10px; text-decoration: none; color: var(--text-2); font-weight: 550; font-size: .92rem; }
.cfg-nav-a .ico { width: 18px; height: 18px; color: var(--muted); }
.cfg-nav-a:hover { background: var(--surface-2); color: var(--text); }
.cfg-nav-a.active { background: var(--text); color: var(--surface); }
.cfg-nav-a.active .ico { color: var(--surface); }
.cfg-body { min-width: 0; }
.cfg-card h2 { margin-bottom: .25rem; }
.cfg-desc { margin: 0 0 .9rem; }
.cfg-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--border); }
.cfg-card > .cfg-row:first-of-type, .cfg-desc + .cfg-row { border-top: 0; padding-top: .2rem; }
.cfg-row-txt { display: grid; gap: .1rem; min-width: 0; }
.cfg-row-txt strong { font-weight: 600; }
.cfg-row-txt small { color: var(--muted); font-size: .82rem; }
.cfg-row-ctl { flex: 0 0 auto; display: flex; align-items: center; gap: .5rem; }
.cfg-row-ctl .seg { margin: 0; }
.cfg-row-ctl .in, .cfg-row-ctl select { min-width: 9rem; }
.cfg-example { margin: .6rem 0 0; padding: .7rem .85rem; border-radius: 10px; background: var(--surface-2); font-size: .88rem; color: var(--text-2); }
.cfg-tip { display: flex; align-items: center; gap: .4rem; margin: 0; }
.cfg-tip .ico { width: 16px; height: 16px; flex: 0 0 auto; }
.cfg-form { display: grid; gap: .7rem; }
.cfg-form .btn { justify-self: start; }
/* interruptor */
.switch { position: relative; width: 44px; height: 26px; border-radius: 99px; border: 0; padding: 0; background: var(--border-strong); cursor: pointer; transition: background .2s; flex: 0 0 auto; }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s cubic-bezier(.3,.7,.3,1); }
.switch.on { background: var(--text); }
.switch.on .switch-knob { transform: translateX(18px); }
[data-theme="dark"] .switch.on .switch-knob { background: #111; }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* modelos de distribuição */
.tpl-wrap { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 1.25rem; align-items: center; }
.tpl-ring { display: grid; gap: .5rem; justify-items: center; }
.tpl-ring .lc-wrap { width: 160px; }
.tpl-sum { margin: 0; font-size: .84rem; font-weight: 650; }
.tpl-sum.ok { color: var(--good); }
.tpl-sum.bad { color: var(--bad); }
.tpl-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.tpl { display: grid; gap: .2rem; text-align: left; font: inherit; color: inherit; padding: .75rem .85rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.tpl:hover { border-color: var(--border-strong); }
.tpl.on { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.tpl small { color: var(--muted); font-size: .8rem; line-height: 1.35; }
.tpl-bar { display: flex; gap: 2px; height: 6px; margin-top: .35rem; border-radius: 99px; overflow: hidden; }
.tpl-bar i { display: block; height: 100%; }
/* arrastar categorias */
.cat-chip[draggable="true"] { cursor: grab; }
.cat-chip.dragging { opacity: .4; }
.cat-chip small { color: var(--muted); font-weight: 500; }
.cfg-drop { border-radius: 12px; transition: background .15s, box-shadow .15s; min-height: 2.6rem; }
.is-dragging .cfg-drop { box-shadow: inset 0 0 0 1px dashed var(--border-strong); background: var(--surface-2); }
.cfg-drop.drop-into { box-shadow: inset 0 0 0 2px var(--text); background: var(--surface-2); }
.cat-chip.drop-before { box-shadow: -3px 0 0 0 var(--text); }
.cat-move { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
/* regras automáticas */
.rules-list { display: grid; gap: .5rem; margin-bottom: .6rem; }
.rule-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: .5rem; align-items: center; }
.rule-if, .rule-then { font-size: .84rem; color: var(--muted); white-space: nowrap; }
/* sessões e segurança */
.sess-list { display: grid; }
.sess { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-top: 1px solid var(--border); }
.sess:first-child { border-top: 0; }
.sess-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); flex: 0 0 auto; }
.sess-txt { display: grid; flex: 1; min-width: 0; }
.sess-txt small { color: var(--muted); font-size: .8rem; }
.totp-setup { display: grid; gap: .8rem; }
.totp-steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .55rem; font-size: .9rem; }
.totp-key { list-style: none; margin-left: -1.2rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.totp-key code { font-size: 1rem; letter-spacing: .08em; padding: .45rem .7rem; }
.totp-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.otp-input { font-size: 1.3rem; letter-spacing: .25em; text-align: center; max-width: 11rem; font-variant-numeric: tabular-nums; }
.codes { margin-top: .9rem; padding: .9rem; border-radius: 12px; border: 1px dashed var(--border-strong); background: var(--surface-2); display: grid; gap: .6rem; }
.codes p { margin: 0; font-size: .88rem; }
.codes-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
.codes-grid code { text-align: center; font-size: .92rem; padding: .35rem; background: var(--surface); }
/* importar extrato */
.csv-drop { display: grid; justify-items: center; gap: .3rem; padding: 1.6rem 1rem; border-radius: 14px; border: 2px dashed var(--border-strong); cursor: pointer; text-align: center; color: var(--text-2); transition: border-color .15s, background .15s; }
.csv-drop:hover, .csv-drop.over { border-color: var(--text); background: var(--surface-2); }
.csv-drop .ico { width: 26px; height: 26px; }
.csv-drop small { color: var(--muted); }
.csv-imp { display: grid; gap: .8rem; }
.csv-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.csv-head .btn { margin-left: auto; }
.csv-map { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; }
.csv-opts { display: grid; gap: .3rem; font-size: .88rem; }
.csv-opts .check { display: flex; gap: .45rem; align-items: center; }
.csv-prev td { font-size: .84rem; }
.csv-go { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; padding-top: .3rem; border-top: 1px solid var(--border); }
/* mês financeiro no título do mês */
.month-period { display: block; width: 100%; text-align: center; font-size: .76rem; font-weight: 600; color: var(--muted); }
.month-title { flex-wrap: wrap; justify-content: center; }
/* modo privado */
[data-theme] .only-private { display: none; }
[data-private] .only-private { display: inline; }
[data-private] .only-public { display: none; }
[data-private] #privBtn { color: var(--text); background: var(--surface-2); }
[data-private] input[inputmode="decimal"] { filter: blur(5px); }
[data-private] input[inputmode="decimal"]:focus { filter: none; }
@media (max-width: 860px) {
  .cfg-layout { grid-template-columns: minmax(0, 1fr); }
  .cfg-nav { position: static; display: flex; overflow-x: auto; gap: .3rem; scrollbar-width: none; }
  .cfg-nav-a { flex: 0 0 auto; padding: .5rem .75rem; font-size: .86rem; }
  .tpl-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .tpl-list { grid-template-columns: minmax(0, 1fr); width: 100%; }
  .csv-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .codes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule-row { grid-template-columns: minmax(0, 1fr) auto; }
  .rule-row .rule-if, .rule-row .rule-then { display: none; }
  .cfg-row { flex-wrap: wrap; }
}
.cfg-body .group-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem; }
.cfg-body .group-edit .grow { grid-column: 1 / -1; }
.cfg-body .group-edit .w-pct { width: auto; }
.totp > .cfg-row:first-child { border-top: 0; padding-top: .2rem; }
.csv-map { align-items: end; }
/* telemóveis estreitos: o tema muda-se em Definições → Aparência (o botão do modo privado fica no topo) */
@media (max-width: 480px) { #themeBtn { display: none; } }

/* ---------- 2.11: privacidade, RGPD e segurança ---------- */
.simple-foot { text-align: center; font-size: .8rem; color: var(--text-3, var(--text-2)); padding: 0 1rem 2rem; }
.simple-foot a { color: inherit; }
.simple-foot a:hover { color: var(--text); }
.legal { max-width: 720px; margin: 0 auto; line-height: 1.6; font-size: .95rem; }
.legal h1 { font-size: 1.6rem; margin-bottom: .2rem; }
.legal h2 { font-size: 1.05rem; margin: 1.8rem 0 .4rem; }
.legal p, .legal li { color: var(--text-2); }
.legal ul { padding-left: 1.2rem; display: grid; gap: .25rem; }
.legal table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: .5rem 0; }
.legal th, .legal td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.check-line { display: flex; gap: .55rem; align-items: flex-start; font-size: .9rem; margin: .6rem 0; cursor: pointer; }
.check-line input { margin-top: .2rem; accent-color: var(--text); }
fieldset.choice { border: 1px solid var(--border); border-radius: 12px; padding: .4rem .9rem .2rem; margin: .8rem 0; }
fieldset.choice legend { font-size: .82rem; color: var(--text-2); padding: 0 .3rem; }
.admin-grid { align-items: start; }

.app-banners:empty { display: none; }
.app-banners { display: grid; gap: .5rem; margin: 1rem 1rem 0; }
@media (min-width: 900px) { .app-banners { margin: 1rem 1.5rem 0; } }
.banner { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; padding: .65rem .85rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: .88rem; }
.banner-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text); flex: none; }
.banner-warn .banner-dot { background: #ff1744; box-shadow: 0 0 0 3px rgba(255, 23, 68, .15); }
.banner-txt { flex: 1 1 260px; color: var(--text-2); }
.banner-txt strong { color: var(--text); }

.totp-qr { width: 176px; height: 176px; padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.totp-qr svg { width: 100%; height: 100%; display: block; }
@media (min-width: 640px) { .totp-setup { grid-template-columns: auto 1fr; align-items: start; column-gap: 1.2rem; } .totp-setup .totp-qr { grid-row: span 2; } }

.act-list { display: grid; }
.act { display: flex; gap: .7rem; align-items: flex-start; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.act:last-child { border-bottom: 0; }
.act-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong, #999); margin-top: .45rem; flex: none; }
.act-warn .act-dot { background: #ff1744; }
.act-txt { display: grid; gap: .1rem; min-width: 0; }
.act-txt strong { font-size: .88rem; font-weight: 600; }
.act-txt small { color: var(--text-2); font-size: .78rem; overflow-wrap: anywhere; }

.choices { display: grid; gap: .5rem; margin-bottom: .4rem; }
.choice { display: flex; gap: .6rem; align-items: flex-start; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--text); }
.choice input { margin-top: .25rem; accent-color: var(--text); }
.choice span { display: grid; gap: .1rem; }
.choice small { color: var(--text-2); font-size: .8rem; }
.gdpr-status:empty { display: none; }
.form label.check-line { display: flex; flex-direction: row; gap: .6rem; align-items: flex-start; font-weight: 400; color: var(--text); margin: .2rem 0; }
.form label.check-line input { width: 18px; height: 18px; min-height: 0; padding: 0; margin: .15rem 0 0; flex: none; box-shadow: none; accent-color: var(--text); }
.form label.check-line small { margin-left: .2rem; }
.form fieldset.choice { display: grid; gap: .5rem; padding: .5rem .9rem .8rem; }
.chip-ghost { opacity: .35; }
.chip-chosen { box-shadow: 0 0 0 2px var(--text); }
.chip-drag { transform: rotate(-2deg); }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- 3.1: páginas de autenticação (cartão central sobre grelha de pontos) ---------- */
.auth-page { margin: 0; min-height: 100vh; background-color: var(--bg);
  background-image: radial-gradient(color-mix(in srgb, var(--text) 9%, transparent) 1px, transparent 1px); background-size: 22px 22px; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; box-sizing: border-box; }
.auth-card { width: 100%; max-width: 420px; box-sizing: border-box; background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  padding: 2.4rem 2.2rem; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 24px 60px -24px rgba(0,0,0,.18); outline: none; }
.auth-top { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1.1rem; margin-bottom: 1.6rem; }
.auth-mark { width: 52px; height: 52px; color: var(--text); display: inline-flex; }
.auth-mark svg { width: 100%; height: 100%; }
.auth-badge { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); color: var(--text); display: grid; place-items: center; }
.auth-badge svg { width: 28px; height: 28px; }
.auth-top h1 { font-size: 1.55rem; letter-spacing: -.025em; margin: 0; }
.auth-sub { color: var(--muted); margin: .4rem 0 0; }
.auth-card .alert { margin: 0 0 1rem; }
.auth-form { display: grid; gap: 1rem; }
.auth-field { display: grid; gap: .4rem; }
.auth-label { font-size: .82rem; font-weight: 600; color: var(--text-2); display: flex; justify-content: space-between; align-items: baseline; }
.auth-label a { font-weight: 500; color: var(--muted); text-decoration: none; }
.auth-label a:hover { color: var(--text); }
.auth-input { position: relative; display: flex; align-items: center; }
.auth-input .ico { position: absolute; left: .85rem; width: 18px; height: 18px; color: var(--muted); pointer-events: none; display: flex; }
.auth-input .ico svg { width: 100%; height: 100%; }
.auth-input input { width: 100%; box-sizing: border-box; height: 48px; border: 1px solid var(--border-strong); border-radius: 12px; padding: 0 1rem 0 2.75rem;
  font: inherit; font-size: .98rem; background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.auth-input.has-eye input { padding-right: 2.9rem; }
.auth-input input:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 10%, transparent); }
.auth-eye { position: absolute; right: .45rem; width: 36px; height: 36px; border: 0; background: none; color: var(--muted); border-radius: 9px; display: grid; place-items: center; cursor: pointer; }
.auth-eye svg { width: 18px; height: 18px; }
.auth-eye:hover, .auth-eye.on { color: var(--text); background: var(--surface-2); }
.auth-check { display: flex; gap: .55rem; align-items: center; font-size: .88rem; color: var(--text-2); cursor: pointer; }
.auth-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--text); flex: none; }
.auth-check.terms { align-items: flex-start; line-height: 1.45; }
.auth-check.terms input { margin-top: .15rem; }
.auth-check a { color: var(--text); font-weight: 600; }
.auth-btn { height: 48px; border: 0; border-radius: 12px; background: var(--text); color: var(--bg); font: inherit; font-weight: 600; font-size: .98rem; cursor: pointer;
  transition: opacity .15s, transform .05s; width: 100%; }
.auth-btn:hover { opacity: .88; }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:disabled { opacity: .6; cursor: progress; }
.auth-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 22%, transparent); }
.auth-alt { text-align: center; font-size: .88rem; color: var(--muted); margin: 1.4rem 0 0; }
.auth-alt a { color: var(--text); font-weight: 600; text-decoration: none; }
.auth-note { color: var(--muted); font-size: .88rem; }
.auth-secure { display: flex; align-items: center; gap: .45rem; justify-content: center; font-size: .76rem; color: var(--muted); margin: 1.1rem 0 0; }
.auth-secure i { width: 6px; height: 6px; border-radius: 50%; background: var(--dot-pos, #00c853); display: inline-block; }
.auth-foot { margin-top: 1.6rem; font-size: .78rem; display: flex; gap: 1rem; justify-content: center; }
.auth-foot a { color: var(--muted); text-decoration: none; }
.auth-foot a:hover { color: var(--text); }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: .45rem; }
.pw-meter i { height: 4px; border-radius: 2px; background: var(--border); transition: background .2s; }
.pw-meter i.on { background: var(--text); }
.pw-meter i.on.s1 { background: var(--dot-neg, #ff1744); }
.pw-hint { font-size: .78rem; color: var(--muted); display: flex; justify-content: space-between; gap: 1rem; margin-top: .35rem; }
.pw-hint b { color: var(--text); font-weight: 600; white-space: nowrap; }
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: .5rem; }
.otp[hidden] { display: none; }
.otp input { min-width: 0; width: 100%; box-sizing: border-box; padding: 0; height: 56px; border: 1px solid var(--border-strong); border-radius: 12px; text-align: center;
  font: inherit; font-size: 1.35rem; font-weight: 700; background: var(--surface); color: var(--text); }
.otp input:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 10%, transparent); }
.otp input.filled { border-color: var(--text); }
.auth-help { margin-top: 1.2rem; padding: .85rem 1rem; border-radius: 12px; background: var(--surface-2); font-size: .84rem; color: var(--text-2); line-height: 1.5; }
.auth-help .linklike { color: var(--text); font-weight: 600; text-decoration: underline; }
.auth-back { text-align: center; margin-top: 1.1rem; }
.auth-back .linklike { color: var(--muted); font-size: .88rem; }
@media (max-width: 480px) {
  .auth-page { background-image: none; }
  .auth-wrap { justify-content: flex-start; padding-top: 2.5rem; }
  .auth-card { border: 0; box-shadow: none; padding: 1.2rem .4rem; background: transparent; }
}

/* ---------- Definições e A minha conta (3.2.0) ---------- */
.cfg-body { max-width: 820px; }
.cfg-body.stack { gap: 1.6rem; }
.cfg-group { min-width: 0; }
.cfg-group-title { font-size: .76rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 .5rem .15rem; }
.cfg-group-desc { margin: -.2rem 0 .65rem .15rem; color: var(--muted); font-size: .88rem; max-width: 62ch; }
.cfg-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cfg-list > * + * { border-top: 1px solid var(--border); }
.cfg-list > [hidden] + *, .cfg-list > *:first-child { border-top: 0; }
.cfg-list > .cfg-row, .totp > .cfg-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .9rem; padding: .85rem 1rem; border-top: 1px solid var(--border); }
.cfg-list > .cfg-row:first-child { border-top: 0; padding-top: .85rem; }
.cfg-list > .cfg-row.has-ico, .totp > .cfg-row.has-ico { grid-template-columns: 36px minmax(0, 1fr) auto; }
.cfg-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border); }
.cfg-ico .ico { width: 18px; height: 18px; }
.cfg-row.danger .cfg-ico { background: var(--bad-soft); color: var(--bad); box-shadow: none; }
.cfg-row.danger .cfg-row-txt strong { color: var(--bad); }
.cfg-row-ctl { justify-content: flex-end; flex-wrap: wrap; }
.cfg-block { padding: .9rem 1rem; min-width: 0; }
.cfg-block:empty, .cfg-block:has(> [hidden]:only-child), .cfg-block:has(> .gdpr-status:empty), .cfg-block:has(> :only-child:empty) { display: none; }
.cfg-indent { padding-left: calc(1rem + 36px + .9rem); background: var(--surface-2); }
.cfg-flush { padding: 0; }
.totp > .cfg-row:first-child { border-top: 0; }
.totp > :not(.cfg-row) { margin: 0 1rem 1rem calc(1rem + 36px + .9rem); }
.cfg-flush > .panel, .cfg-flush > .cfg-card { border: 0; box-shadow: none; border-radius: 0; }
.cfg-pair { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.cfg-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem; align-items: end; }
.cfg-form-actions { grid-column: 1 / -1; display: flex; gap: .5rem; justify-content: flex-end; }
.cfg-foot { margin: .55rem 0 0 .15rem; font-size: .82rem; color: var(--muted); }
.cfg-body .grid-2:not(.cfg-groups) { grid-template-columns: 1fr; }
.cfg-groups { padding: 0; }
.act-more { margin-top: .6rem; }
@media (max-width: 640px) {
  .cfg-list > .cfg-row, .cfg-list > .cfg-row.has-ico, .totp > .cfg-row.has-ico { grid-template-columns: 36px minmax(0, 1fr); }
  .cfg-list > .cfg-row:not(.has-ico) { grid-template-columns: 1fr; }
  .cfg-list > .cfg-row > .cfg-row-ctl { grid-column: 1 / -1; justify-content: flex-start; }
  .cfg-list > .cfg-row.has-ico > .cfg-row-ctl { grid-column: 2; }
  .cfg-indent { padding-left: 1rem; }
  .cfg-form-actions { justify-content: stretch; }
  .cfg-form-actions .btn { flex: 1; }
}

/* A minha conta */
.acc { max-width: 820px; }
.acc.stack { gap: 1.6rem; }
.acc-profile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .4rem 1rem; align-items: center; padding: 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.acc-avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--text); color: var(--surface); font-weight: 700; font-size: 1.2rem; letter-spacing: .02em; }
.acc-who { display: grid; gap: .15rem; min-width: 0; }
.acc-who strong { font-size: 1.15rem; font-weight: 650; }
.acc-who small { color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; }
.acc-chips { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .35rem; }
.acc-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .6rem; border-radius: 99px; font-size: .76rem; font-weight: 600; color: var(--text-2); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.acc-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.acc-chip i.on { background: var(--dot-pos, #00c853); }
.acc-chip.warn i { background: var(--dot-neg, #ff1744); }
.acc-group-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: .1rem; }
.acc-group-head .cfg-group-desc { margin-bottom: .65rem; }
.acc-group-head .btn { margin-bottom: .65rem; flex: 0 0 auto; }
.acc-year-row { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) auto; align-items: center; gap: .9rem; padding: .8rem 1rem; }
.acc-year-n { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.acc-year-meta { color: var(--muted); font-size: .86rem; min-width: 0; }
.acc-year-act { display: flex; gap: .35rem; align-items: center; }
.acc-year-act .ico { width: 16px; height: 16px; }
.acc-year-act .icon-btn { width: 34px; height: 34px; }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-soft); }
.acc-del { padding: .2rem 1rem 1rem calc(1rem + 4.2rem + .9rem); }
.acc-del p { margin: 0 0 .55rem; color: var(--text-2); }
.acc-del-row { display: flex; gap: .45rem; flex-wrap: wrap; }
.acc-del-row .in { width: 7rem; }
.acc-new { background: var(--surface-2); }
.acc-new .acc-form { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: .7rem; align-items: end; }
.acc-new .fld { display: grid; gap: .3rem; }
.acc-form-actions { grid-column: 1 / -1; display: flex; gap: .5rem; justify-content: flex-end; }
@media (max-width: 640px) {
  .acc-profile { grid-template-columns: auto minmax(0, 1fr); }
  .acc-profile > .btn { grid-column: 1 / -1; justify-self: start; }
  .acc-chips { grid-column: 1 / -1; }
  .acc-year-row { grid-template-columns: 3.6rem minmax(0, 1fr); }
  .acc-year-act { grid-column: 1 / -1; }
  .acc-del { padding-left: 1rem; }
  .acc-new .acc-form { grid-template-columns: 1fr; }
}
.cfg-groups + .cfg-list { margin-top: 1rem; }
@media (max-width: 640px) {
  .cfg-list > .cfg-row.has-ico:has(> .cfg-row-ctl > :only-child:is(.switch, .btn-ghost)) { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .cfg-list > .cfg-row.has-ico:has(> .cfg-row-ctl > :only-child:is(.switch, .btn-ghost)) > .cfg-row-ctl { grid-column: 3; }
  .acc-profile > .btn { order: 5; }
  .acc-year-act { grid-column: 2; }
}

/* 3.2.1 — metas em linha e grupos a toda a largura */
.cfg-pair { gap: .5rem 1.1rem; }
.cfg-pair .fld { display: flex; align-items: center; gap: .5rem; margin: 0; width: auto; }
.cfg-pair .fld-label { font-weight: 600; color: var(--text-2); }
.cfg-pair .in-wrap .in { flex: 0 0 auto; width: 5rem; min-width: 0; text-align: right; }
.cfg-body .cfg-groups { grid-template-columns: 1fr; gap: .75rem; }
.cfg-body .group-card { padding: 1rem 1.1rem 1rem 1.35rem; overflow: hidden; }
.cfg-body .group-card::before { left: 0; right: auto; top: 0; bottom: 0; width: 4px; height: auto; border-radius: 0; }
.cfg-body .group-edit { grid-template-columns: minmax(0, 1fr) 10rem 8rem; align-items: end; margin-bottom: .85rem; }
.cfg-body .group-edit .grow { grid-column: auto; }
.cfg-body .group-edit .fld { margin: 0; }
@media (max-width: 640px) {
  .cfg-body .group-edit { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cfg-body .group-edit .grow { grid-column: 1 / -1; }
  .cfg-list > .cfg-row:has(.cfg-pair) > .cfg-row-ctl { grid-column: 2; }
}

/* ---------- Animações (3.3.0) ---------- */
:root { --ease-out: cubic-bezier(.2, .7, .3, 1); --ease-spring: cubic-bezier(.34, 1.56, .64, 1); }
/* entrada dos ecrãs, em cascata */
@keyframes mIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.m-in { animation: mIn .38s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 35ms); }
/* barras a encher ao abrir */
@keyframes mGrowX { from { transform: scaleX(0); } }
.m-enter .bar-fill, .m-enter .hbar-real, .m-enter .hbar-plan, .m-enter .tpl-bar i, .m-enter .pvr-bar > *, .m-enter .efm-b > i {
  transform-origin: left center; animation: mGrowX .7s var(--ease-out) both; animation-delay: .12s;
}
/* lançamentos: novo, pago, apagado */
@keyframes mNew { 0% { opacity: 0; transform: translateX(-10px); background: var(--accent-soft); } 30% { opacity: 1; transform: none; } 100% { background: transparent; } }
.item.m-new { animation: mNew 1.4s var(--ease-out); }
@keyframes mPop { 0% { transform: scale(1); } 35% { transform: scale(1.28); } 100% { transform: scale(1); } }
.check.m-pop { animation: mPop .38s var(--ease-spring); }
.item.m-out { overflow: hidden; opacity: 0; transform: translateX(14px); min-height: 0; border-bottom-color: transparent;
  transition: height .22s var(--ease-out), opacity .18s, transform .22s var(--ease-out); }
/* botões: resposta ao toque */
.btn, .icon-btn, .cat-chip, .tpl, .kpi-btn, .side-nav a, .cfg-nav-a, .seg button, .check { transition: background .12s, border-color .12s, color .12s, transform .12s var(--ease-out), box-shadow .12s; }
.btn:active:not(:disabled), .icon-btn:active, .cat-chip:active, .tpl:active, .seg button:active, .check:active { transform: scale(.96); }
.side-nav a:active, .cfg-nav-a:active { transform: scale(.98); }
/* menus e janelas */
@keyframes mPopIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
.usermenu[open] .usermenu-panel { transform-origin: top right; animation: mPopIn .16s var(--ease-out); }
@keyframes mZoomIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.palette { animation: mZoomIn .18s var(--ease-out); }
.sheet-overlay.open .sheet .sheet-body > * { animation: mIn .3s var(--ease-out) both; }
.sheet-overlay.open .sheet .sheet-body > :nth-child(2) { animation-delay: .03s; }
.sheet-overlay.open .sheet .sheet-body > :nth-child(3) { animation-delay: .06s; }
.sheet-overlay.open .sheet .sheet-body > :nth-child(n+4) { animation-delay: .09s; }
.acc-del:not([hidden]), .acc-new:not([hidden]), .cfg-form-row:not([hidden]), .act-more-box { animation: mIn .25s var(--ease-out); }
.toast { transition: transform .28s var(--ease-spring), opacity .2s; }
/* troca de tema */
.theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after {
  transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease, stroke .35s ease, box-shadow .35s ease !important;
}
/* animações reduzidas */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion]) .m-in, :root:not([data-motion]) .item.m-new, :root:not([data-motion]) .check.m-pop { animation: none; }
}
[data-motion="reduce"] .btn:active, [data-motion="reduce"] .icon-btn:active, [data-motion="reduce"] .cat-chip:active { transform: none; }

/* ---------- Menu da conta e menu «Mais» (3.4.0) ---------- */
.usermenu-panel { min-width: 320px; padding: .45rem; }
.usermenu-head { display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem .7rem; margin-bottom: .3rem; border-bottom: 1px solid var(--border); }
.avatar-lg { width: 40px; height: 40px; font-size: 1rem; background: var(--text); color: var(--surface); }
.usermenu-head .usermenu-name { padding: 0; border: 0; margin: 0; font-weight: 650; min-width: 0; }
.usermenu-head .usermenu-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu-panel a > span, .usermenu-panel button > span { display: grid; gap: .05rem; }
.usermenu-panel a small { color: var(--muted); font-size: .78rem; font-weight: 400; }
.usermenu-panel a, .usermenu-panel button { align-items: flex-start; }
.usermenu-panel a .ico, .usermenu-panel button .ico { margin-top: .1rem; }
.usermenu-sep { height: 1px; background: var(--border); margin: .3rem .2rem; }
.more-sec { margin: .9rem .2rem .25rem; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.more-sec:first-child { margin-top: .1rem; }

/* ---------- Administração (3.4.0) ---------- */
.page-simple .simple-wide:has(.adm) { max-width: 1180px; }
.adm { margin-top: .25rem; }
.adm-nav-title { margin: .35rem .7rem .4rem; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.adm-nav .cfg-nav-a { position: relative; }
.adm-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--dot-neg, #ff1744); color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center; }
.adm-body { min-width: 0; display: grid; gap: 1.6rem; align-content: start; }
.adm-body > .view-head { margin: 0; }
.adm-body .cfg-group { max-width: none; }
.adm-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.6rem; align-items: start; }
/* números */
.adm-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.adm-stat { display: grid; gap: .2rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.adm-stat > span { display: flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.adm-stat > span .ico { width: 16px; height: 16px; }
.adm-stat strong { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.adm-stat small { color: var(--muted); font-size: .8rem; }
/* estados nas linhas */
.cfg-row.adm-ok .cfg-ico { background: color-mix(in srgb, var(--dot-pos, #00c853) 14%, transparent); color: var(--good); box-shadow: none; }
.cfg-row.adm-warn .cfg-ico { background: var(--warn-soft, #fff7e6); color: var(--warn, #b45309); box-shadow: none; }
.cfg-row.adm-bad .cfg-ico { background: var(--bad-soft); color: var(--bad); box-shadow: none; }
.cfg-row-ctl form { display: inline-flex; margin: 0; }
.adm-tag { font-style: normal; font-size: .68rem; font-weight: 650; padding: .08rem .45rem; border-radius: 99px; background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border); vertical-align: 2px; margin-left: .25rem; }
.adm-tag.dark { background: var(--text); color: var(--surface); box-shadow: none; }
/* atividade */
.adm-ev { display: flex; gap: .75rem; align-items: flex-start; padding: .7rem 1rem; }
.adm-ev-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); margin-top: .45rem; flex: 0 0 auto; }
.adm-ev-dot.bad { background: var(--dot-neg, #ff1744); }
.adm-ev-txt { display: grid; gap: .1rem; min-width: 0; }
.adm-ev-txt strong { font-weight: 600; font-size: .92rem; }
.adm-ev-txt small { color: var(--muted); font-size: .8rem; }
/* utilizadores */
.adm-tools { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; justify-content: space-between; margin-bottom: -.8rem; }
.adm-search { position: relative; flex: 1 1 260px; max-width: 380px; }
.adm-search .ico { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.adm-search .in { padding-left: 2.4rem; width: 100%; }
.adm-tools .seg-btn small { color: var(--muted); font-weight: 600; margin-left: .2rem; }
.adm-users { overflow: visible; }
.adm-u { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr) 4rem minmax(0, 1fr) 44px; gap: .9rem; align-items: center; padding: .7rem 1rem; }
.adm-u[hidden] { display: none; }
.adm-u-head { padding-top: .6rem; padding-bottom: .6rem; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.adm-u-who { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.adm-u-who > span:last-child { display: grid; gap: .1rem; min-width: 0; }
.adm-u-who strong { font-weight: 600; }
.adm-u-who small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-u.off .adm-u-who strong, .adm-u.off .avatar { opacity: .55; }
.adm-u-st { display: inline-flex; align-items: center; gap: .45rem; font-size: .88rem; color: var(--text-2); }
.adm-u-st > i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.adm-u-st > i.on { background: var(--dot-pos, #00c853); }
.adm-2fa .ico { width: 15px; height: 15px; color: var(--muted); vertical-align: -2px; }
.adm-u-n, .adm-u-last { font-size: .88rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.row-menu { position: relative; justify-self: end; }
.row-menu > summary { list-style: none; cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 250px; padding: .35rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); display: grid; transform-origin: top right; animation: mPopIn .14s var(--ease-out, ease); }
.row-menu-panel form { margin: 0; }
.row-menu-panel button { display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; padding: .55rem .65rem; border: 0; background: none; border-radius: 8px; font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; }
.row-menu-panel button:hover { background: var(--surface-2); }
.row-menu-panel button .ico { width: 17px; height: 17px; color: var(--muted); }
.row-menu-panel button.danger, .row-menu-panel button.danger .ico { color: var(--bad); }
.adm-users > .adm-u:last-of-type .row-menu-panel { top: auto; bottom: calc(100% + 4px); }
.adm-temp { display: flex; gap: .9rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid color-mix(in srgb, var(--dot-pos, #00c853) 45%, var(--border)); box-shadow: var(--shadow); }
.adm-temp p { margin: .15rem 0 .6rem; font-size: .88rem; }
.adm-code { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.adm-code code { font-size: 1.15rem; padding: .35rem .7rem; background: var(--surface-2); border-radius: 8px; letter-spacing: .04em; }
.adm-inline-code { font-size: .8rem; word-break: break-all; }
[data-copy].copied { border-color: var(--dot-pos, #00c853); }
/* formulários */
.adm-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; }
.adm-form .fld { margin: 0; }
.adm-form .span-2 { grid-column: 1 / -1; }
.adm-form textarea.in { min-height: 4.5rem; resize: vertical; }
.adm-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.adm-form-foot .btn { margin-left: auto; }
.adm-form-foot .check-line { margin: 0; }

/* ---------- Atualizações ---------- */
.upd-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 1.5rem; align-items: center; padding: 1.3rem 1.4rem; border-radius: var(--radius); background: var(--text); color: var(--surface); box-shadow: var(--shadow); }
.upd-hero-main { display: flex; gap: 1rem; align-items: center; }
.upd-hero-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 12%, transparent); }
.upd-hero-ico .ico { width: 26px; height: 26px; }
.upd-hero-main small { display: block; font-size: .78rem; font-weight: 600; opacity: .7; }
.upd-hero-main strong { display: block; font-size: 2rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.upd-hero-main .muted { color: inherit; opacity: .7; font-size: .85rem; }
.upd-checks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem; }
.adm-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .65rem; border-radius: 99px; font-size: .76rem; font-weight: 600; background: color-mix(in srgb, var(--surface) 10%, transparent); }
.adm-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--dot-pos, #00c853); }
.adm-chip.bad i { background: var(--dot-neg, #ff1744); }
.upd-hero-act { grid-row: 1; grid-column: 2; }
.upd-hero-act .btn-primary { background: var(--surface); color: var(--text); }
/* zona de envio */
.upd-drop { position: relative; display: grid; justify-items: center; gap: .35rem; padding: 2rem 1rem; border: 2px dashed var(--border-strong); border-radius: 14px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.upd-drop:hover, .upd-drop.over { border-color: var(--text); background: var(--surface-2); }
.upd-drop.off { opacity: .5; cursor: not-allowed; }
.upd-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upd-drop.busy input { pointer-events: none; }
.upd-drop-ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); margin-bottom: .2rem; }
.upd-drop.over .upd-drop-ico { animation: mPop .5s var(--ease-spring, ease) infinite alternate; }
.upd-drop-ico .ico { width: 22px; height: 22px; }
.upd-drop small { color: var(--muted); }
.upd-progress { width: min(320px, 90%); height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: .4rem; }
.upd-progress i { display: block; height: 100%; width: 0; background: var(--text); transition: width .2s; }
/* pronta a instalar */
.upd-compare { display: flex; align-items: center; gap: 1.1rem; padding: 1.1rem 1.2rem; flex-wrap: wrap; }
.upd-compare > div:not(.upd-file) small { display: block; font-size: .74rem; font-weight: 600; color: var(--muted); }
.upd-compare > div:not(.upd-file) strong { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.upd-compare .new strong { color: var(--text); }
.upd-compare > div:first-child strong { color: var(--muted); }
.upd-arrow .ico { width: 22px; height: 22px; color: var(--muted); }
.upd-file { margin-left: auto; display: flex; gap: .6rem; align-items: center; padding: .55rem .8rem; border-radius: 10px; background: var(--surface-2); min-width: 0; }
.upd-file > span { display: grid; min-width: 0; }
.upd-file strong { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upd-file small { color: var(--muted); font-size: .78rem; }
.upd-warn { display: flex; gap: .5rem; align-items: center; background: var(--warn-soft, #fff7e6); color: var(--warn, #b45309); font-size: .9rem; font-weight: 600; }
.upd-warn .ico { width: 18px; height: 18px; }
.upd-notes { display: grid; gap: .8rem; }
.upd-notes-title { margin: 0; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.upd-note { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .8rem; }
.upd-note-v { font-weight: 700; font-variant-numeric: tabular-nums; }
.upd-note-v em { display: block; font-style: normal; font-size: .68rem; font-weight: 650; color: var(--warn, #b45309); }
.upd-note p { margin: 0; font-size: .9rem; color: var(--text-2); line-height: 1.55; }
.upd-go { display: flex; gap: 1rem; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; background: var(--surface-2); }
.upd-opts { display: grid; gap: .1rem; }
.upd-opts .check-line { margin: .2rem 0; }
.upd-go-btns { display: flex; gap: .5rem; margin-left: auto; }
/* resultado */
.upd-result { border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; animation: mIn .35s var(--ease-out, ease); }
.upd-result-head { display: flex; gap: .85rem; align-items: center; padding: 1rem 1.15rem; }
.upd-result-head strong { display: block; font-size: 1.05rem; }
.upd-result-head small { color: var(--muted); }
.upd-result-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--dot-pos, #00c853); }
.upd-result.bad .upd-result-ico { background: var(--dot-neg, #ff1744); }
.upd-result.ok .upd-result-ico { animation: mPop .5s var(--ease-spring, ease) .15s both; }
.upd-steps { list-style: none; margin: 0; padding: .3rem 1.15rem 1rem 1.15rem; display: grid; gap: .45rem; border-top: 1px solid var(--border); padding-top: .9rem; }
.upd-steps li { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; color: var(--text-2); }
.upd-steps li > span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: color-mix(in srgb, var(--dot-pos, #00c853) 16%, transparent); color: var(--good); margin-top: .05rem; }
.upd-steps li.bad > span { background: var(--bad-soft); color: var(--bad); }
.upd-steps li.info > span { background: var(--surface-2); color: var(--muted); }
.upd-steps li.bad { color: var(--bad); font-weight: 600; }
.upd-steps .ico { width: 13px; height: 13px; stroke-width: 2.5; }
/* a instalar */
.upd-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; background: rgba(9, 9, 11, .55); backdrop-filter: blur(4px); }
.upd-overlay[hidden] { display: none; }
.upd-overlay-card { width: min(420px, 100%); display: grid; gap: .8rem; justify-items: center; text-align: center; padding: 1.8rem 1.5rem; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); animation: mZoomIn .2s var(--ease-out, ease); }
.upd-overlay-card > small { color: var(--muted); }
@keyframes updSpin { to { transform: rotate(360deg); } }
.upd-spin { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--text); animation: updSpin .8s linear infinite; }
.upd-live { list-style: none; margin: .2rem 0; padding: 0; display: grid; gap: .5rem; text-align: left; width: 100%; }
.upd-live li { display: flex; gap: .6rem; align-items: center; font-size: .92rem; color: var(--muted); }
.upd-live li::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); flex: 0 0 auto; box-sizing: border-box; }
.upd-live li.now { color: var(--text); font-weight: 600; }
.upd-live li.now::before { border-color: var(--text); border-right-color: transparent; animation: updSpin .7s linear infinite; }
.upd-live li.done { color: var(--text-2); }
.upd-live li.done::before { border: 0; background: var(--dot-pos, #00c853) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat; }
.upd-bk .cfg-row-ctl { gap: .35rem; }
@media (max-width: 900px) {
  .adm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-two { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .adm-u-head { display: none !important; }
  .adm-u { grid-template-columns: minmax(0, 1fr) 44px; gap: .3rem .75rem; }
  .adm-u-who { grid-column: 1; }
  .row-menu { grid-column: 2; grid-row: 1; }
  .adm-u-st, .adm-u-n, .adm-u-last { grid-column: 1; padding-left: calc(36px + .75rem); font-size: .8rem; }
  .adm-u-n::before { content: "Anos: "; color: var(--muted); }
  .adm-u-last::before { content: "Último acesso: "; color: var(--muted); }
  .adm-form { grid-template-columns: 1fr; }
  .upd-hero { grid-template-columns: 1fr; }
  .upd-hero-act { grid-row: auto; grid-column: 1; }
  .upd-file { margin-left: 0; width: 100%; }
  .upd-note { grid-template-columns: 1fr; gap: .2rem; }
}
@media (max-width: 860px) {
  .adm-nav-title { display: none; }
  .adm-nav { min-width: 0; }
  .adm > * { min-width: 0; }
}
@media (max-width: 760px) {
  .adm-tools { flex-direction: column; align-items: stretch; }
  .adm-search { max-width: none; flex: 0 0 auto; }
  .adm-tools .seg { max-width: 100%; width: 100%; }
  .adm-tools .seg-btn { flex: 0 0 auto; }
  .simple-nav { gap: .5rem 1rem; }
}
.adm-body > *, .adm-tools > * { min-width: 0; }
.adm-body { grid-template-columns: minmax(0, 1fr); }

/* ---------- Dívidas: prestação no orçamento (3.5.0) ---------- */
.debt-pay { display: grid; gap: .75rem; padding: .9rem; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); margin-bottom: .2rem; }
.debt-pay-head { display: flex; gap: .7rem; align-items: center; }
.debt-pay-head > div { display: grid; gap: .1rem; min-width: 0; }
.debt-pay-head small { color: var(--muted); font-size: .82rem; }
.debt-pay-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--c-debt, #5b7083); color: #fff; flex: 0 0 auto; }
.debt-pay-ico .ico { width: 18px; height: 18px; }
.debt-pay-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: .5rem; }
.debt-pay-opt { display: grid; gap: .05rem; justify-items: start; text-align: left; padding: .65rem .75rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; transition: border-color .12s, transform .12s var(--ease-out, ease), box-shadow .12s; }
.debt-pay-opt:hover { border-color: var(--text); }
.debt-pay-opt:active { transform: scale(.97); }
.debt-pay-opt strong { font-size: .84rem; font-weight: 650; }
.debt-pay-opt span { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.debt-pay-opt small { font-size: .74rem; color: var(--muted); }
.debt-pay-opt.main { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.debt-pay-opt.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.debt-pay-opt.on small { color: inherit; opacity: .7; }
.debt-pay-other { display: flex; gap: .45rem; align-items: center; animation: mIn .2s var(--ease-out, ease); }
.debt-pay-other .in { width: 9rem; text-align: right; }
.debt-pay-other[hidden] { display: none; }
/* ano da dívida, mês a mês */
.debt-year { display: grid; gap: .4rem; padding-top: .65rem; border-top: 1px solid var(--border); }
.debt-year-head { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.debt-year-head b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.debt-months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.dm { display: grid; gap: 3px; justify-items: center; }
.dm i { width: 100%; height: 8px; border-radius: 3px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.dm small { font-size: .62rem; color: var(--muted); line-height: 1; }
.dm.paid i { background: var(--c-debt, #5b7083); box-shadow: none; }
.dm.due i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c-debt, #5b7083); }
.dm.late i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--dot-neg, #ff1744); }
.dm.now small { color: var(--text); font-weight: 700; }
.m-enter .dm.paid i { animation: mGrowX .5s var(--ease-out, ease) both; transform-origin: left; }
.debt-auto { margin: 0; font-size: .78rem; color: var(--muted); }
