@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,500;8..60,600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0F1C18;
  --surface: #16261F;
  --surface-alt: #1C332A;
  --surface-raised: #203A30;
  --line: rgba(234, 240, 236, 0.12);
  --line-strong: rgba(234, 240, 236, 0.22);
  --text: #EAF0EC;
  --text-muted: #8FA79B;
  --mint: #5EEAD4;
  --amber: #F0B429;
  --coral: #FF6B6B;
  --font-display: 'Source Serif 4', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --radius: 6px;
}

/* ---------- Themes ----------
   "forest" (above, :root) is the default. Every other theme overrides the
   same set of color variables via [data-theme="..."] on <html>; nothing
   else in this file references a literal color, so this is the whole
   theming surface. ---------- */

/* Dark */
[data-theme="midnight"] {
  --bg: #0B1220; --surface: #121B2E; --surface-alt: #182642; --surface-raised: #1D2F52;
  --line: rgba(226,232,240,0.12); --line-strong: rgba(226,232,240,0.22);
  --text: #E7ECF5; --text-muted: #8592AD;
  --mint: #5B9DF0; --amber: #F2B94C; --coral: #FF6B81;
}
[data-theme="amber-noir"] {
  --bg: #1A1410; --surface: #241C15; --surface-alt: #2E241A; --surface-raised: #392C1F;
  --line: rgba(240,230,210,0.12); --line-strong: rgba(240,230,210,0.22);
  --text: #F3EBDD; --text-muted: #B0A08A;
  --mint: #F0B429; --amber: #F2C94C; --coral: #FF6B6B;
}
[data-theme="crimson"] {
  --bg: #1A0E10; --surface: #241419; --surface-alt: #2E1920; --surface-raised: #392030;
  --line: rgba(245,220,225,0.12); --line-strong: rgba(245,220,225,0.22);
  --text: #F5E9EC; --text-muted: #B08B93;
  --mint: #FF6B6B; --amber: #F0B429; --coral: #FF4D6D;
}
[data-theme="violet"] {
  --bg: #140E1F; --surface: #1C1530; --surface-alt: #251C3D; --surface-raised: #2E234C;
  --line: rgba(230,220,245,0.12); --line-strong: rgba(230,220,245,0.22);
  --text: #ECE6F5; --text-muted: #9C8FB5;
  --mint: #B794F6; --amber: #F0B429; --coral: #FF6B9D;
}
[data-theme="ocean"] {
  --bg: #08161A; --surface: #0F2228; --surface-alt: #143038; --surface-raised: #1A3E48;
  --line: rgba(220,240,245,0.12); --line-strong: rgba(220,240,245,0.22);
  --text: #E4F3F5; --text-muted: #7FA8AD;
  --mint: #4DD0E1; --amber: #F0B429; --coral: #FF7A6B;
}
[data-theme="emerald"] {
  --bg: #0A160E; --surface: #102113; --surface-alt: #16301B; --surface-raised: #1C3E22;
  --line: rgba(224,240,228,0.12); --line-strong: rgba(224,240,228,0.22);
  --text: #E8F5EA; --text-muted: #86A88F;
  --mint: #4ADE80; --amber: #F0B429; --coral: #FF6B6B;
}
[data-theme="rose"] {
  --bg: #1A0F16; --surface: #251420; --surface-alt: #301A2A; --surface-raised: #3C2035;
  --line: rgba(245,225,238,0.12); --line-strong: rgba(245,225,238,0.22);
  --text: #F5E7F0; --text-muted: #B092A8;
  --mint: #F472B6; --amber: #F0B429; --coral: #FF6B6B;
}
[data-theme="slate"] {
  --bg: #12151A; --surface: #1A1E25; --surface-alt: #232830; --surface-raised: #2C323C;
  --line: rgba(230,234,240,0.12); --line-strong: rgba(230,234,240,0.22);
  --text: #E9ECF1; --text-muted: #8D96A5;
  --mint: #64B5C9; --amber: #F0B429; --coral: #FF6B6B;
}
[data-theme="sunset"] {
  --bg: #1C120C; --surface: #281911; --surface-alt: #332015; --surface-raised: #3F281A;
  --line: rgba(245,230,215,0.12); --line-strong: rgba(245,230,215,0.22);
  --text: #F5EBDD; --text-muted: #B39A82;
  --mint: #FF9F5A; --amber: #F0B429; --coral: #FF6B6B;
}

