/* Nossa Casa
   Direção: app doméstico calmo. Neutro frio levemente esverdeado, um acento verde-floresta,
   tipografia Figtree, números tabulares. Sem sombras pesadas, sem gradientes.
   Raios: superfícies 16px · controles 10px · pílulas (tags, filtros, check) 999px.
   Entrada/saída nunca só por cor: ícone ↑/↓ + sinal +/− + texto. */

:root {
  --bg: #f3f5f2;
  --surface: #fcfcfb;
  --surface-2: #eaeee9;
  --line: #dde2dc;
  --line-strong: #c4ccc5;
  --text: #17201b;
  --text-2: #4d5851;
  --text-3: #5b6760;

  --accent: #24583f;
  --accent-hover: #1b4632;
  --accent-soft: #e0ebe4;
  --on-accent: #fbfdfb;

  --band: #24583f;
  --band-text: #f3f7f4;
  --band-text-2: #c5d8cc;

  --in: #006b47;          /* texto de entrada (AA inclusive sobre --in-soft) */
  --in-mark: #008055;     /* barras/ícones de entrada (validado p/ daltonismo com ícone+sinal) */
  --in-soft: #dcefe5;
  --out: #17201b;         /* saída usa a tinta normal, com sinal de menos */
  --out-mark: #d9772f;
  --out-soft: #f8e7da;
  --out-icon: #ad5419;    /* ícone sobre --out-soft (3:1) */
  --field: #858f88;       /* borda de campos (3:1 sobre a superfície) */
  --on-danger: #ffffff;
  --toast-ok: #7fd6a5;
  --toast-info: #9cc2ff;

  --danger: #b3261e;
  --danger-soft: #fbe4e1;
  --info-soft: #e3ebf3;

  --focus: #1f6fd1;
  --shadow: 0 1px 2px rgb(23 32 27 / .05), 0 4px 16px -8px rgb(23 32 27 / .10);
  --shadow-pop: 0 12px 40px -12px rgb(23 32 27 / .28);

  --r-surface: 16px;
  --r-control: 10px;
  --sidebar: 248px;
  --tabbar: 64px;
  --font: "Figtree", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513;
    --surface: #181d1a;
    --surface-2: #222924;
    --line: #2a322d;
    --line-strong: #3a443e;
    --text: #e7ece8;
    --text-2: #a9b4ad;
    --text-3: #8d9991;

    --accent: #7cc49c;
    --accent-hover: #93d2ae;
    --accent-soft: #1f3329;
    --on-accent: #0d1a13;

    --band: #1b3226;
    --band-text: #eef5f0;
    --band-text-2: #a9c7b5;

    --in: #6fcf9e;
    --in-mark: #34a37c;
    --in-soft: #183327;
    --out: #e7ece8;
    --out-mark: #d9722f;
    --out-soft: #3a2518;
    --out-icon: #e58a4e;
    --field: #6b766f;
    --on-danger: #1a0b09;
    --toast-ok: #1b7a4a;
    --toast-info: #1f5fb3;

    --danger: #ff8a80;
    --danger-soft: #3b1d1a;
    --info-soft: #1d2833;

    --focus: #7ab2ff;
    --shadow: 0 1px 2px rgb(0 0 0 / .3);
    --shadow-pop: 0 16px 48px -12px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.ph, .ph-fill, .ph-bold { line-height: 1; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); color: var(--text); }
html { accent-color: var(--accent); caret-color: var(--accent); }
[id] { scroll-margin-top: 84px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: 10px 16px; border-radius: var(--r-control);
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }

/* ---------- Shell ---------- */
.shell { min-height: 100dvh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  display: flex; flex-direction: column; gap: 28px;
  padding: 24px 16px 20px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}
