/* ==========================================================================
   FINANCE TRACKER — DESIGN SYSTEM (DIRECTION A: CLEAN FINTECH)
   ========================================================================== */

:root {
  /* Colors — Light Theme (OKLCH Mapped Hex Constants) */
  --g-bg: #f8fafc;
  --g-surface: #ffffff;
  --g-surface-subtle: #f1f5f9;
  --g-surface-hover: #f8fafc;
  --g-border: #e2e8f0;
  --g-border-subtle: #cbd5e1;
  --g-text: #0f172a;
  --g-text-secondary: #64748b;
  --g-text-tertiary: #94a3b8;
  
  --g-accent: #4f46e5;
  --g-accent-hover: #4338ca;
  --g-accent-subtle: #eef2ff;
  --g-accent-text: #4338ca;

  --g-income: #059669;
  --g-income-subtle: #ecfdf5;
  --g-income-text: #047857;

  --g-expense: #e11d48;
  --g-expense-subtle: #fff1f2;
  --g-expense-text: #be123c;

  --g-warning: #d97706;
  --g-warning-subtle: #fffbeb;
  --g-warning-text: #b45309;

  --g-danger: #dc2626;
  --g-danger-subtle: #fef2f2;
  
  /* Typography Scale */
  --g-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --g-font-display: 'Google Sans', 'Inter', sans-serif;
  --g-font-tnum: 'Inter', monospace;

  --g-text-xs: 0.75rem;     /* 12px */
  --g-text-sm: 0.8125rem;  /* 13px */
  --g-text-base: 0.875rem;  /* 14px */
  --g-text-lg: 1rem;       /* 16px */
  --g-text-xl: 1.25rem;    /* 20px */
  --g-text-2xl: 1.625rem;  /* 26px */
  --g-text-3xl: 2.125rem;  /* 34px */

  /* Radius */
  --g-radius-sm: 6px;
  --g-radius-md: 10px;
  --g-radius-lg: 14px;
  --g-radius-xl: 20px;
  --g-radius-full: 9999px;

  /* Shadows */
  --g-shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --g-shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --g-shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.04);
  --g-shadow-modal: 0 20px 40px -8px rgba(15, 23, 42, 0.20);

  /* Layout Dimensions */
  --sidebar-width: 250px;
  --topbar-height: 64px;
  --mobile-nav-height: 64px;

  /* Motion */
  --g-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Overrides */
html.dark {
  --g-bg: #0f172a;
  --g-surface: #1e293b;
  --g-surface-subtle: #334155;
  --g-surface-hover: #26354a;
  --g-border: #334155;
  --g-border-subtle: #475569;
  --g-text: #f8fafc;
  --g-text-secondary: #94a3b8;
  --g-text-tertiary: #64748b;

  --g-accent: #6366f1;
  --g-accent-hover: #818cf8;
  --g-accent-subtle: #1e1b4b;
  --g-accent-text: #a5b4fc;

  --g-income: #10b981;
  --g-income-subtle: #064e3b;
  --g-income-text: #34d399;

  --g-expense: #f43f5e;
  --g-expense-subtle: #4c0519;
  --g-expense-text: #fb7185;

  --g-warning: #f59e0b;
  --g-warning-subtle: #451a03;
  --g-warning-text: #fbbf24;

  --g-danger: #ef4444;
  --g-danger-subtle: #450a0a;

  --g-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --g-shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.5);
  --g-shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.6);
  --g-shadow-modal: 0 20px 40px -8px rgba(0, 0, 0, 0.7);
}

/* Base Reset & Global Styles */
* { box-sizing: border-box; }
body {
  background-color: var(--g-bg);
  color: var(--g-text);
  font-family: var(--g-font-sans);
  font-size: var(--g-text-base);
  line-height: 1.5;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Tabular Numerals for Money */
.tnum, .money {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.01em;
}

/* App Shell Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--g-surface);
  border-right: 1px solid var(--g-border);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--g-transition);
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  height: var(--topbar-height);
  background: var(--g-surface);
  border-bottom: 1px solid var(--g-border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(8px);
}

.app-content {
  padding: 28px 32px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.topbar-left, .topbar-right {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
/* Specificity beats .btn-g's display: inline-flex, which is declared later in this file. */
.app-topbar .topbar-menu { display: none; padding: 6px 8px; font-size: 20px; line-height: 1; }
.topbar-search { padding: 6px 14px; font-size: var(--g-text-sm); }
.topbar-kbd {
  font-size: 10px; background: var(--g-surface-subtle); padding: 1px 5px;
  border-radius: 4px; margin-left: 6px; color: var(--g-text-secondary);
}
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1050;
}
.flash-stack { padding: 16px 32px 0 32px; }
.flash-stack .insight-banner { margin-bottom: 12px; }
.flash-stack .insight-banner.is-error { background: var(--g-expense-subtle); border-color: var(--g-expense); }
.flash-stack .insight-banner.is-success { background: var(--g-income-subtle); border-color: var(--g-income); }

