@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700;800&display=swap');

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

:root {
  --canvas: #E7E4DF;
  --bg: #F6F3EF;
  --surface: #FFFFFF;
  --surface-2: #FBF9F6;
  --surface-3: #F1EDE7;
  --border: #EAE4DC;
  --border-2: #E0D8CD;
  --text: #2B2722;
  --text-soft: #6E665B;
  --text-faint: #9D9488;
  --accent: #BE7A5E;
  --accent-2: #A8634A;
  --accent-soft: #F4E8E0;
  --accent-line: #E7CFC1;
  --good: #5C7A5C;
  --good-bg: #E7EFE7;
  --info: #5A7794;
  --info-bg: #E7EDF2;
  --warn: #9C6B2E;
  --warn-bg: #F6ECDC;
  --neutral: #8B8276;
  --neutral-bg: #EFEBE5;
  --over: #B0544A;
  --over-bg: #F4E1DE;
  --shadow: 0 1px 2px rgba(43,39,34,.05), 0 8px 24px -12px rgba(43,39,34,.12);
  --shadow-lg: 0 24px 60px -24px rgba(43,39,34,.30);
  --r-card: 18px;
  --r-inner: 13px;
  --r-field: 11px;
}

.dark {
  --canvas: #100E0B;
  --bg: #1A1713;
  --surface: #242019;
  --surface-2: #2A251E;
  --surface-3: #312B23;
  --border: #37312A;
  --border-2: #433C32;
  --text: #F1ECE4;
  --text-soft: #B2A899;
  --text-faint: #7C7367;
  --accent: #D69A7C;
  --accent-2: #E0A98D;
  --accent-soft: #2F2620;
  --accent-line: #4A3A30;
  --good: #9CC09C;
  --good-bg: #232C23;
  --info: #9DB6CD;
  --info-bg: #222C35;
  --warn: #D6A45E;
  --warn-bg: #322A1E;
  --neutral: #A89F93;
  --neutral-bg: #2C2820;
  --over: #E08379;
  --over-bg: #332220;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.55);
  --shadow-lg: 0 30px 70px -28px rgba(0,0,0,.7);
}

html, body {
  font-family: 'Onest', system-ui, sans-serif;
  background: var(--canvas);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
  min-height: 100vh;
}

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- Layout ---- */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--surface); /* fills sidebar column for full height */
}

/* Desktop sidebar */
.sidebar {
  flex: none;
  width: 236px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px;
}

.brand-logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  display: flex; align-items: center; justify-content: center;
  flex: none;
}

.brand-diamond {
  width: 12px; height: 12px;
  background: var(--accent);
  transform: rotate(45deg);
  border-radius: 2px;
}

.brand-text { line-height: 1.15; white-space: nowrap; }
.brand-title { font-weight: 700; font-size: 14px; }
.brand-sub { font-size: 11px; color: var(--text-faint); }

.nav-list { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-field);
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.nav-icon { width: 18px; display: flex; justify-content: center; font-size: 16px; }
.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 7px;
  color: var(--text-faint);
}
.nav-item.active .nav-count { background: var(--accent-line); border-color: var(--accent-line); color: var(--accent-2); }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 14px;
}

.event-widget {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
}

.event-widget-label { font-size: 11px; color: var(--text-faint); margin-bottom: 3px; }
.event-widget-days { font-weight: 700; font-size: 18px; }

.event-progress {
  height: 6px;
  background: var(--surface-3);
  border-radius: 4px;
  margin-top: 9px;
  overflow: hidden;
}
.event-progress-fill { height: 100%; background: var(--accent); border-radius: 4px; }

/* Main content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  border-left: 1px solid var(--border);
}

.content-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.content-header-title { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.content-header-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.content-body { padding: 24px 28px 40px; }

/* ---- Mobile FAB (floating action button) ---- */
.fab {
  display: none;
  position: fixed;
  right: 20px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 16px);
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 25;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: opacity .15s, transform .15s;
}
.fab:hover { opacity: .88; transform: scale(1.05); }
.fab:active { opacity: .75; transform: scale(.97); }

