/* TallyDash v2 — Flup-inspired design system (light sidebar, emerald accent) */
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 400; font-display: swap; src: url('../fonts/plus-jakarta-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 500; font-display: swap; src: url('../fonts/plus-jakarta-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 600; font-display: swap; src: url('../fonts/plus-jakarta-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 700; font-display: swap; src: url('../fonts/plus-jakarta-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 800; font-display: swap; src: url('../fonts/plus-jakarta-sans-latin-800-normal.woff2') format('woff2'); }
:root {
  color-scheme: light;
  --page: #f3f4f4;
  --surface: #ffffff;
  --surface-2: #f7f8f8;
  --ink: #16211c;
  --ink-2: #4b5563;
  --muted: #8a9299;
  --grid: #eceeee;
  --border: #e8eaea;
  --accent: #17a06a;
  --accent-ink: #0e7c50;
  --accent-soft: #e7f5ee;
  --accent-strong: #12915f;
  --good: #0e8a52; --good-bg: #e7f6ee;
  --bad: #d13b3b;  --bad-bg: #fdecec;
  --warn: #b97d0c; --warn-bg: #fdf3dd;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 8px 28px rgba(16, 24, 40, 0.12);
  --radius: 16px;
  /* chart series (validated dataviz palette, light steps) */
  --s1: #2a78d6; --s2: #008300; --s3: #e87ba4; --s4: #eda100; --s5: #1baf7a; --s6: #eb6834;
}
[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1211;
  --surface: #181c1a;
  --surface-2: #1f2422;
  --ink: #f2f4f3;
  --ink-2: #b7c0bb;
  --muted: #7d8783;
  --grid: #262b29;
  --border: #262b29;
  --accent: #22b377;
  --accent-ink: #35c98b;
  --accent-soft: #143528;
  --accent-strong: #22b377;
  --good: #35c98b; --good-bg: #143528;
  --bad: #ef7070;  --bad-bg: #3a1a1a;
  --warn: #e0b34a; --warn-bg: #33290f;
  --shadow: none;
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.5);
  --s1: #3987e5; --s2: #21a05d; --s3: #d55181; --s4: #c98500; --s5: #199e70; --s6: #d95926;
}

* { box-sizing: border-box; margin: 0; }
html { height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page); color: var(--ink); font-size: 13.5px; min-height: 100%;
  -webkit-font-smoothing: antialiased;
}
body[data-density="compact"] { font-size: 12.8px; }
body[data-density="compact"] .card { padding: 13px; }
body[data-density="compact"] table.data td { padding: 6.5px 10px; }
a { color: var(--accent-ink); text-decoration: none; }
.hidden { display: none !important; }
svg.lucide { width: 16px; height: 16px; stroke-width: 2; flex: none; }

.shell { display: flex; min-height: 100vh; }

/* ---------- sidebar (light, Flup style) ---------- */
.sidebar {
  width: 224px; flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent);
  color: #fff; display: grid; place-items: center;
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font-size: 17px; font-weight: 750; letter-spacing: -0.01em; }
.brand-name span { color: var(--accent); }
#nav { flex: 1; padding: 2px 10px 12px; }
.nav-section {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); padding: 16px 10px 6px;
}
#nav a {
  display: flex; align-items: center; gap: 10px; padding: 7.5px 10px; border-radius: 9px;
  color: var(--ink-2); font-size: 13.5px; margin-bottom: 1px; font-weight: 500;
}
#nav a svg { color: var(--muted); }
#nav a:hover { background: var(--surface-2); color: var(--ink); }
#nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
#nav a.active svg { color: var(--accent-ink); }
.sidebar-foot { padding: 12px 14px; border-top: 1px solid var(--border); }
.theme-toggle {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px;
  border: none; background: none; color: var(--ink-2); font: inherit; font-size: 13px;
  border-radius: 9px; cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); }
.sync-status { font-size: 11px; color: var(--muted); padding: 8px 10px 2px; }

