/* ===========================================================================
   Bill Tracker v2 — Base stylesheet
   Reference: Tiller dark + Personal Finance Pro + Qlik typography
   Sidebar navigation, KPI strip, denser bill list, saturated accents.

   ARCHITECTURE:
   - All visual decisions live in CSS custom properties
   - Themes are loaded as additional stylesheets after this one
   - Each theme supplies .theme-dashboard overrides
   - See themes/README.md for theme authoring instructions
   =========================================================================== */

/* Default values (used as fallback if no theme loaded). These match the
   "default" theme (v2 dark). Theme files override them by setting the
   same variables under .theme-dashboard. */
:root {
  /* ---- Surfaces (backgrounds) ---- */
  --bg-ground:      #0a0e1a;    /* page background */
  --bg-sidebar:     #0d121f;    /* sidebar background */
  --bg-panel:       #141a2b;    /* primary card/panel background */
  --bg-panel-2:     #1a2138;    /* alt/hover panel, cluster header */
  --bg-row:         #131929;    /* bill list row */
  --bg-row-hover:   #1c2340;    /* bill list row hover */
  --bg-track:       #0a0e1a;    /* progress bar / util bar track */
  --bg-chip:        #0a0e1a;    /* count pills, badges on panels */

  /* ---- Borders ---- */
  --border:         #232a44;
  --border-strong:  #2e3757;
  --border-accent:  #3a4572;

  /* ---- Text (foreground) ---- */
  --fg-primary:     #e8ecf7;
  --fg-secondary:   #9aa4c4;
  --fg-tertiary:    #6b7699;
  --fg-muted:       #4a536e;
  --fg-on-accent:   #ffffff;

  /* ---- Accents: paid / success ---- */
  --accent-green:     #3dd68c;
  --accent-green-bg:  #0f2e21;
  --accent-green-dim: #1a4d3a;

  /* ---- Accents: amber / warning ---- */
  --accent-amber:     #f5b547;
  --accent-amber-bg:  #2e2113;
  --accent-amber-dim: #4d3a1e;

  /* ---- Accents: red / alert ---- */
  --accent-red:       #ff5e6c;
  --accent-red-bg:    #2e1219;
  --accent-red-dim:   #4d1f2a;

  /* ---- Accents: cyan / info ---- */
  --accent-cyan:      #56c8ff;
  --accent-cyan-bg:   #0e2535;
  --accent-cyan-dim:  #1a3d55;

  /* ---- Accents: secondary family (badges) ---- */
  --accent-purple:    #a78bfa;
  --accent-purple-bg: #1e1a36;
  --accent-pink:      #f472b6;
  --accent-pink-bg:   #2e1524;

  /* ---- Layout constants ---- */
  --sidebar-w:        240px;
  --max-content:      1240px;

  /* ---- Type ---- */
  --font-body:        "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:        "JetBrains Mono", "SF Mono", Menlo, monospace;

  /* ---- Type scale (TV theme scales these up ~1.3x) ---- */
  --fs-base:          14px;    /* body text */
  --fs-label:         11px;    /* KPI labels, section sublabels */
  --fs-micro:         10px;    /* uppercase eyebrow, table headers */
  --fs-small:         12px;    /* secondary info, chip buttons */
  --fs-bill-name:     14px;    /* bill name, primary row text */
  --fs-amount:        15px;    /* monetary values in tables */
  --fs-kpi-value:     30px;    /* KPI big numbers */
  --fs-page-title:    34px;    /* page h1 */
  --fs-section-head:  18px;    /* section h2 */

  /* ---- Corner radius scale ---- */
  --radius-xs:        3px;
  --radius-sm:        6px;
  --radius-md:        8px;
  --radius-lg:        10px;
  --radius-pill:      12px;
  --radius-round:     50%;

  /* ---- Shadow scale ---- */
  --shadow-none:      none;
  --shadow-card:      none;
  --shadow-overlay:   0 10px 30px rgba(0,0,0,0.5);
  --shadow-progress:  0 0 12px rgba(61, 214, 140, 0.3);

  /* ---- Page background glow ---- */
  --glow-1-color:     rgba(86, 200, 255, 0.04);
  --glow-2-color:     rgba(167, 139, 250, 0.03);

  /* ---- Focus ring ---- */
  --focus-ring:       var(--accent-cyan);
}

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

html, body {
  background: var(--bg-ground);
  color: var(--fg-primary);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 800px 400px at 15% 0%, var(--glow-1-color), transparent 60%),
    radial-gradient(ellipse 600px 400px at 85% 100%, var(--glow-2-color), transparent 60%),
    var(--bg-ground);
}