/* Light */
[data-theme="daylight"] {
  --bg: #F7FAF8; --surface: #FFFFFF; --surface-alt: #EEF3F0; --surface-raised: #E3ECE7;
  --line: rgba(15,30,25,0.10); --line-strong: rgba(15,30,25,0.18);
  --text: #10201A; --text-muted: #5B7268;
  --mint: #0F9D8E; --amber: #B5790A; --coral: #D6425A;
}
[data-theme="paper"] {
  --bg: #FAF6EC; --surface: #FFFDF7; --surface-alt: #F1E9D6; --surface-raised: #E9DEC4;
  --line: rgba(50,40,20,0.10); --line-strong: rgba(50,40,20,0.18);
  --text: #2B2115; --text-muted: #7A6B50;
  --mint: #9C6B14; --amber: #B5790A; --coral: #C43D3D;
}
[data-theme="sky"] {
  --bg: #F5F9FE; --surface: #FFFFFF; --surface-alt: #E8F1FC; --surface-raised: #DBEAFB;
  --line: rgba(20,40,70,0.10); --line-strong: rgba(20,40,70,0.18);
  --text: #101E2E; --text-muted: #5D7387;
  --mint: #1D6FC4; --amber: #B5790A; --coral: #D6425A;
}
[data-theme="blossom"] {
  --bg: #FDF6F8; --surface: #FFFFFF; --surface-alt: #FBEAEF; --surface-raised: #F7DDE5;
  --line: rgba(60,20,35,0.10); --line-strong: rgba(60,20,35,0.18);
  --text: #2E1420; --text-muted: #8A6373;
  --mint: #C2478D; --amber: #B5790A; --coral: #C43D3D;
}
[data-theme="mist"] {
  --bg: #F6F8F7; --surface: #FFFFFF; --surface-alt: #ECF0EE; --surface-raised: #E1E7E4;
  --line: rgba(20,30,26,0.10); --line-strong: rgba(20,30,26,0.18);
  --text: #17211D; --text-muted: #647169;
  --mint: #3F9C82; --amber: #B5790A; --coral: #C43D3D;
}

/* More dark */
[data-theme="charcoal"] {
  --bg: #060707; --surface: #0E0F10; --surface-alt: #17181A; --surface-raised: #1F2123;
  --line: rgba(230,232,235,0.10); --line-strong: rgba(230,232,235,0.20);
  --text: #ECEDEF; --text-muted: #83898F;
  --mint: #5EEAD4; --amber: #F0B429; --coral: #FF6B6B;
}
[data-theme="nordic"] {
  --bg: #0E1620; --surface: #16202D; --surface-alt: #1D2A3A; --surface-raised: #253649;
  --line: rgba(217,229,240,0.12); --line-strong: rgba(217,229,240,0.22);
  --text: #E4ECF3; --text-muted: #7E93A8;
  --mint: #7DC4E0; --amber: #E8B562; --coral: #E88D8D;
}
[data-theme="terracotta"] {
  --bg: #1C1310; --surface: #271B16; --surface-alt: #33241D; --surface-raised: #402D24;
  --line: rgba(244,225,210,0.12); --line-strong: rgba(244,225,210,0.22);
  --text: #F4E5D6; --text-muted: #B08D77;
  --mint: #E0784A; --amber: #EFAE4E; --coral: #E85B4E;
}
[data-theme="plum"] {
  --bg: #170C1A; --surface: #221327; --surface-alt: #2C1934; --surface-raised: #382042;
  --line: rgba(236,220,244,0.12); --line-strong: rgba(236,220,244,0.22);
  --text: #EFE2F5; --text-muted: #A78DB5;
  --mint: #D688E8; --amber: #F0B429; --coral: #FF6B9D;
}
[data-theme="lagoon"] {
  --bg: #061A1C; --surface: #0C2629; --surface-alt: #113338; --surface-raised: #164047;
  --line: rgba(210,240,242,0.12); --line-strong: rgba(210,240,242,0.22);
  --text: #DFF3F4; --text-muted: #6FA4A8;
  --mint: #2DD4BF; --amber: #F0B429; --coral: #FF7A6B;
}
[data-theme="cyber"] {
  --bg: #08090F; --surface: #0F1220; --surface-alt: #171B30; --surface-raised: #1F2440;
  --line: rgba(210,220,255,0.12); --line-strong: rgba(210,220,255,0.24);
  --text: #E6EBFF; --text-muted: #8189B8;
  --mint: #4CE0D2; --amber: #F5C542; --coral: #FF4FA3;
}

