/* ============================================================
   EQUATOR Pulse — Design System
   Brand blue #2f6bfd · glass · light + dark · Manrope / JetBrains Mono
   ============================================================ */

:root {
  /* brand (EQUATOR blue) */
  --eq-red: #2f6bfd;
  --eq-red-600: #205fe6;
  --eq-red-700: #1a4fc4;
  --eq-red-soft: rgba(47, 107, 253, 0.10);
  --eq-red-soft2: rgba(47, 107, 253, 0.16);
  --eq-grad: linear-gradient(135deg, #4f7cff, #6a8dff);
  --chart-exp: #f0517a;
  --glass-blur: 18px;

  /* semantic */
  --pos: #1f8a5b;
  --pos-soft: rgba(31, 138, 91, 0.12);
  --neg: #e4002b;
  --neg-soft: rgba(228, 0, 43, 0.12);
  --warn: #c9870a;
  --warn-soft: rgba(201, 135, 10, 0.14);
  --info: #2563c9;
  --info-soft: rgba(37, 99, 201, 0.12);

  /* radii / shadow */
  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;
  --r-xl: 22px;
  --ring: 0 0 0 3px var(--eq-red-soft2);

  font-family: 'Manrope', system-ui, sans-serif;
}

/* ---------- LIGHT (default) ---------- */
[data-theme="light"] {
  --bg: #f3f1ef;
  --bg-grad:
    radial-gradient(820px 520px at 6% -10%, rgba(63,119,255,0.14), transparent 60%),
    radial-gradient(760px 540px at 98% 2%, rgba(255,178,122,0.16), transparent 60%),
    radial-gradient(720px 600px at 58% 112%, rgba(124,92,246,0.10), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --surface-3: #f1efeb;
  --hover: #f4f2ee;
  --border: #eae7e1;
  --border-strong: #ddd8d0;
  --text: #211f2a;
  --text-2: #5c5867;
  --text-3: #948f9c;
  --inverse: #ffffff;
  --shadow-sm: 0 1px 2px rgba(80,70,60,0.05), 0 1px 3px rgba(80,70,60,0.04);
  --shadow-md: 0 6px 18px rgba(80,70,60,0.08), 0 2px 6px rgba(80,70,60,0.05);
  --shadow-lg: 0 24px 60px rgba(70,60,55,0.18);
  --grid-line: #efece7;
  --chart-track: #efece7;
  /* glass */
  --glass-bg: rgba(255,255,255,0.7);
  --glass-2: rgba(255,255,255,0.52);
  --glass-strong: rgba(255,255,255,0.9);
  --glass-border: rgba(255,255,255,0.85);
  --glass-shadow: 0 12px 32px rgba(90,78,66,0.12), 0 2px 8px rgba(90,78,66,0.06);
  /* sidebar (glass warm white) */
  --sidebar-bg: rgba(255,255,255,0.62);
  --sidebar-border: rgba(255,255,255,0.78);
  --sidebar-fg-strong: #211f2a;
  --sidebar-text: #5c5867;
  --sidebar-text-2: #9c97a3;
  --sidebar-hover: rgba(63,119,255,0.08);
  --sidebar-active: rgba(63,119,255,0.12);
}

/* ---------- DARK ---------- */
[data-theme="dark"] {
  --bg: #080a12;
  --bg-grad:
    radial-gradient(860px 520px at 6% -10%, rgba(47,107,253,0.24), transparent 60%),
    radial-gradient(760px 560px at 98% 2%, rgba(124,92,246,0.20), transparent 62%),
    radial-gradient(720px 600px at 58% 114%, rgba(18,165,210,0.12), transparent 60%);
  --surface: #141826;
  --surface-2: #181d2e;
  --surface-3: #1f2537;
  --hover: #1d2336;
  --border: #29314b;
  --border-strong: #37415f;
  --text: #eef1fb;
  --text-2: #a3abc6;
  --text-3: #6d7591;
  --inverse: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 28px 64px rgba(0,0,0,0.62);
  --grid-line: #232a40;
  --chart-track: #232a40;
  --eq-red: #5b86ff;
  --eq-red-soft: rgba(91,134,255,0.14);
  --eq-red-soft2: rgba(91,134,255,0.22);
  /* glass */
  --glass-bg: rgba(24,30,50,0.55);
  --glass-2: rgba(24,30,50,0.4);
  --glass-strong: rgba(20,25,42,0.86);
  --glass-border: rgba(125,145,210,0.14);
  --glass-shadow: 0 14px 38px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4);
  /* sidebar (glass dark) */
  --sidebar-bg: rgba(10,13,24,0.6);
  --sidebar-border: rgba(125,145,210,0.12);
  --sidebar-fg-strong: #ffffff;
  --sidebar-text: #aeb6cf;
  --sidebar-text-2: #6d7591;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active: rgba(47,107,253,0.30);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv01";
}
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-feature-settings: "tnum"; }
.num { font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ APP SHELL ============================ */
#root { height: 100vh; }
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
  background: var(--bg);
  background-image: var(--bg-grad);
}

