/* AuditDesk — audit workspace design system (light sidebar, indigo 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: #4353c4;
  --accent-ink: #37439f;
  --accent-soft: #eceefb;
  --accent-strong: #3a49b5;
  --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: #6474e5;
  --accent-ink: #8b98f0;
  --accent-soft: #1d2143;
  --accent-strong: #6474e5;
  --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; }
}

/* ================= AuditDesk additions ================= */

.ok { color: var(--good); }
.neg { color: var(--bad); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.warn-box {
  display: flex; gap: 9px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--warn-bg); color: var(--ink); border: 1px solid var(--warn);
  font-size: 13px; margin-bottom: 12px;
}
.warn-box svg { color: var(--warn); flex: none; margin-top: 1px; }
.error-box { padding: 16px; border-radius: 12px; background: var(--bad-bg); color: var(--bad); }
.empty.ok { color: var(--good); display: flex; align-items: center; gap: 8px; justify-content: center; }

/* ---- overview ---- */
.health-list { display: flex; flex-direction: column; }
.health-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  cursor: pointer; color: var(--ink-2); font-size: 13px;
}
.health-row:hover { background: var(--surface-2); }
.health-row svg { margin-left: auto; color: var(--good); }
.health-row.bad svg { color: var(--bad); }
.hr-count {
  min-width: 34px; text-align: center; font-weight: 750; border-radius: 8px; padding: 3px 6px;
  background: var(--surface-2);
}
.health-row.bad .hr-count { background: var(--bad-bg); color: var(--bad); }
.prog-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; font-size: 13px; }
.prog { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.prog-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width .3s; }
.prog-val { font-size: 12px; color: var(--muted); min-width: 44px; text-align: right; }
.flow-strip { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; color: var(--muted); }
.flow-step {
  background: var(--surface-2); border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--ink-2);
}
.flow-step b { color: var(--accent-ink); margin-right: 4px; }

/* ---- financial statements ---- */
.stmt-card { max-width: 1000px; }
.stmt-head { text-align: center; margin-bottom: 16px; }
.stmt-company { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.stmt-title { font-size: 14px; font-weight: 650; margin-top: 2px; }
.stmt-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
table.fs-table { width: 100%; border-collapse: collapse; }
table.fs-table th, table.fs-table td { padding: 6.5px 10px; font-size: 13px; }
table.fs-table thead th { border-bottom: 2px solid var(--ink); font-weight: 700; text-align: left; }
table.fs-table thead th.num { text-align: right; }
table.fs-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.fs-table .part-row td { font-size: 13.5px; padding-top: 14px; }
table.fs-table .sec-row td { font-weight: 650; padding-top: 10px; }
table.fs-table .subtotal-row td { border-top: 1px solid var(--border); font-weight: 650; }
table.fs-table .total-row td { border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); font-weight: 750; }
.indent { padding-left: 18px; display: inline-block; }
.roman { display: inline-block; min-width: 26px; font-weight: 650; }
.note-ref { color: var(--accent-ink); font-weight: 650; }
.stmt-foot { margin-top: 14px; font-size: 12.5px; color: var(--ink-2); }
.stmt-foot .ok, .stmt-foot .neg { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; }