/* ---- Mobile bottom nav ---- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
}

.bottom-nav-list {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border-radius: 10px;
  transition: background .15s;
}

.bottom-nav-item:hover { background: var(--surface-2); }

.bottom-nav-icon {
  width: 40px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  font-size: 18px;
  transition: background .15s;
}

.bottom-nav-item.active { color: var(--accent-2); }
.bottom-nav-item.active .bottom-nav-icon { background: var(--accent-soft); }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}

.card-inner {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-inner);
  padding: 12px 14px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-field);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, background .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { opacity: .88; }
.btn:active { opacity: .75; }

.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-danger { background: var(--over-bg); color: var(--over); border: 1px solid var(--over); }
.btn-icon { width: 38px; padding: 0; justify-content: center; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }

/* ---- Form fields ---- */
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; color: var(--text-faint); font-weight: 500; }

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-field);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-color: var(--accent);
}

.field-textarea { height: auto; padding: 10px 14px; resize: vertical; }
.field-input.error, .field-select.error { border-color: var(--over); }

.search-wrap { position: relative; }
.search-icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 15px;
  pointer-events: none;
}
.search-wrap .field-input { padding-left: 36px; }

/* ---- Segment control ---- */
.segment {
  display: flex;
  align-items: center;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-field);
  padding: 3px;
  gap: 2px;
}

.segment-btn {
  height: 30px;
  padding: 0 13px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.segment-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex: none;
}

.badge-planned { background: var(--neutral-bg); color: var(--neutral); }
.badge-booked { background: var(--info-bg); color: var(--info); }
.badge-partially_paid { background: var(--warn-bg); color: var(--warn); }
.badge-paid { background: var(--good-bg); color: var(--good); }

.badge-must_have { background: var(--accent-soft); color: var(--accent-2); border-radius: 7px; font-size: 10.5px; }
.badge-optional {
  background: transparent;
  color: var(--text-faint);
  border: 1px solid var(--border-2);
  border-radius: 7px;
  font-size: 10.5px;
}

/* ---- Progress bar ---- */
.progress-wrap { position: relative; height: 12px; border-radius: 7px; overflow: hidden; }
.progress-track { position: absolute; inset: 0; background: var(--surface-3); border-radius: 7px; }
.progress-track.over { background: var(--over-bg); }
.progress-planned { position: absolute; inset: 0; background: var(--accent-line); border-radius: 7px; }
.progress-paid { position: absolute; inset: 0; background: var(--accent); border-radius: 7px; }
.progress-over { position: absolute; inset: 0; background: var(--over); border-radius: 7px; }

/* ---- KPI Grid ---- */
.kpi-grid { display: grid; gap: 10px; }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid-2 { grid-template-columns: repeat(2, 1fr); }

.kpi-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-inner);
  padding: 12px 14px;
}
.kpi-label { font-size: 11px; color: var(--text-faint); line-height: 1.25; height: 28px; }
.kpi-value { font-weight: 700; font-size: 18px; letter-spacing: -.01em; margin-top: 2px; }

/* ---- Currency block ---- */
.cur-block { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.cur-block-header { display: flex; align-items: center; justify-content: space-between; }
.cur-sym {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: var(--accent-2);
  font-size: 15px;
}
.cur-name { font-weight: 700; font-size: 15px; }
.cur-budget-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 9px;
}
.progress-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.progress-meta-label { font-size: 12px; color: var(--text-soft); }
.progress-meta-pct { font-size: 12.5px; font-weight: 700; }
.progress-meta-pct.over { color: var(--over); }
.progress-legend { display: flex; align-items: center; gap: 16px; margin-top: 9px; font-size: 11.5px; color: var(--text-soft); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; }

