/* ─────────────────────────────────────────────────────────────────────────────
   icantsave — styles.css
   Single source of truth for all visual styles.
───────────────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── DESIGN TOKENS ─────────────────────────────────────────────────────────── */
:root {
  --bg:          #0a0c10;
  --surface:     #10131a;
  --surface2:    #161922;
  --surface3:    #1c2030;
  --border:      #212535;
  --border2:     #2a3048;
  --gold:        #c9a84c;
  --gold-dim:    #7a5e20;
  --gold-glow:   rgba(201,168,76,0.10);
  --gold-glow2:  rgba(201,168,76,0.18);
  --green:       #3ecf8e;
  --green-dim:   #174d34;
  --red:         #f06969;
  --red-dim:     #5c2020;
  --blue:        #5b8dee;
  --blue-dim:    #1e3260;
  --purple:      #a78bfa;
  --purple-dim:  #3a2060;
  --text:        #e8e4d9;
  --text2:       #7a7870;
  --text3:       #4a4844;
  --radius:      14px;
  --radius-sm:   9px;
  --header-bg:   rgba(10,12,16,0.94);
  --shadow:      0 4px 24px rgba(0,0,0,0.35);
}

:root.light {
  --bg:          #f2f0eb;
  --surface:     #ffffff;
  --surface2:    #f7f5f0;
  --surface3:    #edeae3;
  --border:      #e0ddd6;
  --border2:     #ccc8bf;
  --gold:        #8a6010;
  --gold-dim:    #b8892a;
  --gold-glow:   rgba(138,96,16,0.08);
  --gold-glow2:  rgba(138,96,16,0.14);
  --green:       #1a7a50;
  --green-dim:   #c0e8d6;
  --red:         #b83030;
  --red-dim:     #f2c8c8;
  --blue:        #1e5cc0;
  --blue-dim:    #c0d4f8;
  --purple:      #6d40d0;
  --purple-dim:  #e0d4fc;
  --text:        #1a1814;
  --text2:       #5a5652;
  --text3:       #9a9690;
  --header-bg:   rgba(242,240,235,0.94);
  --shadow:      0 4px 24px rgba(0,0,0,0.10);
}

/* ── BASE ──────────────────────────────────────────────────────────────────── */
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

/* ── LOADING ───────────────────────────────────────────────────────────────── */
#loading-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 3000; gap: 1rem;
  transition: opacity 0.4s;
}
#loading-overlay.fade-out { opacity: 0; pointer-events: none; }
#loading-overlay.hidden    { display: none; }

.loading-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem; color: var(--gold);
  letter-spacing: 0.04em; margin-bottom: 0.5rem;
}
.loading-text { font-size: 13px; color: var(--text2); letter-spacing: 0.08em; }

.spinner {
  width: 34px; height: 34px;
  border: 2px solid var(--border2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.72s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── AUTH ──────────────────────────────────────────────────────────────────── */
#auth-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse 70% 50% at 50% 65%, var(--gold-glow2) 0%, transparent 70%);
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 2000; padding: 1.5rem;
}
#auth-screen.visible { display: flex; }

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 2.25rem 2rem;
  width: min(400px, 100%);
  display: flex; flex-direction: column; gap: 0;
  box-shadow: var(--shadow);
  animation: slideUp 0.35s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-brand { text-align: center; margin-bottom: 2rem; }
.auth-emblem {
  width: 64px; height: 64px;
  border: 1.5px solid var(--gold-dim);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  background: var(--gold-glow);
  color: var(--gold);
}
.auth-emblem svg { width: 28px; height: 28px; }
.auth-title  { font-family: 'Playfair Display', serif; font-size: 1.7rem; color: var(--gold); letter-spacing: 0.02em; }
.auth-sub    { font-size: 12px; color: var(--text3); margin-top: 4px; letter-spacing: 0.07em; text-transform: uppercase; }

.auth-tabs {
  display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem;
}
.auth-tab {
  flex: 1; padding: 10px; text-align: center;
  font-size: 13px; font-weight: 500; color: var(--text2);
  cursor: pointer; background: none; border: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s; font-family: 'DM Sans', sans-serif; margin-bottom: -1px;
}
.auth-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.auth-pane            { display: none; flex-direction: column; gap: 12px; }
.auth-pane.active     { display: flex; }

.google-icon { width: 18px; height: 18px; flex-shrink: 0; }
.divider {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--text3); margin: 4px 0;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── PAYWALL ───────────────────────────────────────────────────────────────── */
#paywall-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse 70% 50% at 50% 65%, var(--gold-glow2) 0%, transparent 70%);
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 1500; padding: 1.5rem;
}
#paywall-screen.visible { display: flex; }

