/* ============================================================
   Controle Financeiro Pro — Design System v3 (fintech premium)
   Petróleo #062E2A / #0B3D37 · Dourado #E5B95C
   Receita #22C55E · Despesa #EF4444 · Texto 2º #8A9996
   ============================================================ */

:root {
  /* ---- TEMA ESCURO (padrão) ---- */
  --bg:            #04201d;
  --bg-2:          #062a26;
  --surface:       #0a352f;
  --surface-2:     #0e3f38;
  --surface-3:     #134a42;
  --border:        rgba(255,255,255,.06);
  --border-2:      rgba(229,185,92,.14);

  --text:          #f0f6f4;
  --text-dim:      #a7beb9;
  --text-faint:    #8a9996;

  --gold:          #e5b95c;
  --gold-2:        #d4a747;
  --gold-soft:     rgba(229,185,92,.12);
  --income:        #22c55e;
  --income-soft:   rgba(34,197,94,.13);
  --expense:       #ef4444;
  --expense-soft:  rgba(239,68,68,.13);
  --warn:          #f5b740;
  --warn-soft:     rgba(245,183,64,.15);

  --shadow:        0 22px 55px -18px rgba(0,0,0,.6);
  --shadow-sm:     0 8px 24px -12px rgba(0,0,0,.5);
  --shadow-card:   0 2px 10px -4px rgba(0,0,0,.35);
  --glow-gold:     0 10px 34px -10px rgba(229,185,92,.45);

  --r-xl: 26px; --r-lg: 20px; --r-md: 15px; --r-sm: 11px;
  --nav-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Cartão de saldo — SEMPRE escuro premium (nos 2 temas) */
  --card-grad-a: #0b3d37;
  --card-grad-b: #062e2a;
  --card-ink:    #f4f9f7;
  --card-ink-dim: #9fc4bc;
}

/* ---- TEMA CLARO ---- */
html[data-theme="light"] {
  --bg:            #eef2f0;
  --bg-2:          #e7edea;
  --surface:       #ffffff;
  --surface-2:     #f6f9f7;
  --surface-3:     #eef3f1;
  --border:        rgba(6,46,42,.09);
  --border-2:      rgba(6,46,42,.10);

  --text:          #062e2a;
  --text-dim:      #4a5f5b;
  --text-faint:    #8a9996;

  --gold:          #b78a2f;
  --gold-2:        #a5791f;
  --gold-soft:     rgba(183,138,47,.12);
  --income:        #16a34a;
  --income-soft:   rgba(22,163,74,.10);
  --expense:       #dc2626;
  --expense-soft:  rgba(220,38,38,.09);
  --warn:          #b5820a;
  --warn-soft:     rgba(181,130,10,.13);

  --shadow:        0 22px 50px -20px rgba(6,46,42,.22);
  --shadow-sm:     0 8px 22px -12px rgba(6,46,42,.14);
  --shadow-card:   0 2px 10px -5px rgba(6,46,42,.12);
  --glow-gold:     0 10px 30px -12px rgba(183,138,47,.36);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(700px 380px at 108% -8%, var(--gold-soft), transparent 60%),
    radial-gradient(600px 360px at -12% 4%, rgba(34,197,94,.06), transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  min-height: 100vh; overflow-x: hidden;
}

svg { flex: 0 0 auto; }
.ic { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: -.14em; flex: 0 0 auto; }
.icon-lg { width: 46px !important; height: 46px !important; stroke-width: 1.5 !important; }
.tnum { font-variant-numeric: tabular-nums; }

/* ===================== HEADER ===================== */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; padding-top: calc(12px + var(--safe-t));
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 44px; height: 44px; display: grid; place-items: center; font-size: 21px; flex: 0 0 auto;
  border-radius: 14px; color: #2a1c07;
  background: linear-gradient(150deg, var(--gold), var(--gold-2)); box-shadow: var(--glow-gold);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.18; min-width: 0; }