/* ---------------------------------------------------------------------------
   Sidebar
   --------------------------------------------------------------------------- */

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-green) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-on-accent);
  font-weight: 800;
  font-size: 16px;
}
.brand-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 11px;
  color: var(--fg-tertiary);
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-tertiary);
  font-weight: 600;
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s ease;
}
.nav-item:hover {
  background: var(--bg-panel);
  color: var(--fg-primary);
}
.nav-item.is-active {
  background: var(--bg-panel-2);
  color: var(--fg-primary);
  box-shadow: inset 2px 0 0 var(--accent-cyan);
}
.nav-item.is-disabled {
  color: var(--fg-muted);
  cursor: not-allowed;
}
.nav-item.is-disabled:hover { background: transparent; color: var(--fg-muted); }
.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-round);
  background: currentColor;
  opacity: 0.5;
}
.nav-soon {
  margin-left: auto;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  background: var(--bg-panel);
  color: var(--fg-muted);
  border-radius: var(--radius-xs);
}

.month-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.month-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--fg-secondary);
  text-decoration: none;
  font-size: 11px;
  transition: all 0.12s ease;
  border: 1px solid transparent;
}
.month-item:hover {
  background: var(--bg-panel-2);
  color: var(--fg-primary);
}
.month-item.is-active {
  background: var(--bg-panel-2);
  border-color: var(--accent-cyan);
  color: var(--fg-primary);
}
.month-short {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.month-year {
  font-size: 9px;
  color: var(--fg-tertiary);
  margin-top: 1px;
  font-family: var(--font-mono);
}

/* Theme picker — at bottom of sidebar */
.theme-picker .theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.12s ease;
}
.theme-picker .theme-option:hover {
  background: var(--bg-panel);
  color: var(--fg-primary);
}
.theme-picker .theme-option.is-active {
  background: var(--bg-panel-2);
  color: var(--fg-primary);
  box-shadow: inset 2px 0 0 var(--accent-green);
}
.theme-swatch {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  border: 1px solid var(--border);
}
/* Individual swatch colors — each theme can set these if desired,
   but a fallback lets the swatch show without per-theme code */
.theme-swatch-default    { background: linear-gradient(135deg, #0a0e1a 0%, #56c8ff 100%); }
.theme-swatch-slate      { background: linear-gradient(135deg, #ffffff 0%, #0284c7 100%); }
.theme-swatch-tv-mode    { background: linear-gradient(135deg, #0d1220 0%, #a78bfa 100%); }

/* ---------------------------------------------------------------------------
   Main area
   --------------------------------------------------------------------------- */

.main {
  margin-left: var(--sidebar-w);
  padding: 28px 32px 80px;
  max-width: calc(var(--max-content) + var(--sidebar-w));
}

.main-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 6px;
}

.page-title {
  font-size: var(--fs-page-title);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg-primary);
  line-height: 1.1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-secondary);
  text-decoration: none;
  font-size: var(--fs-small);
  font-weight: 500;
  transition: all 0.12s ease;
}
.chip-btn:hover {
  background: var(--bg-panel-2);
  color: var(--fg-primary);
  border-color: var(--border-strong);
}

.today-chip {
  font-size: 11px;
  color: var(--fg-tertiary);
  padding: 8px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

/* ---------------------------------------------------------------------------
   KPI strip
   --------------------------------------------------------------------------- */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.kpi {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease;
  box-shadow: var(--shadow-card);
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--kpi-color, var(--accent-cyan));
  opacity: 0.7;
}

.kpi-expected      { --kpi-color: var(--accent-cyan); }
.kpi-paid          { --kpi-color: var(--accent-green); }
.kpi-remaining     { --kpi-color: var(--accent-amber); }
.kpi-anomalies     { --kpi-color: var(--accent-red); }
.kpi-anomalies.is-empty { --kpi-color: var(--accent-green); }

.kpi-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--bg-panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--kpi-color);
  flex-shrink: 0;
}

.kpi-label {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-tertiary);
  font-weight: 600;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: var(--fs-kpi-value);
  font-weight: 600;
  color: var(--fg-primary);
  letter-spacing: -0.02em;
  font-feature-settings: "tnum" on, "lnum" on;
  line-height: 1.1;
  margin-bottom: 4px;
}

.kpi-paid .kpi-value      { color: var(--accent-green); }
.kpi-remaining .kpi-value { color: var(--accent-amber); }
.kpi-anomalies .kpi-value { color: var(--accent-red); }
.kpi-anomalies.is-empty .kpi-value { color: var(--accent-green); }