.brand {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 4px 8px; text-decoration: none; font-weight: 700; font-size: 1.125rem; letter-spacing: -.01em;
}
.brand__mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-size: 1.2rem;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px; border-radius: var(--r-control);
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav a i { font-size: 1.3rem; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.nav a[aria-current="page"] i { color: var(--accent); }
.nav__count {
  margin-left: auto; min-width: 24px; padding: 1px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: .8125rem; font-weight: 600; text-align: center;
}

.sidebar__user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.avatar {
  display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: .9rem;
}
.sidebar__user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sidebar__user-text a { display: inline-block; padding: 14px 0; margin: -14px 0; font-size: .8125rem; color: var(--text-3); text-decoration: none; }
.sidebar__user-text a:hover { color: var(--text); text-decoration: underline; }
.sidebar__user form { margin-left: auto; }

.main {
  margin-left: var(--sidebar);
  padding: 40px 48px 64px;
  max-width: calc(1180px + var(--sidebar));
}
.main:focus { outline: none; }

.topbar, .tabbar { display: none; }

/* ---------- Page header ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  margin-bottom: 28px;
}
.page-head h1 { font-size: 1.875rem; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin-top: 6px; color: var(--text-2); }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: -10px 0 2px;
  color: var(--text-2); text-decoration: none; font-weight: 500; font-size: .9375rem;
}
.back:hover { color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-control);
  border: 1px solid transparent; background: none;
  font-weight: 600; font-size: .9375rem; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.btn i { font-size: 1.15rem; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { background: var(--surface); border-color: var(--field); color: var(--text); }
.btn--secondary:hover { background: var(--surface-2); }
.btn--ghost { color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--danger { background: var(--danger); color: var(--on-danger); }
.btn--danger:hover { filter: brightness(.92); }
.btn--danger-quiet { color: var(--danger); }
.btn--danger-quiet:hover { background: var(--danger-soft); }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .65; cursor: progress; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-control);
  border: 0; background: none; color: var(--text-3); text-decoration: none; font-size: 1.2rem;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn--danger:hover { background: var(--danger-soft); color: var(--danger); }

.link { display: inline-block; padding: 11px 0; margin: -11px 0; color: var(--accent); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-surface);
  padding: 22px 24px;
}
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel__head h2 { font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; }
.panel__head .link { font-size: .9375rem; }

/* ---------- Tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 9px; border-radius: 999px; background: var(--surface-2);
  color: var(--text-2); font-size: .8125rem; font-weight: 500; white-space: nowrap;
}
.tag--in { background: var(--in-soft); color: var(--in); }
.tag--out { background: var(--out-soft); color: var(--text); }

/* ---------- Movimentações (lista) ---------- */
.movs { display: flex; flex-direction: column; }
.mov {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 14px;
  padding: 12px 0;
}
.mov + .mov, .movs > li + li > .mov { border-top: 1px solid var(--line); }
a.mov { text-decoration: none; border-radius: var(--r-control); }
.mov__icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; font-size: 1.1rem;
}
.mov--in .mov__icon { background: var(--in-soft); color: var(--in-mark); }
.mov--out .mov__icon { background: var(--out-soft); color: var(--out-icon); }
.mov__text { display: flex; flex-direction: column; min-width: 0; }
.mov__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mov__meta { display: flex; flex-wrap: wrap; gap: 0 10px; font-size: .875rem; color: var(--text-3); }
.mov__origem { color: var(--text-2); font-weight: 500; }
.mov__lado { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.mov__data { font-size: .8125rem; color: var(--text-3); white-space: nowrap; }
a.mov:hover .mov__title { text-decoration: underline; text-underline-offset: 3px; }
.valor { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.valor--in { color: var(--in); }
.valor--out { color: var(--out); }
.valor small { display: block; font-weight: 400; font-size: .8125rem; color: var(--text-3); }

/* ---------- Dashboard ---------- */
.saldo-band {
  padding: 26px 32px 24px; border-radius: var(--r-surface);
  background: var(--band); color: var(--band-text);
  margin-bottom: 24px;
}
.saldo-band__mes { font-size: 1.125rem; font-weight: 600; color: var(--band-text); }
.conta-mes { display: grid; grid-template-columns: 1fr 1fr 1.4fr; margin: 16px 0 0; }
.conta-mes__item { padding: 0 24px; }
.conta-mes__item:first-child { padding-left: 0; }
.conta-mes__item + .conta-mes__item { border-left: 1px solid color-mix(in srgb, var(--band-text) 22%, transparent); }
.conta-mes dt { display: flex; align-items: center; gap: 6px; color: var(--band-text-2); font-weight: 500; }
.conta-mes dd { margin: 4px 0 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.conta-mes__saldo dd { font-size: clamp(2rem, 3.4vw, 2.625rem); letter-spacing: -.03em; line-height: 1.1; }
.saldo-band__geral { margin-top: 18px; padding-top: 14px; border-top: 1px solid color-mix(in srgb, var(--band-text) 16%, transparent); color: var(--band-text-2); font-size: .9375rem; }
.saldo-band__geral strong { color: var(--band-text); font-weight: 600; }
.panel__sub { margin: -6px 0 14px; font-size: .875rem; color: var(--text-3); }
.titulo-icone { color: var(--accent); margin-right: 8px; vertical-align: -2px; }
.resumo-mensal { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.resumo-mensal th, .resumo-mensal td { padding: 9px 0; text-align: right; }
.resumo-mensal thead th { font-size: .8125rem; font-weight: 600; color: var(--text-3); padding-top: 0; }
.resumo-mensal tbody th { text-align: left; font-weight: 500; color: var(--text-2); }
.resumo-mensal tbody tr + tr > * { border-top: 1px solid var(--line); }
.resumo-mensal td { padding-left: 16px; }
.resumo-mensal__saldo > * { font-weight: 700; color: var(--text) !important; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.faltando__count { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; }
.faltando__count span { font-size: 1rem; font-weight: 500; color: var(--text-2); letter-spacing: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  font-size: .9375rem; background: var(--bg);
}

/* ---------- Barras por categoria ---------- */
.barras { display: flex; flex-direction: column; gap: 14px; }
.barra__top { display: flex; justify-content: space-between; gap: 12px; font-size: .9375rem; }
.barra__top span:first-child { font-weight: 500; }
.barra__top .num { color: var(--text-2); }
.barra__trilho { margin-top: 6px; height: 8px; }
.barra__fill { height: 100%; min-width: 4px; border-radius: 4px; background: var(--out-mark); }
.barras--in .barra__fill { background: var(--in-mark); }

/* ---------- Filtros ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.seg {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: var(--surface-2); flex-wrap: wrap;
}
.seg a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px;
  text-decoration: none; color: var(--text-2); font-weight: 500; font-size: .9375rem; white-space: nowrap;
}
.seg a:hover { color: var(--text); }
.seg a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.seg .seg__n { color: var(--text-3); font-weight: 500; }

.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; flex: 1; }
.search { position: relative; flex: 1 1 220px; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input { padding-left: 38px; }
.filtros select { flex: 0 1 190px; min-width: 160px; }
.filtros .btn { min-height: 44px; }

.mes-nav { display: flex; align-items: center; gap: 4px; }
.mes-nav h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; min-width: 11ch; text-align: center; }
.mes-nav h2::first-letter { text-transform: uppercase; }

.resumo-linha {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line); border-radius: var(--r-surface); background: var(--surface);
  margin-bottom: 20px;
}
.resumo-linha > div { padding: 16px 22px; }
.resumo-linha > div + div { border-left: 1px solid var(--line); }
.resumo-linha dt { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: .9375rem; font-weight: 500; }
.resumo-linha dd { white-space: nowrap; margin: 2px 0 0; font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.resumo-linha .ph-arrow-up { color: var(--in-mark); }
.resumo-linha .ph-arrow-down { color: var(--out-mark); }
.resumo-linha__saldo { background: var(--accent-soft); border-radius: 0 calc(var(--r-surface) - 1px) calc(var(--r-surface) - 1px) 0; }
.resumo-linha__saldo dt { color: var(--text); font-weight: 600; }
.conta { margin-bottom: 20px; }
.conta .resumo-linha { margin-bottom: 0; }
.conta__periodo { font-weight: 700; font-size: 1.0625rem; margin-bottom: 10px; }
.conta__acumulado { margin-top: 10px; font-size: .9375rem; color: var(--text-2); }
.conta__acumulado strong { color: var(--text); }
.saldo-band__nota { display: block; font-size: .8125rem; margin-top: 2px; }
.conta-mes__link { display: inline-block; padding: 11px 0; margin: -11px 0; color: inherit; text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 5px; text-decoration-color: currentColor; }
.conta-mes__link:hover { text-decoration-color: currentColor; }
.barra__link { display: inline-block; padding: 11px 0; margin: -11px 0; font-weight: 500; color: inherit;
  text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 3px; }
.barra__link:hover { text-decoration-color: currentColor; }
.conta__filtro { font-size: .875rem; color: var(--text-3); margin: -4px 0 10px; }
.hist-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 28px 0 12px; }
.lista-aviso { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; font-size: .9rem; color: var(--text-2); }
.lista-contagem { margin: 0 0 8px; font-size: .9rem; }
.hist-head h2 { font-size: 1.125rem; font-weight: 700; letter-spacing: -.01em; }
.tabela__origem { font-weight: 500; }

/* ---------- Tabela ---------- */
.tabela-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-surface); overflow: hidden; }
.tabela { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.tabela th {
  text-align: left; font-weight: 600; font-size: .8125rem; color: var(--text-3);
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.tabela td { padding: 12px 16px; vertical-align: middle; }
.tabela tbody tr + tr td { border-top: 1px solid var(--line); }
.tabela tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.tabela .col-num { text-align: right; }
.tabela .col-acoes { width: 1%; white-space: nowrap; text-align: right; }
.tabela .col-acoes form { display: inline; }
.tabela__desc { font-weight: 600; }
.tabela__obs { display: block; font-size: .8125rem; color: var(--text-3); font-weight: 400; max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-mobile { display: none; }

/* ---------- Compras ---------- */
.rapido {
  margin-bottom: 24px; padding: 20px 22px; border-radius: var(--r-surface);
  background: var(--surface); border: 1px solid var(--line);
}
.rapido__label { display: block; font-size: 1.125rem; font-weight: 700; margin-bottom: 10px; }
.rapido__linha { display: flex; gap: 10px; }
.rapido input { flex: 1; min-width: 0; min-height: 52px; font-size: 1.0625rem; }
.rapido .btn { min-height: 52px; padding: 0 20px; }
.rapido .hint { margin-top: 10px; }
.link-inline { color: var(--accent); font-weight: 600; text-underline-offset: 3px; }

.grupo + .grupo { margin-top: 22px; }
.grupo h2 { font-size: .9375rem; font-weight: 600; color: var(--text-2); margin: 0 0 8px 4px; }
.itens { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-surface); }
.item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 10px 12px 10px 14px; }
.item + .item { border-top: 1px solid var(--line); }
.item__nome { font-weight: 600; font-size: 1.0625rem; }
.item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 2px; font-size: .875rem; color: var(--text-3); }
.item__obs { margin-top: 4px; font-size: .875rem; color: var(--text-2); }
.item__acoes { display: flex; gap: 2px; }
.item--feito .item__nome { color: var(--text-3); text-decoration: line-through; text-decoration-thickness: 1px; }

.check {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px;
  border: 2px solid var(--field); background: var(--surface); color: transparent; font-size: .95rem;
  transition: border-color .15s, background-color .15s, color .15s;
}
.check-hit { display: grid; place-items: center; width: 44px; height: 44px; margin: -7px; border: 0; background: none; padding: 0; border-radius: 999px; }
.check-hit:hover .check { border-color: var(--accent); color: var(--accent); }
.check--on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check-hit:hover .check--on { background: var(--surface); color: var(--accent); }

.item__comprado { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }

/* ---------- Configurações ---------- */
.ajustes { display: flex; flex-direction: column; gap: 12px; }
.ajuste {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px; min-height: 44px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-surface);
  text-decoration: none; color: var(--text);
}
.ajuste:hover { border-color: var(--line-strong); }
.ajuste__icone { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 1.3rem; }
.ajuste__texto { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.ajuste__texto span { color: var(--text-2); font-size: .9375rem; }
.ajuste__seta { color: var(--text-3); font-size: 1.1rem; }

.cat-grupo + .cat-grupo { margin-top: 20px; }
.cat-lista { margin: 0 -24px; border-top: 1px solid var(--line); }
.cat { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 24px; }
.cat + .cat { border-top: 1px solid var(--line); }
.cat__info { display: flex; flex-direction: column; min-width: 0; }
.cat__nome { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.cat__estado { color: var(--accent); font-size: 1.1rem; }
.cat--inativa .cat__nome { color: var(--text-2); font-weight: 500; }
.cat--inativa .cat__estado { color: var(--text-3); }
.cat__uso { margin-left: 26px; font-size: .875rem; color: var(--text-3); }
.cat__acoes { display: flex; align-items: flex-start; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.cat__acoes .btn { min-height: 44px; padding: 0 12px; }
.cat__renomear > summary { list-style: none; cursor: pointer; }
.cat__renomear > summary::-webkit-details-marker { display: none; }
.cat__renomear[open] { flex-basis: 100%; order: 2; }
.cat__renomear[open] > summary { display: none; }
.cat__form, .cat-nova { display: flex; flex-direction: column; gap: 6px; }
.cat__form label, .cat-nova label { font-weight: 600; font-size: .9375rem; }
.cat__linha { display: flex; gap: 8px; }
.cat__linha input { flex: 1; min-width: 0; }
.cat-nova { margin: 0 -24px -22px; padding: 16px 24px 20px; border-top: 1px solid var(--line); }

/* ---------- Formulários ---------- */
.form-page { max-width: 640px; }
.form { display: flex; flex-direction: column; gap: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-weight: 600; font-size: .9375rem; }
.field .req { color: var(--text-3); font-weight: 500; }
.hint { font-size: .875rem; color: var(--text-3); }
.field-error { display: flex; align-items: center; gap: 6px; font-size: .875rem; color: var(--danger); font-weight: 500; }

/* :where() zera a especificidade para variações (.search, .money) sobrescreverem */
:where(input[type="text"], input[type="password"], input[type="search"], input[type="date"],
input[type="number"], select, textarea) {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--field); border-radius: var(--r-control);
  background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
:where(textarea) { min-height: 88px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--text-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--accent);
}
[aria-invalid="true"] { border-color: var(--danger) !important; }
:where(select) {
  appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.money { position: relative; }
.money span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-weight: 500; pointer-events: none; }
.money input { padding-left: 40px; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.form-tipo {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-radius: var(--r-control); font-weight: 500;
}
.form-tipo--in { background: var(--in-soft); }
.form-tipo--out { background: var(--out-soft); }
.form-tipo i { font-size: 1.3rem; }
.form-tipo--in i { color: var(--in-mark); }
.form-tipo--out i { color: var(--out-icon); }

.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.form-actions .spacer { flex: 1; }

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-control);
  background: var(--danger-soft); color: var(--danger); font-weight: 500;
}
.alert i { font-size: 1.25rem; flex: none; margin-top: 1px; }

/* ---------- Estado vazio ---------- */
.vazio {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 48px 24px; border: 1px dashed var(--line-strong); border-radius: var(--r-surface);
}
.vazio--compacto { padding: 28px 16px; border: 0; }
.vazio__icon {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 1.6rem; margin-bottom: 14px;
}
.vazio h1, .vazio h2, .vazio h3 { font-size: 1.125rem; font-weight: 700; }
.erro-page .vazio h1 { font-size: 1.625rem; letter-spacing: -.02em; }
.vazio p { margin-top: 6px; color: var(--text-2); max-width: 38ch; }
.vazio .btn, .vazio__acoes { margin-top: 18px; }
.vazio__acoes { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.vazio__acoes .btn { margin-top: 0; }

/* ---------- Relatórios ---------- */
.rel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.evolucao { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.evolucao th { text-align: left; font-weight: 600; font-size: .8125rem; color: var(--text-3); padding: 0 12px 10px 0; }
.evolucao td { padding: 10px 12px 10px 0; vertical-align: middle; }
.evolucao tbody tr + tr td { border-top: 1px solid var(--line); }
.evolucao th.mes { font-weight: 600; font-size: .9375rem; color: var(--text); white-space: nowrap; padding-top: 10px; }
.evolucao .mes::first-letter { text-transform: uppercase; }
.evolucao .col-barras { width: 50%; }
.evolucao__vazio td { font-size: .875rem; }
.evolucao .col-num { text-align: right; white-space: nowrap; }
.duo { display: flex; flex-direction: column; gap: 3px; }
.duo span { display: block; height: 8px; border-radius: 0 4px 4px 0; }
.duo .in { background: var(--in-mark); }
.duo .out { background: var(--out-mark); }
.legenda { display: flex; gap: 16px; font-size: .875rem; color: var(--text-2); }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { width: 12px; height: 8px; border-radius: 2px; display: inline-block; }
.legenda .in { background: var(--in-mark); }
.legenda .out { background: var(--out-mark); }
.bloco { margin-bottom: 24px; }
.form-extra { margin-top: 16px; }
.personalizado { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: -6px 0 20px; }
.personalizado .field { flex: 0 1 190px; }
.compras-rel { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
.compras-rel__nums { display: flex; flex-direction: column; gap: 14px; padding-right: 24px; border-right: 1px solid var(--line); }
.compras-rel__nums strong { display: block; font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.lista-simples li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; }
.lista-simples li + li { border-top: 1px solid var(--line); }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; z-index: 50; right: 24px; bottom: 24px;
  display: flex; flex-direction: column; gap: 10px; width: min(400px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px;
  border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-pop);
  font-weight: 500;
}
.toast > i { font-size: 1.3rem; flex: none; }
.toast--success > i { color: var(--toast-ok); }
.toast--error { background: var(--danger); color: var(--on-danger); }
.toast--info > i { color: var(--toast-info); }
.toast__text { flex: 1; }
.toast form { display: contents; }
.toast__acao {
  display: inline-flex; align-items: center; white-space: nowrap;
  border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
  min-height: 44px; padding: 8px 10px; border-radius: 8px;
}
.toast__fechar { border: 0; background: none; color: inherit; opacity: .7; width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; font-size: 1.1rem; }
.toast__fechar:hover, .toast__acao:hover { background: rgb(127 127 127 / .2); opacity: 1; }

/* ---------- Dialog ---------- */
.dialog {
  width: min(420px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: var(--r-surface);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
}
.dialog::backdrop { background: color-mix(in srgb, var(--text) 45%, transparent); }
.dialog h2 { font-size: 1.1875rem; font-weight: 700; }
.dialog p { margin-top: 8px; color: var(--text-2); }
.dialog__acoes { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ---------- Login ---------- */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px;
  background:
    radial-gradient(900px 480px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.login__box { width: min(400px, 100%); }
.login__head { text-align: center; margin-bottom: 28px; }
.login__mark {
  display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 18px;
  background: var(--accent); color: var(--on-accent); font-size: 2rem; margin-bottom: 18px;
}
.login__head h1 { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; }
.login__head p { margin-top: 6px; color: var(--text-2); }
.login__panel { padding: 28px; border-radius: var(--r-surface); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.senha { position: relative; }
.senha input { padding-right: 48px; }
.senha button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }

/* ---------- Erro ---------- */
.erro-page { max-width: 520px; padding-top: 40px; }
.erro-page .vazio { border-style: solid; background: var(--surface); }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .main { padding: 32px 32px 56px; }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 20; height: 60px; padding: 0 12px 0 16px;
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .brand { padding: 0; font-size: 1.0625rem; }
  .topbar__acoes { display: flex; align-items: center; gap: 10px; }
  .main { margin-left: 0; padding: 20px 16px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr);
    position: fixed; z-index: 20; inset: auto 0 0 0;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabbar a {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--text-3); text-decoration: none; font-size: .6875rem; font-weight: 600;
  }
  .tabbar a i { font-size: 1.45rem; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar__count {
    position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--accent); color: var(--on-accent); font-size: .6875rem; line-height: 18px; text-align: center;
  }
  .toasts { left: 12px; right: 12px; width: auto; top: 68px; bottom: auto; }

  .page-head { margin-bottom: 20px; }
  .page-head h1 { font-size: 1.625rem; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
  .toolbar .seg { width: 100%; border-radius: 24px; }  /* quebra em linhas em vez de rolar escondido */
  .toolbar .seg a { flex: 1 1 auto; justify-content: center; }
  .filtros { flex-basis: 100%; }
  .mes-nav h2 { min-width: 0; font-size: 1.0625rem; white-space: nowrap; }
  .toolbar:has(.mes-nav) { justify-content: space-between; row-gap: 0; }
  .toolbar:has(.mes-nav) > .btn { padding: 0 10px; }
  .filtros select { flex: 1 1 140px; min-width: 0; }

  .so-desktop { display: none; }
  .so-mobile { display: block; }
  .lista-mobile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-surface); padding: 0 14px; }
  .lista-mobile .mov { padding: 12px 2px; }
  .panel__head .legenda { display: none; }  /* as barras somem no celular; os números ficam */

  .resumo-linha > div { padding: 12px 14px; }
  .resumo-linha dd { font-size: 1.0625rem; }
  .resumo-linha dt { font-size: .8125rem; }

  .rel-grid, .compras-rel { grid-template-columns: 1fr; }
  .compras-rel__nums { flex-direction: row; gap: 32px; padding: 0 0 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .panel { padding: 18px; }
  .cat-lista { margin: 0 -18px; }
  .cat { padding: 10px 18px; }
  .cat-nova { margin: 0 -18px -18px; padding: 14px 18px 18px; }
  .saldo-band { padding: 22px 20px 20px; }
  .conta-mes { grid-template-columns: 1fr 1fr; row-gap: 16px; }
  .conta-mes__saldo { grid-column: 1 / -1; padding-left: 0 !important; padding-top: 14px; border-left: 0 !important;
    border-top: 1px solid color-mix(in srgb, var(--band-text) 22%, transparent); }
  .conta-mes dd { font-size: 1.25rem; }
  .conta-mes .conta-mes__saldo dd { font-size: 2rem; }
  .hist-head { margin-top: 20px; }
  .evolucao .col-barras { display: none; }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .filtros select { flex: 1 1 140px; }
  .conta-mes__item { padding: 0 14px; }
  .conta-mes dd { font-size: 1.0625rem; }
  .conta-mes .conta-mes__saldo dd { font-size: 1.75rem; }
  .resumo-linha { grid-template-columns: 1fr 1fr; }
  .resumo-linha__saldo { grid-column: 1 / -1; border-left: 0 !important; border-top: 1px solid var(--line);
    border-radius: 0 0 calc(var(--r-surface) - 1px) calc(var(--r-surface) - 1px); }
  .resumo-linha__saldo dd { font-size: 1.375rem !important; }
  .rapido__linha { flex-wrap: wrap; }
  .rapido .btn { flex: 1 1 100%; }
  .evolucao { font-size: .875rem; }
  .evolucao th, .evolucao td { padding-right: 8px; }
  .evolucao tr > :last-child { padding-right: 0; }
  .evolucao th.mes .subtle { display: none; }
  .rapido { padding: 16px; }
  .rapido .btn { padding: 0 14px; }
  .resumo-linha dd { font-size: .9375rem; }
  .form-actions .btn--primary { flex: 1; }
  .item { gap: 10px; padding-right: 6px; }
}

/* ---------- Orçamento ---------- */
.orc-resumo { margin-bottom: 20px; }
.orc-resumo .resumo-linha { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 8px; }
.orc-resumo .resumo-linha dd { font-size: 1.25rem; }
.orc-resumo .resumo-linha__saldo { border-radius: 0 calc(var(--r-surface) - 1px) calc(var(--r-surface) - 1px) 0; }
.orc-lista { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.orc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-surface); padding: 18px 20px; }
.orc--atencao { border-color: var(--out-mark); }
.orc--estourado { border-color: var(--danger); border-width: 2px; }
.orc__topo { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.orc__nome { font-size: 1.0625rem; font-weight: 700; }
.orc__nome a { text-decoration: none; }
.orc__nome a:hover { text-decoration: underline; }
.orc__estado { display: inline-flex; align-items: center; gap: 5px; font-size: .8125rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); }
.orc__estado--ok { background: var(--in-soft); color: var(--in); }
.orc__estado--atencao { background: var(--out-soft); color: var(--text); }
.orc__estado--atencao .ph-fill { color: var(--out-icon); }
.orc__estado--estourado { background: var(--danger-soft); color: var(--danger); }
.orc__trilho { position: relative; height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-bottom: 12px; }
.orc__fill { height: 100%; background: var(--in-mark); border-radius: 6px; min-width: 2px; }
.orc--atencao .orc__fill { background: var(--out-mark); }
/* Ultrapassado: listras, para não depender só da cor. */
.orc--estourado .orc__fill { background: repeating-linear-gradient(135deg, var(--danger) 0 6px, color-mix(in srgb, var(--danger) 55%, var(--surface)) 6px 12px); }
.orc__marca { position: absolute; top: 0; bottom: 0; left: 80%; width: 2px; background: var(--text-3); opacity: .6; }
.orc__nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 0 0 12px; }
.orc__nums dt { font-size: .8125rem; color: var(--text-3); }
.orc__nums dd { margin: 0; font-weight: 700; white-space: nowrap; }
a.orc__estado { text-decoration: none; }
.orc__proj { grid-column: 1 / -1; }
.orc__proj small { display: block; font-weight: 500; color: var(--text-2); white-space: normal; }
.orc__acoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; border-top: 1px solid var(--line); padding-top: 10px; }
.orc__acoes form { margin: 0; }
.orc__acoes .cat__form { min-width: min(100%, 280px); }
.orc-novo { margin-bottom: 16px; }
.orc-novo__form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.orc-novo__form .field-error { grid-column: 1 / -1; }
.orc-sem__titulo { margin: 20px 0 8px; font-size: .9375rem; font-weight: 600; color: var(--text-2); }
.orc-sem { display: flex; flex-wrap: wrap; gap: 8px; }
.orc-sem li { display: inline-flex; gap: 8px; align-items: baseline; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); font-size: .9rem; }
.orc-nota { margin-top: 8px; }
.dash-orc__nums { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 8px 0; }
.dash-orc__nums strong { font-size: 1.125rem; }
.dash-orc__alertas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
@media (max-width: 860px) {
  .orc-lista { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .orc-resumo .resumo-linha { grid-template-columns: 1fr 1fr; }
  .orc-resumo .resumo-linha > div:nth-child(3) { border-left: 0; }
  .orc-resumo .resumo-linha > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .orc-resumo .resumo-linha__saldo { border-radius: 0 0 calc(var(--r-surface) - 1px) 0; }
  .orc-novo__form { grid-template-columns: 1fr; }
}

/* ---------- Dia de Feira ---------- */
.fe-pagina { max-width: 720px; }
.btn--grande { min-height: 54px; padding: 0 22px; font-size: 1.0625rem; font-weight: 700; justify-content: center; }
.fe-inicio h2 { font-size: 1.25rem; margin-bottom: 6px; }
.fe-inicio .muted { margin-bottom: 14px; }
.fe-acoes { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.fe-acoes form { margin: 0; }
.fe-acoes--fim { margin-top: 20px; }
.fe-atalhos { margin: 20px 0; }
.fe-lista { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.fi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-surface); }
.fi[hidden] { display: none; }
.fi--ok { border-color: var(--in-mark); background: color-mix(in srgb, var(--in-soft) 45%, var(--surface)); }
.fi__link { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 64px; text-decoration: none; }
.fi__marca { font-size: 1.75rem; color: var(--text-3); display: flex; }
.fi--ok .fi__marca { color: var(--in-mark); }
.fi__texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.fi__nome { font-weight: 700; font-size: 1.0625rem; }
.fi__meta, .fi__ref { font-size: .875rem; color: var(--text-2); }
.fi__ref { color: var(--text-3); }
.fi__valor { font-weight: 700; white-space: nowrap; }
.fe-barra {
  position: sticky; bottom: calc(var(--tabbar) + 8px + env(safe-area-inset-bottom)); z-index: 15; margin-top: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px;
  background: var(--surface); border: 2px solid var(--accent); border-radius: var(--r-surface); box-shadow: var(--shadow-pop);
}
.fe-barra__total strong { font-size: 1.375rem; }
.fe-extra { margin-top: 12px; }
.fe-importar { margin: 0 0 12px; }
.fe-extra > summary, .fe-form details > summary { list-style: none; cursor: pointer; }
.fe-form { display: flex; flex-direction: column; gap: 14px; margin: 18px 0; }
.fe-form h2 { font-size: 1.25rem; }
.fe-form details { display: flex; flex-direction: column; gap: 12px; }
.fe-grupo { border: 1px solid var(--line); border-radius: var(--r-control); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.fe-grupo legend { font-weight: 700; padding: 0 6px; }
.fe-radio, .check-linha { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 1rem; }
.fe-radio input, .check-linha input { width: 22px; height: 22px; flex: none; }
.fe-confirma { font-weight: 600; }
.fe-dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fe-subtotal { font-size: 1.125rem; }
.fe-subtotal strong { font-size: 1.5rem; }
.fe-ref { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.fe-lido { margin: 12px 0; }
.fe-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; margin: 0; }
.fe-dl dt { font-size: .8125rem; color: var(--text-3); }
.fe-dl dd { margin: 0; font-weight: 700; }
.fe-total { font-size: 1.5rem; }
.fe-aviso { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 8px 12px; border-radius: var(--r-control); background: var(--out-soft); }
.fe-aviso .ph-fill { color: var(--out-icon); margin-top: 3px; }
.fe-camera { position: relative; background: #000; border-radius: var(--r-surface); overflow: hidden; margin-bottom: 12px; }
.fe-camera video, .fe-camera img { width: 100%; max-height: 62vh; object-fit: contain; background: #000; }
.fe-camera[hidden], .fe-camera video[hidden], .fe-camera img[hidden], .fe-arquivo[hidden] { display: none; }
.fe-arquivo { gap: 12px; }
.fe-arquivo input[type=file] { font-size: 1rem; padding: 10px; }
.fe-grafico { margin: 14px 0; }
.fe-grafico svg { width: 100%; max-width: 480px; height: auto; background: var(--surface-2); border-radius: var(--r-control); }
.fe-linha { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.fe-linha--anun { stroke: var(--out-mark); stroke-width: 1.5; stroke-dasharray: 4 3; }
.fe-ponto { fill: var(--accent); }
.fe-leg { display: inline-block; width: 18px; height: 0; border-top: 3px solid var(--accent); vertical-align: middle; }
.fe-leg--anun { border-top: 2px dashed var(--out-mark); }
.fe-comp--aumento .col-num strong { color: var(--danger); }
.fe-comp--reducao .col-num strong { color: var(--in); }
.fe-habitual .cat__acoes { flex-wrap: wrap; }
.dash-feira__nums { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 8px 0; }
@media (max-width: 560px) {
  .fe-dupla { grid-template-columns: 1fr 1fr; }
  .fe-acoes .btn--grande { flex: 1 1 100%; }
  .fe-barra { bottom: calc(var(--tabbar) + 4px + env(safe-area-inset-bottom)); }
}

/* ---------- Orçamento: período, avisos e comparação ---------- */
.orc-periodo { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: -4px 0 18px; }
.orc-periodo .field { flex: 0 1 170px; }
.orc-periodo--dois { gap: 14px 22px; }
.orc-periodo__par { display: flex; gap: 10px; border: 1px solid var(--line); border-radius: var(--r-control); padding: 8px 12px 12px; margin: 0; }
.orc-periodo__par legend { font-weight: 600; font-size: .875rem; padding: 0 6px; color: var(--text-2); }
.orc-aviso { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control); font-size: .9rem; color: var(--text-2); }
.orc-comp .tabela th, .orc-comp .tabela td, .tabela.orc-comp th, .tabela.orc-comp td { padding: 10px 12px; }
.orc-comp-pagina .tabela-wrap { overflow-x: auto; }
.orc-comp-pagina .tabela { min-width: 640px; }
@media (max-width: 560px) {
  .orc-periodo .field { flex: 1 1 120px; }
  .orc-periodo__par { flex: 1 1 100%; }
  /* Relatórios: a tabela de orçamento vira lista de cartões no celular (sem rolagem horizontal). */
  .orc-rel-tabela thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .orc-rel-tabela, .orc-rel-tabela tbody { display: block; }
  .orc-rel-tabela tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
  .orc-rel-tabela tr:first-child { border-top: 0; }
  .orc-rel-tabela th[scope="row"] { grid-column: 1 / -1; padding: 0; }
  .orc-rel-tabela td { display: block; padding: 0; text-align: left; border: 0; }
  .orc-rel-tabela td.col-barras { display: none; }
  .orc-comp-pagina .tabela { min-width: 0; }
  .orc-comp-pagina .tabela-wrap { overflow: visible; }
  .orc-rel-tabela.tabela tbody tr + tr td, .orc-rel-tabela.tabela tbody td { border-top: 0; padding: 0; }
  .orc-rel-tabela.tabela tr { padding: 12px 14px; }
  .orc-rel-tabela td::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--text-3); }
  .orc-periodo > .btn { flex: 1 1 100%; min-height: 48px; }
}

/* ---------- Ajustes de UI/acessibilidade (auditoria mobile) ---------- */
.ico-in { color: var(--in-mark); }
.ico-out { color: var(--out-icon); }
.conta-mes__chev { font-size: .85em; margin-left: 4px; opacity: .75; vertical-align: -1px; text-decoration: none; }
.saldo-band__nota { margin-top: 6px; font-size: .8125rem; color: var(--band-text-2); }
.saldo-band__nota summary { display: inline-block; cursor: pointer; padding: 8px 0; min-height: 24px; text-decoration: underline; text-underline-offset: 3px; }
.saldo-band__nota p { margin: 0 0 4px; }
.tabbar a, .icon-btn { -webkit-tap-highlight-color: transparent; }
.tabbar a:active, .icon-btn:active { background: var(--surface-2); transform: scale(.97); }
.compras-add { margin-bottom: 24px; }
.compras-add .btn { min-width: 220px; }
@media (max-width: 860px) {
  .compras-add .btn { width: 100%; }
}
@media (max-width: 560px) {
  .filtros > .btn { flex: 1 1 140px; }                      /* Filtrar / Limpar dividem a linha em vez de cair soltos */
  .toolbar .seg.seg--grade { display: grid; grid-template-columns: 1fr 1fr; }
  .toolbar .seg.seg--grade a { padding: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media (forced-colors: active) {
  .barra__fill, .duo span { background: CanvasText; }
  .check--on { background: Highlight; }
}

/* ---------- Impressão (A4, via "Imprimir > Salvar como PDF" do navegador) ---------- */
.so-impressao { display: none; }

@media print {
  @page {
    size: A4;
    margin: 16mm 14mm 18mm;
    @bottom-left { content: "Nossa Casa"; font: 8pt sans-serif; color: #555; }
    @bottom-right { content: "Página " counter(page) " de " counter(pages); font: 8pt sans-serif; color: #555; }
  }

  /* Papel sempre claro, mesmo com o sistema no modo escuro. */
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #f1f1f1; --line: #ccc; --line-strong: #999;
    --text: #000; --text-2: #222; --text-3: #444;
    --band: #fff; --band-text: #000; --band-text-2: #222;
    --in: #006b47; --in-mark: #008055; --in-soft: #e6f3ec; --out: #000; --out-mark: #b85d1c; --out-soft: #f6ebe1;
    color-scheme: light;
  }
  html, body { background: #fff; }
  body { font-size: 10.5pt; line-height: 1.35; }

  /* Navegação, ações e controles não fazem sentido no papel. */
  .sidebar, .topbar, .tabbar, .toasts, .skip-link, dialog, .page-head__actions, .toolbar .seg,
  .filtros, .personalizado, .mes-nav .icon-btn, .toolbar .btn, .hist-head .btn, .vazio__acoes,
  .orc-periodo, .col-acoes, .fe-barra, .fe-acoes, .orc__acoes, .orc-novo, .orc-sem, .lista-mobile .icon-btn, .link { display: none !important; }
  .toolbar--periodo { margin-bottom: 8px; }

  .so-impressao { display: block; margin: 0 0 8mm; padding-bottom: 2mm; border-bottom: 1px solid #999; font-size: 9pt; color: #444; }
  .main { margin: 0; padding: 0; max-width: none; }
  .page-head { margin-bottom: 8mm; }
  .page-head h1 { font-size: 18pt; }

  /* Blocos inteiros ficam na mesma página; tabelas repetem o cabeçalho e não cortam linhas. */
  .orc-aviso, .fi, .orc, .panel, .conta, .saldo-band, .barras li, .evolucao tr, .tabela tr, .movs li, .vazio { break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }

  .panel, .tabela-wrap, .saldo-band { box-shadow: none; background: #fff; border: 1px solid #999; border-radius: 4px; }
  .panel { padding: 4mm 5mm; }
  .saldo-band { padding: 4mm 5mm; }
  .tabela { font-size: 9pt; }
  .tabela td, .tabela th { padding: 4px 8px; }
  /* Sem moldura fechada: a tabela atravessa páginas, então só uma linha embaixo. */
  .tabela-wrap { overflow: visible; border: 0; border-bottom: 1px solid #999; border-radius: 0; }
  .dash-grid, .rel-grid { gap: 5mm; }

  /* No papel a tabela sempre vale, mesmo se a folha cair no ponto de corte do celular. */
  .so-desktop { display: block !important; }
  .so-mobile { display: none !important; }

  /* Navegadores não imprimem fundos por padrão: barras e etiquetas precisam disso para aparecer. */
  .barra__fill, .barra__trilho, .tag { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .barra__trilho { background: #e3e3e3; }

  a { text-decoration: none; color: inherit; }
}