.brand-text strong { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.brand-text small { color: var(--text-faint); font-size: 12px; }
.header-right { display: flex; align-items: center; gap: 8px; }
.month-switch { display: flex; align-items: center; gap: 1px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.icon-btn { height: 38px; min-width: 38px; padding: 0 9px; font-size: 18px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-dim); border-radius: 12px; display: grid; place-items: center;
  cursor: pointer; transition: transform .12s, color .12s; }
.icon-btn.ghost { border: 0; background: transparent; height: 32px; min-width: 32px; }
.icon-btn:hover { color: var(--text); }
.icon-btn:active { transform: scale(.9); }
.pill { height: 32px; padding: 0 10px; border: 0; background: transparent; color: var(--text);
  font-weight: 700; font-size: 13px; cursor: pointer; min-width: 92px; letter-spacing: -.01em; }

/* ===================== VIEW ===================== */
.view { padding: 16px 16px 8px; max-width: 720px; margin: 0 auto; }
.view > * { animation: rise .42s cubic-bezier(.2,.7,.2,1) backwards; }
.view > *:nth-child(1){animation-delay:.02s} .view > *:nth-child(2){animation-delay:.06s}
.view > *:nth-child(3){animation-delay:.1s} .view > *:nth-child(4){animation-delay:.14s}
.view > *:nth-child(5){animation-delay:.18s} .view > *:nth-child(n+6){animation-delay:.22s}
@keyframes rise { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view > * { animation: none; } }

.section-title { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint);
  margin: 20px 4px 10px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.section-title:first-child { margin-top: 4px; }
.link-more { color: var(--gold); font-size: 12.5px; cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 600; }

/* ===================== BALANCE CARD ===================== */
.balance-card {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 20px 20px 18px;
  color: var(--card-ink);
  background:
    radial-gradient(420px 200px at 118% -30%, rgba(229,185,92,.32), transparent 62%),
    radial-gradient(360px 220px at -10% 120%, rgba(34,197,94,.16), transparent 60%),
    linear-gradient(158deg, var(--card-grad-a), var(--card-grad-b));
  box-shadow: var(--shadow);
  border: 1px solid rgba(229,185,92,.16);
}
.balance-card::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(125deg, transparent 42%, rgba(255,255,255,.05) 50%, transparent 58%); }
.bc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bc-label { color: var(--card-ink-dim); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.bc-value { font-size: 40px; font-weight: 800; letter-spacing: -.03em; margin: 8px 0 2px; line-height: 1; }
.bc-sub { color: var(--card-ink-dim); font-size: 12px; }
.bc-split { display: flex; gap: 11px; margin-top: 18px; }
.bc-cell { flex: 1; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-md); padding: 11px 13px; backdrop-filter: blur(4px); }
.bc-cell small { color: var(--card-ink-dim); font-size: 11px; display: flex; align-items: center; gap: 6px; }
.bc-cell b { font-size: 17px; font-weight: 700; margin-top: 4px; display: block; letter-spacing: -.01em; }
.bc-cell .ic { font-size: 13px; }
.bc-cell.inc b { color: #7ff0b0; } .bc-cell.exp b { color: #ff9d9d; }

.var-badge { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }
.var-badge.good { background: rgba(34,197,94,.18); color: #7ff0b0; }
.var-badge.bad  { background: rgba(239,68,68,.18); color: #ff9d9d; }
.var-badge.flat { background: rgba(255,255,255,.12); color: var(--card-ink-dim); }

/* ===================== STAT CARDS ===================== */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 13px 12px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 8px; }
.sc-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; }
.sc-k { color: var(--text-faint); font-size: 11px; font-weight: 600; line-height: 1.2; }
.sc-v { font-size: 16.5px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }

/* ===================== QUICK ADD ===================== */
.quick-chips { display: flex; gap: 9px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.quick-chips::-webkit-scrollbar { display: none; }
.qchip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow-card); transition: transform .12s, border-color .12s; }
.qchip:hover { border-color: var(--border-2); }
.qchip:active { transform: scale(.95); }
.qchip .e { font-size: 16px; }