/* -------- Sidebar -------- */
.sidebar {
  background: var(--sidebar-bg);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--sidebar-border);
}
.sb-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 16px;
}
.sb-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--eq-red);
  display: grid; place-items: center; flex: none;
  box-shadow: 0 6px 16px rgba(47,107,253,0.4);
}
.sb-logo svg { display: block; }
.sb-wordmark { display: flex; flex-direction: column; line-height: 1.05; }
.sb-wordmark b { color: var(--sidebar-fg-strong); font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.sb-wordmark span { color: var(--sidebar-text-2); font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

.sb-scroll { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.sb-scroll::-webkit-scrollbar { width: 6px; }
.sb-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--sidebar-text-2); padding: 16px 10px 7px;
}
.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 11px; border-radius: 9px; cursor: pointer;
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 600;
  position: relative; user-select: none;
  transition: background .12s, color .12s;
}
.sb-item:hover { background: var(--sidebar-hover); color: var(--sidebar-fg-strong); }
.sb-item.active { background: var(--sidebar-active); color: var(--eq-red); }
.sb-item.active::before {
  content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 3px; background: var(--eq-red);
}
.sb-item .ic { width: 18px; height: 18px; flex: none; opacity: .9; }
.sb-item .badge-count {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--eq-red); color: #fff; border-radius: 20px;
  min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center;
}
.sb-item.muted { color: var(--sidebar-text-2); }
.sb-foot { padding: 12px 14px; border-top: 1px solid var(--sidebar-border); }
.sb-user { display: flex; align-items: center; gap: 10px; cursor: pointer; border-radius: 9px; padding: 6px; }
.sb-user:hover { background: var(--sidebar-hover); }
.sb-ava {
  width: 32px; height: 32px; border-radius: 8px; flex: none;
  background: var(--eq-grad); color:#fff;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.sb-user .nm { color: var(--sidebar-fg-strong); font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.sb-user .rl { color: var(--sidebar-text-2); font-size: 11px; }

/* -------- Main column -------- */
.main { display: flex; flex-direction: column; overflow: hidden; }

/* Topbar */
.topbar {
  height: 60px; flex: none;
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  background: var(--glass-bg);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border-bottom: 1px solid var(--glass-border);
  z-index: 30;
}
.tb-title { display: flex; flex-direction: column; flex: none; max-width: 38%; }
.tb-title b { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title .crumb { font-size: 11.5px; color: var(--text-3); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 9px; padding: 7px 12px; width: 280px; color: var(--text-3);
  cursor: text; transition: border .12s, box-shadow .12s;
}
.tb-search:focus-within { border-color: var(--eq-red); box-shadow: var(--ring); }
.tb-search input { border: none; background: none; outline: none; color: var(--text); font-size: 13px; width: 100%; font-family: inherit; }
.tb-search kbd { font-size: 10px; font-family: var(--mono); background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; color: var(--text-3); }
.tb-btn {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  display: grid; place-items: center; cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2);
  position: relative; transition: background .12s, color .12s;
}
.tb-btn:hover { background: var(--hover); color: var(--text); }
.tb-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--eq-red); border: 2px solid var(--surface); }
.tb-period {
  display: flex; align-items: center; gap: 7px; background: var(--surface-3);
  border: 1px solid var(--border); border-radius: 9px; padding: 7px 12px;
  font-size: 13px; font-weight: 700; cursor: pointer; color: var(--text);
}
.tb-period:hover { background: var(--hover); }