/* ---------- topbar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px 12px; position: sticky; top: 0; z-index: 5;
  background: var(--page);
}
.topbar h1 { font-size: 19px; font-weight: 750; letter-spacing: -0.01em; }
.page-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
select, input[type="date"], input[type="text"], input[type="search"] {
  font: inherit; font-size: 13px; padding: 7px 11px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink); max-width: 250px;
}
.btn {
  font: inherit; font-size: 13px; padding: 7px 14px; border-radius: 10px; border: none;
  background: var(--accent); color: #fff; cursor: pointer; font-weight: 600;
}
.btn:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border: 1px solid var(--border); }
.dash { color: var(--muted); }

/* ---------- content ---------- */
#view { padding: 8px 24px 48px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.two-col { grid-template-columns: 3fr 2fr; }
.half { grid-template-columns: 1fr 1fr; }
.thirds { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1180px) { .two-col, .half, .thirds { grid-template-columns: 1fr; } }
.mt { margin-top: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card h3 {
  font-size: 13px; font-weight: 650; color: var(--ink); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.card h3 svg { color: var(--muted); }
.card h3 .right { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); }
.sub { font-size: 12px; color: var(--muted); }

/* KPI card */
.kpi { display: flex; flex-direction: column; gap: 8px; }
.kpi-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.kpi-top .ic {
  width: 28px; height: 28px; border-radius: 9px; background: var(--accent-soft);
  display: grid; place-items: center; color: var(--accent-ink);
}
.kpi-value { font-size: 23px; font-weight: 760; letter-spacing: -0.02em; }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 650; padding: 2.5px 8px; border-radius: 999px; }
.delta svg { width: 12px; height: 12px; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--muted); background: var(--surface-2); }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: var(--accent); }

/* chips / filter pills */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px;
  font-size: 12.5px; font-weight: 550; color: var(--ink-2); background: var(--surface); cursor: pointer;
}
.chip b { font-weight: 700; color: inherit; }
.chip .cnt {
  background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.active .cnt { background: rgba(255,255,255,0.22); color: #fff; }
.chip:hover:not(.active) { border-color: var(--accent); color: var(--accent-ink); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 9px 15px; font-size: 13px; font-weight: 550; color: var(--ink-2); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 680; }

/* toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 15px; height: 15px; }
.search-wrap input { padding-left: 34px; width: 260px; border-radius: 999px; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.2px; }
table.data th {
  text-align: left; font-size: 10.8px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap; font-weight: 650;
}
table.data td { padding: 9.5px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.row-click { cursor: pointer; }
table.data tr.row-click:hover td { background: var(--accent-soft); }
table.data tr.total-row td { font-weight: 750; border-top: 2px solid var(--border); }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 650; padding: 3px 9px; border-radius: 999px; }
.badge svg { width: 11px; height: 11px; }
.badge.good { color: var(--good); background: var(--good-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
.badge.info { color: var(--ink-2); background: var(--surface-2); }

/* charts */
.chart-wrap { position: relative; height: 280px; }
.chart-wrap.tall { height: 320px; }
.chart-wrap.short { height: 210px; }
.donut-flex { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-flex .chart-wrap { height: 210px; flex: 0 0 210px; }
.donut-legend { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 7px; }
.donut-legend .dl-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.donut-legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend .dl-val { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.donut-legend .dl-pct { color: var(--muted); font-size: 11.5px; width: 40px; text-align: right; }

/* skeletons */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.skel {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--grid) 50%, var(--surface-2) 75%);
  background-size: 800px 100%; animation: shimmer 1.1s infinite linear;
}
.skel.text { height: 13px; width: 60%; }
.skel.title { height: 22px; width: 40%; }
.skel.kpi-block { height: 96px; }
.skel.chart-block { height: 280px; }
.skel.row { height: 38px; margin-bottom: 8px; width: 100%; }

/* modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(9, 14, 12, 0.45); z-index: 40;
  display: grid; place-items: center; padding: 24px; backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: 18px; max-width: 780px; width: 100%;
  max-height: 86vh; overflow-y: auto; padding: 22px 24px; border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.modal h2 { font-size: 16.5px; margin-bottom: 2px; }
.modal .close { float: right; cursor: pointer; color: var(--muted); background: none; border: none; padding: 4px; }
.modal h4 { font-size: 11.5px; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; letter-spacing: 0.06em; }

/* hub */
.hub-section { margin-bottom: 24px; }
.hub-section h2 { font-size: 13px; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.hub-card {
  display: flex; gap: 12px; align-items: flex-start; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; padding: 15px; font-weight: 600; font-size: 13.5px;
}
.hub-card .ic { width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.hub-card .sub { font-weight: 400; margin-top: 2px; }
.hub-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }

/* party/detail headers */
.detail-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.detail-head h2 { font-size: 19px; letter-spacing: -0.01em; }
.detail-meta { font-size: 12.5px; color: var(--ink-2); line-height: 1.8; margin-top: 4px; }
.stat-row { display: flex; gap: 30px; flex-wrap: wrap; margin-top: 14px; }
.stat-row .st .v { font-size: 18px; font-weight: 750; }
.stat-row .st .l { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* tooltip (chartjs external) */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 13px;
  font-size: 12px; box-shadow: var(--shadow-lg); min-width: 130px;
  transition: left .06s ease-out, top .06s ease-out;
}
.tooltip .tt-title { font-weight: 700; margin-bottom: 5px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; color: var(--ink-2); padding: 1.5px 0; }
.tooltip .tt-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tooltip .swatch { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 4px; }

.error-box { color: var(--bad); padding: 26px; }
.empty { color: var(--muted); padding: 30px; text-align: center; font-size: 13px; }
.wa-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--good-bg); color: var(--good); font-size: 12px; font-weight: 650; }
.wa-btn:hover { filter: brightness(0.96); }
tr.expand-parent td:first-child { font-weight: 650; }
tr.expand-child td:first-child { padding-left: 30px; }
tr.expand-grand td:first-child { padding-left: 52px; color: var(--ink-2); }
.caret { display: inline-block; transition: transform .15s; margin-right: 6px; color: var(--muted); }
.caret.open { transform: rotate(90deg); }

/* ---------- create-entry button ---------- */
.create-wrap { padding: 6px 14px 0; }
.create-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 9px; font-weight: 700; border-radius: 11px; box-shadow: 0 2px 8px rgba(23,160,106,0.35); }
.create-btn svg { width: 15px; height: 15px; }