/* Sidebar Branding & Navigation */
.sidebar-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo {
  width: 34px; height: 34px;
  border-radius: var(--g-radius-md);
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}
.sidebar-title {
  font-size: 16px; font-weight: 700;
  color: var(--g-text);
  letter-spacing: -0.02em;
}

.nav-menu {
  padding: 12px;
  display: flex; flex-direction: column; gap: 4px;
  flex: 1;
}

.nav-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--g-radius-md);
  color: var(--g-text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--g-text-base);
  transition: all var(--g-transition);
}

.nav-link-content {
  display: flex; align-items: center; gap: 12px;
}
.nav-link i {
  font-size: 18px;
}

.nav-link:hover {
  background: var(--g-surface-subtle);
  color: var(--g-text);
}

.nav-link.active {
  background: var(--g-accent-subtle);
  color: var(--g-accent);
  font-weight: 600;
}

.nav-badge {
  background: var(--g-accent);
  color: white;
  font-size: var(--g-text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--g-radius-full);
}

/* Mobile Bottom Navigation (Visible on <= 768px) */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--mobile-nav-height);
  background: var(--g-surface);
  border-top: 1px solid var(--g-border);
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
}
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--g-text-secondary);
  text-decoration: none;
  font-size: var(--g-text-xs);
  font-weight: 500;
  padding: 6px;
}
.mobile-nav-item i { font-size: 20px; }
.mobile-nav-item.active { color: var(--g-accent); font-weight: 600; }
.mobile-nav-icon { position: relative; display: inline-flex; }
.mobile-nav-dot {
  position: absolute; top: -2px; right: -6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--g-expense); border: 2px solid var(--g-surface);
}

/* Bento Grid System
   Bootstrap (loaded before this file) defines .col-3/.col-4/… as flex columns with
   a fixed width (25%, 33%, …). Inside the grid that width applied to the grid area
   and shrank every card. The rules are scoped to .bento-grid so they win on
   specificity and reset Bootstrap's width. Do not use bare .col-N selectors here. */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.bento-grid > [class*="col-"] {
  flex: none;
  width: auto;
  max-width: none;
  min-width: 0;
}
.bento-grid > .col-12 { grid-column: span 12; }
.bento-grid > .col-8  { grid-column: span 8; }
.bento-grid > .col-7  { grid-column: span 7; }
.bento-grid > .col-6  { grid-column: span 6; }
.bento-grid > .col-5  { grid-column: span 5; }
.bento-grid > .col-4  { grid-column: span 4; }
.bento-grid > .col-3  { grid-column: span 3; }

/* Cards & Containers */
.card-bento {
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-lg);
  padding: 16px 20px;
  box-shadow: var(--g-shadow-sm);
  transition: box-shadow var(--g-transition), border-color var(--g-transition);
  min-width: 0;
  overflow-wrap: break-word;
}

.card-bento:hover {
  box-shadow: var(--g-shadow-md);
  border-color: var(--g-border-subtle);
}

.card-header-clean {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.card-title-clean {
  font-size: var(--g-text-lg);
  font-weight: 600;
  color: var(--g-text);
  margin: 0;
  display: flex; align-items: center; gap: 8px;
}

/* Stat Cards */
.stat-card {
  display: flex; flex-direction: column; justify-content: space-between;
  min-width: 0;
  container-type: inline-size;
}
.stat-title {
  color: var(--g-text-secondary);
  font-size: var(--g-text-sm);
  font-weight: 500;
  margin-bottom: 6px;
}
.stat-value {
  /* Scales with the card width so a 7-figure balance still fits on one line. */
  font-size: clamp(1.125rem, 9cqw, 1.75rem);
  line-height: 1.2;
  font-weight: 700;
  color: var(--g-text);
  white-space: nowrap;
  min-width: 0;
}
.stat-delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--g-text-xs);
  font-weight: 600;
  margin-top: 6px;
}
.stat-delta.positive { color: var(--g-income); }
.stat-delta.negative { color: var(--g-expense); }
.stat-delta.neutral { color: var(--g-text-secondary); }