/* Content scroll */
.content { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.page { padding: 24px 28px 60px; max-width: 1680px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.025em; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; }
.page-head .spacer { flex: 1; }

/* ============================ PRIMITIVES ============================ */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg); box-shadow: var(--glass-shadow);
}
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.card-head h3 { font-size: 14.5px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.card-head .sub { font-size: 12px; color: var(--text-3); font-weight: 600; }
.card-head .spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border-radius: 9px; padding: 8px 14px; font-size: 13px; font-weight: 700;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-family: inherit; transition: background .12s, border .12s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--eq-red); border-color: var(--eq-red); color: #fff; box-shadow: 0 6px 16px rgba(47,107,253,0.35); }
.btn.primary:hover { background: var(--eq-red-600); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.icon { padding: 8px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
  cursor: pointer; white-space: nowrap;
}
.chip:hover { background: var(--hover); }
.chip.active { background: var(--eq-red-soft); color: var(--eq-red); border-color: transparent; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.pos { background: var(--pos-soft); color: var(--pos); }
.badge.neg { background: var(--neg-soft); color: var(--neg); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.gray { background: var(--surface-3); color: var(--text-2); }

.delta { font-weight: 800; font-size: 12.5px; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: var(--pos); }
.delta.down { color: var(--neg); }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  border: 1px solid var(--glass-border); border-radius: var(--r-lg);
  padding: 16px 18px; box-shadow: var(--glass-shadow); position: relative; overflow: hidden;
  transition: border .12s, box-shadow .12s, transform .12s;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi .k-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.kpi .k-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--eq-red-soft); color: var(--eq-red); }
.kpi .k-label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.kpi .k-val { font-size: 25px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.kpi .k-val small { font-size: 14px; font-weight: 700; color: var(--text-3); }
.kpi .k-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.kpi .k-foot .lbl { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.kpi .spark { position: absolute; right: 12px; top: 14px; opacity: .9; }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--text-3); padding: 10px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0;
  background: var(--glass-strong); backdrop-filter: blur(var(--glass-blur)); z-index: 2;
}
table.tbl th.r, table.tbl td.r { text-align: right; }
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr { cursor: pointer; transition: background .1s; }
table.tbl tbody tr:hover { background: var(--hover); }
table.tbl tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 700; }
.cell-sub { color: var(--text-3); font-size: 11.5px; }

/* Avatars */
.ava { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: 11px; color: #fff; flex: none; }
.ava.lg { width: 40px; height: 40px; border-radius: 10px; font-size: 14px; }
.who { display: flex; align-items: center; gap: 9px; }
.who .nm { font-weight: 700; font-size: 13px; line-height: 1.25; white-space: nowrap; }
.who .rl { font-size: 11px; color: var(--text-3); line-height: 1.2; white-space: nowrap; }

/* progress bar */
.bar { height: 7px; border-radius: 20px; background: var(--chart-track); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 20px; background: var(--eq-red); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 14px; font-size: 13px; font-weight: 700; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--eq-red); border-bottom-color: var(--eq-red); }

/* segmented */
.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: none; background: none; font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-2); padding: 5px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* grids */
.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2,1fr); }
.g-3 { grid-template-columns: repeat(3,1fr); }
.row { display: flex; gap: 14px; }
.flex { display: flex; align-items: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }
.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}.mt20{margin-top:20px}.mt24{margin-top:24px}
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.sec-title { font-size: 13px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-3); margin: 28px 0 12px; }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 12px; }
.legend .li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ============================ KANBAN ============================ */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; }
.kcol { width: 274px; flex: none; background: var(--glass-2); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100vh - 240px); box-shadow: var(--glass-shadow); }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px; border-bottom: 1px solid var(--border); }
.kcol-head .dot { width: 9px; height: 9px; border-radius: 50%; }
.kcol-head .t { font-size: 13px; font-weight: 800; }
.kcol-head .c { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--text-3); background: var(--surface-3); border-radius: 20px; padding: 1px 8px; }
.kcol-sum { padding: 6px 14px; font-size: 11.5px; color: var(--text-3); font-weight: 700; border-bottom: 1px solid var(--border); }
.kcol-body { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; flex: 1; min-height: 60px; }
.kcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 11px 12px; cursor: grab; box-shadow: var(--shadow-sm); transition: box-shadow .12s, transform .08s, border .12s;
}
.kcard:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.kcard.dragging { opacity: .4; }
.kcard .kc-co { font-size: 11px; color: var(--text-3); font-weight: 700; }
.kcard .kc-t { font-size: 13px; font-weight: 700; margin: 2px 0 8px; line-height: 1.25; }
.kcard .kc-meta { display: flex; align-items: center; gap: 8px; }
.kcard .kc-sum { font-size: 13px; font-weight: 800; }
.kcard .kc-foot { display: flex; align-items: center; gap: 6px; margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--border); }
.kcol.drop-target { outline: 2px dashed var(--eq-red); outline-offset: -4px; }
.prob { font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 5px; }