.kpi-sub {
  font-size: var(--fs-small);
  color: var(--fg-tertiary);
}
.kpi-sub span { color: var(--fg-secondary); font-weight: 600; }

/* Progress bar */
.progress-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding: 12px 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg-track);
  border-radius: var(--radius-xs);
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-cyan) 100%);
  border-radius: var(--radius-xs);
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-progress);
}
.progress-label {
  font-size: 12px;
  color: var(--fg-secondary);
  font-weight: 500;
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* ---------------------------------------------------------------------------
   Cluster cards
   --------------------------------------------------------------------------- */

.bills-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cluster-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.cluster-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel-2);
}

.cluster-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cluster-title h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--fg-primary);
}
.cluster-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-round);
  background: var(--accent-cyan);
}
.cluster-count {
  font-size: 11px;
  color: var(--fg-tertiary);
  background: var(--bg-chip);
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
}

.cluster-stats {
  display: flex;
  gap: 18px;
}
.cstat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: flex-end;
  font-family: var(--font-mono);
}
.cstat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-tertiary);
}
.cstat-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-primary);
}
.cstat-paid { color: var(--accent-green); }
.cstat-remaining { color: var(--accent-amber); }

/* ---------------------------------------------------------------------------
   Bill table
   --------------------------------------------------------------------------- */

.bill-table {
  display: flex;
  flex-direction: column;
}

.bill-table-head,
.bill-row {
  display: grid;
  grid-template-columns: 56px 1fr 110px 120px 200px;
  gap: 16px;
  align-items: center;
  padding: 10px 20px;
}

.bill-table-head {
  padding-top: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--fg-tertiary);
}
.bill-table-head .col-amount { text-align: right; }

.bill-row {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
  outline: none;
  cursor: default;
}
.bill-row:last-child { border-bottom: none; }
.bill-row:hover,
.bill-row:focus {
  background: var(--bg-row-hover);
}
.bill-row.is-overdue:not(.is-paid) {
  background: linear-gradient(90deg, var(--accent-red-bg) 0%, var(--bg-panel) 40%);
  border-left: 2px solid var(--accent-red);
  padding-left: 18px;
}
.bill-row.is-due-soon:not(.is-paid) {
  background: linear-gradient(90deg, var(--accent-amber-bg) 0%, var(--bg-panel) 40%);
  border-left: 2px solid var(--accent-amber);
  padding-left: 18px;
}
.bill-row.has-anomaly:not(.is-paid) {
  box-shadow: inset 0 0 0 1px var(--accent-amber-dim);
}
.bill-row.is-paid .amount-val,
.bill-row.is-paid .bill-name {
  color: var(--fg-tertiary);
}
.bill-row.is-paid {
  opacity: 0.78;
}

/* Day pill */
.daypill {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  color: var(--fg-primary);
}
.bill-row.is-overdue:not(.is-paid) .daypill {
  background: var(--accent-red-bg);
  border-color: var(--accent-red-dim);
  color: var(--accent-red);
}
.bill-row.is-due-soon:not(.is-paid) .daypill {
  background: var(--accent-amber-bg);
  border-color: var(--accent-amber-dim);
  color: var(--accent-amber);
}
.bill-row.is-paid .daypill {
  background: var(--accent-green-bg);
  border-color: var(--accent-green-dim);
  color: var(--accent-green);
}
.daypill-empty { color: var(--fg-muted); }

/* Name column */
.bill-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.bill-name {
  font-size: var(--fs-bill-name);
  font-weight: 600;
  color: var(--fg-primary);
  letter-spacing: -0.005em;
}

.bill-notes {
  font-size: 12px;
  color: var(--fg-tertiary);
  margin-top: 4px;
  font-style: italic;
  line-height: 1.4;
}

.bill-debt-line {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.debt-balance { color: var(--fg-tertiary); }
.debt-balance strong { color: var(--fg-secondary); font-weight: 600; }

.debt-util {
  display: flex;
  align-items: center;
  gap: 6px;
}
.util-bar {
  width: 60px;
  height: 4px;
  background: var(--bg-track);
  border-radius: var(--radius-xs);
  overflow: hidden;
}
.util-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-xs);
}
.util-fill.util-low { background: var(--accent-green); }
.util-fill.util-med { background: var(--accent-amber); }
.util-fill.util-high { background: var(--accent-red); }
.util-pct { font-weight: 600; font-size: 11px; }
.util-pct.util-low { color: var(--accent-green); }
.util-pct.util-med { color: var(--accent-amber); }
.util-pct.util-high { color: var(--accent-red); }