.paywall-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 2.25rem 2rem;
  width: min(420px, 100%);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  animation: slideUp 0.35s ease;
}
.paywall-brand { text-align: center; margin-bottom: 1.5rem; }

.paywall-price {
  display: flex; align-items: baseline; justify-content: center; gap: 4px;
  margin-bottom: 0.5rem;
}
.paywall-amount {
  font-family: 'Playfair Display', serif;
  font-size: 3rem; font-weight: 700; line-height: 1;
  color: var(--text);
}
.paywall-period {
  font-family: 'DM Mono', monospace;
  font-size: 14px; color: var(--text3);
}
.paywall-desc {
  text-align: center; font-size: 13px; color: var(--text2);
  margin-bottom: 1.5rem;
}
.paywall-features {
  list-style: none; margin-bottom: 1.5rem;
}
.paywall-features li {
  font-size: 13px; color: var(--text2);
  padding: 7px 0; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.paywall-features li:last-child { border-bottom: none; }
.pw-ck { color: var(--green); font-weight: 700; font-size: 14px; flex-shrink: 0; }
.paywall-meta {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; font-size: 11px; color: var(--text3);
  margin-top: 0.75rem;
}
.paywall-meta a { color: var(--text2); text-decoration: underline; }
.paywall-meta a:hover { color: var(--gold); }
.paywall-meta strong { color: var(--text2); }

/* ── FORM ELEMENTS ─────────────────────────────────────────────────────────── */
.field-label {
  font-size: 11px; color: var(--text2);
  letter-spacing: 0.09em; text-transform: uppercase;
  margin-bottom: 4px; display: block;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
input::placeholder { color: var(--text3); }
select option { background: var(--surface2); color: var(--text); }

.err-msg     { font-size: 12px; color: var(--red); min-height: 16px; }
.success-msg { font-size: 12px; color: var(--green); min-height: 16px; }

/* ── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn {
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 500;
  transition: all 0.18s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm  { font-size: 12px; padding: 7px 14px; }
.btn-lg  { font-size: 14px; padding: 10px 20px; }

.btn-gold { background: var(--gold); color: #1a1200; }
.btn-gold:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 4px 14px rgba(201,168,76,0.28); }

.btn-ghost { background: transparent; border: 1px solid var(--border2); color: var(--text2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--gold-dim); color: var(--gold); }

.btn-google { background: var(--surface2); border: 1px solid var(--border2); color: var(--text); width: 100%; }
.btn-google:hover:not(:disabled) { background: var(--surface3); }

.btn-danger  { background: transparent; border: 1px solid var(--red-dim); color: var(--red); font-size: 12px; padding: 5px 10px; }
.btn-danger:hover:not(:disabled) { background: var(--red-dim); }

/* ── APP SHELL ─────────────────────────────────────────────────────────────── */
#app { display: none; flex-direction: column; min-height: 100vh; }
#app.visible { display: flex; }

/* ── HEADER ────────────────────────────────────────────────────────────────── */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  z-index: 100; gap: 1rem;
  transition: background 0.3s, border-color 0.3s;
}
.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem; color: var(--gold);
  letter-spacing: 0.03em; line-height: 1;
  display: flex; flex-direction: column;
}
.logo span {
  font-size: 10px; font-family: 'DM Sans', sans-serif;
  color: var(--text3); letter-spacing: 0.1em;
  text-transform: uppercase; margin-top: 1px; font-weight: 400;
}
.header-right { display: flex; gap: 0.5rem; align-items: center; }
#header-currency { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text2); }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px 4px 5px;
}
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--gold-glow); border: 1.5px solid var(--gold-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--gold);
  overflow: hidden; flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-email { font-size: 12px; color: var(--text2); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── TABS ──────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 7px 15px; border-radius: 999px;
  cursor: pointer; font-size: 13px; color: var(--text2);
  background: transparent; border: 1px solid transparent;
  transition: all 0.18s; white-space: nowrap;
  font-family: 'DM Sans', sans-serif; font-weight: 500;
}
.tab:hover  { color: var(--text); background: var(--surface2); }
.tab.active { background: var(--gold-glow); border-color: var(--gold-dim); color: var(--gold); }