/* ---- notes ---- */
.note-block { margin: 22px 0; page-break-inside: avoid; }
.note-title { font-size: 13.5px; font-weight: 750; margin-bottom: 8px; }
.note-text { font-size: 13px; line-height: 1.6; color: var(--ink-2); white-space: normal; }
.kv-table td { padding: 6px 10px; }
.edit-block { position: relative; }
.edit-block .edit-text { font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.edit-block textarea { width: 100%; font: inherit; font-size: 13px; padding: 10px; border-radius: 10px; border: 1px solid var(--accent); background: var(--surface); color: var(--ink); }
.edit-btn { margin-top: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 11.5px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  border-radius: 8px; padding: 4px 9px; cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---- workpaper marks ---- */
.mark-cell { display: inline-flex; gap: 4px; }
.mark-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 7px;
  width: 26px; height: 24px; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted);
}
.mark-btn.good.on { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.mark-btn.warn.on { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.mark-btn.bad.on { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.mark-btn:hover { border-color: var(--accent); }

/* ---- checklists ---- */
.cl-row {
  display: flex; gap: 14px; align-items: flex-start; justify-content: space-between;
  padding: 12px 10px; border-bottom: 1px solid var(--border);
}
.cl-row:last-child { border-bottom: none; }
.cl-row.done { opacity: 0.72; }
.cl-title { font-size: 13px; }
.cl-ref {
  display: inline-block; background: var(--accent-soft); color: var(--accent-ink);
  font-size: 10.5px; font-weight: 750; border-radius: 6px; padding: 2px 7px; margin-right: 5px;
}
.cl-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.cl-btn {
  font: inherit; font-size: 11.5px; font-weight: 600; border-radius: 8px; padding: 4.5px 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
}
.cl-btn.done.on { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.cl-btn.pending.on { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.cl-btn.na.on { background: var(--surface-2); color: var(--ink-2); border-color: var(--ink-2); }
.cl-remark-text { font-size: 12px; color: var(--accent-ink); margin-top: 4px; display: flex; gap: 5px; align-items: center; }

/* ---- queries ---- */
.query-row {
  display: flex; gap: 14px; justify-content: space-between; align-items: flex-start;
  padding: 12px 10px; border-bottom: 1px solid var(--border);
}
.query-row:last-child { border-bottom: none; }
.query-row.resolved { opacity: 0.75; }
.q-main { display: flex; flex-direction: column; gap: 4px; }

/* ---- lead schedules ---- */
.lead-ref {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 13px;
}

/* ---- charts ---- */
.chart-box { height: 280px; }

/* ---- confirmation letters ---- */
.letter { max-width: 800px; margin-top: 14px; font-size: 13.5px; line-height: 1.65; }
.letter p { margin: 10px 0; }
.letter-head { border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 10px; }
.letter-slip { margin-top: 22px; font-size: 13px; }
.print-only { display: none; }

/* ---- modal wide ---- */
.modal-wide { max-width: 900px; width: 92vw; }

/* ---- PY entry + share capital modal ---- */
.py-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; max-height: 55vh; overflow-y: auto; }
.py-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.py-row input { width: 150px; text-align: right; }

/* ---- diagnostics strip on statements ---- */
.diag-strip { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.diag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600;
  border-radius: 999px; padding: 3.5px 10px; background: var(--surface-2); color: var(--ink-2);
}
.diag.ok { background: var(--good-bg); color: var(--good); }
.diag.neg { background: var(--bad-bg); color: var(--bad); }

/* ---- note title controls ---- */
.note-title { display: flex; align-items: center; gap: 8px; }
.note-title .note-hide { opacity: 0; transition: opacity .15s; }
.note-block:hover .note-hide { opacity: 1; }

/* ---- JET risk score ---- */
.score-chip {
  display: inline-grid; place-items: center; min-width: 30px; height: 22px; border-radius: 7px;
  font-weight: 750; font-size: 11.5px; padding: 0 6px;
}
.score-hi { background: var(--bad-bg); color: var(--bad); }
.score-md { background: var(--warn-bg); color: var(--warn); }
.score-lo { background: var(--surface-2); color: var(--ink-2); }
.flag-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.flag-tag { font-size: 10px; font-weight: 650; border-radius: 5px; padding: 1.5px 6px; background: var(--accent-soft); color: var(--accent-ink); }

/* ---- heat cells (TB movement vs PM) ---- */
td.heat-1 { box-shadow: inset 3px 0 0 var(--warn); }
td.heat-2 { box-shadow: inset 3px 0 0 var(--bad); }

/* ---- evidence panel in checklists ---- */
.evidence { margin-top: 8px; border-left: 3px solid var(--accent-soft); padding: 6px 0 6px 12px; }
.evidence .sub { margin-bottom: 6px; }

/* ---- confirmation status ---- */
.conf-status { font-size: 11.5px; border-radius: 8px; padding: 4px 8px; }

/* ---- login / signup ---- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--page); padding: 20px; }
.auth-card { width: 400px; max-width: 94vw; padding: 28px; }
.auth-tabs { margin-bottom: 16px; }
.auth-tabs .tab {
  font: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px;
  border: none; background: none; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.auth-tabs .tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
.auth-field { margin-bottom: 12px; }
.auth-field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.auth-field input { width: 100%; max-width: none; }
.auth-btn { width: 100%; padding: 10px; margin-top: 4px; }
.auth-err { color: var(--bad); min-height: 16px; margin-top: 10px; }

/* ---- print ---- */
@media print {
  .sidebar, .topbar, .no-print, .pager, .mark-cell, .edit-btn, .theme-toggle { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; font-size: 12px; }
  .shell { display: block; }
  #view { padding: 0; }
  .card { border: none; box-shadow: none; padding: 0; border-radius: 0; }
  .letter { page-break-after: always; border: none; max-width: none; }
  .stmt-card { max-width: none; }
  .note-block { page-break-inside: avoid; }
  .report-print { font-family: Georgia, serif; font-size: 12.5px; line-height: 1.6; }
  a { color: inherit; text-decoration: none; }
}