/* ===================== CARDS ===================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px; box-shadow: var(--shadow-card); }
.card + .card { margin-top: 12px; }
.hero { border-radius: var(--r-xl); padding: 20px; background: linear-gradient(158deg, var(--card-grad-a), var(--card-grad-b)); color: var(--card-ink); }

/* ===================== TRANSACTIONS ===================== */
.tx { display: flex; align-items: center; gap: 13px; padding: 12px 6px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s; border-radius: 12px; }
.tx:hover { background: color-mix(in srgb, var(--surface-3) 50%, transparent); }
.tx:last-child { border-bottom: 0; }
.tx .avatar { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 20px;
  flex: 0 0 auto; box-shadow: inset 0 0 0 1px var(--border); }
.tx .info { flex: 1; min-width: 0; }
.tx .info .t { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.tx .info .s { color: var(--text-faint); font-size: 12px; margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tag { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-dim); }
.tx .amt { font-weight: 800; font-size: 15px; text-align: right; white-space: nowrap; letter-spacing: -.01em; }
.tx .amt.inc { color: var(--income); } .tx .amt.exp { color: var(--expense); }

.empty { text-align: center; color: var(--text-faint); padding: 30px 18px; font-size: 14px; line-height: 1.55;
  display: flex; flex-direction: column; align-items: center; }
.empty .ring { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px;
  background: radial-gradient(circle at 50% 40%, var(--gold-soft), transparent 70%); color: var(--gold); }
.empty .ring .icon-lg { width: 40px !important; height: 40px !important; }
.empty b { color: var(--text-dim); }
.empty .cta { margin-top: 14px; }

/* ===================== CHART ===================== */
.chart-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.legend { flex: 1; min-width: 168px; display: flex; flex-direction: column; gap: 10px; }
.legend .li { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend .li .dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.legend .li .nm { flex: 1; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend .li .vl { font-weight: 700; letter-spacing: -.01em; }
.legend .li .pc { color: var(--text-faint); font-size: 11px; width: 38px; text-align: right; }
.dot { display: inline-block; }

.bar-list { display: flex; flex-direction: column; gap: 14px; }
.bar-row .bar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 7px; }
.bar-row .bar-top b { font-weight: 700; letter-spacing: -.01em; }
.bar-track { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* ===================== FORMS ===================== */
.form { display: flex; flex-direction: column; gap: 15px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; }
.field input, .field select, .field textarea { width: 100%; padding: 14px 15px; font-size: 15px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px; font-family: var(--font); transition: border-color .12s, box-shadow .12s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.field textarea { resize: vertical; min-height: 62px; }
.field .amount-input { font-size: 30px; font-weight: 800; text-align: center; letter-spacing: -.02em; padding: 18px; font-variant-numeric: tabular-nums; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.help { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; line-height: 1.4; }
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 12px; border: 0; background: transparent; color: var(--text-dim); font-weight: 700; font-size: 14px; border-radius: 10px; cursor: pointer; transition: all .15s; font-family: var(--font); }
.seg button.active.exp { background: var(--expense); color: #fff; box-shadow: var(--shadow-sm); }
.seg button.active.inc { background: var(--income); color: #04271a; box-shadow: var(--shadow-sm); }
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip { padding: 10px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all .13s; font-family: var(--font); }
.chip:hover { border-color: var(--border-2); }
.chip.active { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.switch { display: flex; align-items: center; justify-content: space-between; }
.toggle { width: 50px; height: 30px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); position: relative; cursor: pointer; flex: 0 0 auto; transition: background .2s; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--text-faint); transition: .22s cubic-bezier(.2,.8,.2,1); }
.toggle.on { background: var(--income-soft); border-color: var(--income); }
.toggle.on::after { left: 22px; background: var(--income); }

.btn { width: 100%; padding: 16px; border: 0; border-radius: 15px; font-size: 16px; font-weight: 800; cursor: pointer; font-family: var(--font); display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s, filter .12s; letter-spacing: -.01em; }
.btn svg { font-size: 19px; }
.btn-primary { background: linear-gradient(150deg, var(--gold), var(--gold-2)); color: #2a1c07; box-shadow: var(--glow-gold); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-danger { background: var(--expense-soft); color: var(--expense); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn:active { transform: scale(.98); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.attach-preview { margin-top: 10px; }
.attach-preview img { max-width: 100%; border-radius: 13px; border: 1px solid var(--border); }

/* ===================== FILTERS / SEARCH ===================== */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 9px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip { white-space: nowrap; flex: 0 0 auto; }
.search { position: relative; margin-bottom: 8px; }
.search input { width: 100%; padding: 13px 15px 13px 42px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px; font-family: var(--font); box-shadow: var(--shadow-card); }
.search input:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 18px; display: grid; }

/* ===================== FAB + SPEED DIAL ===================== */
.fab-backdrop { position: fixed; inset: 0; z-index: 38; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s; }
.fab-wrap.open .fab-backdrop { opacity: 1; pointer-events: auto; }
.fab-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) - 28px + var(--safe-b)); z-index: 42; display: flex; flex-direction: column; align-items: center; }
.fab-menu { position: absolute; bottom: 74px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.fab-mini { display: inline-flex; align-items: center; gap: 10px; padding: 11px 16px 11px 14px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: var(--shadow); font-family: var(--font);
  opacity: 0; transform: translateY(14px) scale(.9); pointer-events: none; transition: opacity .2s, transform .2s; white-space: nowrap; }
.fab-mini .ib { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; color: #fff; }
.fab-mini.exp .ib { background: var(--expense); } .fab-mini.inc .ib { background: var(--income); color: #04271a; }
.fab-wrap.open .fab-mini { opacity: 1; transform: none; pointer-events: auto; }
.fab-wrap.open .fab-mini:nth-child(2) { transition-delay: .04s; }
.fab { width: 62px; height: 62px; border-radius: 50%; border: 4px solid var(--bg); background: linear-gradient(150deg, var(--gold), var(--gold-2)); color: #2a1c07; font-size: 28px; cursor: pointer; box-shadow: var(--glow-gold); display: grid; place-items: center; transition: transform .2s cubic-bezier(.2,.8,.2,1); }
.fab .ic { transition: transform .25s; }
.fab-wrap.open .fab .ic { transform: rotate(135deg); }
.fab:active { transform: scale(.9); }

/* ===================== BOTTOM NAV ===================== */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b); display: flex; align-items: stretch;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border); }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: none; border: 0; color: var(--text-faint); font-size: 10px; font-weight: 600; cursor: pointer; padding-top: 10px; transition: color .16s; position: relative; }
.nav-item svg { font-size: 22px; transition: transform .16s; }
.nav-item.active { color: var(--gold); }
.nav-item.active svg { transform: translateY(-1px); }
.nav-item.active::before { content: ""; position: absolute; top: 7px; width: 40px; height: 30px; border-radius: 11px; background: var(--gold-soft); z-index: -1; }
.nav-item.nav-spacer { pointer-events: none; }

/* ===================== METAS ===================== */
.goal { padding: 15px 6px; border-bottom: 1px solid var(--border); }
.goal:last-child { border-bottom: 0; }
.goal .g-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; gap: 8px; }
.goal .g-top .g-name { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.goal .g-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11.5px; color: var(--text-faint); }
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 3px; }
.badge.good { background: var(--income-soft); color: var(--income); }
.badge.bad  { background: var(--expense-soft); color: var(--expense); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.neutral { background: var(--gold-soft); color: var(--gold); }

.mini-btn { padding: 9px 13px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-family: var(--font); }
.mini-btn:hover { border-color: var(--border-2); }

.kv { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; gap: 10px; }
.kv:last-child { border: 0; }
.kv .k { color: var(--text-dim); }
.kv .v { font-weight: 700; text-align: right; letter-spacing: -.01em; }
.kv .v.big { font-size: 17px; }
.up { color: var(--income); } .down { color: var(--expense); }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.info-cell { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.info-cell small { color: var(--text-faint); font-size: 11px; display: block; margin-bottom: 4px; }
.info-cell b { font-size: 19px; letter-spacing: -.02em; }

.alert { display: flex; gap: 11px; align-items: flex-start; border-radius: var(--r-md); padding: 13px 15px; font-size: 13px; line-height: 1.45;
  background: var(--expense-soft); border: 1px solid color-mix(in srgb, var(--expense) 30%, transparent); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert .ico { font-size: 18px; }

hr.sep { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

/* ===================== MODAL / TOAST ===================== */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(3px); animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 8px 18px calc(26px + var(--safe-b)); animation: slideUp .32s cubic-bezier(.2,.85,.25,1); }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.modal-head { position: sticky; top: 0; background: var(--bg-2); display: flex; align-items: center; justify-content: space-between; padding: 14px 0 12px; z-index: 2; }
.modal-head::before { content: ""; position: absolute; top: 5px; left: 50%; transform: translateX(-50%); width: 42px; height: 4px; border-radius: 999px; background: var(--border-2); }
.modal-head h2 { font-size: 19px; margin: 6px 0 0; letter-spacing: -.01em; }
.modal-body { padding-top: 8px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 26px + var(--safe-b)); z-index: 80; background: var(--surface-3); color: var(--text); border: 1px solid var(--border-2); padding: 13px 20px; border-radius: 999px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); max-width: 90vw; text-align: center; animation: toastIn .28s cubic-bezier(.2,.8,.2,1); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px);} to { opacity: 1; transform: translate(-50%, 0);} }
.toast.ok { border-color: var(--income); } .toast.err { border-color: var(--expense); }