/* ── MAIN / PAGES ──────────────────────────────────────────────────────────── */
main { flex: 1; padding: 1.5rem; max-width: 940px; width: 100%; margin: 0 auto; }
.page         { display: none; }
.page.active  { display: block; animation: fadeIn 0.22s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── STAT CARDS ────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px; margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
  display: flex; flex-direction: column; gap: 4px;
  transition: background 0.3s, border-color 0.2s, transform 0.15s;
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.stat-card.highlight  { border-color: var(--gold-dim);  background: var(--gold-glow); }
.stat-card.green-hl   { border-color: var(--green-dim); background: rgba(62,207,142,0.06); }
.stat-card.red-hl     { border-color: var(--red-dim);   background: rgba(240,105,105,0.06); }

.stat-label { font-size: 11px; color: var(--text2); letter-spacing: 0.09em; text-transform: uppercase; }
.stat-value { font-family: 'DM Mono', monospace; font-size: 1.2rem; font-weight: 500; line-height: 1.2; margin-top: 2px; }
.stat-value.green  { color: var(--green); }
.stat-value.red    { color: var(--red); }
.stat-value.gold   { color: var(--gold); }
.stat-value.blue   { color: var(--blue); }
.stat-value.purple { color: var(--purple); }
.stat-sub { font-size: 11px; color: var(--text3); font-family: 'DM Mono', monospace; margin-top: 3px; }

/* ── PROGRESS ──────────────────────────────────────────────────────────────── */
.progress-section {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem; transition: background 0.3s;
}
.progress-section.gold-border { border-color: var(--gold-dim); }

.progress-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem; gap: 1rem; flex-wrap: wrap;
}
.progress-title  { font-family: 'Playfair Display', serif; font-size: 0.95rem; color: var(--gold); }
.progress-amount { font-family: 'DM Mono', monospace; font-size: 1.5rem; font-weight: 500; color: var(--gold); }

.progress-bar  { height: 7px; background: var(--border2); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--gold); transition: width 0.55s cubic-bezier(0.4,0,0.2,1); }
.progress-fill.green { background: var(--green); }
.progress-fill.red   { background: var(--red); }

.progress-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text3); font-family: 'DM Mono', monospace;
}

/* ── SAVINGS TARGET ────────────────────────────────────────────────────────── */
.target-section {
  background: var(--surface);
  border: 1px solid var(--green-dim);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  background-image: linear-gradient(135deg, rgba(62,207,142,0.04) 0%, transparent 60%);
}
.target-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem; flex-wrap: wrap; gap: 8px;
}
.target-title  { font-family: 'Playfair Display', serif; font-size: 0.95rem; color: var(--green); }
.target-amount { font-family: 'DM Mono', monospace; font-size: 1.4rem; font-weight: 500; color: var(--green); }
.target-of     { font-size: 11px; color: var(--text3); font-family: 'DM Mono', monospace; }

/* ── CUSTOM VARS GRID ──────────────────────────────────────────────────────── */
.custom-vars-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px; margin-bottom: 1.25rem;
}
.custom-var-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.2s;
}
.custom-var-card:hover { border-color: var(--purple-dim); }
.custom-var-label {
  font-size: 11px; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.09em;
  display: flex; align-items: center; justify-content: space-between;
}
.custom-var-value { font-family: 'DM Mono', monospace; font-size: 1.1rem; color: var(--purple); font-weight: 500; }
.custom-var-note  { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ── CARD ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  transition: background 0.3s, border-color 0.2s;
}
.card-title { font-family: 'Playfair Display', serif; font-size: 1rem; color: var(--text); margin-bottom: 1rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }
.form-group   { display: flex; flex-direction: column; gap: 5px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }

/* ── TYPE TOGGLE ───────────────────────────────────────────────────────────── */
.type-toggle { display: flex; gap: 6px; }
.type-btn {
  flex: 1; padding: 9px; border-radius: var(--radius-sm);
  border: 1px solid var(--border2); background: transparent;
  cursor: pointer; font-size: 13px; font-weight: 500;
  font-family: 'DM Sans', sans-serif; color: var(--text2);
  transition: all 0.18s;
}
.type-btn.income.active  { background: rgba(62,207,142,0.12);  border-color: var(--green-dim); color: var(--green); }
.type-btn.expense.active { background: rgba(240,105,105,0.12); border-color: var(--red-dim);   color: var(--red); }
.type-btn.active:not(.income):not(.expense) { background: var(--gold-glow); border-color: var(--gold-dim); color: var(--gold); }

/* ── FILTER BUTTONS ────────────────────────────────────────────────────────── */
.tx-filters { display: flex; gap: 6px; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-btn {
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border2); background: transparent;
  color: var(--text2); font-size: 12px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: all 0.18s;
}
.filter-btn.active         { border-color: var(--gold-dim);  color: var(--gold);  background: var(--gold-glow); }
.filter-btn.income.active  { border-color: var(--green-dim); color: var(--green); background: rgba(62,207,142,0.08); }
.filter-btn.expense.active { border-color: var(--red-dim);   color: var(--red);   background: rgba(240,105,105,0.08); }

/* ── TRANSACTION LIST ──────────────────────────────────────────────────────── */
.tx-list { display: flex; flex-direction: column; gap: 7px; }
.tx-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.9rem 1rem;
  display: flex; align-items: center; gap: 12px;
  transition: border-color 0.18s, transform 0.15s;
}
.tx-item:hover { border-color: var(--border2); transform: translateX(2px); }

.tx-indicator { width: 3px; height: 36px; border-radius: 2px; flex-shrink: 0; }
.tx-indicator.income  { background: var(--green); }
.tx-indicator.expense { background: var(--red); }

.tx-info { flex: 1; min-width: 0; }
.tx-desc { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.tx-meta { font-size: 11px; color: var(--text3); margin-top: 2px; font-family: 'DM Mono', monospace; }

.tx-cat { font-size: 10px; padding: 2px 7px; border-radius: 999px; margin-left: 6px; font-family: 'DM Mono', monospace; }
.tx-cat.income  { background: rgba(62,207,142,0.12);  color: var(--green); }
.tx-cat.expense { background: rgba(240,105,105,0.12); color: var(--red); }

.tx-right { text-align: right; flex-shrink: 0; }
.tx-amount { font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 500; }
.tx-amount.income  { color: var(--green); }
.tx-amount.expense { color: var(--red); }
.tx-var-tag      { font-size: 10px; color: var(--gold); font-family: 'DM Mono', monospace; margin-top: 2px; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text3); font-size: 13px; }
.empty-icon  { font-size: 2rem; margin-bottom: 0.5rem; opacity: 0.3; }

/* ── ACTION CARDS (Spendable) ──────────────────────────────────────────────── */
.spendable-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1.25rem;
}
@media (max-width: 500px) { .spendable-actions { grid-template-columns: 1fr; } }
.action-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.2s;
}
.action-card:hover { border-color: var(--border2); }
.action-card-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text2); font-weight: 500; }

/* ── LOG LIST ──────────────────────────────────────────────────────────────── */
.log-list { display: flex; flex-direction: column; gap: 2px; }
.log-item {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; padding: 8px 2px;
  border-bottom: 1px solid var(--border); gap: 8px;
}
.log-item:last-child { border-bottom: none; }
.log-desc   { color: var(--text2); flex: 1; }
.log-amount { font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 500; }
.log-amount.add { color: var(--green); }
.log-amount.sub { color: var(--red); }
.log-amount.set { color: var(--blue); }