/* Inline signed values (net savings, remaining budget, due dates) */
.delta-pos { color: var(--g-income-text); }
.delta-neg { color: var(--g-expense-text); }

/* AI Insight Box */
.insight-banner {
  background: var(--g-accent-subtle);
  border: 1px solid var(--g-accent);
  border-radius: var(--g-radius-lg);
  padding: 16px 20px;
  display: flex; gap: 14px; align-items: flex-start;
}
.insight-icon {
  font-size: 22px; color: var(--g-accent);
}
.insight-body {
  flex: 1; font-size: var(--g-text-base); color: var(--g-text);
}
.insight-body strong { color: var(--g-accent-text); }

/* Buttons */
.btn-g {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px;
  border-radius: var(--g-radius-md);
  font-size: var(--g-text-base);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--g-transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-g:focus-visible {
  outline: 2px solid var(--g-accent);
  outline-offset: 2px;
}

.btn-g-primary {
  background: var(--g-accent);
  color: #ffffff;
}
.btn-g-primary:hover {
  background: var(--g-accent-hover);
  color: #ffffff;
}

.btn-g-secondary {
  background: var(--g-surface);
  border-color: var(--g-border);
  color: var(--g-text);
}
.btn-g-secondary:hover {
  background: var(--g-surface-subtle);
  border-color: var(--g-border-subtle);
}

.btn-g-ghost {
  background: transparent;
  color: var(--g-text-secondary);
}
.btn-g-ghost:hover {
  background: var(--g-surface-subtle);
  color: var(--g-text);
}

.btn-g-danger {
  background: var(--g-expense);
  color: #ffffff;
}
.btn-g-danger:hover {
  background: var(--g-expense-text);
}

.btn-g-sm {
  padding: 5px 10px;
  font-size: var(--g-text-sm);
  border-radius: var(--g-radius-sm);
}

/* Badges & Chips */
.g-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: var(--g-radius-full);
  font-size: var(--g-text-xs);
  font-weight: 600;
  white-space: nowrap;
}
.g-badge-income { background: var(--g-income-subtle); color: var(--g-income-text); }
.g-badge-expense { background: var(--g-expense-subtle); color: var(--g-expense-text); }
.g-badge-warning { background: var(--g-warning-subtle); color: var(--g-warning-text); }
.g-badge-neutral { background: var(--g-surface-subtle); color: var(--g-text-secondary); }
.g-badge-accent  { background: var(--g-accent-subtle); color: var(--g-accent-text); }

a.g-badge-link { text-decoration: none; cursor: pointer; transition: box-shadow var(--g-transition), filter var(--g-transition); }
a.g-badge-link:hover { filter: brightness(0.95); box-shadow: 0 0 0 2px var(--g-border); }
html.dark a.g-badge-link:hover { filter: brightness(1.15); }

/* Clickable breakdown rows (categories, accounts, merchants) */
.drill-row { display: block; color: inherit; text-decoration: none; border-radius: var(--g-radius-sm); margin: 0 -6px; padding: 4px 6px; transition: background var(--g-transition); }
.drill-row:hover { background: var(--g-surface-subtle); color: inherit; }
.drill-row:hover .drill-name { color: var(--g-accent-text); text-decoration: underline; text-underline-offset: 2px; }
.card-bento tr.drill-tr { cursor: pointer; }
.g-chip a, a.g-chip { text-decoration: none; }

/* Removable Keyword Chip */
.g-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--g-accent-subtle);
  color: var(--g-accent-text);
  padding: 4px 10px;
  border-radius: var(--g-radius-full);
  font-size: var(--g-text-sm);
  font-weight: 500;
}
.g-chip-remove {
  cursor: pointer; opacity: 0.6; font-size: 14px;
}
.g-chip-remove:hover { opacity: 1; }

/* Tables */
.table-clean {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table-clean th {
  padding: 10px 14px;
  font-size: var(--g-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--g-text-secondary);
  border-bottom: 1px solid var(--g-border);
  white-space: nowrap;
}

.table-clean td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--g-border);
  font-size: var(--g-text-base);
  color: var(--g-text);
  vertical-align: middle;
  /* Text cells may break long tokens (bank reference strings) so the table fits its card;
     money, id and badge cells stay on one line (rules below). */
  overflow-wrap: anywhere;
}