/* More light */
[data-theme="arctic"] {
  --bg: #F3F8FB; --surface: #FFFFFF; --surface-alt: #E7F1F7; --surface-raised: #D9EAF3;
  --line: rgba(15,45,60,0.10); --line-strong: rgba(15,45,60,0.18);
  --text: #0E2530; --text-muted: #5D7F88;
  --mint: #1C8FB0; --amber: #B5790A; --coral: #D6425A;
}
[data-theme="sepia"] {
  --bg: #F3EAD8; --surface: #FBF5E9; --surface-alt: #EBDDC2; --surface-raised: #E1D0AF;
  --line: rgba(60,40,15,0.12); --line-strong: rgba(60,40,15,0.20);
  --text: #362512; --text-muted: #8A6E48;
  --mint: #8A6420; --amber: #B5790A; --coral: #B5482E;
}
[data-theme="mono"] {
  --bg: #F5F5F5; --surface: #FFFFFF; --surface-alt: #EAEAEA; --surface-raised: #DDDDDD;
  --line: rgba(10,10,10,0.10); --line-strong: rgba(10,10,10,0.20);
  --text: #141414; --text-muted: #6B6B6B;
  --mint: #1A1A1A; --amber: #6B6B6B; --coral: #B5482E;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body, .card, .sidebar, .modal, .passbook, .main, #view-login {
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

button, input, select, textarea { font-family: inherit; color: inherit; }

::selection { background: rgba(94,234,212,0.3); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.2px; }
.amount.pos { color: var(--mint); }
.amount.neg { color: var(--coral); }

/* ---------- Login ---------- */
@keyframes loginFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes loginDrift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-14px, -10px); }
}
@keyframes loginDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.35); }
}
@keyframes loginLineDraw {
  from { stroke-dasharray: 620; stroke-dashoffset: 620; }
  to { stroke-dasharray: 620; stroke-dashoffset: 0; }
}