/* ---- Table ---- */
.expense-table { overflow: hidden; }
.expense-table-head {
  display: grid;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.expense-table-row {
  display: grid;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
  transition: background .12s;
  text-decoration: none;
  color: inherit;
}
.expense-table-row:hover { background: var(--surface-2); }
.expense-table-footer {
  display: grid;
  gap: 12px;
  padding: 15px 20px;
  background: var(--surface-2);
  font-weight: 700;
  align-items: center;
  font-size: 13px;
}

.tbl-cols { grid-template-columns: 2.4fr 1.3fr 1.1fr 1.1fr 1fr 1fr 1.3fr; }
.text-right { text-align: right; }

/* ---- Expense cards (mobile) ---- */
.expense-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 15px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: background .12s;
}
.expense-card:hover { background: var(--surface-2); }

.cat-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }

/* ---- Donut chart ---- */
.donut-wrap { position: relative; flex: none; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.donut-center-label { font-size: 10px; color: var(--text-faint); }
.donut-center-value { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 90%; text-align: center; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(20, 16, 12, .5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-box {
  width: min(560px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
}

.modal-box-lg { width: min(720px, 95vw); max-height: 90vh; }

.modal-header {
  position: sticky;
  top: 0;
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  z-index: 1;
}

.modal-title { font-weight: 700; font-size: 16px; }

.modal-close {
  width: 30px; height: 30px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  margin-left: auto;
  transition: background .15s;
}
.modal-close:hover { background: var(--surface-3); }

.modal-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }

.modal-footer {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.modal-footer .btn { flex: 1; height: 42px; border-radius: 12px; font-size: 13.5px; }

/* ---- Grid helpers ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-14 { gap: 14px; }
.gap-16 { gap: 16px; }
.gap-18 { gap: 18px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.min-w-0 { min-width: 0; }

/* ---- Savings block ---- */
.savings-block { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.savings-header { display: flex; align-items: center; justify-content: space-between; }
.savings-count { font-size: 11px; color: var(--text-faint); }
.savings-total { font-size: 14px; font-weight: 700; }

.savings-account {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-inner);
}
.savings-account-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex: none;
}
.savings-account-name { font-weight: 600; font-size: 13px; }
.savings-account-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }
.savings-account-amount { font-weight: 700; font-size: 14px; margin-left: auto; }

.coverage-bar { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.coverage-fill { height: 100%; background: var(--good); border-radius: 4px; }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-faint);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-title { font-weight: 600; font-size: 15px; color: var(--text-soft); margin-bottom: 6px; }
.empty-state-sub { font-size: 13px; }

/* ---- Misc ---- */
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.text-faint { color: var(--text-faint); }
.text-soft { color: var(--text-soft); }
.text-accent { color: var(--accent); }
.text-accent-2 { color: var(--accent-2); }
.text-good { color: var(--good); }
.text-over { color: var(--over); }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }

/* ---- HTMX indicator ---- */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator { opacity: 1; }

/* ---- Theme toggle ---- */
.theme-toggle-label { font-size: 15px; line-height: 1; }
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-field);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-dot {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset -4px -4px 0 0 var(--surface);
}

/* ---- Layout grid classes (desktop) ---- */
.page-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.charts-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr;
  gap: 18px;
}

/* ---- Responsive ---- */

/* Global overflow prevention */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: hidden; max-width: 100%; }
.app-shell { overflow-x: hidden; }
.main-content { min-width: 0; overflow-x: hidden; max-width: 100%; }

/* Flex children that must shrink */
.cur-block, .card-inner, .kpi-card { min-width: 0; }
.flex-1 { min-width: 0; }
.card { min-width: 0; max-width: 100%; }

/* SVG/images never overflow */
svg { max-width: 100%; }
img { max-width: 100%; height: auto; }

/* Numbers: allow break only on spaces (NBSP won't break, so add overflow safety) */
.num { max-width: 100%; overflow: hidden; }