@media (min-width: 560px) { .stat-grid { gap: 12px; } }

/* ===================== AUTH SCREEN ===================== */
body.guest #appHeader, body.guest #fabWrap, body.guest #bottomNav { display: none !important; }
body.guest { padding-bottom: 0; }
.auth-screen {
  position: fixed; inset: 0; z-index: 90; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 20px calc(24px + var(--safe-b)); padding-top: calc(24px + var(--safe-t));
  background:
    radial-gradient(600px 340px at 110% -5%, var(--gold-soft), transparent 60%),
    radial-gradient(560px 340px at -10% 105%, rgba(34,197,94,.10), transparent 60%),
    var(--bg);
}
.auth-box { width: 100%; max-width: 400px; margin: auto; }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; margin-bottom: 24px; }
.auth-brand .mk { width: 62px; height: 62px; border-radius: 19px; display: grid; place-items: center; font-size: 30px; color: #2a1c07;
  background: linear-gradient(150deg, var(--gold), var(--gold-2)); box-shadow: var(--glow-gold); }
.auth-brand h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
.auth-brand p { margin: 0; color: var(--text-faint); font-size: 13.5px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 18px; margin: 0 0 4px; letter-spacing: -.01em; }
.auth-card .lead { color: var(--text-faint); font-size: 13px; margin: 0 0 18px; }
.auth-field { position: relative; margin-bottom: 13px; }
.auth-field .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 18px; display: grid; }
.auth-field input { width: 100%; padding: 14px 15px 14px 44px; font-size: 15px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 13px; font-family: var(--font); transition: border-color .12s, box-shadow .12s; }
.auth-field input:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.auth-msg { font-size: 12.5px; padding: 10px 13px; border-radius: 11px; margin-bottom: 13px; line-height: 1.45; }
.auth-msg.err { background: var(--expense-soft); color: var(--expense); }
.auth-msg.ok { background: var(--income-soft); color: var(--income); }
.auth-alt { text-align: center; font-size: 13.5px; color: var(--text-faint); margin-top: 16px; }
.auth-alt a { color: var(--gold); font-weight: 700; cursor: pointer; }
.auth-forgot { text-align: right; margin: -4px 0 14px; }
.auth-forgot a { color: var(--gold); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.auth-foot { text-align: center; color: var(--text-faint); font-size: 11.5px; margin-top: 20px; line-height: 1.5; }
.btn.loading { opacity: .7; pointer-events: none; }

@media print {
  .app-header, .bottom-nav, .fab-wrap, .filters, .search, .btn-row, .link-more { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .card, .balance-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; color: #000; }
}