#view-login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  background:
    radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--mint) 14%, transparent), transparent 55%),
    radial-gradient(circle at 85% 85%, color-mix(in srgb, var(--amber) 10%, transparent), transparent 50%),
    repeating-linear-gradient(180deg, transparent 0, transparent 39px, var(--line) 40px),
    var(--bg);
}
.login-shell {
  width: 100%; max-width: 880px; min-height: 520px;
  display: flex; border-radius: calc(var(--radius) + 6px); overflow: hidden;
  box-shadow: 0 30px 70px -24px rgba(0,0,0,0.5);
  animation: loginFadeUp .5s ease both;
}
.login-brand-panel {
  flex: 1 1 46%; position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--surface-raised) 0%, var(--surface) 70%);
  padding: 40px 38px; display: flex; flex-direction: column; justify-content: center;
  border-right: 1px solid var(--line);
}
.login-brand-glow {
  position: absolute; top: -30%; right: -20%; width: 70%; height: 70%; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--mint) 30%, transparent), transparent 70%);
  animation: loginDrift 9s ease-in-out infinite;
  pointer-events: none;
}
.login-illustration {
  position: relative; z-index: 1; width: 100%; height: auto; margin: 8px 0 24px;
  opacity: 0.9;
}
.login-illustration-line {
  animation: loginLineDraw 1.6s ease-out both;
}
.login-illustration-dot { animation: loginDotPulse 2.4s ease-in-out infinite; }
.login-illustration-dot.d2 { animation-delay: .5s; }
.login-illustration-dot.d3 { animation-delay: 1s; }
.login-brand-content { position: relative; z-index: 1; }
.login-brand-title {
  font-family: var(--font-display); font-size: 32px; font-weight: 600; line-height: 1.15;
  margin: 0 0 10px;
}
.login-brand-tagline {
  font-size: 13.5px; color: var(--text-muted); line-height: 1.55; max-width: 300px;
}
.login-feature-list { position: relative; z-index: 1; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.login-feature-list li {
  display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text);
}
.login-feature-icon {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  background: var(--surface-alt); border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.login-card {
  flex: 1 1 54%;
  background: var(--surface);
  padding: 44px 44px 34px;
  position: relative;
  display: flex; flex-direction: column; justify-content: center;
}
.login-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(145deg, var(--mint), var(--amber));
  color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px; box-shadow: 0 8px 20px -8px var(--mint);
}
.login-mark svg { width: 22px; height: 22px; }
.login-eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--mint); margin-bottom: 6px;
}
.login-title {
  font-family: var(--font-display); font-size: 28px; font-weight: 600;
  margin: 0 0 8px;
}
.login-tagline {
  font-size: 13px; color: var(--text-muted); margin-bottom: 26px; line-height: 1.5;
}
.login-tagline-compact { margin-bottom: 20px; }
#view-recovery-reveal .login-card {
  width: 420px; flex: none; border: 1px solid var(--line-strong); border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.45); animation: loginFadeUp .4s ease both;
}

@media (max-width: 860px) {
  .login-brand-panel { display: none; }
  .login-shell { max-width: 440px; box-shadow: 0 24px 60px -20px rgba(0,0,0,0.45); }
  .login-card { border: 1px solid var(--line-strong); border-radius: calc(var(--radius) + 4px); }
}
.hidden { display: none !important; }
#view-recovery-reveal {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg);
}
.existing-users { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.existing-users:empty { display: none; margin: 0; }
.existing-users button {
  font-family: var(--font-mono); font-size: 12px; color: var(--text); background: var(--surface-alt);
  border: 1px solid var(--line-strong); border-radius: 20px; padding: 5px 12px; cursor: pointer;
}
.existing-users button:hover { border-color: var(--mint); color: var(--mint); }
.recovery-code-box {
  font-family: var(--font-mono); font-size: 20px; letter-spacing: 2px; text-align: center;
  background: var(--surface-alt); border: 1px dashed var(--mint); border-radius: var(--radius);
  padding: 18px 10px; color: var(--mint); font-weight: 600;
}
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px;
  font-family: var(--font-mono); letter-spacing: 0.4px;
}
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 4px; padding: 10px 12px; font-size: 14px; color: var(--text);
  outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--mint); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--mint); color: #0A1512; border: none; border-radius: 4px;
  padding: 11px 18px; font-weight: 600; font-size: 14px; cursor: pointer;
  font-family: var(--font-body); transition: transform .1s, box-shadow .15s;
  width: 100%;
}
.btn:hover { box-shadow: 0 0 0 3px rgba(94,234,212,0.18); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line-strong); width: auto; }
.btn.danger { background: var(--coral); color: #2b0d0d; }
.btn.ghost { background: transparent; color: var(--mint); width: auto; padding: 8px 10px; }
.link-btn { background: none; border: none; color: var(--mint); cursor: pointer; font-size: 13px; padding: 0; text-decoration: underline; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-muted); }
.auth-error { color: var(--coral); font-size: 13px; margin-top: 4px; min-height: 18px; }

/* ---------- App shell ---------- */
#view-app { display: none; min-height: 100vh; }
#view-app.active { display: flex; }
#view-login.hidden { display: none; }

