/* ============================================================
   DESIGN TOKENS
============================================================ */
:root {
  --bg: #050609;
  --bg-2: #08090f;
  --card: rgba(255,255,255,.04);
  --card-2: rgba(255,255,255,.025);
  --txt: #eef2ff;
  --muted: #6272a4;
  --subtle: #3a4060;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --border: rgba(255,255,255,.07);
  --border-strong: rgba(255,255,255,.13);
  --shadow: 0 0 0 1px rgba(255,255,255,.045), 0 20px 56px rgba(0,0,0,.65);
  --gradient: linear-gradient(135deg, #6366f1 0%, #22d3ee 100%);
  --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --gradient-cool: linear-gradient(135deg, #22c55e 0%, #06b6d4 100%);
  --sidebar-w: 240px;
  --header-h: 60px;
  /* chart helpers kept for JS compatibility */
  --chart-text: #eef2ff;
  --chart-muted: #6272a4;
  --chart-grid: rgba(255,255,255,.06);
  --tile-track: rgba(255,255,255,.08);
  --tile-track-soft: rgba(255,255,255,.05);
  --tile-track-hover: rgba(255,255,255,.13);
  --overlay-text: #fff;
  --overlay-shadow: 0 0 8px rgba(0,0,0,.8);
}

[data-theme="light"] {
  --bg: #f3f4fb;
  --bg-2: #eaecf7;
  --card: rgba(255,255,255,.88);
  --card-2: rgba(255,255,255,.65);
  --txt: #0c0e1c;
  --muted: #5c6a84;
  --subtle: #b0bac9;
  --accent: #4f46e5;
  --accent-2: #0891b2;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --border: rgba(0,0,0,.08);
  --border-strong: rgba(0,0,0,.14);
  --shadow: 0 0 0 1px rgba(0,0,0,.06), 0 8px 32px rgba(0,0,0,.1);
  --gradient: linear-gradient(135deg, #4f46e5 0%, #0891b2 100%);
  --gradient-warm: linear-gradient(135deg, #d97706 0%, #dc2626 100%);
  --gradient-cool: linear-gradient(135deg, #16a34a 0%, #0891b2 100%);
  --chart-text: #0c0e1c;
  --chart-muted: #5c6a84;
  --chart-grid: rgba(0,0,0,.07);
  --tile-track: rgba(0,0,0,.08);
  --tile-track-soft: rgba(0,0,0,.05);
  --tile-track-hover: rgba(0,0,0,.12);
  --overlay-text: #fff;
  --overlay-shadow: 0 1px 3px rgba(0,0,0,.4);
}

/* ============================================================
   BASE RESET
============================================================ */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
html { height: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--txt);
  min-height: 100vh;
  transition: background .4s, color .3s;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
[data-theme="light"]::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); }

/* ============================================================
   APP SHELL
============================================================ */
.app-shell { display: flex; min-height: 100vh; }

/* ============================================================
   SIDEBAR
============================================================ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: transform .3s cubic-bezier(.22,1.2,.36,1);
}
.sidebar-head {
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.s-logo { display: flex; align-items: center; gap: 12px; }
.s-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 900; color: #fff; letter-spacing: -.03em;
  box-shadow: 0 4px 14px rgba(99,102,241,.3); flex-shrink: 0;
}
.s-name { font-size: .92rem; font-weight: 800; letter-spacing: -.02em; }
.s-sub { font-size: .65rem; color: var(--muted); font-weight: 500; margin-top: 1px; }

/* Tabs become vertical nav */
.tabs {
  display: flex; flex-direction: column; gap: 1px;
  padding: 14px 12px; overflow-y: auto; flex: 1;
  scrollbar-width: none;
  /* remove old horizontal pill bg */
  background: transparent; border: none; border-radius: 0;
  margin-bottom: 0;
  backdrop-filter: none;
  box-shadow: none;
}
.tabs::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-size: .58rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--subtle);
  padding: 12px 10px 5px; margin-top: 4px;
}
.nav-section-label:first-child { margin-top: 0; padding-top: 4px; }

.tabs button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px;
  background: transparent; border: none; border-radius: 10px;
  text-align: left; color: var(--muted);
  font-size: .82rem; font-weight: 500; cursor: pointer;
  transition: all .18s; white-space: nowrap; min-height: 38px;
  letter-spacing: 0;
  /* reset pill styles from old design */
  box-shadow: none;
}
.tabs button:hover { background: var(--card); color: var(--txt); }
.tabs button.active {
  background: rgba(99,102,241,.12);
  color: var(--accent);
  font-weight: 700;
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  box-shadow: none;
}
.tab-icon {
  width: 20px; text-align: center; font-size: 1rem;
  flex-shrink: 0; opacity: .7;
}
.tabs button.active .tab-icon { opacity: 1; }
.tab-label { flex: 1; }

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.s-hub {
  display: flex; align-items: center; gap: 7px;
  font-size: .76rem; font-weight: 600; color: var(--muted);
  text-decoration: none; padding: 6px 10px; border-radius: 9px;
  transition: all .2s;
}
.s-hub:hover { color: var(--txt); background: var(--card); }
.s-hub-icon { font-size: .9rem; }
.s-logout {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  color: var(--muted); font-size: 1rem; text-decoration: none;
  transition: all .2s;
}
.s-logout:hover { color: var(--bad); background: rgba(239,68,68,.1); }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
============================================================ */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
}
.sidebar-overlay.active { display: block; animation: fadeIn .2s ease; }