@media (max-width: 1023px) {
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .fab { display: flex; }

  /* Content area */
  .content-body { padding: 14px 16px 100px; }
  .content-header { padding: 12px 16px; gap: 10px; }
  .content-header-title { font-size: 19px; }
  .content-header-sub { display: none; }

  /* Theme toggle: icon only */
  .theme-toggle { padding: 0 10px; gap: 4px; }
  .theme-dot { display: none; }
  .theme-toggle-label { font-size: 17px; line-height: 1; }

  /* Desktop-only actions hidden */
  .header-action-desktop { display: none !important; }

  /* Page grids → single column */
  .page-grid { grid-template-columns: 1fr; gap: 14px; }
  .charts-grid { grid-template-columns: 1fr; gap: 14px; }

  /* KPI grids */
  .kpi-grid-3 { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kpi-label { font-size: 10.5px; height: auto; margin-bottom: 2px; }
  .kpi-card { padding: 11px 12px; }

  /* Tables: CSS hides desktop, shows mobile (JS also handles this) */
  #expense-desktop { display: none !important; }
  #expense-mobile { display: flex !important; flex-direction: column; gap: 10px; }

  /* Generic grids collapse */
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .detail-amounts { grid-template-columns: 1fr !important; }
  .detail-bottom { grid-template-columns: 1fr !important; }

  /* Currency blocks */
  .cur-block { padding: 14px; gap: 12px; }
  .cur-block-header { flex-wrap: wrap; gap: 8px; align-items: center; }
  .cur-sym { width: 28px; height: 28px; font-size: 13px; border-radius: 8px; }
  .cur-name { font-size: 14px; }
  .cur-budget-pill {
    font-size: 11px;
    padding: 4px 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Progress */
  .progress-legend { flex-wrap: wrap; gap: 8px 12px; }

  /* Savings */
  .savings-block { padding: 14px; gap: 12px; }
  .savings-account { gap: 8px; padding: 10px 12px; }
  .savings-account-icon { width: 30px; height: 30px; font-size: 14px; }
  .savings-account-amount { font-size: 12px; }
  .savings-account-name { font-size: 12px; }

  /* Settings */
  .settings-card { max-width: 100%; }

  /* Bottom nav */
  .bottom-nav-item { font-size: 10px; gap: 2px; }
  .bottom-nav-icon { width: 38px; height: 30px; font-size: 17px; }
}

@media (max-width: 480px) {
  /* Small phones */
  .content-body { padding: 12px 12px 100px; }
  .content-header { padding: 10px 12px; }
  .content-header-title { font-size: 17px; }

  /* Modal slides up from bottom */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box { width: 100vw; max-height: 92vh; border-radius: 22px 22px 0 0; }

  /* KPI tighter */
  .kpi-grid-3 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-value { font-size: 13px; }
  .kpi-label { font-size: 10px; }
  .kpi-card { padding: 10px 10px; }

  /* Expense cards */
  .expense-card { padding: 12px; }

  /* Grid-2 → 1 col in modals/forms */
  .modal-body .grid-2 { grid-template-columns: 1fr; }

  /* Bottom nav compact */
  .bottom-nav { padding: 4px 2px 16px; }
  .bottom-nav-item { font-size: 9px; }
  .bottom-nav-icon { width: 34px; height: 28px; font-size: 16px; }

  /* cur block */
  .cur-sym { width: 26px; height: 26px; font-size: 12px; }
}

/* Detail page */
.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.payment-list { border: 1px solid var(--border); border-radius: var(--r-inner); overflow: hidden; }
.payment-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--border);
}
.payment-row:last-child { border-bottom: none; }
.payment-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }

.dashed-placeholder {
  border: 1px dashed var(--border-2);
  border-radius: var(--r-inner);
  padding: 18px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* Settings */
.settings-card { max-width: 760px; }
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12.5px;
}
.cat-chip-dot { width: 8px; height: 8px; border-radius: 3px; }

/* Theme selector */
.theme-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-field);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.theme-card-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-2);
}

/* Totals note */
.totals-note { font-size: 11.5px; color: var(--text-faint); margin-top: 12px; }

/* Vendor card in detail */
.vendor-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-inner); padding: 14px 15px; }

/* File attachment */
.file-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-inner);
  padding: 14px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.file-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--over-bg);
  color: var(--over);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
  border: 1px solid var(--over);
}