.debt-apr { color: var(--fg-tertiary); }

.bill-anomaly {
  font-size: 11px;
  color: var(--accent-amber);
  margin-top: 6px;
  padding: 4px 10px;
  background: var(--accent-amber-bg);
  border-left: 2px solid var(--accent-amber);
  border-radius: var(--radius-xs);
  display: inline-block;
}

/* Badges */
.badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.6;
  font-family: var(--font-mono);
}
.badge-ap {
  background: var(--bg-chip);
  color: var(--fg-tertiary);
  border: 1px solid var(--border-strong);
}
.badge-debt { background: var(--accent-cyan-bg); color: var(--accent-cyan); }
.badge-credit_card { background: var(--accent-pink-bg); color: var(--accent-pink); }
.badge-student_loan { background: var(--accent-purple-bg); color: var(--accent-purple); }
.badge-personal_loan { background: var(--accent-amber-bg); color: var(--accent-amber); }
.badge-phone_financing { background: var(--accent-cyan-bg); color: var(--accent-cyan); }
.badge-parent_car { background: var(--accent-green-bg); color: var(--accent-green); }
.badge-medical { background: var(--accent-red-bg); color: var(--accent-red); }

/* Status pills */
.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-align: center;
  min-width: 80px;
}
.status-paid {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid var(--accent-green-dim);
}
.status-overdue {
  background: var(--accent-red-bg);
  color: var(--accent-red);
  border: 1px solid var(--accent-red-dim);
}
.status-due-soon {
  background: var(--accent-amber-bg);
  color: var(--accent-amber);
  border: 1px solid var(--accent-amber-dim);
}
.status-upcoming {
  background: var(--bg-chip);
  color: var(--fg-tertiary);
  border: 1px solid var(--border);
}

/* Amount column */
.col-amount {
  text-align: right;
}
.amount-val {
  font-family: var(--font-mono);
  font-size: var(--fs-amount);
  font-weight: 600;
  color: var(--fg-primary);
  font-feature-settings: "tnum" on, "lnum" on;
  letter-spacing: -0.01em;
}

/* ---------------------------------------------------------------------------
   Toggles
   --------------------------------------------------------------------------- */

.col-toggles {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease;
  font-family: var(--font-body);
  outline: none;
}
.toggle:hover { background: var(--bg-row-hover); }
.toggle:focus-visible {
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.toggle-track {
  width: 28px;
  height: 16px;
  background: var(--border-strong);
  border-radius: 9px;
  position: relative;
  transition: background 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--fg-secondary);
  border-radius: var(--radius-round);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle.is-on .toggle-track { background: var(--accent-green); }
.toggle.is-on .toggle-thumb {
  left: 14px;
  background: var(--fg-on-accent);
}
.toggle.toggle-reflected.is-on .toggle-track { background: var(--accent-cyan); }

.toggle-label {
  font-size: 10px;
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  min-width: 40px;
}
.toggle.is-on .toggle-label { color: var(--fg-primary); }

/* ---------------------------------------------------------------------------
   Footer + toast
   --------------------------------------------------------------------------- */

.main-footer {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 11px;
  color: var(--fg-tertiary);
}
.main-footer kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  color: var(--fg-secondary);
  margin: 0 1px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-panel-2);
  border: 1px solid var(--border-strong);
  color: var(--fg-primary);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-overlay);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 100;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.is-error {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.kpi-value.is-updated {
  animation: pulse-update 0.6s ease;
}
@keyframes pulse-update {
  0%   { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}

/* Responsive */
@media (max-width: 960px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main { padding: 20px 16px 60px; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .bill-table-head { display: none; }
  .bill-row {
    grid-template-columns: 44px 1fr;
    row-gap: 8px;
  }
  .col-status, .col-amount, .col-toggles {
    grid-column: 2;
    justify-self: start;
  }
  .col-amount { justify-self: end; }
}

/* ===========================================================================
   Edit buttons (Phase 7.5) — small icon-link in row tables
   =========================================================================== */
.edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-tertiary);
  text-decoration: none;
  transition: all 0.12s;
}
.edit-btn:hover {
  background: var(--bg-row-hover);
  border-color: var(--border);
  color: var(--accent-cyan);
}
.col-edit { display: flex; justify-content: center; }

.bill-name-link {
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-xs);
  padding: 1px 4px;
  margin: -1px -4px;
  transition: background 0.12s, color 0.12s;
}
.bill-name-link:hover {
  background: var(--bg-row-hover);
  color: var(--accent-cyan);
}
.bill-name-link:hover .bill-name {
  color: var(--accent-cyan);
}