/* ── VARIABLE CARDS (new system) ───────────────────────────────────────────── */
.var-hub-nav {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.var-hub-nav:empty { display: none; }
.var-hub-btn {
  padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--border2); background: var(--surface2);
  color: var(--text2); font-size: 13px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-weight: 500;
  transition: all 0.18s;
}
.var-hub-btn:hover { border-color: var(--gold-dim); color: var(--gold); background: var(--gold-glow); }
.var-card-highlight { outline: 2px solid var(--gold-dim); transition: outline 0.2s; }
.var-card { margin-bottom: 10px; }
.var-card-header  { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 2px; }
.var-card-name    { font-family: 'Playfair Display', serif; font-size: 1.05rem; color: var(--text); }
.var-card-value   { font-family: 'DM Mono', monospace; font-size: 1.3rem; color: var(--gold); font-weight: 500; }
.var-card-desc    { font-size: 12px; color: var(--text3); margin-bottom: 10px; }
.var-card-rules   { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.var-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.var-rule-tag {
  font-size: 11px; padding: 2px 9px; border-radius: 999px;
  font-family: 'DM Mono', monospace; border: 1px solid transparent;
}
.var-rule-tag.income  { background: rgba(62,207,142,0.10);  color: var(--green); border-color: var(--green-dim); }
.var-rule-tag.expense { background: rgba(240,105,105,0.10); color: var(--red);   border-color: var(--red-dim); }
.var-rule-tag.none    { background: var(--surface3); color: var(--text3); border-color: var(--border); }

/* ── RULE ROW (modal) ──────────────────────────────────────────────────────── */
.rule-row         { display: flex; gap: 8px; align-items: center; }
.rule-row select  { flex: 1; }
.rule-row input   { width: 110px; flex-shrink: 0; }

/* ── VARIABLES PAGE ────────────────────────────────────────────────────────── */
.var-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.var-list-item:last-child { border-bottom: none; }
.var-name  { flex: 1; color: var(--text); font-weight: 500; }
.var-note  { flex: 1; color: var(--text3); font-size: 12px; padding: 0 8px; }
.var-val   { font-family: 'DM Mono', monospace; color: var(--purple); font-size: 12px; min-width: 90px; text-align: right; }
.var-actions { display: flex; gap: 6px; }

/* ── SETTINGS ──────────────────────────────────────────────────────────────── */
.settings-section { margin-bottom: 2rem; }
.settings-title {
  font-family: 'Playfair Display', serif; font-size: 1.05rem; color: var(--text);
  margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
}
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 0; border-bottom: 1px solid var(--border); gap: 1rem; flex-wrap: wrap;
}
.setting-info { flex: 1; min-width: 160px; }
.setting-label { font-size: 14px; color: var(--text); font-weight: 500; }
.setting-desc  { font-size: 12px; color: var(--text3); margin-top: 2px; }
.setting-control { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.currency-select { width: 100px; }
.pct-input       { width: 80px; }

/* ── CHARTS ────────────────────────────────────────────────────────────────── */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1.25rem; }
@media (max-width: 600px) { .chart-row { grid-template-columns: 1fr; } }
.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; transition: background 0.3s;
}
.chart-title { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 1rem; font-weight: 500; }
.bar-chart   { display: flex; flex-direction: column; gap: 9px; }
.bar-row     { display: flex; align-items: center; gap: 8px; }
.bar-label   { font-size: 12px; color: var(--text2); width: 88px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track   { flex: 1; height: 7px; background: var(--border2); border-radius: 4px; overflow: hidden; }
.bar-fill    { height: 100%; border-radius: 4px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }
.bar-val     { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text2); min-width: 64px; text-align: right; flex-shrink: 0; }