/* ---------- sortable headers + pagination ---------- */
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--ink); }
table.data th .sort-ind { font-size: 9px; margin-left: 4px; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 10px 4px 0; font-size: 12px; color: var(--muted); }
.pager button { font: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.pager button:disabled { opacity: 0.4; cursor: default; }
.pager button:not(:disabled):hover { border-color: var(--accent); color: var(--accent-ink); }
.tbl-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.icon-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: none; border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.icon-btn:hover { color: var(--accent-ink); background: var(--accent-soft); }
.icon-btn svg { width: 13px; height: 13px; }

/* ---------- hero band (rich page headers) ---------- */
.hero {
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 14px; color: #fff;
  background: linear-gradient(120deg, #0d7a52 0%, #17a06a 55%, #2bbd85 100%);
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  box-shadow: 0 6px 20px rgba(23, 160, 106, 0.25);
}
[data-theme="dark"] .hero { background: linear-gradient(120deg, #0c5c40 0%, #12855a 55%, #17a06a 100%); box-shadow: none; }
.hero .h-label { font-size: 12px; opacity: 0.85; font-weight: 600; letter-spacing: 0.02em; }
.hero .h-value { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }
.hero .h-side { display: flex; gap: 34px; flex-wrap: wrap; }
.hero .h-side .h-value { font-size: 20px; }

/* ---------- forms (Entry Studio) ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.field label { display: block; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 13px; padding: 8px 11px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.lines-table td { padding: 5px 6px !important; }
.lines-table input, .lines-table select { width: 100%; font: inherit; font-size: 12.8px; padding: 6px 9px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
.line-total { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.rm-line { color: var(--bad); cursor: pointer; background: none; border: none; padding: 4px; }
.invoice-summary { display: flex; justify-content: flex-end; gap: 40px; padding: 14px 8px 2px; font-size: 14px; }
.invoice-summary .grand { font-size: 19px; font-weight: 800; }
.push-result { border-radius: 12px; padding: 14px 16px; margin-top: 14px; font-weight: 600; }
.push-result.ok { background: var(--good-bg); color: var(--good); }
.push-result.err { background: var(--bad-bg); color: var(--bad); }
.drop-zone {
  border: 2px dashed var(--border); border-radius: 14px; padding: 34px; text-align: center;
  color: var(--muted); cursor: pointer; transition: border-color .15s;
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- settings ---------- */
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 2px; border-bottom: 1px solid var(--grid); }
.setting-row:last-child { border-bottom: none; }
.setting-row .s-label { font-weight: 600; }
.setting-row .s-hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg button { font: inherit; font-size: 12.5px; font-weight: 600; border: none; background: none; color: var(--ink-2); padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow); }

/* ---------- printable invoice ---------- */
.print-sheet { background: #fff; color: #111; border-radius: 14px; padding: 34px; max-width: 820px; margin: 0 auto; border: 1px solid var(--border); }
.print-sheet h1 { font-size: 22px; margin-bottom: 2px; }
.print-sheet .inv-head { display: flex; justify-content: space-between; margin-bottom: 22px; }
.print-sheet table { width: 100%; border-collapse: collapse; font-size: 13px; }
.print-sheet th { text-align: left; border-bottom: 2px solid #111; padding: 7px 6px; font-size: 11px; text-transform: uppercase; }
.print-sheet td { padding: 8px 6px; border-bottom: 1px solid #ddd; }
.print-sheet .num { text-align: right; font-variant-numeric: tabular-nums; }
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  #view { padding: 0; }
  .print-sheet { border: none; }
  body { background: #fff; }
}

/* ---- CFO Overview upgrades (tab-loop #1) ---- */
.mt-sm { margin-top: 8px; }
.alert-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.alert-strip a { text-decoration: none; }
.alert-strip .badge { cursor: default; }
.alert-strip a .badge { cursor: pointer; }
.agebar { display: flex; height: 5px; border-radius: 999px; overflow: hidden; margin-top: 8px; background: var(--surface-2); }
.agebar span { display: block; height: 100%; }
.kpi-spark { height: 34px; margin-top: 8px; }
.chips-inline { margin: 0; display: inline-flex; gap: 6px; }
.chips-inline .chip { padding: 3px 10px; font-size: 11px; }
/* ---- Daily Pulse (tab-loop #2) ---- */
.rail { display: flex; flex-direction: column; gap: 4px; }
.rail-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; color: var(--ink); text-decoration: none; }
.rail-row:hover { background: var(--surface-2); }
.rail-row svg { flex-shrink: 0; color: var(--muted); }
.rail-row > span:not(.badge) { flex: 1; min-width: 0; }
.rail-row .badge { margin-left: auto; flex-shrink: 0; }
.digest { font-family: inherit; font-size: 12.5px; line-height: 1.55; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; max-height: 300px; overflow-y: auto; margin: 0; color: var(--ink); }
.alert-strip.stale { border-left: 3px solid var(--warn); padding-left: 10px; }

/* ---- Reports Hub v2 + command palette (tab-loop #3) ---- */
.hub-card-wrap { position: relative; }
.hub-card-wrap .hub-card { width: 100%; height: 100%; }
.hub-pin { position: absolute; top: 8px; right: 8px; border: none; background: none; color: var(--muted); opacity: 0; cursor: pointer; padding: 4px; border-radius: 7px; }
.hub-card-wrap:hover .hub-pin, .hub-pin.on { opacity: 1; }
.hub-pin.on { color: var(--warn); }
.hub-pin.on svg { fill: var(--warn); }
.hub-pin:hover { background: var(--surface-2); }
.hub-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.hub-chip { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); }
.hub-chip:hover { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-soft); }
.hub-sig { display: block; margin-top: 7px; }
.hub-sig:empty { display: none; }
.hub-card:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--shadow-lg); }