/* ============================================================
   MAIN WRAP
============================================================ */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ============================================================
   STICKY HEADER
============================================================ */
header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(5,6,9,.88);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 28px;
  flex-shrink: 0;
  /* remove old margin-bottom */
  margin-bottom: 0;
}
[data-theme="light"] header { background: rgba(243,244,251,.92); }
.hd-left { display: flex; align-items: center; gap: 14px; }
.hd-info { display: flex; flex-direction: column; gap: 2px; }
.hamburger {
  display: none; flex-direction: column; gap: 4px;
  background: transparent; border: none; cursor: pointer; padding: 6px;
  border-radius: 8px; transition: background .2s;
}
.hamburger:hover { background: var(--card); }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--muted); border-radius: 2px; transition: .2s; }
.hd-title { font-size: 1rem; font-weight: 800; letter-spacing: -.03em; }
.meta { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.meta::before {
  content: '●'; color: var(--good); margin-right: 5px;
  font-size: .5rem; animation: statusPulse 2.5s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes statusPulse { 0%,100%{opacity:1} 50%{opacity:.25} }
.hd-right { display: flex; align-items: center; gap: 10px; }
.hd-logout {
  display: flex; align-items: center; gap: 5px;
  font-size: .73rem; font-weight: 600; color: var(--muted);
  text-decoration: none; padding: 0 12px; height: 34px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 9px; transition: all .2s;
}
.hd-logout:hover { color: var(--txt); border-color: var(--border-strong); }

/* ============================================================
   PAGE BODY & BLOBS
============================================================ */
.page-body {
  flex: 1; padding: 28px;
  position: relative; overflow-x: hidden;
  background: radial-gradient(ellipse 120% 60% at 70% -5%, rgba(99,102,241,.12) 0%, transparent 50%),
              radial-gradient(ellipse 70% 50% at -5% 100%, rgba(34,211,238,.07) 0%, transparent 50%);
}
.blob {
  position: fixed; border-radius: 50%;
  filter: blur(160px); opacity: .06; z-index: -1;
  pointer-events: none; animation: blobFloat 30s ease-in-out infinite;
}
.blob.b1 { top: -100px; right: 5%; width: 600px; height: 600px; background: var(--accent); }
.blob.b2 { bottom: -100px; left: 5%; width: 500px; height: 500px; background: var(--accent-2); animation-delay: -15s; }
@keyframes blobFloat { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(30px,-20px) scale(1.07)} }

/* ============================================================
   TAB CONTENT SECTIONS
============================================================ */
section.tab-content { display: none; }
section.tab-content.active { display: block; animation: fadeUp .3s ease; }
@keyframes fadeUp { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }
@keyframes slideUp { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:none} }
@keyframes slideRight { from{opacity:0;transform:translateX(-8px)} to{opacity:1;transform:none} }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