.table-clean td.money, .table-clean td.tnum { white-space: nowrap; }
.table-clean tbody tr:last-child td { border-bottom: 0; }

/* Scroll container for tables that are wider than their card (mirrors Bootstrap's .table-responsive) */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table-clean tr:hover td {
  background: var(--g-surface-hover);
}

.day-header-row td {
  background: var(--g-bg);
  font-weight: 600;
  font-size: var(--g-text-sm);
  color: var(--g-text-secondary);
  padding: 8px 14px;
}

/* Filter bar: inputs wrap onto new lines instead of overflowing the card */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar > * { min-width: 0; }
.filter-bar .form-input { width: auto; }

/* Inputs & Form Controls */
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-md);
  background: var(--g-surface);
  color: var(--g-text);
  font-size: var(--g-text-base);
  transition: border-color var(--g-transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--g-accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Command Palette Modal (⌘K) */
.cmd-backdrop {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: 15vh;
  opacity: 0; pointer-events: none;
  transition: opacity var(--g-transition);
}

.cmd-backdrop.open {
  opacity: 1; pointer-events: auto;
}

.cmd-modal {
  width: 100%; max-width: 600px;
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-xl);
  box-shadow: var(--g-shadow-modal);
  overflow: hidden;
}

.cmd-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--g-border);
}

.cmd-input {
  border: none; background: transparent;
  width: 100%; font-size: var(--g-text-lg);
  color: var(--g-text);
  outline: none;
}

.cmd-results {
  max-height: 360px; overflow-y: auto; padding: 8px;
}

.cmd-item {
  padding: 10px 14px;
  border-radius: var(--g-radius-md);
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; text-decoration: none; color: var(--g-text);
}
.cmd-item:hover, .cmd-item.active {
  background: var(--g-accent-subtle);
  color: var(--g-accent);
}

/* Toast with Undo */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 3000;
  display: flex; flex-direction: column; gap: 8px;
  width: auto;
  max-width: calc(100vw - 32px);
  pointer-events: auto;
}

.g-toast {
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  box-shadow: var(--g-shadow-lg);
  border-radius: var(--g-radius-lg);
  padding: 12px 18px;
  display: flex; align-items: center; gap: 14px;
  font-size: var(--g-text-base);
  animation: slideIn 200ms ease-out;
}

.btn-undo {
  color: var(--g-accent);
  font-weight: 600;
  background: none; border: none;
  cursor: pointer; padding: 0;
}

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Bootstrap components used inside the design system */
.modal-content { background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-radius-xl); color: var(--g-text); }
.modal-header, .modal-footer { border-color: var(--g-border); }
html.dark .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
.nav-link:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; box-shadow: none; }
.nav-link:focus { color: inherit; }
.form-input option { color: var(--g-text); background: var(--g-surface); }

.dropdown-item { color: var(--g-text); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--g-surface-subtle); color: var(--g-text); }
.dropdown-item i { margin-right: 6px; color: var(--g-text-secondary); }

/* Rotating icon for in-progress buttons (bank sync) */
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Simple page components (forms, settings, reconciliation, errors)
   Used by the secondary pages: edit_transaction, account_settings, delete_account,
   reconcile_account, reconciliation, import_preview, plaid_status, edit_member, error.
   ========================================================================== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px 16px;
  margin-bottom: 20px;
}
.page-title {
  font-size: 22px; font-weight: 700; margin: 0 0 16px 0; color: var(--g-text);
  letter-spacing: -0.01em;
}
.page-header .page-title { margin-bottom: 0; }
.page-title-sub {
  color: var(--g-text-secondary); margin: 2px 0 0 0; font-size: var(--g-text-sm); font-weight: 400;
}

.g-card {
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-lg);
  padding: 20px 22px;
  box-shadow: var(--g-shadow-sm);
  min-width: 0;
  overflow-wrap: break-word;
  max-width: 820px;
}
.g-card + .g-card, .g-card.mt-3 { margin-top: 16px; }
.g-card > :first-child { margin-top: 0; }
.g-card > :last-child { margin-bottom: 0; }
.g-card p { margin: 0 0 12px 0; color: var(--g-text); }
.g-card a { color: var(--g-accent-text); }
.g-card-title {
  font-size: var(--g-text-lg); font-weight: 600; color: var(--g-text);
  margin: 0 0 12px 0;
}