.pal-back { position: fixed; inset: 0; background: rgba(10, 14, 12, 0.45); z-index: 60; display: flex; justify-content: center; padding-top: 12vh; backdrop-filter: blur(2px); }
.pal { width: min(620px, 92vw); align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.pal-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.pal-input { flex: 1; border: none !important; background: none !important; font: inherit; font-size: 14.5px; color: var(--ink); outline: none; padding: 0 !important; max-width: none !important; }
.pal-kbd { font-size: 10.5px; border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; color: var(--muted); }
.pal-results { max-height: 46vh; overflow-y: auto; padding: 6px; }
.pal-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 8px 10px 4px; }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.pal-item.sel { background: var(--accent-soft); }
.pal-item .pal-ic { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.pal-item.sel .pal-ic { background: var(--surface); color: var(--accent-ink); }
.pal-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; overflow: hidden; }
.pal-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.pal-hint { font-size: 10.5px; color: var(--muted); flex: none; }
.pal-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 12.5px; }
.pal-foot { border-top: 1px solid var(--border); padding: 8px 16px; font-size: 11px; color: var(--muted); }
.hub-card[data-go] { cursor: pointer; }
.hub-card[data-go]:hover { border-color: var(--accent); }
/* ---- Ledger Explorer tree (tab-loop #11) ---- */
.lt-node { display: flex; align-items: center; gap: 4px; padding: 3px 4px; font-size: 12.5px; border-radius: 7px; }
.lt-node:hover { background: var(--surface-2); }
.lt-name { cursor: pointer; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt-name.active { color: var(--accent-ink); font-weight: 700; }
.lt-bal { font-size: 11px; color: var(--muted); flex: none; }
.lt-node .caret { cursor: pointer; display: inline-flex; transition: transform .15s; }
.lt-node .caret.open { transform: rotate(90deg); }
@media (max-width: 1100px) { .lt-split { grid-template-columns: 1fr !important; } }
/* ---- Day Book v2 (tab-loop #10) ---- */
.heat-strip { display: flex; flex-wrap: wrap; gap: 2px; margin: 2px 0 10px; }
.heat-cell { width: 11px; height: 11px; border-radius: 3px; background: var(--surface-2); display: block; }
.heat-cell.lvl1 { background: var(--accent-soft); }
.heat-cell.lvl2 { background: var(--accent); opacity: .55; }
.heat-cell.lvl3 { background: var(--accent); }
.heat-cell.gap { outline: 1px solid var(--warn); outline-offset: -1px; }
.heat-cell.sun { opacity: .35; }
tr.day-head td { position: sticky; top: 0; background: var(--surface-2); cursor: pointer; }
tr.sel td { background: var(--accent-soft) !important; }
.tick { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border); color: transparent; cursor: pointer; }
.tick.on { background: var(--good-bg); border-color: var(--good); color: var(--good); }
/* ---- Financial reports (tab-loop #12) ---- */
.sticky-col { position: sticky; left: 0; background: var(--surface); min-width: 170px; }
tr.total-row .sticky-col { background: var(--surface-2); }
/* ---- Expenses heatmap (tab-loop #14) ---- */
td.hm.lvl1 { background: color-mix(in srgb, var(--accent) 10%, transparent); }
td.hm.lvl2 { background: color-mix(in srgb, var(--accent) 22%, transparent); }
td.hm.lvl3 { background: color-mix(in srgb, var(--accent) 38%, transparent); }
td.hm.hm-spike { box-shadow: inset 0 0 0 2px var(--bad); border-radius: 4px; }
/* ---- Parties directory + compare tray (tab-loop #19) ---- */
.cmp-bar { position: fixed; right: 24px; bottom: 20px; z-index: 60; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14); font-size: 12.5px; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cmp-table th, .cmp-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.cmp-table td.num, .cmp-table th.num { text-align: right; }
.cmp-table thead th { font-size: 13.5px; }
.cmp-table tbody tr:hover td { background: var(--surface-2); }
/* ---- Leaderboards (tab-loop #20) ---- */
.lb-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
.lb-row:last-child { border-bottom: none; }
.lb-row[data-go] { cursor: pointer; }
.lb-row[data-go]:hover { background: var(--surface-2); border-radius: 8px; }
.lb-rank { width: 22px; text-align: right; color: var(--muted); font-weight: 700; font-size: 12px; flex: none; }
.lb-arrow { width: 44px; flex: none; font-size: 11.5px; }
.lb-move { font-weight: 700; }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; flex: none; }
.lb-share { margin-left: 6px; font-weight: 400; }
.lb-strip { margin: 2px 0 8px; }
.lb-card h3 .chips .chip { padding: 1px 9px; font-size: 11px; }
/* ---- Items register (tab-loop #21) ---- */
.share-wrap { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.share-bar { width: 54px; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; flex: none; }
.share-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
/* ---- Entry Studio pipeline (tab-loop #24) ---- */
.pipeline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.pl-step { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px;
  border: 1.5px solid var(--border); font-size: 12px; color: var(--muted); }
.pl-step.on { border-color: var(--good); color: var(--good); background: var(--good-bg); font-weight: 600; }
.pl-step.fail { border-color: var(--bad); color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); font-weight: 600; }
/* ---- My Entries pipeline board (tab-loop #25) ---- */
.me-card { cursor: pointer; }
.me-card.sel .kpi { outline: 2px solid var(--accent); outline-offset: -1px; border-radius: 14px; }
.me-stepper { display: inline-flex; align-items: center; gap: 0; vertical-align: middle; }
.me-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-2); border: 1.5px solid var(--border); display: inline-block; }
.me-dot.on { background: var(--good); border-color: var(--good); }
.me-dot.fail { background: var(--bad); border-color: var(--bad); }
.me-line { width: 14px; height: 1.5px; background: var(--border); display: inline-block; }
/* ---- Settings pipeline card (tab-loop #26) ---- */
.danger-zone { border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); border-radius: 10px; padding: 8px 12px; }
.danger-zone summary { cursor: pointer; color: var(--bad); }
details.mt summary { cursor: pointer; }
/* ---- agent status dots ---- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: baseline; }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); } .dot.grey { background: var(--border); }