/* ============================================================
   OVERVIEW LAYOUT
============================================================ */
.ov-actions-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.ov-primary {
  display: grid; grid-template-columns: 1fr 380px;
  gap: 16px; margin-bottom: 16px; align-items: start;
}
.ov-main { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.ov-side { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.ov-glance {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 16px; margin-bottom: 16px;
}

@media (max-width: 1200px) {
  .ov-primary { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .ov-glance { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   HERO KPI STRIP
============================================================ */
.hero-strip {
  display: grid; grid-template-columns: repeat(6,1fr);
  gap: 10px; margin-bottom: 16px;
}
.kpi-mini {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px 18px;
  position: relative; overflow: hidden;
  transition: all .22s cubic-bezier(.22,1.2,.36,1);
  backdrop-filter: blur(20px);
}
.kpi-mini:hover { transform: translateY(-2px); border-color: rgba(99,102,241,.3); box-shadow: var(--shadow); }
.kpi-mini::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; background:var(--gradient); }
.kpi-mini.bad::before  { background: var(--gradient-warm); }
.kpi-mini.good::before { background: var(--gradient-cool); }
.kpi-mini.warn::before { background: linear-gradient(135deg,#f59e0b,#fbbf24); }
.kpi-mini .lbl { font-size:.6rem; color:var(--muted); text-transform:uppercase; letter-spacing:.1em; font-weight:700; }
.kpi-mini .val { font-size:1.1rem; font-weight:800; line-height:1.15; margin-top:6px; letter-spacing:-.03em; }
.kpi-mini .sub { font-size:.6rem; color:var(--muted); margin-top:3px; }
@media (max-width: 1100px) { .hero-strip { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 600px) { .hero-strip { grid-template-columns: repeat(2,1fr); } }

/* ============================================================
   MAIN HERO KPI GRID
============================================================ */
.hero {
  display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr));
  gap: 12px; margin-bottom: 20px;
}
.kpi {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 20px 22px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: all .25s cubic-bezier(.22,1.2,.36,1);
  animation: slideUp .5s ease backwards;
  backdrop-filter: blur(20px);
}
.kpi:nth-child(1){animation-delay:.05s} .kpi:nth-child(2){animation-delay:.10s}
.kpi:nth-child(3){animation-delay:.15s} .kpi:nth-child(4){animation-delay:.20s}
.kpi:nth-child(5){animation-delay:.25s} .kpi:nth-child(6){animation-delay:.30s}
.kpi:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(99,102,241,.2), 0 20px 50px rgba(0,0,0,.55); }
.kpi::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; background:var(--gradient); }
.kpi.bad::before   { background: var(--gradient-warm); }
.kpi.good::before  { background: var(--gradient-cool); }
.kpi.warn::before  { background: linear-gradient(135deg,#f59e0b,#fbbf24); }
.kpi .lbl { font-size:.6rem; color:var(--muted); text-transform:uppercase; letter-spacing:.1em; margin-bottom:10px; font-weight:700; }
.kpi .val {
  font-size: 1.65rem; font-weight: 800; line-height: 1;
  background: var(--gradient); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; letter-spacing: -.04em;
}
.kpi .val.plain { background: none; -webkit-text-fill-color: var(--txt); }
.kpi.bad .val  { background:var(--gradient-warm); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.kpi.good .val { background:var(--gradient-cool); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.kpi .sub { font-size:.7rem; color:var(--muted); margin-top:6px; }

/* ============================================================
   CARDS
============================================================ */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 24px 26px;
  margin-bottom: 16px; box-shadow: var(--shadow);
  animation: fadeUp .4s ease backwards;
  transition: border-color .2s;
  backdrop-filter: blur(24px);
}
.card:hover { border-color: rgba(99,102,241,.2); }
.card h2 {
  font-size: 1rem; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: -.02em;
}
.card h2 .badge {
  background: var(--gradient); color: #fff;
  padding: 3px 10px; font-size: .6rem;
  border-radius: 20px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.card h3 { font-size: .9rem; margin: 16px 0 12px; color: var(--accent-2); font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap: 16px; }
@media(max-width:768px) { .grid-2 { grid-template-columns: 1fr; } }

/* ============================================================
   COLLAPSIBLES
============================================================ */
.collapsible {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; margin-bottom: 10px; overflow: hidden;
  transition: border-color .2s;
  animation: slideUp .35s ease backwards;
  backdrop-filter: blur(20px);
}
.collapsible:hover { border-color: rgba(99,102,241,.2); }
.collapsible-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 20px; cursor: pointer; user-select: none; gap: 10px;
  transition: background .18s;
}
.collapsible-header:hover { background: rgba(255,255,255,.025); }
.collapsible-header .left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.collapsible-header h2 { margin: 0; font-size: .95rem; font-weight: 700; letter-spacing: -.01em; }
.collapsible-header .summary { font-size: .73rem; color: var(--muted); font-weight: 500; }
.collapsible-header .chip {
  font-size: .65rem; padding: 3px 10px;
  background: rgba(255,255,255,.06); border-radius: 20px;
  color: var(--muted); font-weight: 700; white-space: nowrap;
  border: 1px solid var(--border);
}
.collapsible-header .chip.bad  { background: rgba(239,68,68,.1);  color: var(--bad);  border-color: rgba(239,68,68,.2); }
.collapsible-header .chip.warn { background: rgba(245,158,11,.1); color: var(--warn); border-color: rgba(245,158,11,.2); }
.collapsible-header .chip.good { background: rgba(34,197,94,.1);  color: var(--good); border-color: rgba(34,197,94,.2); }
.chevron { font-size: .85rem; color: var(--muted); transition: transform .3s cubic-bezier(.22,1.2,.36,1); flex-shrink: 0; }
.collapsible.expanded .chevron { transform: rotate(180deg); color: var(--accent); }
.collapsible-body { display: none; padding: 0 20px 20px; border-top: 1px solid var(--border); }
.collapsible.expanded .collapsible-body { display: block; animation: fadeIn .3s ease; }
.collapsible.no-border .collapsible-body { border-top: none; padding-top: 0; }

/* ============================================================
   TILES
============================================================ */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(265px,1fr)); gap: 14px; margin-bottom: 16px; }
.tile {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 20px 22px; cursor: pointer;
  transition: all .25s cubic-bezier(.22,1.2,.36,1);
  position: relative; overflow: hidden;
  animation: slideUp .4s ease backwards;
  backdrop-filter: blur(20px);
}
.tile:hover { transform: translateY(-4px); border-color: rgba(99,102,241,.35); box-shadow: 0 0 0 1px rgba(99,102,241,.15), 0 24px 52px rgba(0,0,0,.55); }
.tile.expanded { cursor: default; grid-column: 1/-1; }
.tile.expanded:hover { transform: none; }
.tile::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; background:var(--gradient); opacity:.85; }
.tile.bad::before  { background: var(--gradient-warm); opacity: 1; }
.tile.warn::before { background: linear-gradient(135deg,#f59e0b,#fbbf24); opacity: 1; }
.tile.good::before { background: var(--gradient-cool); opacity: 1; }
.tile-header { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 12px; }
.tile-title { font-size: .9rem; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.tile-subtitle { font-size: .68rem; color: var(--muted); margin-top: 2px; }
.tile-status {
  font-size: .6rem; padding: 3px 9px; border-radius: 20px;
  font-weight: 700; letter-spacing: .06em; white-space: nowrap;
  text-transform: uppercase; border: 1px solid transparent;
}
.tile-status.bad  { background: rgba(239,68,68,.1);  color: var(--bad);    border-color: rgba(239,68,68,.2); }
.tile-status.warn { background: rgba(245,158,11,.1); color: var(--warn);   border-color: rgba(245,158,11,.2); }
.tile-status.good { background: rgba(34,197,94,.1);  color: var(--good);   border-color: rgba(34,197,94,.2); }
.tile-status.info { background: rgba(34,211,238,.1); color: var(--accent-2); border-color: rgba(34,211,238,.2); }
.tile-main { font-size: 1.7rem; font-weight: 800; line-height: 1; margin: 8px 0; letter-spacing: -.05em; }
.tile-meta { display: flex; justify-content: space-between; font-size: .73rem; color: var(--muted); margin-top: 6px; align-items: center; }
.tile-meta b { color: var(--txt); }
.tile-progress { height: 4px; background: rgba(255,255,255,.07); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.tile-progress div { height: 100%; background: var(--gradient); transition: width .6s ease; }
.tile-detail { display: none; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border); animation: fadeIn .3s; }
.tile.expanded .tile-detail { display: block; }
.tile-expand-hint { font-size: .68rem; color: var(--muted); margin-top: 10px; display: flex; align-items: center; gap: 5px; opacity: .6; }
.tile.expanded .tile-expand-hint { display: none; }

/* ============================================================
   ALERTS
============================================================ */
.alerts-panel { margin-bottom: 16px; display: grid; gap: 8px; }
.alert {
  display: flex; align-items: start; gap: 12px;
  padding: 13px 16px; border-radius: 13px;
  border: 1px solid var(--border); background: var(--card);
  animation: slideRight .3s ease backwards; transition: .18s;
  backdrop-filter: blur(20px);
}
.alert:hover { transform: translateX(2px); }
.alert .ico { font-size: 1.05rem; flex-shrink: 0; margin-top: 1px; }
.alert .body { flex: 1; }
.alert .body .t { font-size: .85rem; font-weight: 600; margin-bottom: 2px; }
.alert .body .d { font-size: .75rem; color: var(--muted); line-height: 1.45; }
.alert .close { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 1.05rem; padding: 2px 6px; border-radius: 6px; }
.alert .close:hover { color: var(--txt); background: rgba(255,255,255,.08); }
.alert.critical { border-left: 3px solid var(--bad);  background: linear-gradient(90deg, rgba(239,68,68,.07) 0%, var(--card) 50%); }
.alert.warning  { border-left: 3px solid var(--warn); background: linear-gradient(90deg, rgba(245,158,11,.07) 0%, var(--card) 50%); }
.alert.info     { border-left: 3px solid var(--accent); background: linear-gradient(90deg, rgba(99,102,241,.07) 0%, var(--card) 50%); }
.alert.success  { border-left: 3px solid var(--good); background: linear-gradient(90deg, rgba(34,197,94,.07) 0%, var(--card) 50%); }

/* ============================================================
   SECTION HEADER & CONTROLS
============================================================ */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.section-header h2 { margin: 0; font-size: 1rem; font-weight: 700; letter-spacing: -.02em; }
.section-header .count { font-size: .67rem; color: var(--muted); background: rgba(255,255,255,.06); padding: 3px 10px; border-radius: 20px; font-weight: 700; border: 1px solid var(--border); }
.section-header .actions { display: flex; gap: 6px; }
.section-controls {
  display: flex; align-items: center; gap: 12px;
  font-size: .72rem; color: var(--muted);
}
.section-controls .caption { font-size: .72rem; }
.ctl-link { font-size: .72rem; color: var(--muted); cursor: pointer; text-decoration: none; background: transparent; border: none; font-weight: 600; padding: 0; }
.ctl-link:hover { color: var(--accent); }

/* ============================================================
   TYPE SCALE
============================================================ */
.display { font-size: 1.8rem; font-weight: 800; letter-spacing: -.05em; line-height: 1; }
.h-lg { font-size: 1.1rem; font-weight: 700; letter-spacing: -.02em; }
.h-md { font-size: .95rem; font-weight: 600; }
.body { font-size: .88rem; }
.caption { font-size: .75rem; color: var(--muted); }
.tiny { font-size: .68rem; color: var(--muted); }

/* ============================================================
   TABLES
============================================================ */
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: .61rem; letter-spacing: .1em; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: rgba(99,102,241,.04); }

/* ============================================================
   FORMS
============================================================ */
input, select, textarea {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,.04); color: var(--txt);
  border: 1px solid var(--border); border-radius: 11px;
  font-size: .88rem; font-family: inherit; transition: .2s;
}
input:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15); background: rgba(255,255,255,.07);
}
input:hover, select:hover { border-color: var(--border-strong); }
label { font-size: .68rem; color: var(--muted); display: block; margin-bottom: 6px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea { background: rgba(255,255,255,.8); }
[data-theme="light"] input:focus, [data-theme="light"] select:focus { background: #fff; }

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  padding: 10px 20px; background: var(--gradient); color: #fff;
  border: none; border-radius: 11px; cursor: pointer;
  font-size: .84rem; font-weight: 600; transition: all .2s; letter-spacing: .02em;
  box-shadow: 0 4px 16px rgba(99,102,241,.25);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(99,102,241,.38); filter: brightness(1.06); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); box-shadow: none; }
.btn.ghost:hover { color: var(--txt); border-color: var(--border-strong); background: rgba(255,255,255,.05); }
.btn.good { background: var(--gradient-cool); box-shadow: 0 4px 16px rgba(34,197,94,.2); }
.btn.good:hover { box-shadow: 0 6px 22px rgba(34,197,94,.38); }
.btn.bad  { background: var(--gradient-warm); box-shadow: 0 4px 16px rgba(239,68,68,.2); }
.btn.bad:hover  { box-shadow: 0 6px 22px rgba(239,68,68,.38); }

/* ============================================================
   QUICK ACTIONS
============================================================ */
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-actions .btn { padding: 9px 16px; font-size: .82rem; min-height: 38px; }

/* ============================================================
   LOAN CARDS
============================================================ */
.loan-card {
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 20px; margin-bottom: 14px;
  transition: all .25s; animation: slideUp .4s ease backwards;
  backdrop-filter: blur(24px);
}
.loan-card:hover { border-color: rgba(99,102,241,.3); transform: translateY(-2px); box-shadow: var(--shadow); }
.loan-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.loan-name { font-size: 1rem; font-weight: 700; letter-spacing: -.02em; }
.loan-stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px,1fr)); gap: 10px; margin-bottom: 16px; }
.loan-stat > div { background: rgba(255,255,255,.04); padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border); transition: .18s; }
.loan-stat > div:hover { background: rgba(255,255,255,.07); border-color: rgba(99,102,241,.2); }
.loan-stat .lbl { font-size: .62rem; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-weight: 700; }
.loan-stat .val { font-size: 1rem; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; }
[data-theme="light"] .loan-stat > div { background: rgba(0,0,0,.03); }
[data-theme="light"] .loan-stat > div:hover { background: rgba(0,0,0,.06); }