.sidebar {
  width: 216px; flex-shrink: 0; position: relative;
  background: linear-gradient(180deg, var(--surface-alt) 0%, var(--surface) 45%);
  border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column;
  box-shadow: 6px 0 28px -18px rgba(0,0,0,0.5);
}
.sidebar::after {
  content: ''; position: absolute; top: 0; right: -1px; bottom: 0; width: 1px;
  background: linear-gradient(180deg, var(--mint) 0%, transparent 22%);
  opacity: 0.5;
}
.brand {
  font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.2; margin: 0 8px 4px;
  display: flex; align-items: center; gap: 8px;
}
.brand::before {
  content: '◆'; color: var(--mint); font-size: 13px; flex-shrink: 0;
}
.brand-sub {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin: 0 8px 26px;
  letter-spacing: 1.5px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 4px;
  color: var(--text-muted); text-decoration: none; font-size: 14px; cursor: pointer;
  margin-bottom: 2px; border-left: 3px solid transparent;
  transition: background-color .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--surface-alt); color: var(--text); }
.nav-item.active {
  background: var(--surface-raised); color: var(--text); border-left-color: var(--mint); font-weight: 600;
}
.nav-icon { width: 16px; text-align: center; font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); transition: color .15s ease; }
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { color: var(--mint); }
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.user-chip {
  font-size: 12px; color: var(--text); padding: 6px 12px; font-family: var(--font-mono);
  display: flex; align-items: center; gap: 8px;
}
.user-chip-avatar {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(145deg, var(--mint), var(--amber));
  color: var(--bg); font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.main { flex: 1; padding: 28px 36px 60px; overflow-y: auto; height: 100vh; }
.page-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; }
.page-title { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin: 0; }
.page-sub { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ---------- Cards & ledger elements ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px;
}
.hairline { border: none; border-top: 1px solid var(--line); margin: 14px 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card { padding: 18px 20px; }
.stat-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-family: var(--font-mono); font-size: 26px; margin-top: 8px; font-weight: 600; }

.chart-card { padding: 20px; }
.chart-title { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }

/* Passbook-style account card — the signature element */
.passbook {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 16px 22px; position: relative; overflow: hidden;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.passbook::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 8px;
  background-image: radial-gradient(circle, var(--bg) 2.5px, transparent 2.6px);
  background-size: 8px 14px; background-position: 0 4px;
  background-color: var(--mint);
}
.bank-badge {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.4px;
  text-align: center; line-height: 1.1; padding: 2px;
}
.passbook-name { font-weight: 600; font-size: 15px; }
.passbook-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.passbook-balance { font-family: var(--font-mono); font-size: 18px; font-weight: 600; text-align: right; }
.passbook-actions { display: flex; gap: 6px; margin-top: 8px; }
.passbook-tag {
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
  padding: 2px 7px; border-radius: 20px; border: 1px solid var(--line-strong); color: var(--text-muted);
}

/* Tables (ledger rows) */
table.ledger { width: 100%; border-collapse: collapse; }
table.ledger th {
  text-align: left; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  color: var(--text-muted); letter-spacing: 0.6px; padding: 8px 10px; border-bottom: 1px solid var(--line-strong);
}
table.ledger td { padding: 10px 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
table.ledger td.note-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.ledger tr:hover td { background: var(--surface-alt); }
table.ledger td.right, table.ledger th.right { text-align: right; }

.pill {
  display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 20px;
  font-family: var(--font-mono); border: 1px solid var(--line-strong);
}

/* Category chip color dot */
.cat-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* Dashboard list rows (recent/biggest transactions, upcoming recurring) —
   a colored monogram icon per row instead of plain left-aligned text. */
.txn-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.txn-row:last-child { border-bottom: none; }
.txn-icon {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; border: 1px solid transparent;
  font-family: var(--font-body);
}
.txn-row-body { flex: 1; min-width: 0; }
.txn-row-title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn-row-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6,12,10,0.72); display: none;
  align-items: flex-start; justify-content: center; padding-top: 60px; z-index: 100; overflow-y: auto;
}
.modal-backdrop.active { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  width: 460px; max-width: 92vw; padding: 26px 26px 22px; margin-bottom: 60px;
}
.modal-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 0 0 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { width: auto; flex: 1; }
.close-x { position: absolute; top: 16px; right: 18px; background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }

.form-row { display: flex; gap: 12px; }
.form-row > .field { flex: 1; }

.toggle-group { display: flex; gap: 8px; margin-bottom: 16px; }
.toggle-opt {
  flex: 1; text-align: center; padding: 9px 8px; border: 1px solid var(--line-strong); border-radius: 4px;
  cursor: pointer; font-size: 13px; color: var(--text-muted); font-family: var(--font-mono);
}
.toggle-opt.active { background: var(--surface-raised); color: var(--mint); border-color: var(--mint); }

.empty-state {
  text-align: center; padding: 50px 20px; color: var(--text-muted);
}
.empty-state .big { font-family: var(--font-display); font-size: 20px; color: var(--text); margin-bottom: 6px; }

.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--surface-raised);
  border: 1px solid var(--mint); color: var(--text); padding: 12px 18px; border-radius: 4px;
  font-size: 13px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* Budget progress bars */
.budget-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.budget-row-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.budget-track { height: 8px; border-radius: 4px; background: var(--surface-alt); overflow: hidden; }
.budget-fill { height: 100%; border-radius: 4px; }

/* Theme picker — each .theme-preview carries its own data-theme attribute,
   re-declaring the --bg/--surface/etc custom properties locally, so it
   renders that THEME's actual colors regardless of which theme is active
   for the rest of the page (custom properties cascade to descendants from
   wherever they're last set, not only from the root). */
.theme-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
}
.theme-swatch {
  display: flex; flex-direction: column; gap: 9px;
  background: var(--surface-alt); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 10px; cursor: pointer; font-family: var(--font-body);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.theme-swatch:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -12px rgba(0,0,0,0.45); }
.theme-swatch.active { border-color: var(--mint); box-shadow: 0 0 0 2px var(--mint); }
.theme-preview {
  display: block; border-radius: 6px; height: 60px; padding: 8px;
  background: var(--bg); border: 1px solid var(--line);
}
.theme-preview-card {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 4px;
  height: 100%; padding: 7px 8px; display: flex; flex-direction: column; justify-content: center; gap: 5px;
}
.theme-preview-dot { width: 16px; height: 4px; border-radius: 2px; background: var(--mint); display: block; }
.theme-preview-bar { width: 75%; height: 4px; border-radius: 2px; background: var(--text-muted); opacity: 0.55; display: block; }
.theme-preview-bar.short { width: 42%; background: var(--text); opacity: 0.9; }
.theme-swatch-label { font-size: 12.5px; color: var(--text); display: flex; align-items: center; justify-content: space-between; }
.theme-check { color: var(--mint); font-weight: 700; }

.section-title {
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-muted); margin: 26px 0 10px;
}

.import-drop {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 40px 20px;
  text-align: center; color: var(--text-muted); cursor: pointer; transition: border-color .15s;
}
.import-drop:hover, .import-drop.dragover { border-color: var(--mint); color: var(--text); }

.review-row { display: grid; grid-template-columns: 130px 1fr 80px 80px 120px 46px 22px; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.review-row input, .review-row select { background: var(--bg); border: 1px solid var(--line-strong); border-radius: 4px; padding: 6px 8px; font-size: 12.5px; width: 100%; }
.review-row input[type="date"] { padding: 6px 4px; font-size: 11.5px; }

@media print {
  .sidebar, .page-header .btn, .page-header button { display: none !important; }
  body, .main { background: #fff !important; color: #111 !important; height: auto; overflow: visible; }
  .main { padding: 10px 20px; }
  .card { border-color: #ccc !important; break-inside: avoid; }
  .chart-box, .chart-box.tall { height: 220px; }
}

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .brand, .brand-sub, .nav-item span.label { display: none; }
  .main { padding: 20px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