/* ── MODAL ─────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 200; align-items: center; justify-content: center;
  padding: 1rem; display: none;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 1.75rem;
  width: min(440px, 100%); display: flex; flex-direction: column; gap: 1rem;
  box-shadow: var(--shadow); animation: slideUp 0.28s ease;
}
.modal-title   { font-family: 'Playfair Display', serif; font-size: 1.15rem; }
.modal-body    { font-size: 13px; color: var(--text2); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* ── TOAST ─────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--surface2); border: 1px solid var(--border2); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13px;
  transform: translateY(80px) scale(0.96); opacity: 0;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 999; max-width: 280px; box-shadow: var(--shadow);
}
#toast.show    { transform: translateY(0) scale(1); opacity: 1; }
#toast.success { border-color: var(--green-dim); }
#toast.error   { border-color: var(--red-dim); color: var(--red); }

/* ── SAVE INDICATOR ────────────────────────────────────────────────────────── */
#save-indicator {
  position: fixed; bottom: 1.5rem; left: 1.5rem;
  font-size: 11px; font-family: 'DM Mono', monospace;
  color: var(--text3); display: flex; align-items: center; gap: 6px;
  z-index: 998; transition: opacity 0.4s; opacity: 0; pointer-events: none;
}
#save-indicator.visible { opacity: 1; }
.save-dot          { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.save-dot.saving   { background: var(--gold); animation: pulse 0.8s ease-in-out infinite; }
.save-dot.error    { background: var(--red); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── CHIPS ─────────────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-family: 'DM Mono', monospace;
}
.chip.gold   { background: var(--gold-glow);              color: var(--gold);   border: 1px solid var(--gold-dim); }
.chip.green  { background: rgba(62,207,142,0.10);         color: var(--green);  border: 1px solid var(--green-dim); }
.chip.red    { background: rgba(240,105,105,0.10);        color: var(--red);    border: 1px solid var(--red-dim); }
.chip.purple { background: rgba(167,139,250,0.10);        color: var(--purple); border: 1px solid var(--purple-dim); }

/* ── UTILITY ───────────────────────────────────────────────────────────────── */
.section-sep   { height: 1px; background: var(--border); margin: 0.5rem 0 1rem; }
.row-between   { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; flex-wrap: wrap; gap: 8px; }
.page-heading  { font-family: 'Playfair Display', serif; font-size: 1.2rem; color: var(--text); margin-bottom: 1.25rem; }

/* ── ANALYTICS BARS ────────────────────────────────────────────────────────── */
.cat-bar-row   { display: grid; grid-template-columns: 130px 1fr 160px; gap: 10px; align-items: center; margin-bottom: 8px; }
@media (max-width:600px) { .cat-bar-row { grid-template-columns: 90px 1fr 120px; } }
.cat-bar-label { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-bar-track { background: var(--bg3); border-radius: 4px; height: 8px; overflow: hidden; }
.cat-bar-fill  { background: var(--red); height: 100%; border-radius: 4px; transition: width 0.5s cubic-bezier(.4,0,.2,1); }
.cat-bar-vals  { display: flex; justify-content: space-between; font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text2); }

.month-bar-row { display: grid; grid-template-columns: 80px 1fr 200px; gap: 10px; align-items: center; margin-bottom: 10px; }
@media (max-width:600px) { .month-bar-row { grid-template-columns: 70px 1fr; } }
.month-label   { font-size: 11px; color: var(--text3); font-family: 'DM Mono', monospace; }
.month-bars    { display: flex; flex-direction: column; gap: 3px; }
.mo-bar-wrap   { background: var(--bg3); border-radius: 3px; height: 6px; overflow: hidden; }
.mo-bar        { background: var(--green); height: 100%; border-radius: 3px; transition: width 0.5s cubic-bezier(.4,0,.2,1); }
.mo-bar.red-fill { background: var(--red); }
.month-vals    { display: flex; gap: 12px; font-family: 'DM Mono', monospace; font-size: 11px; }
@media (max-width:600px) { .month-vals { display: none; } }

/* ── SETTINGS ──────────────────────────────────────────────────────────────── */
.settings-row   { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.settings-label { font-size: 13px; color: var(--text); font-weight: 500; margin-bottom: 2px; }
.settings-desc  { font-size: 11px; color: var(--text3); line-height: 1.4; }
.theme-toggle-row { display: flex; gap: 6px; }
.theme-btn      { padding: 7px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border2); background: transparent; color: var(--text2); font-size: 12px; cursor: pointer; transition: all 0.2s; }
.theme-btn.active { background: var(--gold); color: var(--bg); border-color: var(--gold); font-weight: 600; }
.theme-btn:hover:not(.active) { border-color: var(--gold); color: var(--gold); }
.chip-list      { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-delete    { background: none; border: none; color: inherit; cursor: pointer; padding: 0 0 0 4px; opacity: 0.6; font-size: 14px; line-height: 1; }
.chip-delete:hover { opacity: 1; }
.danger-card    { border-color: var(--red-dim) !important; }

/* ── SCROLLBAR ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  header { padding: 0.75rem 1rem; }
  .tabs  { padding: 0.5rem 0.75rem; }
  main   { padding: 1rem; }
  .logo  { font-size: 1.15rem; }
  .user-email { display: none; }
}