.g-label {
  display: block;
  font-size: var(--g-text-sm); font-weight: 500;
  color: var(--g-text-secondary);
  margin-bottom: 12px;
}
.g-label > .g-input, .g-label > .form-input { margin-top: 4px; }
.g-input {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-md);
  background: var(--g-surface);
  color: var(--g-text);
  font-size: var(--g-text-base);
  font-family: inherit;
  transition: border-color var(--g-transition);
}
textarea.g-input { min-height: 80px; resize: vertical; }
.g-input:focus {
  outline: none;
  border-color: var(--g-accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.g-card label:not(.g-label) { display: block; margin-bottom: 8px; color: var(--g-text); }
.g-card input[type="checkbox"] { accent-color: var(--g-accent); width: 15px; height: 15px; vertical-align: -2px; margin-right: 4px; }

.g-table { width: 100%; border-collapse: collapse; text-align: left; }
.g-table th {
  padding: 10px 12px; font-size: var(--g-text-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--g-text-secondary); border-bottom: 1px solid var(--g-border); white-space: nowrap;
}
.g-table td { padding: 10px 12px; border-bottom: 1px solid var(--g-border); vertical-align: top; overflow-wrap: anywhere; }
.g-table td.tnum, .g-table td.money { white-space: nowrap; }
.g-table tbody tr:last-child td { border-bottom: 0; }
.g-table .g-input { min-width: 220px; }

.empty-state {
  text-align: center; color: var(--g-text-secondary); padding: 24px 8px;
}
.empty-state > i { font-size: 32px; display: block; margin-bottom: 8px; }

.text-red { color: var(--g-expense-text) !important; }
.text-secondary { color: var(--g-text-secondary) !important; }

/* Inline status messages (bank connection flow) */
.g-alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-radius: var(--g-radius-md);
  font-size: var(--g-text-sm); font-weight: 500;
  border: 1px solid transparent;
}
.g-alert-success { background: var(--g-income-subtle); color: var(--g-income-text); border-color: var(--g-income); }
.g-alert-error   { background: var(--g-expense-subtle); color: var(--g-expense-text); border-color: var(--g-expense); }
.g-alert-warning { background: var(--g-warning-subtle); color: var(--g-warning-text); border-color: var(--g-warning); }
.g-alert-info    { background: var(--g-accent-subtle); color: var(--g-accent-text); border-color: var(--g-accent); }

/* Skeleton Loading States */
.skeleton {
  background: linear-gradient(90deg, var(--g-surface-subtle) 25%, var(--g-surface) 50%, var(--g-surface-subtle) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: var(--g-radius-sm);
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive Breakpoint Rules */
@media (max-width: 1280px) {
  .bento-grid > .col-3 { grid-column: span 6; }
  .table-clean th, .table-clean td { padding-left: 10px; padding-right: 10px; }
}

@media (max-width: 1024px) {
  .bento-grid > .col-3, .bento-grid > .col-4, .bento-grid > .col-5, .bento-grid > .col-6 { grid-column: span 6; }
  .bento-grid > .col-7, .bento-grid > .col-8, .bento-grid > .col-12 { grid-column: span 12; }
}

@media (max-width: 768px) {
  .app-sidebar { transform: translateX(-100%); z-index: 1100; box-shadow: none; }
  .app-sidebar.open { transform: translateX(0); box-shadow: var(--g-shadow-lg); }
  .sidebar-backdrop.open { display: block; }
  .app-main { margin-left: 0; padding-bottom: var(--mobile-nav-height); }
  .mobile-nav { display: flex; }
  .app-topbar { padding: 0 12px; gap: 8px; }
  .app-topbar .topbar-menu { display: inline-flex; }
  .topbar-label, .topbar-kbd { display: none; }
  .topbar-search { padding: 6px 10px; }
  .flash-stack { padding: 14px 14px 0 14px; }
  .app-content { padding: 14px; }
  .bento-grid { grid-template-columns: 1fr; }
  .bento-grid > [class*="col-"] { grid-column: span 1; }
  .toast-container { left: 16px; right: 16px; bottom: calc(var(--mobile-nav-height) + 12px); }
  .g-toast { justify-content: space-between; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .cmd-backdrop { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
