:root {
  --bg: #f2f2f2;
  --fg: #111;
  --fg-muted: #666;
  --fg-subtle: #999;
  --border: #ddd;
  --negative: #c0392b;
  --positive: #1a7a3a;
  --accent-blue: #1565c0;
  --warning: #e65100;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 48px 24px 80px;
  max-width: 800px;
  margin: 0 auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Nav ──────────────────────────────────── */

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.nav-brand {
  font-size: 1rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
}

.nav-brand:hover {
  opacity: 0.7;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-decoration: none;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--fg);
}

.nav-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--fg);
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
}

.nav-menu-toggle:hover {
  background: var(--border);
}

.nav-menu-toggle:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.nav-menu-toggle:active {
  opacity: 0.7;
}

.nav-desktop {
  display: flex;
}

.nav-mobile {
  display: none;
}

.nav-links--dropdown {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px 0;
}

/* ── Page Header ─────────────────────────── */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 20px;
  margin-bottom: 10px;
}

.page-header-title {
  font-size: 1.1rem;
  font-weight: semi-bold;
  color: var(--fg);
}

.page-header-title .count {
  color: var(--fg-muted);
}

/* ── Stats Bar ──────────────────────────── */

.stats-container {
  background: #e0e0e0;
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.stats-bar {
  display: flex;
  justify-content: space-between;
}

.stats-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stats-bar-label {
  font-size: 0.7rem;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats-bar-value {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}

.stats-delta--worse {
  color: var(--negative);
}

.stats-delta--better {
  color: var(--positive);
}

/* ── Month Nav ───────────────────────────── */

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
}

.month-nav a {
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-decoration: none;
}

.month-nav a:hover {
  color: var(--fg);
}

.month-nav .period {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fg);
}

/* ── Data List ───────────────────────────── */

.data-list {
  list-style: none;
}

.data-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
}

.data-item:last-child {
  border-bottom: none;
}

.item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  color: var(--fg-muted);
}

.item-icon svg {
  width: 20px;
  height: 20px;
}

.item-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--fg);
}

.item-meta {
  font-size: 0.75rem;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-date {
  color: var(--fg-muted);
}

.item-sep {
  color: var(--border);
}

.item-value {
  font-size: 1rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.item-value .muted {
  color: var(--fg-subtle);
}

.spent {
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
}

.negative {
  color: var(--negative);
  font-variant-numeric: tabular-nums;
}

.positive {
  color: var(--positive);
  font-variant-numeric: tabular-nums;
}

/* ── Category Select ─────────────────────── */

.cat-form {
  display: inline-flex;
  position: relative;
}

.cat-dropdown {
  position: relative;
  display: inline-flex;
}

.cat-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--fg-muted);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0 0 2px 0;
  cursor: pointer;
  font-family: inherit;
  list-style: none;
}

.cat-dropdown-trigger::-webkit-details-marker {
  display: none;
}

.cat-dropdown-trigger:hover,
.cat-dropdown-trigger:focus {
  color: var(--fg);
  border-bottom-color: var(--fg);
  outline: none;
}

.cat-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: max-content;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 0;
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
}

.cat-dropdown-option {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: var(--fg);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  white-space: nowrap;
}

.cat-dropdown-option:hover,
.cat-dropdown-option:focus {
  background: var(--border);
  outline: none;
}

.cat-dropdown-option--selected {
  font-weight: 500;
  color: var(--fg);
}

.cat-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.cat-icon svg {
  width: 14px;
  height: 14px;
}

.cat-label {
  line-height: 1.3;
}

/* ── Empty State ─────────────────────────── */