/* ============================================================
   SIMULATOR
============================================================ */
.sim-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: rgba(34,211,238,.04); border: 1px solid rgba(34,211,238,.14); padding: 14px; border-radius: 13px; margin-bottom: 12px; }
.sim-result { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 10px; padding: 12px 16px; background: rgba(34,197,94,.06); border: 1px solid rgba(34,197,94,.18); border-radius: 13px; margin-bottom: 10px; }
.sim-result .lbl { font-size: .67rem; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-weight: 600; }
.sim-result .val { font-size: .95rem; font-weight: 700; color: var(--good); margin-top: 3px; }

/* ============================================================
   PLANNER
============================================================ */
.planner-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 14px; align-items: start; }
@media(max-width:1100px) { .planner-grid { grid-template-columns: 1fr; } }
.planner-left { min-width: 0; }
.planner-left .pay-now-panel { margin-bottom: 0; }
.planner-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.planner-section { padding: 14px 16px; margin-bottom: 0; }
.planner-section-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: 10px; }
.planner-section-header h3 { margin: 0; font-size: .95rem; font-weight: 700; }
.planner-section-header .summary { font-size: .85rem; font-weight: 700; color: var(--accent-2); }
.planner-inputs-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
@media(max-width:680px) { .planner-inputs-2col { grid-template-columns: 1fr; } }