/* funnel */
.funnel-row { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.funnel-row .fl { width: 150px; font-size: 12.5px; font-weight: 700; flex: none; }
.funnel-row .ft { flex: 1; height: 34px; position: relative; background: var(--surface-3); border-radius: 8px; overflow: hidden; }
.funnel-row .ft > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; background: linear-gradient(90deg, var(--eq-red), #6a8dff); display: flex; align-items: center; padding-left: 12px; color: #fff; font-weight: 800; font-size: 12.5px; }
.funnel-row .fc { width: 90px; text-align: right; font-size: 12px; color: var(--text-3); font-weight: 700; flex: none; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(8,11,24,0.5); backdrop-filter: blur(5px); z-index: 100; display: flex; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
.drawer { width: 560px; max-width: 92vw; background: var(--glass-strong); backdrop-filter: blur(28px) saturate(1.5); -webkit-backdrop-filter: blur(28px) saturate(1.5); height: 100%; box-shadow: var(--shadow-lg); overflow-y: auto; border-left: 1px solid var(--glass-border); }
@keyframes slidein { from { transform: translateX(40px); opacity: .6; } }
.drawer-head { position: sticky; top: 0; background: var(--glass-strong); backdrop-filter: blur(20px); padding: 18px 22px; border-bottom: 1px solid var(--glass-border); display: flex; align-items: flex-start; gap: 12px; z-index: 5; }
.drawer-body { padding: 20px 22px 50px; }
.modal-center { align-items: center; justify-content: center; }
.modal { width: 460px; max-width: 92vw; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--border); }
@keyframes pop { from { transform: scale(.96); opacity: .5; } }

/* field rows */
.frow { display: flex; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.frow .fk { width: 168px; flex: none; color: var(--text-3); font-weight: 600; }
.frow .fv { font-weight: 600; flex: 1; }
.frow:last-child { border-bottom: none; }

/* stat strip */
.stat-strip { display: grid; grid-template-columns: repeat(4,1fr); gap: 0; border: 1px solid var(--glass-border); border-radius: var(--r-lg); overflow: hidden; background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)) saturate(1.4); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4); box-shadow: var(--glass-shadow); }
.stat-strip > div { padding: 14px 18px; border-right: 1px solid var(--border); }
.stat-strip > div:last-child { border-right: none; }
.stat-strip .sl { font-size: 11.5px; color: var(--text-3); font-weight: 700; margin-bottom: 5px; }
.stat-strip .sv { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7,1fr); gap: 7px; }
.cal .dow { font-size: 11px; font-weight: 700; color: var(--text-3); text-align: center; text-transform: uppercase; padding-bottom: 4px; }
.cal-cell { min-height: 88px; border: 1px solid var(--border); border-radius: 9px; padding: 6px 7px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.cal-cell.out { opacity: .4; }
.cal-cell .dn { font-size: 11.5px; font-weight: 700; color: var(--text-3); }
.cal-cell.today .dn { color: var(--eq-red); }
.cal-ev { font-size: 10.5px; font-weight: 700; border-radius: 5px; padding: 2px 5px; line-height: 1.2; cursor: pointer; }
.cal-ev.in { background: var(--pos-soft); color: var(--pos); }
.cal-ev.out2 { background: var(--neg-soft); color: var(--neg); }

/* placeholder pages */
.ph { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 70px 20px; }
.ph .ph-ic { width: 64px; height: 64px; border-radius: 18px; background: var(--eq-red-soft); color: var(--eq-red); display: grid; place-items: center; margin-bottom: 18px; }
.ph h2 { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.ph p { color: var(--text-2); max-width: 460px; margin: 0 0 18px; line-height: 1.5; }
.ph .feat { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 560px; }

/* empty/img placeholder */
.imgph { background: repeating-linear-gradient(135deg, var(--surface-3), var(--surface-3) 9px, var(--surface-2) 9px, var(--surface-2) 18px); border: 1px dashed var(--border-strong); border-radius: var(--r-md); display: grid; place-items: center; color: var(--text-3); font-size: 11px; font-family: var(--mono); font-weight: 600; }

/* notifications popover */
.pop { position: absolute; top: 52px; right: 0; width: 360px; background: var(--glass-strong); backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5); border: 1px solid var(--glass-border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden; }
.pop-head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.noti { display: flex; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.noti:hover { background: var(--hover); }
.noti .ni { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.noti .nt { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.noti .nd { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.relative { position: relative; }

/* responsive-ish */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .g-3 { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .fade-in { animation: fadein .25s ease; }
  .overlay { animation: fade .15s ease; }
  .drawer { animation: slidein .22s cubic-bezier(.2,.8,.2,1); }
  .modal { animation: pop .18s cubic-bezier(.2,.8,.2,1); }
  .pop { animation: pop .15s ease; }
}
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

/* ===================== compact table ===================== */
table.tbl.compact th { padding: 7px 12px; }
table.tbl.compact td { padding: 6px 12px; font-size: 12.5px; }
table.tbl.compact .who .ava { width: 22px; height: 22px; }

/* sub-rows (budget tree) */
tr.grp td { background: var(--surface-3); font-weight: 800; }
tr.grp.income td { background: color-mix(in srgb, var(--eq-red) 8%, transparent); }
tr.sub td:first-child { padding-left: 30px; color: var(--text-2); }
.fund-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }

/* segmented view switch (bigger) */
.view-switch { display: inline-flex; background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.view-switch button { border: none; background: none; font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-2); padding: 7px 14px; border-radius: 7px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.view-switch button.active { background: var(--surface); color: var(--eq-red); box-shadow: var(--shadow-sm); }

/* ===================== forms ===================== */
.modal-lg { width: 660px; max-width: 94vw; max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex: none; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex: none; background: var(--glass-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > label { font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.input, select.input, textarea.input {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 9px 11px; outline: none; width: 100%; transition: border .12s, box-shadow .12s;
}
.input:focus, select.input:focus, textarea.input:focus { border-color: var(--eq-red); box-shadow: var(--ring); }
.seg-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-pick .opt { flex: 1; min-width: 90px; text-align: center; padding: 9px 10px; border-radius: 9px; border: 1.5px solid var(--border-strong); font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--text-2); background: var(--surface); }
.seg-pick .opt.on { border-color: var(--eq-red); color: var(--eq-red); background: var(--eq-red-soft); }

/* editable cell hint */
.edit-cell { cursor: pointer; border-bottom: 1px dashed var(--border-strong); }
.edit-cell:hover { color: var(--eq-red); border-bottom-color: var(--eq-red); }
.orig-date { font-size: 10.5px; color: var(--text-3); font-weight: 600; }

/* ===================== RNP grouped table ===================== */
table.tbl.rnp th.grp-th { border-left: 1px solid var(--border); text-align: center; font-size: 10.5px; color: var(--text-2); background: var(--surface-2); padding: 6px 8px; }
table.tbl.rnp th.sub-th { font-size: 9.5px; padding: 4px 8px; border-left: 1px solid var(--border); font-weight: 700; }
table.tbl.rnp th.sub-th.f { color: var(--eq-red); }
table.tbl.rnp td.f { background: color-mix(in srgb, var(--eq-red) 4%, transparent); }
table.tbl.rnp th.c, table.tbl.rnp td.c { text-align: center; }
table.tbl.rnp tr.conv-row td { background: var(--surface-3); font-style: italic; font-weight: 700; color: var(--eq-red); font-size: 11px; }
table.tbl.rnp tfoot td { background: var(--surface-3); font-weight: 800; border-top: 2px solid var(--border-strong); position: sticky; bottom: 0; }
.dotmark { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--border-strong); }
.dotmark.on { background: var(--warn); border-color: var(--warn); }
tr.tax-row td { background: color-mix(in srgb, var(--neg) 4%, transparent); font-size: 11.5px; }
tr.tax-row td:first-child { border-left: 2px solid var(--neg); }