.empty {
  padding: 64px 0;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

/* ── Buttons ─────────────────────────────── */

.btn-primary {
  font-size: 0.8rem;
  padding: 10px 28px;
  background: var(--fg);
  color: var(--bg);
  border: none;
  cursor: pointer;
  font-weight: 500;
  letter-spacing: 0.01em;
  font-family: inherit;
}

.btn-primary:hover {
  opacity: 0.85;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Connect Bank ────────────────────────── */

.connect-bank-section {
  margin-top: 48px;
  text-align: center;
}

/* ── Auth Forms ──────────────────────────── */

.auth-form {
  max-width: 420px;
}

.auth-form label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 6px;
  margin-top: 24px;
}

.auth-form input {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-size: 1.1rem;
  font-family: inherit;
  outline: none;
  color: var(--fg);
}

.auth-form input:focus {
  border-bottom-color: var(--fg);
}

.auth-form button {
  margin-top: 28px;
  font-size: 0.8rem;
  padding: 10px 28px;
  background: var(--fg);
  color: var(--bg);
  border: none;
  cursor: pointer;
  font-weight: 500;
  letter-spacing: 0.01em;
  font-family: inherit;
}

.auth-form button:hover {
  opacity: 0.85;
}

.error {
  color: var(--negative);
  font-size: 0.75rem;
  margin-bottom: 8px;
}

.auth-link {
  margin-top: 24px;
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.auth-link a {
  color: var(--fg);
}

/* ── Auth Error ──────────────────────────── */

.auth-error {
  padding: 64px 0;
  text-align: center;
}

.auth-error h1 {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 12px;
}

.auth-error p {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.auth-error a {
  color: var(--fg);
}

/* ── Account / Sessions page ─────────────── */

.account-page h1 {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0;
}

.account-page h2 {
  font-size: 0.9rem;
  font-weight: 500;
  margin: 48px 0 16px;
}

.account-page p {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.account-page a {
  color: var(--fg);
  font-size: 0.8rem;
  text-decoration: none;
}

.account-section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.session-list {
  list-style: none;
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.session-item:last-child {
  border-bottom: none;
}

.session-info strong {
  font-size: 1rem;
  font-weight: 500;
}

.session-info small {
  font-size: 0.7rem;
  color: var(--fg-muted);
}

.session-info .badge {
  display: inline-block;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.6rem;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.btn-small {
  font-size: 0.7rem;
  padding: 4px 16px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.01em;
}

.btn-small:hover {
  border-color: var(--fg);
  color: var(--fg);
}

.btn-excluded {
  background: var(--negative);
  border-color: var(--negative);
  color: #fff;
}

.btn-excluded:hover {
  background: transparent;
  color: var(--negative);
}

.btn-danger {
  font-size: 0.8rem;
  padding: 10px 28px;
  background: transparent;
  border: 1px solid var(--negative);
  color: var(--negative);
  cursor: pointer;
  font-weight: 500;
  letter-spacing: 0.01em;
  font-family: inherit;
}

.btn-danger:hover {
  background: var(--negative);
  color: var(--bg);
}

/* ── Badges ───────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-auto {
  background: #e3f2fd;
  color: var(--accent-blue);
}

.badge-manual {
  background: #fff3e0;
  color: var(--warning);
}

.badge-disabled {
  background: #f5f5f5;
  color: var(--fg-subtle);
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

/* ── Banners ──────────────────────────────── */

.banner {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.banner--success {
  background: #e6ffe6;
  border: 1px solid #4caf50;
}

.banner--info {
  background: #e3f2fd;
  border: 1px solid var(--accent-blue);
}

.banner--warn {
  background: #fff3e0;
  border: 1px solid var(--warning);
}

.banner--error {
  background: #ffebee;
  border: 1px solid #e53935;
}

/* ── Budget Layout ────────────────────────── */

.budgets-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
}

.budget-section {
  margin-bottom: 2rem;
}

.budget-section h2 {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.data-item--column {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.budget-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.budget-row-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.budget-row-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.budget-meta {
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.budget-row-bottom {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.budget-spent {
  font-size: 0.8rem;
  color: var(--fg-muted);
  min-width: 120px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.budget-spent--empty {
  font-size: 0.8rem;
  color: var(--fg-subtle);
  min-width: 120px;
  text-align: right;
}

.budget-override-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.budget-override-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.budget-override-input {
  width: 110px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.8rem;
}

/* ── Progress ─────────────────────────────── */

.progress-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.progress-track {
  flex: 1;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
}

.progress-fill--ontrack {
  background: #4caf50;
}

.progress-fill--warning {
  background: #ff9800;
}

.progress-fill--over {
  background: #e53935;
}

.progress-label {
  font-size: 0.8rem;
  min-width: 120px;
}

/* ── Billing ──────────────────────────────── */

.billing-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

.billing-page h1 {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.billing-page h2 {
  font-size: 0.9rem;
  font-weight: 500;
  margin: 2rem 0 1rem;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.plan-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
}

.plan-card h3 {
  font-size: 1rem;
  font-weight: 500;
}

.plan-price {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1rem 0;
}

.plan-price span {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--fg-muted);
}

.current-plan {
  background: #f5f5f5;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

/* ── Empty State ──────────────────────────── */

.empty {
  padding: 64px 0;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.empty-icon {
  display: block;
  margin: 0 auto 16px;
  color: var(--border);
  width: 48px;
  height: 48px;
}

/* ── Transaction Table ─────────────────────── */

.txn-list {
  display: flex;
  flex-direction: column;
}

.date-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg);
  margin-top: 4px;
}

.date-header:first-child {
  margin-top: 0;
}

.txn-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.txn-row:last-child {
  border-bottom: none;
}

.txn-col {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.txn-col-merchant {
  flex: 3;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.txn-col-merchant > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.txn-col-category {
  flex: 2;
}

.txn-col-account {
  flex: 2;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--fg-muted);
  font-size: 0.8rem;
}

.txn-col-account > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.txn-col-actions {
  flex: 0 0 28px;
  justify-content: center;
}

.txn-col-amount {
  flex: 0 0 auto;
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
}

/* ── Icon Placeholders ──────────────────────── */

.icon-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.icon-account {
  width: 20px;
  height: 20px;
  font-size: 0.6rem;
}

/* ── Badges ─────────────────────────────────── */

.badge-transfer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--fg-subtle);
}

/* ── Chevron ────────────────────────────────── */

.chevron {
  font-size: 1.1rem;
  color: var(--fg-subtle);
  margin-left: 2px;
}

/* ── Muted ──────────────────────────────────── */

.muted {
  color: var(--fg-subtle);
}

/* ── Utility Classes ─────────────────────────── */

.form-inline {
  display: inline;
}

.btn-full-width {
  width: 100%;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mt-4 {
  margin-top: 2rem;
}

.text-danger {
  color: var(--negative);
}

.text-success {
  color: var(--positive);
}

.text-muted {
  color: var(--fg-muted);
}

/* ── Stats bar clickable items ─────────── */

.stats-bar-item--clickable {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  line-height: inherit;
  border-radius: 4px;
  padding: 4px 8px;
  transition: background 0.15s;
}

.stats-bar-item--clickable:hover {
  background: rgba(0, 0, 0, 0.06);
}

.stats-bar-item--clickable .stats-bar-label {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Drilldown Modal ──────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
}

.modal-overlay--visible {
  display: flex;
}

.modal-container {
  background: #fff;
  border-radius: 8px;
  max-width: 600px;
  width: calc(100vw - 40px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--fg);
}

.modal-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* ── Modal: loading state ─────────────── */

.modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
  color: var(--fg-muted);
  gap: 8px;
}

.modal-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: modal-spin 0.6s linear infinite;
}

@keyframes modal-spin {
  to { transform: rotate(360deg); }
}

/* ── Modal: formula breakdown ──────────── */

.modal-formula {
  background: #e0e0e0;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.modal-formula-value {
  font-weight: 600;
  color: var(--fg);
}

/* ── Modal: comparison side-by-side ────── */

.modal-comparison {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-comparison-col {
  flex: 1;
  background: #e0e0e0;
  border-radius: 6px;
  padding: 12px 16px;
  text-align: center;
}

.modal-comparison-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-subtle);
  margin-bottom: 4px;
}

.modal-comparison-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
}

.modal-delta {
  text-align: center;
  margin-bottom: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ── Modal: tab switcher ───────────────── */

.modal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}

.modal-tab {
  flex: 1;
  padding: 8px 0;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.modal-tab:hover {
  color: var(--fg);
}

.modal-tab--active {
  color: var(--fg);
  border-bottom-color: var(--accent-blue);
}

.modal-tab-panel {
  display: none;
}

.modal-tab-panel--active {
  display: block;
}

/* ── Modal: transaction list ────────────── */

.modal-txn-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.modal-txn-date-group {
  margin-bottom: 16px;
}

.modal-txn-date-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.modal-txn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.82rem;
}

.modal-txn-desc {
  flex: 1;
  color: var(--fg);
  margin-right: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-txn-category {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--fg-muted);
  margin-right: 12px;
  white-space: nowrap;
}

.modal-txn-category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.modal-txn-amount {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--fg);
  white-space: nowrap;
}

.modal-txn-subtotal {
  text-align: right;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* ── Modal: explainer ──────────────────── */

.modal-explainer-section {
  margin-bottom: 20px;
}

.modal-explainer-section:last-child {
  margin-bottom: 0;
}

.modal-explainer-heading {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.modal-explainer-text {
  font-size: 0.8rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* ── Modal: error ──────────────────────── */

.modal-error {
  color: var(--negative);
  text-align: center;
  padding: 16px 0;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  body {
    padding: 24px 16px 64px;
  }

  .data-item {
    padding: 24px 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .item-title {
    font-size: 1.35rem;
  }

  .item-value {
    font-size: 1.15rem;
    align-self: flex-end;
  }

  .site-nav {
    margin-bottom: 32px;
  }

  .nav-desktop {
    display: none;
  }

  .nav-mobile {
    display: block;
  }

  .nav-menu-toggle {
    display: block;
    min-height: 44px;
    min-width: 44px;
  }

  .nav-links--dropdown {
    display: none;
  }

  .nav-mobile[open] .nav-links--dropdown {
    display: flex;
  }

  .txn-row {
    padding: 16px 0;
    flex-wrap: wrap;
    gap: 8px;
  }

  .txn-col-merchant {
    flex: 1 1 100%;
    min-width: 0;
  }

  .txn-col-category {
    flex: 1 1 auto;
  }

  .txn-col-account {
    display: none;
  }

  .txn-col-amount {
    flex: 0 0 auto;
    font-size: 0.95rem;
  }

  .icon-placeholder {
    display: none;
  }

  /* ── Stats bar (mobile) ── */

  .stats-bar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .stats-bar-item {
    flex: 0 1 auto;
  }

  /* ── Budget page (mobile) ── */

  .budgets-page {
    padding: 0;
    max-width: 100%;
  }

  .budget-row {
    flex-direction: column;
    gap: 8px;
  }

  .budget-row-right {
    flex-wrap: wrap;
    gap: 4px;
  }

  .budget-row-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .budget-spent,
  .budget-spent--empty {
    text-align: left;
    min-width: 0;
  }

  .budget-override-form {
    flex-wrap: wrap;
  }

  .budget-override-input {
    width: 100%;
  }

  /* ── Billing page (mobile) ── */

  .billing-page {
    padding: 0;
    max-width: 100%;
  }

  .plans-grid {
    grid-template-columns: 1fr;
  }

  /* ── Account / Sessions (mobile) ── */

  .session-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .institution-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── Auth forms (mobile) ── */

  .auth-form input {
    font-size: 16px;
  }

  /* ── Category dropdown (mobile) ── */

  .cat-dropdown-menu {
    max-width: calc(100vw - 32px);
  }

  /* ── Buttons & spacing (mobile) ── */

  .btn-small {
    padding: 6px 16px;
    font-size: 0.75rem;
  }

  .connect-bank-section .btn-primary {
    width: 100%;
  }

  /* ── General (mobile) ── */

  .month-nav {
    gap: 8px;
  }

  .page-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── Drilldown modal (mobile) ── */

  .modal-container {
    max-width: 100%;
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-comparison {
    flex-direction: column;
    gap: 8px;
  }

  .modal-txn-row {
    flex-wrap: wrap;
    gap: 2px;
  }

  .modal-txn-category {
    margin-right: 0;
  }
}