.plan-summary-grid {
  display: grid;
  grid-template-columns: minmax(320px, .95fr) minmax(280px, 1.05fr);
  gap: 18px;
  margin-top: 14px;
  align-items: start;
}
.plan-table {
  width: 100%;
  font-size: .9rem;
  border-collapse: collapse;
}
.plan-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.plan-table td:last-child {
  text-align: right;
  font-weight: 800;
  white-space: nowrap;
}
.plan-recos {
  background: rgba(34,211,238,.035);
  border: 1px solid rgba(34,211,238,.12);
  border-radius: 12px;
  padding: 12px 14px;
}
.plan-recos summary {
  cursor: pointer;
  font-size: .85rem;
  font-weight: 800;
  color: var(--accent-2);
}
@media(max-width:900px) {
  .plan-summary-grid { grid-template-columns: 1fr; }
}

/* Planner rows */
.planner-row { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); transition: background .15s; border-radius: 8px; }
.planner-row:hover { background: rgba(99,102,241,.04); }
.planner-row .name { font-size: .88rem; }
.planner-row input { text-align: right; padding: 7px 10px; font-size: .85rem; }
.planner-row .tag { font-size: .62rem; padding: 2px 9px; border-radius: 20px; background: rgba(255,255,255,.06); color: var(--muted); margin-left: 6px; font-weight: 700; border: 1px solid var(--border); }
.planner-row .tag.fixed { background: rgba(239,68,68,.1);  color: var(--bad);    border-color: rgba(239,68,68,.2); }
.planner-row .tag.flex  { background: rgba(34,211,238,.1); color: var(--accent-2); border-color: rgba(34,211,238,.2); }
.planner-row.compact { padding: 5px 0; border-bottom: 1px solid var(--border); }
.planner-row.compact:last-child { border-bottom: none; }
.planner-row.compact .name { font-size: .82rem; display: flex; align-items: center; gap: 4px; }
.planner-row.compact .name .tag { font-size: .6rem; padding: 1px 6px; }
.planner-row.compact input { padding: 5px 8px; font-size: .85rem; width: 100px; text-align: right; }

/* ============================================================
   CHARTS
============================================================ */
.chart-box { position: relative; height: 280px; margin-top: 10px; }
.chart-box.tall { height: 360px; }

/* ============================================================
   NOTES / CALLOUTS
============================================================ */
.note        { background: rgba(245,158,11,.08); border-left: 3px solid var(--warn); padding: 12px 16px; border-radius: 10px; font-size: .82rem; color: #fde68a; margin: 10px 0; line-height: 1.55; }
.success-note{ background: rgba(34,197,94,.08);  border-left: 3px solid var(--good); padding: 12px 16px; border-radius: 10px; font-size: .82rem; color: #86efac; margin: 10px 0; line-height: 1.55; }
.info-note   { background: rgba(99,102,241,.08); border-left: 3px solid var(--accent); padding: 12px 16px; border-radius: 10px; font-size: .82rem; color: #c7d2fe; margin: 10px 0; line-height: 1.55; }
[data-theme="light"] .note { color: #92400e; }
[data-theme="light"] .success-note { color: #166534; }
[data-theme="light"] .info-note { color: #3730a3; }

/* ============================================================
   EXPENSE LOGGER
============================================================ */
.exp-quick {
  display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr 1.2fr auto;
  gap: 10px; align-items: end; background: var(--card);
  padding: 18px; border-radius: 16px; border: 1px solid var(--border); margin-bottom: 16px;
}
.exp-quick .full { grid-column: 1/-1; }
@media(max-width:1000px) { .exp-quick { grid-template-columns: 1fr 1fr; } }

.exp-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.exp-pills button {
  padding: 5px 13px; background: rgba(255,255,255,.04); color: var(--txt);
  border: 1px solid var(--border); border-radius: 20px; cursor: pointer;
  font-size: .78rem; font-weight: 500; transition: .15s;
}
.exp-pills button:hover  { border-color: var(--accent); background: rgba(99,102,241,.1); }
.exp-pills button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.exp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 10px; margin-bottom: 16px; }
.exp-stats .stat { background: var(--card); padding: 13px 16px; border-radius: 13px; border: 1px solid var(--border); }
.exp-stats .stat .lbl { font-size: .67rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.exp-stats .stat .val { font-size: 1.2rem; font-weight: 800; margin-top: 4px; letter-spacing: -.03em; }

/* ============================================================
   FILTER BAR & ENTRIES
============================================================ */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar select, .filter-bar input { width: auto; min-width: 140px; }

.cat-bar { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.cat-bar .name { flex: 0 0 130px; font-size: .84rem; }
.cat-bar .bar { flex: 1; height: 5px; background: var(--tile-track); border-radius: 3px; overflow: hidden; }
.cat-bar .bar div { height: 100%; background: var(--gradient); border-radius: 3px; }
.cat-bar .amt { flex: 0 0 90px; text-align: right; font-size: .84rem; font-variant-numeric: tabular-nums; }

.entry-row {
  display: grid; grid-template-columns: 90px 1fr 100px 100px 30px; gap: 10px;
  align-items: center; padding: 10px 14px;
  border-bottom: 1px solid var(--border); font-size: .84rem;
  transition: .15s; animation: slideRight .3s ease backwards;
}
.entry-row:hover { background: rgba(99,102,241,.04); transform: translateX(2px); }
.entry-row .date { color: var(--muted); font-size: .76rem; }
.entry-row .desc { font-weight: 500; }
.entry-row .cat { font-size: .67rem; padding: 2px 9px; background: rgba(34,211,238,.1); color: var(--accent-2); border-radius: 20px; width: fit-content; border: 1px solid rgba(34,211,238,.18); }
.entry-row .amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.entry-row .del { background: transparent; color: var(--muted); border: none; cursor: pointer; font-size: 1rem; padding: 3px 7px; border-radius: 6px; transition: .15s; }
.entry-row .del:hover { background: rgba(239,68,68,.12); color: var(--bad); }

/* ============================================================
   UPCOMING PAYMENTS
============================================================ */
.upcoming-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 13px 16px; border-radius: 14px; border: 1px solid var(--border);
  margin-bottom: 8px; background: var(--card);
  transition: .2s; animation: slideUp .35s ease backwards;
  backdrop-filter: blur(20px);
}
.upcoming-item:hover { transform: translateX(2px); box-shadow: var(--shadow); }
.upcoming-item .when { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 74px; padding: 8px 6px; border-radius: 12px; font-weight: 700; text-align: center; flex-shrink: 0; }
.upcoming-item .when .day { font-size: 1.4rem; line-height: 1; letter-spacing: -.04em; }
.upcoming-item .when .mon { font-size: .58rem; text-transform: uppercase; letter-spacing: .09em; margin-top: 2px; opacity: .85; }
.upcoming-item .when .rel { font-size: .58rem; margin-top: 3px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.upcoming-item .body { min-width: 0; }
.upcoming-item .body .t { font-weight: 700; font-size: .9rem; line-height: 1.2; margin-bottom: 3px; letter-spacing: -.01em; }
.upcoming-item .body .d { font-size: .73rem; color: var(--muted); line-height: 1.35; }
.upcoming-item .amt { text-align: right; font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.upcoming-item.overdue  { border-left: 3px solid var(--bad);  background: linear-gradient(90deg, rgba(239,68,68,.07) 0%, var(--card) 55%); }
.upcoming-item.overdue  .when { background: rgba(239,68,68,.12); color: var(--bad); }
.upcoming-item.overdue  .amt  { color: var(--bad); }
.upcoming-item.due-soon { border-left: 3px solid var(--warn); background: linear-gradient(90deg, rgba(245,158,11,.06) 0%, var(--card) 55%); }
.upcoming-item.due-soon .when { background: rgba(245,158,11,.12); color: var(--warn); }
.upcoming-item.due-soon .amt  { color: var(--warn); }
.upcoming-item.upcoming { border-left: 3px solid var(--accent); }
.upcoming-item.upcoming .when { background: rgba(99,102,241,.12); color: var(--accent); }
.upcoming-item.future   { opacity: .72; border-left: 3px solid transparent; }
.upcoming-item.future   .when { background: rgba(255,255,255,.04); color: var(--muted); }
.upcoming-item.paid     { border-left: 3px solid var(--good); opacity: .62; }
.upcoming-item.paid     .when { background: rgba(34,197,94,.1); color: var(--good); }
.up-month-header { font-size: .67rem; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-weight: 700; margin: 16px 0 7px 4px; }
.up-month-header:first-child { margin-top: 0; }

/* ============================================================
   PAY NOW PANEL
============================================================ */
.pay-now-panel { background: linear-gradient(135deg, rgba(239,68,68,.06) 0%, rgba(245,158,11,.04) 100%); border: 1px solid rgba(239,68,68,.18); border-radius: 18px; padding: 18px; margin-bottom: 14px; }
.pay-now-panel.ok { background: linear-gradient(135deg, rgba(34,197,94,.06) 0%, rgba(34,211,238,.04) 100%); border-color: rgba(34,197,94,.18); }
.pay-now-panel .pn-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.pay-now-panel h3 { margin: 0 0 10px; font-size: .95rem; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.pay-now-panel .pn-head h3 { margin: 0; }
.pn-total-pill {
  border: 1px solid rgba(239,68,68,.28);
  background: rgba(239,68,68,.12);
  color: var(--bad);
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 900;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.pay-now-panel .total-line { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 0; padding-top: 10px; border-top: 1px dashed var(--border); }
.pay-now-panel .total-line .lbl { font-weight: 700; font-size: .88rem; }
.pay-now-panel .total-line .v { font-size: 1.5rem; font-weight: 800; color: var(--bad); letter-spacing: -.04em; }
.pay-now-panel.ok .total-line .v { color: var(--good); }
.pay-now-panel .pn-section { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); }
.pay-now-panel .pn-section.fixed { background: rgba(239,68,68,.04);   border-color: rgba(239,68,68,.14); }
.pay-now-panel .pn-section.edit  { background: rgba(245,158,11,.04);  border-color: rgba(245,158,11,.16); }
.pay-now-panel .pn-section.extra { background: rgba(34,211,238,.04);  border-color: rgba(34,211,238,.14); }
.pay-now-panel .pn-tag { display: inline-block; font-size: .63rem; font-weight: 700; letter-spacing: .07em; padding: 2px 9px; border-radius: 20px; margin-bottom: 8px; text-transform: uppercase; }
.pay-now-panel .pn-tag.fixed { background: rgba(239,68,68,.12);  color: var(--bad); }
.pay-now-panel .pn-tag.edit  { background: rgba(245,158,11,.14); color: var(--warn); }
.pay-now-panel .pn-tag.extra { background: rgba(34,211,238,.12); color: var(--accent-2); }
.pay-now-panel .pn-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.pay-now-panel .pn-row:last-child { border-bottom: none; }
.pay-now-panel .pn-row .ico  { font-size: 1.2rem; width: 28px; text-align: center; }
.pay-now-panel .pn-row .meta { min-width: 0; }
.pay-now-panel .pn-row .meta .name { font-weight: 700; font-size: .88rem; }
.pay-now-panel .pn-row .meta .sub  { font-size: .7rem; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.pay-now-panel .pn-row .ro-amt { font-weight: 800; font-size: 1rem; color: var(--bad); min-width: 120px; text-align: right; }
.pay-now-panel .pn-row .lock  { font-size: .62rem; color: var(--muted); display: block; margin-top: 2px; letter-spacing: .03em; }
.pay-now-panel .pn-row input[type=number] { width: 130px; padding: 7px 10px; border: 1.5px solid var(--accent-2); background: rgba(255,255,255,.04); color: var(--txt); border-radius: 8px; font-size: .95rem; font-weight: 700; text-align: right; outline: none; transition: .15s; }
.pay-now-panel .pn-row input[type=number]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.pay-now-panel .pn-subtotal { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; margin-top: 4px; border-top: 1px dashed var(--border); font-weight: 700; font-size: .88rem; }
.pay-now-panel button.dirty { background: var(--warn) !important; color: #fff !important; border-color: var(--warn) !important; animation: pulseDirty 1.4s ease-in-out infinite; }
@keyframes pulseDirty { 0%,100%{box-shadow:0 0 0 0 rgba(245,158,11,.45)} 50%{box-shadow:0 0 0 6px rgba(245,158,11,0)} }

/* ============================================================
   SALARY UTILISATION BAR
============================================================ */
.util-bar-wrap { margin-top: 8px; }
.util-bar { position: relative; display: flex; height: 28px; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.04); border: 1px solid var(--border); }
.util-seg { height: 100%; transition: width .35s ease; }
.util-seg.loan    { background: linear-gradient(180deg,#ef4444,#dc2626); }
.util-seg.life    { background: linear-gradient(180deg,#f59e0b,#d97706); }
.util-seg.save    { background: linear-gradient(180deg,#22d3ee,#06b6d4); }
.util-seg.surplus { background: linear-gradient(180deg,#22c55e,#16a34a); }
.util-seg.overflow{ background: repeating-linear-gradient(45deg,#ef4444 0,#ef4444 8px,#7f1d1d 8px,#7f1d1d 16px); }
.util-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: .76rem; }
.ul-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.ul-item b { color: var(--txt); margin-left: 2px; }
.ul-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.ul-dot.loan    { background: #ef4444; }
.ul-dot.life    { background: #f59e0b; }
.ul-dot.save    { background: #22d3ee; }
.ul-dot.surplus { background: #22c55e; }
.ul-dot.overflow{ background: repeating-linear-gradient(45deg,#ef4444 0,#ef4444 4px,#7f1d1d 4px,#7f1d1d 8px); }
.plan-banner { padding: 12px 16px; border-radius: 12px; font-size: .9rem; font-weight: 600; display: flex; align-items: center; gap: 10px; border: 1px solid transparent; }
.plan-banner.ok    { background: rgba(34,197,94,.08); color: var(--good); border-color: rgba(34,197,94,.2); }
.plan-banner.tight { background: rgba(245,158,11,.08); color: var(--warn); border-color: rgba(245,158,11,.2); }
.plan-banner.over  { background: rgba(239,68,68,.08);  color: var(--bad);  border-color: rgba(239,68,68,.2); }

/* ============================================================
   THEME TOGGLE
============================================================ */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); padding: 4px; border-radius: 24px;
  border: 1px solid var(--border); cursor: pointer; transition: .2s;
  user-select: none; height: 36px; backdrop-filter: blur(20px);
}
.theme-toggle:hover { border-color: rgba(99,102,241,.35); }
.theme-toggle .knob {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gradient); font-size: .88rem;
  transition: transform .35s cubic-bezier(.22,1.2,.36,1);
}
[data-theme="light"] .theme-toggle .knob { transform: translateX(36px); }
.theme-toggle .ic { font-size: .82rem; width: 16px; text-align: center; opacity: .35; transition: .2s; }
.theme-toggle .ic.on { opacity: 1; }

/* ============================================================
   TOAST
============================================================ */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--gradient-cool); color: #fff;
  padding: 14px 22px; border-radius: 14px;
  font-weight: 600; font-size: .88rem;
  box-shadow: 0 12px 40px rgba(34,197,94,.3);
  transform: translateY(120px) scale(.9); opacity: 0;
  transition: .3s cubic-bezier(.22,1.2,.36,1); z-index: 1000;
  display: flex; align-items: center; gap: 8px;
}
.toast::before { content: '✓'; font-size: .95rem; font-weight: 800; }
.toast.show { transform: translateY(0) scale(1); opacity: 1; }
.toast.bad { background: var(--gradient-warm); box-shadow: 0 12px 40px rgba(239,68,68,.3); }
.toast.bad::before { content: '⚠'; }
@media (max-width: 959px) { .toast { left: 12px; right: 12px; bottom: 12px; text-align: center; justify-content: center; } }

/* ============================================================
   FAB
============================================================ */
.fab {
  position: fixed; bottom: 24px; right: 24px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--gradient); color: #fff; border: none;
  font-size: 1.5rem; font-weight: 700;
  box-shadow: 0 8px 28px rgba(99,102,241,.45);
  cursor: pointer; z-index: 50; transition: .2s;
  display: none; align-items: center; justify-content: center;
}
@media (max-width: 959px) { .fab { display: flex; } }
.fab:hover { transform: scale(1.1); }
.fab.hide { display: none !important; }

/* ============================================================
   FOOTER
============================================================ */
footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 28px; border-top: 1px solid var(--border);
  font-size: .7rem; color: var(--muted); letter-spacing: .02em; flex-shrink: 0;
}
.ver-badge {
  font-size: .62rem; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  background: rgba(99,102,241,.1); color: var(--accent); border: 1px solid rgba(99,102,241,.2);
}
/* support old id="ver" for JS that may reference it */
#ver {
  font-size: .62rem; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  background: rgba(99,102,241,.1); color: var(--accent); border: 1px solid rgba(99,102,241,.2);
}

/* ============================================================
   EXPENSE ANALYSIS — filter summary
============================================================ */
#filter-summary { font-size: .78rem; color: var(--muted); padding: 6px 4px; display: flex; gap: 14px; flex-wrap: wrap; }

/* ============================================================
   MOBILE RESPONSIVE
============================================================ */
@media (max-width: 959px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 24px 0 60px rgba(0,0,0,.6); }
  .main-wrap { margin-left: 0; }
  .hamburger { display: flex; }
  .page-body { padding: 16px; }
  header { padding: 0 16px; }
  .ov-primary { grid-template-columns: 1fr; }
  .ov-glance { grid-template-columns: 1fr; }
  .hero-strip { grid-template-columns: repeat(2,1fr); }
  .hero { grid-template-columns: repeat(2,1fr) !important; gap: 8px; }
  .kpi { padding: 14px 16px; }
  .kpi .val { font-size: 1.35rem; }
  .card { padding: 16px 18px; border-radius: 16px; }
  .tile-grid { grid-template-columns: 1fr !important; }
  .grid-2 { grid-template-columns: 1fr !important; }
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 44px; }
  .exp-quick { grid-template-columns: 1fr !important; }
  .exp-stats { grid-template-columns: repeat(2,1fr); }
  .loan-stat { grid-template-columns: 1fr 1fr !important; }
  .sim-controls { grid-template-columns: 1fr !important; }
  .sim-result { grid-template-columns: 1fr 1fr !important; }
  .planner-row { grid-template-columns: 1fr !important; gap: 6px; padding: 10px 8px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar select, .filter-bar input { min-width: 0; width: 100%; }
  .entry-row { grid-template-columns: 1fr auto auto; gap: 6px; padding: 10px; }
  .entry-row .date { display: none; }
  .chart-box { height: 240px; }
  .chart-box.tall { height: 280px; }
  table { font-size: .76rem; display: block; overflow-x: auto; white-space: nowrap; }
  th, td { padding: 8px 10px; }
  .blob { opacity: .04; }
  footer { padding: 14px 16px; }
}

@media (max-width: 380px) {
  .hero { grid-template-columns: 1fr 1fr; gap: 6px; }
  .kpi .val { font-size: 1rem; }
  .exp-stats { grid-template-columns: 1fr 1fr; }
}
