/* ===========================================================
   SochenAI — Premium Financial Report Stylesheet
   Palette: Ink/Violet/Sage/Sand/Mist (Stripe + Mercury inspired)
   =========================================================== */

:root {
  --ink: #0A2540;
  --ink-2: #2A3F5C;
  --ink-3: #4F6582;
  --violet: #635BFF;
  --violet-2: #8B85FF;
  --violet-bg: #EEF0FF;
  --sage: #7FB069;
  --sage-bg: #EAF3E2;
  --brick: #C44536;
  --brick-bg: #FBECEA;
  --gold: #C7A04A;
  --sand: #F6F2EC;
  --mist: #F6F9FC;
  --hair: #E3E8EE;
  --hair-strong: #C9D2DC;
  --white: #FFFFFF;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Heebo', sans-serif;
  background: var(--mist);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* Icons */
.icon { width: 20px; height: 20px; stroke-width: 1.75; vertical-align: middle; flex-shrink: 0; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 28px; height: 28px; }
.icon-circle {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--violet-bg); color: var(--violet);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-circle.sand { background: var(--sand); color: var(--ink); }
.icon-circle.sage { background: var(--sage-bg); color: var(--sage); }
.icon-circle.gold { background: #FAF1DC; color: var(--gold); }
.icon-circle.violet { background: var(--violet-bg); color: var(--violet); }
.icon-circle.brick { background: var(--brick-bg); color: var(--brick); }
.icon-circle.sm { width: 32px; height: 32px; }
.icon-circle.sm .icon { width: 16px; height: 16px; }
.icon-circle.lg { width: 56px; height: 56px; }
.icon-circle.lg .icon { width: 28px; height: 28px; }

/* ---------- HOME ---------- */
.home-hero {
  background: var(--ink);
  color: #fff;
  padding: 72px 0 96px;
  position: relative;
  overflow: hidden;
}
.home-hero::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 88% 18%, rgba(99,91,255,.22), transparent 42%),
    radial-gradient(circle at 12% 90%, rgba(127,176,105,.10), transparent 42%);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 18px; }
.brand-mark {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, var(--violet) 0%, var(--violet-2) 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.home-hero h1 {
  font-size: 40px; font-weight: 900; letter-spacing: -0.02em; color: #fff;
  line-height: 1.05;
}
.home-hero h1 .accent { color: var(--violet-2); }
.tagline { font-size: 17px; opacity: 0.78; margin-top: 14px; max-width: 660px; color: #B7C2D4; }

.main-flow { transform: translateY(-56px); padding-bottom: 80px; }
.upload-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px;
  border: 1px solid var(--hair);
  margin-bottom: 48px;
}
.upload-card h2 { font-size: 22px; margin-bottom: 6px; }
.upload-card .sub { color: var(--ink-3); margin: 0 0 24px; font-size: 14px; }

.drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  padding: 56px 32px;
  border: 1.5px dashed var(--hair-strong);
  border-radius: 14px;
  background: var(--mist);
  cursor: pointer;
  transition: all .2s;
}
.drop-zone:hover, .drop-zone.drag {
  border-color: var(--violet); background: var(--violet-bg);
}
.drop-zone svg { color: var(--violet); }
.drop-main { font-size: 17px; font-weight: 600; color: var(--ink); }
.drop-hint { color: var(--ink-3); font-size: 13px; }

.filename { margin: 16px 0 0; min-height: 20px; color: var(--sage); font-weight: 600; }

.cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  background: var(--violet);
  color: #fff;
  font-family: inherit; font-size: 16px; font-weight: 700;
  border: none; padding: 15px;
  border-radius: 12px; cursor: pointer;
  margin-top: 20px;
  transition: background .15s, transform .1s;
}
.cta:hover { background: #5249E6; transform: translateY(-1px); }
.cta:active { transform: translateY(0); }

.recent h3 { margin: 32px 0 16px; font-size: 20px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: #fff; border-radius: 14px; padding: 20px;
  border: 1px solid var(--hair);
  transition: border-color .15s, transform .1s;
  display: block;
}
.card:hover { border-color: var(--violet); transform: translateY(-1px); }
.card-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.card-name { font-weight: 700; font-size: 16px; }
.card-id { color: var(--ink-3); font-size: 12px; }
.card-stats { display: flex; gap: 18px; margin-bottom: 12px; }
.card-stats > div { flex: 1; }
.card-stats .lbl { display: block; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.card-stats .val { font-weight: 800; font-size: 20px; color: var(--ink); }
.card-date { font-size: 11px; color: var(--ink-3); border-top: 1px solid var(--hair); padding-top: 10px; }

/* ---------- Report toolbar ---------- */
.report-toolbar {
  background: rgba(255,255,255,0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hair);
  padding: 12px 0;
  position: sticky; top: 0; z-index: 10;
}
.tool-flex { display: flex; justify-content: space-between; align-items: center; }
.back { color: var(--violet); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.tool-actions { display: flex; gap: 8px; }
.btn {
  padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 13px;
  border: 1px solid transparent; display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s;
}
.btn.primary { background: var(--violet); color: #fff; }
.btn.primary:hover { background: #5249E6; }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--hair); }
.btn.ghost:hover { background: var(--mist); }

/* ---------- Report layout ---------- */
.report { padding: 28px 24px 80px; }
.report.container { max-width: 1280px; }

.block {
  background: #fff; border-radius: 16px; padding: 32px 32px 36px;
  margin-bottom: 24px;
  border: 1px solid var(--hair);
  position: relative;
}
/* Right-edge spine (RTL leading edge) */
.block::before {
  content: ''; position: absolute; top: 32px; bottom: 32px; right: 0;
  width: 3px; border-radius: 0 0 0 3px;
  background: var(--violet);
  opacity: 0.85;
}
.block.zone-cover::before { display: none; }
.block.zone-summary::before { background: var(--sage); }
.block.zone-products::before { background: var(--violet); }
.block.zone-coverage::before { background: var(--gold); }
.block.zone-insurance::before { background: var(--gold); }
.block.zone-loans::before { background: var(--brick); }

.section-head {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 18px; margin-bottom: 24px;
  border-bottom: 1px solid var(--hair);
}
.section-head h2 { font-size: 22px; margin: 0; }
.section-head .sec-sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.section-head .sec-text { flex: 1; }

/* View toggle (table / grid) */
.view-toggle {
  display: inline-flex; padding: 3px;
  background: var(--mist); border: 1px solid var(--hair); border-radius: 9px;
  align-self: center;
}
.vt-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--ink-3); font-family: inherit;
  border: none; padding: 7px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.vt-btn:hover { color: var(--ink); }
.vt-btn.active { background: var(--ink); color: #fff; }
.vt-btn.active svg { color: #fff; }

.view-pane { display: none; }
.view-pane.active { display: block; }

/* Compact product table — uniform font, all cells centered except kind */
.prod-table.compact tbody td {
  padding: 4px 5px;
  font-size: 10px;          /* -1px */
  text-align: center;
  line-height: 1.4;
}
.prod-table.compact thead th {
  padding: 5px 5px;
  font-size: 8.5px;
  text-align: center;
}
.prod-table.compact tbody td.prod-cell,
.prod-table.compact thead th.prod-cell-head { text-align: right; }
/* Force kind column header right-aligned (it's not .prod-cell-head — use nth-of-type) */
.prod-table.compact thead th:nth-of-type(3) { text-align: right; }
.prod-table .amt-col { text-align: center; }
.prod-table .thin-col { white-space: nowrap; }
.prod-table .alerts-col { width: 22px; padding: 0 3px !important; }
.prod-table .idx-col { width: 20px; padding: 0 2px !important; font-size: 10px; color: var(--ink-3); }
.prod-table tr.clickable:hover { background: var(--violet-bg); }
.prod-table .prod-cell {
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
  max-width: 280px;
}
.prod-table .prod-cell .pcell-body { min-width: 0; flex: 1; line-height: 1.2; }
.prod-table .pc-line1 { display: block; }
.prod-table .pc-fund { font-size: 12px; line-height: 1.25; font-weight: 700; color: var(--ink); }
.prod-table .pc-prod-inline { font-size: 10.5px; color: var(--ink-3); font-weight: 500; margin-inline-start: 2px; }
.prod-table .pc-line2 { font-size: 10px; line-height: 1.3; color: var(--ink-3); margin-top: 1px; }
.prod-table .pc-type { color: var(--ink-3); }
.prod-table .pc-emp { color: var(--violet); font-weight: 500; }
.prod-table .pc-sep { color: var(--hair-strong); margin: 0 3px; }
.prod-icon-inline { display: inline-flex; flex-shrink: 0; }
.prod-icon-inline .icon-circle { width: 26px; height: 26px; }
.prod-icon-inline .icon-circle .icon { width: 13px; height: 13px; }
.pill.sm { padding: 0 5px; font-size: 9px; font-weight: 700; line-height: 1.5; }
.liq-pill { padding: 0 5px; font-size: 9px; line-height: 1.5; }
.liq-note { font-size: 8px; }
/* Beneficiary tables — always right-aligned (names) */
.data-table.bnf-table thead th,
.data-table.bnf-table tbody td { text-align: right !important; }

/* Tracks table — track name + balance right-aligned (in RTL: visual leading edge) */
.data-table.tracks-table tbody td.tk-name {
  text-align: right !important;
  font-weight: 600; color: var(--ink);
}
.data-table.tracks-table tbody td.tk-bal {
  text-align: right !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.data-table.tracks-table thead th:nth-of-type(2),
.data-table.tracks-table thead th:nth-of-type(4) { text-align: right; }
.alert-icons { gap: 2px; }
.alert-dot { width: 14px; height: 14px; font-size: 9px; }
.alert-dot.opp { font-size: 11px; }
.alert-dot.bnf { font-size: 9px; }

/* Liquidity pills */
.liq-pill { padding: 2px 8px; font-weight: 700; }
.pill.liq-liquid { background: var(--sage-bg); color: var(--sage); }
.pill.liq-liquid_at_age { background: #FAF1DC; color: var(--gold); }
.pill.liq-not_liquid { background: var(--brick-bg); color: var(--brick); }
.pill.liq-na { background: var(--mist); color: var(--ink-3); }

/* ============= ALERTS ============= */
.alert-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  font-size: 11px; font-weight: 900; color: #fff;
  line-height: 1; cursor: help;
}
.alert-dot.warn { background: var(--gold); }
.alert-dot.high { background: var(--brick); }
.alert-dot.opp {
  background: linear-gradient(135deg, #4F46E5 0%, #635BFF 100%);
  font-size: 13px; line-height: 1;
  box-shadow: 0 0 0 2px rgba(99,91,255,0.15);
}
.alert-dot.bnf {
  background: #0A2540;
  font-size: 10px; line-height: 1;
  color: #fff;
}
.alert-icons {
  display: flex; gap: 4px; align-items: center;
  flex-wrap: nowrap;
}
.row-alert-bnf { background: #F1F3F8 !important; }
.row-alert-bnf:hover { background: #E3E8EE !important; }
.row-alert-warn { background: #FFFAEC !important; }
.row-alert-warn:hover { background: #FCF1D2 !important; }
.row-alert-high { background: #FBECEA !important; }
.row-alert-high:hover { background: #F6D7D2 !important; }
.row-alert-opp { background: #F1F0FF !important; }
.row-alert-opp:hover { background: #E5E3FF !important; }
/* Opportunity row + alert mix - high/warn take precedence visually */
.row-alert-warn.has-opp, .row-alert-high.has-opp { /* leave warn/high bg */ }
.fee-alert-warn { color: var(--gold) !important; font-weight: 800 !important; }
.fee-alert-high { color: var(--brick) !important; font-weight: 800 !important; }

.alerts-legend {
  margin-top: 14px; padding: 14px 18px;
  background: linear-gradient(180deg, #FFFCF5 0%, #fff 100%);
  border: 1px solid var(--gold-bg);
  border-radius: 12px;
}
.alerts-legend .al-head {
  font-size: 13px; font-weight: 800; color: var(--ink);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.alerts-legend .al-head .icon { color: var(--gold); }
.alerts-legend .al-count {
  margin-inline-start: auto;
  background: var(--gold); color: #fff;
  padding: 2px 9px; border-radius: 9999px;
  font-size: 11px; font-weight: 800;
  text-transform: none; letter-spacing: 0;
}
.alerts-legend .al-count.opp {
  background: linear-gradient(135deg, #4F46E5 0%, #635BFF 100%);
}
.alerts-legend .opp-head .icon { color: var(--violet); }
.alerts-legend .al-body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px;
}
.alerts-legend .al-item {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13px; line-height: 1.4;
}
.alerts-legend .al-fund { font-weight: 700; color: var(--ink); flex-shrink: 0; }
.alerts-legend .al-arrow { color: var(--ink-3); }
.alerts-legend .al-msg { color: var(--ink-2); }

/* Liquidity note (future-liquid date) */
.liq-note {
  display: block;
  font-size: 10px;
  color: var(--gold);
  font-weight: 600;
  margin-top: 3px;
  letter-spacing: 0.01em;
}
.liq-note-inline {
  display: inline-block;
  font-size: 10px;
  color: var(--gold);
  font-weight: 600;
  margin-inline-start: 6px;
  vertical-align: middle;
}

/* Mini liquidity dot for chart legend */
.liq-mini {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-inline-start: 4px; vertical-align: middle; flex-shrink: 0;
}
.liq-mini.liq-liquid { background: var(--sage); }
.liq-mini.liq-liquid_at_age { background: var(--gold); }
.liq-mini.liq-not_liquid { background: var(--brick); }
.liq-mini.liq-na { background: var(--ink-3); }

/* Liquidity summary strip (under sunburst) */
.liq-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-top: 16px;
}
.liq-tile {
  background: #fff; border: 1px solid var(--hair);
  border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  position: relative; overflow: hidden;
}
.liq-tile::before {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 4px;
}
.liq-tile.liq-l::before { background: var(--sage); }
.liq-tile.liq-la::before { background: var(--gold); }
.liq-tile.liq-nl::before { background: var(--brick); }
.liq-dot {
  width: 36px; height: 36px; border-radius: 50%;
  flex-shrink: 0;
}
.liq-l .liq-dot { background: var(--sage-bg); border: 3px solid var(--sage); }
.liq-la .liq-dot { background: #FAF1DC; border: 3px solid var(--gold); }
.liq-nl .liq-dot { background: var(--brick-bg); border: 3px solid var(--brick); }
.liq-text { flex: 1; }
.liq-l1 { font-size: 11px; color: var(--ink-3);
          text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.liq-l2 { font-size: 18px; font-weight: 800; color: var(--ink); margin-top: 1px;
          letter-spacing: -0.015em; }
.liq-l3 { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.amt-col.num.sage { color: var(--sage); font-weight: 700; }
.amt-col.num.dim, .num.dim { color: var(--ink-3); font-weight: 400; }
.prod-table tr.total { background: var(--mist); }
.prod-table tr.total td { padding: 10px 8px !important; font-size: 13px; }

/* ---------- COVER ---------- */
.cover {
  background: linear-gradient(135deg, var(--ink) 0%, #11305C 60%, #1A3F6F 100%);
  color: #fff;
  position: relative; overflow: hidden;
  padding: 40px 40px 44px;
}
.cover::after {
  content: ''; position: absolute; right: -120px; top: -80px;
  width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(99,91,255,.32), transparent 70%);
  pointer-events: none;
}
.cover h1, .cover h2, .cover h3 { color: #fff; }
.cover-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  position: relative; z-index: 1;
}
.cover-brand { display: flex; gap: 14px; align-items: center; }
.cover-eyebrow {
  font-size: 11px; color: #B7C2D4; text-transform: uppercase;
  letter-spacing: 0.18em; margin-bottom: 4px;
}
.cover h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.015em; }
.cover-date { color: #B7C2D4; font-size: 13px; text-align: end; }
.cover-date b { color: #fff; display: block; font-size: 16px; margin-top: 2px; }

.cover-client {
  margin: 28px 0 32px; padding: 22px 24px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  position: relative; z-index: 1;
}
.client-row { display: flex; flex-wrap: wrap; gap: 36px; align-items: baseline; }
.client-row.small { margin-top: 14px; font-size: 13px; color: #B7C2D4; }
.kv { display: flex; flex-direction: column; gap: 3px; }
.kv-label { font-size: 10px; color: #B7C2D4; text-transform: uppercase; letter-spacing: 0.12em; }
.kv-val { font-weight: 600; color: #fff; }
.kv-val.xl { font-size: 26px; font-weight: 800; }

/* Material-style outlined field: label floats on the border */
.mat-field {
  position: relative;
  padding: 14px 14px 10px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  min-width: 0;
}
.mat-field > .mat-lbl {
  position: absolute;
  top: -7px; right: 12px;
  background: #142C4F;
  color: var(--violet-2);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0 6px;
  line-height: 14px;
  border-radius: 3px;
}
.mat-field > .mat-val {
  display: block;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mat-field.lg > .mat-val { font-size: 22px; font-weight: 800; letter-spacing: -0.015em; }
.mat-field.xl > .mat-val { font-size: 30px; font-weight: 900; letter-spacing: -0.02em; }
.mat-field.dark > .mat-lbl { background: #fff; color: var(--violet); }
.mat-field.dark { border-color: var(--hair); }
.mat-field.dark > .mat-val { color: var(--ink); }

/* ============= HERO BAND =============
   RTL flex row — first child (client identity) sits on the RIGHT,
   then a thin divider, then the savings total on the LEFT.
   Both zones are headline-large and immediately legible.
*/
.cover-hero-band {
  display: flex; align-items: stretch; gap: 0;
  position: relative; z-index: 1;
  margin: 36px 0 28px;
  padding: 4px;
}
/* === Right: client identity === */
.hero-id { flex: 1 1 50%; min-width: 0; padding-inline-end: 32px; }
.hi-eyebrow {
  font-size: 11px; color: #B7C2D4;
  text-transform: uppercase; letter-spacing: 0.22em;
  font-weight: 700; margin-bottom: 8px;
}
.hi-name {
  font-size: 48px; font-weight: 900; color: #fff;
  letter-spacing: -0.03em; line-height: 1;
  margin: 0 0 18px;
  text-shadow: 0 4px 24px rgba(255,255,255,0.08);
}
.hi-rows { display: flex; flex-direction: column; gap: 6px; }
.hi-row {
  display: flex; align-items: baseline; flex-wrap: wrap;
  gap: 6px; font-size: 13px; color: #DCE5F2;
  line-height: 1.5;
}
.hi-lbl {
  font-size: 10px; color: #8FA0BC;
  letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 600; margin-inline-end: 4px;
}
.hi-val { color: #fff; font-weight: 600; }
.hi-sep {
  display: inline-block;
  width: 3px; height: 3px; border-radius: 50%;
  background: rgba(220,229,242,0.35);
  margin: 0 8px;
  vertical-align: middle;
}

/* === Vertical divider === */
.hero-divider {
  flex: 0 0 1px;
  background: linear-gradient(180deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.18) 30%,
    rgba(139,133,255,0.32) 50%,
    rgba(255,255,255,0.18) 70%,
    rgba(255,255,255,0) 100%);
  margin: 0 4px;
}

/* === Left: HUGE savings total === */
.hero-total {
  flex: 1 1 50%; min-width: 0;
  padding-inline-start: 32px;
  text-align: end;
  display: flex; flex-direction: column; justify-content: center;
}
.ht-eyebrow {
  font-size: 11px; color: var(--violet-2);
  text-transform: uppercase; letter-spacing: 0.22em;
  font-weight: 700; margin-bottom: 10px;
}
.ht-val {
  font-size: 62px; font-weight: 900; color: #fff;
  letter-spacing: -0.04em; line-height: 1;
  text-shadow: 0 6px 28px rgba(99,91,255,0.45);
  white-space: nowrap;
}
.ht-sub {
  font-size: 14px; color: var(--violet-2);
  margin-top: 12px; font-weight: 600;
  letter-spacing: 0.02em;
}
.ht-sub .ht-count {
  display: inline-block;
  background: rgba(99,91,255,0.18);
  border: 1px solid rgba(139,133,255,0.4);
  padding: 1px 9px; border-radius: 9999px;
  color: #fff; font-weight: 800;
  margin-inline-end: 4px;
}

@media (max-width: 880px) {
  .cover-hero-band { flex-direction: column; gap: 24px; }
  .hero-divider {
    flex: 0 0 1px; height: 1px; width: 100%;
    background: linear-gradient(90deg,
      transparent, rgba(139,133,255,0.32), transparent);
    margin: 0;
  }
  .hero-id, .hero-total { padding: 0; flex: 1 1 auto; }
  .hero-total { text-align: start; }
}

.mat-field .mat-sub {
  display: block;
  font-size: 11px;
  color: var(--violet-2);
  margin-top: 4px;
  font-weight: 600;
}

/* Wide breakdown bar (now takes full cover width) */
.cover-mix {
  position: relative; z-index: 1;
  margin-bottom: 22px;
  padding: 22px 26px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
}
.ch-stack.tall { height: 18px; border-radius: 9px; }
.ch-mix { display: flex; flex-direction: column; gap: 12px; }
.ch-stack {
  height: 14px; border-radius: 7px; overflow: hidden;
  display: flex; background: rgba(255,255,255,0.08);
}
.ch-seg { height: 100%; display: block; transition: opacity .15s; }
.ch-seg:hover { opacity: 0.85; }
.ch-mix-legend {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 36px;
  font-size: 12px; color: #DCE5F2;
  margin-top: 14px;
}
.ch-mix-legend.single-col { grid-template-columns: 1fr; }
.ch-leg-row {
  display: grid; grid-template-columns: 10px 1fr auto auto;
  gap: 8px; align-items: center;
  padding: 3px 0;
}
.ch-leg-name { color: #fff; font-weight: 500;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-leg-pct { color: #B7C2D4; font-weight: 700; font-size: 11px; }
.ch-leg-amt { color: #fff; font-weight: 700; }

.donut-wrap { position: relative; height: 100%; }
.donut-wrap canvas { max-height: 100%; }

.hero-stats { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); position: relative; z-index: 1; }
@media (max-width: 900px) { .hero-stats { grid-template-columns: 1fr 1fr; } }
.hero-stat {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px; padding: 16px 18px;
}
.hs-icon { color: var(--violet-2); margin-bottom: 6px; }
.hs-label { font-size: 11px; color: #B7C2D4; letter-spacing: 0.04em;
            text-transform: uppercase; }
.hs-value { font-size: 24px; font-weight: 900; margin: 4px 0; color: #fff; letter-spacing: -0.02em; }
.hs-sub { font-size: 11px; color: #B7C2D4; }

/* ---------- Summary block (donuts) ---------- */
.donut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .donut-grid { grid-template-columns: 1fr; } }
.donut-card {
  background: var(--mist); border: 1px solid var(--hair);
  border-radius: 12px; padding: 24px;
}
.donut-card h3 {
  font-size: 14px; color: var(--ink-2); margin-bottom: 16px;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
}
.donut-card .donut-wrap { height: 280px; position: relative; }

/* Sunburst (multi-ring donut + tabs + legend) */
.sunburst-card {
  display: grid; grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 32px; align-items: center;
  background: var(--mist); border: 1px solid var(--hair);
  border-radius: 14px; padding: 28px;
}
@media (max-width: 880px) { .sunburst-card { grid-template-columns: 1fr; } }
.sb-chart { position: relative; height: 360px; }
.sb-chart canvas { max-height: 100%; }
.sb-chart .donut-center .dc-amt { font-size: 26px; font-weight: 900; color: var(--ink); letter-spacing: -0.02em; }
.sb-chart .donut-center .dc-lbl { font-size: 11px; color: var(--ink-3);
                                    text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px; }

.sb-side { display: flex; flex-direction: column; gap: 16px; }
.sb-toggle {
  display: inline-flex; padding: 4px;
  background: #fff; border: 1px solid var(--hair); border-radius: 10px;
  align-self: flex-start;
}
.sb-tab {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--ink-3); font-family: inherit;
  border: none; padding: 8px 14px; border-radius: 7px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.sb-tab:hover { color: var(--ink); }
.sb-tab.active { background: var(--violet); color: #fff; }
.sb-tab.active svg { color: #fff; }
.sb-legend { max-height: 320px; overflow-y: auto; padding-inline-end: 4px; }
.sb-legend::-webkit-scrollbar { width: 6px; }
.sb-legend::-webkit-scrollbar-thumb { background: var(--hair-strong); border-radius: 3px; }
.sb-legend .legend-row { padding: 8px 0; }
.sb-legend .legend-name small { line-height: 1.4; margin-top: 1px; }
.donut-center {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; flex-direction: column;
  pointer-events: none;
}
.donut-center .dc-amt { font-size: 22px; font-weight: 800; color: var(--ink); }
.donut-center .dc-lbl { font-size: 11px; color: var(--ink-3);
                          text-transform: uppercase; letter-spacing: 0.08em; }
.legend { margin-top: 14px; }
.legend-row {
  display: grid; grid-template-columns: 14px 1fr auto auto;
  gap: 10px; align-items: center; padding: 6px 0;
  font-size: 13px; border-bottom: 1px solid var(--hair);
}
.legend-row:last-child { border-bottom: 0; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-name { font-weight: 600; color: var(--ink); }
.legend-pct { color: var(--ink-3); font-weight: 600; }
.legend-amt { font-weight: 700; color: var(--ink); }

/* Insurance coverage grid */
.cov-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* ===== Floating-Legend fieldsets (Material-3 outlined, semantic) ===== */
.cov-grid.floating {
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.cov-fs {
  border: 1.5px solid var(--hair-strong);
  border-radius: 12px;
  padding: 4px 14px 12px;
  margin: 0;
  background: transparent;
  transition: border-color .15s, background .15s;
  min-width: 0;
  position: relative;
}
.cov-fs:hover { border-color: var(--violet); background: var(--violet-bg); }
.cov-fs legend {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
  padding: 0 8px;
  margin-inline-start: -2px;
  letter-spacing: .015em;
  line-height: 1.1;
}
.cov-fs-row {
  display: flex; align-items: center; gap: 10px;
  padding-top: 4px;
}
.cov-fs-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  flex-shrink: 0;
}
.cov-fs-icon .icon { width: 16px; height: 16px; }
.cov-fs-val {
  font-size: 20px; font-weight: 800; color: var(--ink);
  letter-spacing: -0.015em;
}
/* Empty state — muted */
.cov-fs.is-empty { border-color: var(--hair); }
.cov-fs.is-empty:hover { border-color: var(--hair-strong); background: var(--mist); }
.cov-fs.is-empty legend { color: var(--ink-3); }
.cov-fs.is-empty .cov-fs-val { color: var(--ink-3); font-weight: 600; font-size: 16px; }
.cov-fs.is-empty .cov-fs-icon { opacity: 0.5; }

/* Color variants — frame color + icon tint */
.cov-fs.cov-gold:not(.is-empty)   { border-color: rgba(199,160,74,.45); }
.cov-fs.cov-gold:not(.is-empty) .cov-fs-icon { background: #FAF1DC; color: var(--gold); }
.cov-fs.cov-gold:not(.is-empty):hover { background: #FFFAEC; border-color: var(--gold); }
.cov-fs.cov-violet:not(.is-empty) { border-color: rgba(99,91,255,.40); }
.cov-fs.cov-violet:not(.is-empty) .cov-fs-icon { background: var(--violet-bg); color: var(--violet); }
.cov-fs.cov-violet:not(.is-empty):hover { background: #F5F4FF; border-color: var(--violet); }
.cov-fs.cov-sage:not(.is-empty)   { border-color: rgba(127,176,105,.40); }
.cov-fs.cov-sage:not(.is-empty) .cov-fs-icon { background: var(--sage-bg); color: var(--sage); }
.cov-fs.cov-sage:not(.is-empty):hover { background: #F2F8EE; border-color: var(--sage); }
.cov-fs.cov-brick:not(.is-empty)  { border-color: rgba(196,69,54,.35); }
.cov-fs.cov-brick:not(.is-empty) .cov-fs-icon { background: var(--brick-bg); color: var(--brick); }
.cov-fs.cov-brick:not(.is-empty):hover { background: #FDF4F2; border-color: var(--brick); }

/* Sub-text below the value (e.g., "25% · 4 מוצרים") */
.cov-fs-sub {
  font-size: 11px; color: var(--ink-3);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* "Value-only" variant — no icon, value alone (used for KPIs + meta) */
.cov-fs-val-only {
  font-size: 18px; font-weight: 800; color: var(--ink);
  letter-spacing: -0.015em;
  padding-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Compact variant — smaller value, used for meta strip (string values) */
.cov-fs.compact { padding: 2px 12px 8px; }
.cov-fs.compact legend { font-size: 10.5px; }
.cov-fs.compact .cov-fs-val-only {
  font-size: 14px; font-weight: 600; padding-top: 2px;
}

/* Tighter grid for meta strip + kpi strip */
.meta-fs-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi-fs-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.liq-fs-grid { margin-top: 16px; grid-template-columns: repeat(3, 1fr); }

/* Dark mode for fieldsets */
html[data-theme="dark"] .cov-fs { background: #131C30; border-color: var(--hair-strong); }
html[data-theme="dark"] .cov-fs legend { background: #131C30; color: var(--ink-2); }
html[data-theme="dark"] .cov-fs.is-empty { background: #0F1626; border-color: var(--hair); }
html[data-theme="dark"] .cov-fs.is-empty legend { background: #0F1626; }
html[data-theme="dark"] .cov-fs-val-only { color: var(--ink); }
html[data-theme="dark"] .cov-fs-sub { color: var(--ink-3); }

.cov-box {
  background: #fff; border: 1px solid var(--hair);
  border-radius: 12px; padding: 16px;
  display: flex; gap: 12px; align-items: flex-start;
}
.cov-box .cov-text { flex: 1; }
.cov-label { font-size: 12px; color: var(--ink-3); }
.cov-val { font-size: 20px; font-weight: 800; color: var(--ink);
           margin-top: 2px; letter-spacing: -0.015em; }
.cov-val.empty { color: var(--ink-3); font-size: 16px; font-weight: 600; }

/* ---------- Product Cards Grid ---------- */
.prod-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 880px) { .prod-grid { grid-template-columns: 1fr; } }

.prod-card {
  background: #fff; border: 1px solid var(--hair);
  border-radius: 14px; padding: 20px 22px;
  position: relative;
  transition: border-color .15s, transform .12s;
}
.prod-card:hover { border-color: var(--violet); transform: translateY(-1px); }

.prod-card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.prod-card-head .icon-circle { margin-top: 2px; }
.prod-card-title {
  flex: 1; min-width: 0;
}
.pct-kind {
  font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
}
.pct-name {
  font-size: 17px; font-weight: 800; color: var(--ink);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pct-producer { color: var(--ink-3); font-size: 13px; margin-top: 1px; }
.prod-card-bal {
  text-align: end;
  white-space: nowrap;
}
.pcb-val {
  font-size: 22px; font-weight: 900; color: var(--ink); letter-spacing: -0.02em;
}
.pcb-lbl { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }

.prod-card-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  padding: 14px 0; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair);
}
.pcs-item .pcs-lbl {
  font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.pcs-item .pcs-val {
  font-size: 15px; font-weight: 700; color: var(--ink); margin-top: 2px;
}
.pcs-item .pcs-val.sage { color: var(--sage); }
.pcs-item .pcs-val.dim { color: var(--ink-3); font-weight: 600; }

.prod-card-meta {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  padding-top: 12px;
  font-size: 12px; color: var(--ink-3);
}
.prod-card-meta b { color: var(--ink-2); font-weight: 600; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 9999px;
  background: var(--sage-bg); color: var(--sage); font-size: 11px; font-weight: 700;
}
.pill.warn { background: #FFF4E0; color: #B47214; }
.pill.bad { background: var(--brick-bg); color: var(--brick); }

.prod-card-cta {
  margin-top: 12px;
  font-size: 12px; color: var(--violet); font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer; user-select: none;
}
.prod-card-cta:hover { text-decoration: underline; }

/* ---------- Bar tables (producer / type / market position) ---------- */
.bar-table { width: 100%; border-collapse: collapse; }
.bar-table td { padding: 9px 6px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.bar-table .name { font-weight: 600; width: 32%; font-size: 13px; }
.bar-table .bar-cell { width: 100%; }
.bar {
  height: 8px; background: var(--violet); border-radius: 8px;
  background: linear-gradient(90deg, var(--violet) 0%, var(--violet-2) 100%);
}
.bar.sage { background: linear-gradient(90deg, var(--sage) 0%, #A1C68A 100%); }
.bar.gold { background: linear-gradient(90deg, var(--gold) 0%, #DEB970 100%); }
.bar-table .pct { width: 56px; font-weight: 700; color: var(--ink-2); font-size: 13px; }
.bar-table .amt {
  width: 110px; text-align: end; font-weight: 700; color: var(--ink); font-size: 13px;
}

/* ---------- Data tables ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  background: var(--mist); color: var(--ink-2);
  padding: 10px 8px; text-align: start; font-weight: 700;
  border-bottom: 1px solid var(--hair); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.data-table tbody td { padding: 11px 8px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--mist); }
.data-table .amt, .data-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .total { background: var(--mist); font-weight: 700; }
.data-table.small { font-size: 12px; }
.data-table.small thead th { font-size: 10px; padding: 8px 6px; }
.data-table.small tbody td { padding: 8px 6px; }

/* ---------- Product detail (collapsible) ---------- */
.product-detail {
  background: #fff; border: 1px solid var(--hair);
  border-radius: 14px; margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.product-detail::before {
  content: ''; position: absolute; top: 18px; bottom: 18px; right: 0;
  width: 3px; background: var(--violet); border-radius: 0 0 0 3px; opacity: 0.65;
}
.product-detail > summary {
  list-style: none; cursor: pointer; padding: 14px 18px;
  user-select: none;
  transition: background .12s;
}
.product-detail > summary::-webkit-details-marker { display: none; }
.product-detail > summary:hover { background: var(--mist); }
.product-detail[open] > summary { border-bottom: 1px solid var(--hair); background: var(--mist); }

.prod-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px;
}
.prod-h-l { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; }
.prod-num {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--ink); color: #fff;
  font-weight: 900; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.prod-title-wrap { min-width: 0; flex: 1; }
.prod-header h2 {
  font-size: 17px; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prod-sub { color: var(--ink-2); font-size: 12px; margin-top: 1px; }
.prod-h-r { text-align: end; }
.prod-bal { font-size: 22px; font-weight: 900; color: var(--ink); letter-spacing: -0.02em; line-height: 1; }
.prod-caret {
  color: var(--violet); font-size: 16px;
  transition: transform .2s; flex-shrink: 0;
}
.product-detail[open] .prod-caret { transform: rotate(180deg); }

/* Compact info strip — denser, higher contrast */
.prod-strip {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--hair);
}
.ps-item { display: flex; flex-direction: column; gap: 1px; }
.ps-l {
  font-size: 9px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
}
.ps-item b {
  font-size: 13px; font-weight: 700; color: var(--ink);
}

/* Expanded body — denser */
.prod-body { padding: 14px 18px 16px; }
.prod-body .prod-meta {
  gap: 8px; padding: 10px 12px; margin-bottom: 14px;
}
.prod-body .prod-meta .m b { font-size: 13px; }
.prod-body .prod-meta .m span { font-size: 9px; }
.prod-body .kpi-grid { gap: 8px; margin-bottom: 14px;
                       grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.prod-body .kpi { padding: 10px 12px; }
.prod-body .kpi-l { font-size: 10px; letter-spacing: 0.04em; }
.prod-body .kpi-v { font-size: 16px; margin-top: 2px; }
.prod-body .sub-panel { margin-top: 10px; }
.prod-body details.collapsible > summary { padding: 10px 14px; }
.prod-body .collapse-body { padding: 12px 14px 14px; }

.prod-meta {
  display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  background: var(--mist); border: 1px solid var(--hair);
  border-radius: 10px; padding: 16px; margin-bottom: 20px;
}
.prod-meta .m { display: flex; flex-direction: column; gap: 2px; }
.prod-meta .m span {
  font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.prod-meta .m b { font-weight: 600; font-size: 14px; color: var(--ink); }

.kpi-grid {
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 20px;
}
.kpi {
  background: #fff; border: 1px solid var(--hair);
  border-radius: 10px; padding: 14px;
}
.kpi-l { font-size: 11px; color: var(--ink-3); text-transform: uppercase;
         letter-spacing: 0.06em; font-weight: 600; }
.kpi-v { font-size: 19px; font-weight: 800; color: var(--ink); margin-top: 4px;
         letter-spacing: -0.015em; }
.kpi.violet { background: var(--violet-bg); border-color: #DAD7FF; }
.kpi.violet .kpi-v { color: var(--violet); }
.kpi.sage { background: var(--sage-bg); border-color: #D5E5C6; }
.kpi.sage .kpi-v { color: var(--sage); }
.kpi.sand { background: var(--sand); border-color: #ECE3D2; }

/* ---------- Collapsible (details) ---------- */
.sub-panel { margin-top: 16px; }
.sub-panel h4 {
  font-size: 14px; color: var(--ink); margin: 0;
  display: inline-flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
}
.sub-panel h4 .badge {
  background: var(--violet-bg); color: var(--violet);
  font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 9999px;
  letter-spacing: 0;
}

details.collapsible {
  margin-top: 14px; border: 1px solid var(--hair);
  border-radius: 12px; background: #fff; overflow: hidden;
}
details.collapsible > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; user-select: none;
  background: var(--mist); border-bottom: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
details.collapsible[open] > summary { border-bottom-color: var(--hair); }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary:hover { background: var(--violet-bg); }
details.collapsible .caret { color: var(--violet); font-size: 16px; transition: transform .2s; }
details.collapsible[open] .caret { transform: rotate(180deg); }
.collapse-body { padding: 16px 18px 20px; overflow-x: auto; }

/* Older deposits */
.summary-row { background: #FFF9EC; cursor: pointer; }
.summary-row:hover { background: #FCEFC9; }
.summary-row td { padding: 12px 8px !important; color: var(--ink-2); }
.expand-link { color: var(--violet); font-weight: 700; font-size: 12px; margin-inline-start: 8px; }
.older-row.hidden { display: none; }
.older-row { background: #FAFBFD; }

/* Sparkline (mini bar for returns) */
.spark { display: inline-block; vertical-align: middle; }

.report-footer {
  margin-top: 36px; text-align: center; color: var(--ink-3); font-size: 13px; padding: 20px 0;
  border-top: 1px solid var(--hair);
}
.report-footer .muted { margin-top: 4px; font-size: 11px; }

/* ============================================================
   DARK MODE — applied via [data-theme="dark"] on <html>
   Print/PDF always uses light (PDF generated via dedicated template).
============================================================ */
.theme-icon { display: none; line-height: 1; font-size: 14px; }
[data-theme="light"] .theme-icon-moon,
:root:not([data-theme="dark"]) .theme-icon-moon { display: inline; }
[data-theme="dark"] .theme-icon-sun { display: inline; }
.theme-toggle { padding: 6px 10px; }

@media print { html[data-theme="dark"] { /* PDF uses dedicated template */ } }

html[data-theme="dark"] {
  --ink: #E4EAF2;
  --ink-2: #B7C2D4;
  --ink-3: #8FA0BC;
  --violet: #8B85FF;
  --violet-2: #A39EFF;
  --violet-bg: rgba(99,91,255,0.18);
  --sage: #95C97D;
  --sage-bg: rgba(127,176,105,0.15);
  --brick: #E66252;
  --brick-bg: rgba(196,69,54,0.18);
  --gold: #DEB970;
  --sand: #1F2538;
  --mist: #0F1626;
  --hair: #233146;
  --hair-strong: #324363;
  --white: #11192B;
}

html[data-theme="dark"] body { background: #0A1020; color: var(--ink); }

/* Cards / panels */
html[data-theme="dark"] .block,
html[data-theme="dark"] .card,
html[data-theme="dark"] .upload-card,
html[data-theme="dark"] .product-detail,
html[data-theme="dark"] .donut-card,
html[data-theme="dark"] .sunburst-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .cov-box,
html[data-theme="dark"] .prod-card,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .liq-tile {
  background: #131C30;
  border-color: var(--hair);
  color: var(--ink);
}
html[data-theme="dark"] .upload-card .sub,
html[data-theme="dark"] .drop-zone {
  background: #0F1626; border-color: var(--hair-strong);
}
html[data-theme="dark"] .drop-zone:hover,
html[data-theme="dark"] .drop-zone.drag { background: var(--violet-bg); }

/* Tables */
html[data-theme="dark"] .data-table thead th { background: #1A2438; color: var(--ink-2); border-bottom-color: var(--hair-strong); }
html[data-theme="dark"] .data-table tbody td { border-bottom-color: var(--hair); }
html[data-theme="dark"] .data-table tbody tr:hover { background: #1A2438; }
html[data-theme="dark"] .data-table .total { background: #1A2438; }
html[data-theme="dark"] .bar-table td { border-bottom-color: var(--hair); }

/* Status pills / liquidity */
html[data-theme="dark"] .pill { background: var(--violet-bg); color: var(--violet-2); }
html[data-theme="dark"] .pill.warn { background: #3D2F12; color: #F2C078; }
html[data-theme="dark"] .pill.liq-liquid { background: var(--sage-bg); color: var(--sage); }
html[data-theme="dark"] .pill.liq-liquid_at_age { background: rgba(222,185,112,0.18); color: var(--gold); }
html[data-theme="dark"] .pill.liq-not_liquid { background: var(--brick-bg); color: var(--brick); }

/* Section heads + meta */
html[data-theme="dark"] .section-head { border-bottom-color: var(--hair); }
html[data-theme="dark"] .product-detail > summary { background: #0F1626; }
html[data-theme="dark"] .product-detail > summary:hover { background: #1A2438; }
html[data-theme="dark"] .product-detail[open] > summary { background: #1A2438; border-bottom-color: var(--hair); }
html[data-theme="dark"] details.collapsible { background: #131C30; border-color: var(--hair); }
html[data-theme="dark"] details.collapsible > summary { background: #1A2438; }
html[data-theme="dark"] details.collapsible > summary:hover { background: #233146; }
html[data-theme="dark"] details.collapsible[open] > summary { border-bottom-color: var(--hair); }

/* Toolbar / buttons */
html[data-theme="dark"] .report-toolbar { background: rgba(15,22,38,0.92); border-bottom-color: var(--hair); }
html[data-theme="dark"] .btn.ghost { background: #131C30; color: var(--ink); border-color: var(--hair); }
html[data-theme="dark"] .btn.ghost:hover { background: #1A2438; }
html[data-theme="dark"] .view-toggle { background: #131C30; border-color: var(--hair); }
html[data-theme="dark"] .vt-btn { color: var(--ink-3); }
html[data-theme="dark"] .vt-btn:hover { color: var(--ink); }
html[data-theme="dark"] .vt-btn.active { background: var(--violet); color: #fff; }
html[data-theme="dark"] .sb-toggle { background: #131C30; border-color: var(--hair); }
html[data-theme="dark"] .sb-tab.active { background: var(--violet); color: #fff; }

/* Older deposits row */
html[data-theme="dark"] .summary-row { background: rgba(222,185,112,0.10); color: var(--ink); }
html[data-theme="dark"] .summary-row:hover { background: rgba(222,185,112,0.18); }
html[data-theme="dark"] .older-row { background: #0F1626; }

/* Alerts */
html[data-theme="dark"] .row-alert-warn { background: rgba(199,160,74,0.12) !important; }
html[data-theme="dark"] .row-alert-warn:hover { background: rgba(199,160,74,0.20) !important; }
html[data-theme="dark"] .row-alert-high { background: rgba(196,69,54,0.15) !important; }
html[data-theme="dark"] .row-alert-high:hover { background: rgba(196,69,54,0.25) !important; }
html[data-theme="dark"] .alerts-legend {
  background: linear-gradient(180deg, rgba(222,185,112,0.10) 0%, #131C30 100%);
  border-color: var(--hair-strong);
}

/* Liquidity strip + tiles */
html[data-theme="dark"] .liq-l .liq-dot { background: var(--sage-bg); border-color: var(--sage); }
html[data-theme="dark"] .liq-la .liq-dot { background: rgba(222,185,112,0.18); border-color: var(--gold); }
html[data-theme="dark"] .liq-nl .liq-dot { background: var(--brick-bg); border-color: var(--brick); }

/* Material outlined fields keep their dark cover background */

/* ---------- Print / PDF ---------- */
@media print {
  body, .pdf-mode body { background: #fff; }
  .report-toolbar { display: none; }
  .block { box-shadow: none; padding: 18px 24px; margin-bottom: 14px; page-break-inside: avoid; }
  .product-detail { page-break-inside: avoid; }
  .cover { color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .data-table thead th, .hero-stat, .donut-card, .prod-card,
  details.collapsible, details.collapsible > summary, .summary-row, .older-row,
  .kpi.violet, .kpi.sage, .kpi.sand, .bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  details.collapsible { border: 1px solid var(--hair) !important; background: #fff !important; }
  details.collapsible > summary { background: var(--mist) !important; padding: 10px 14px; }
  details.collapsible .caret { display: none; }
}
.pdf-mode .report-toolbar { display: none; }
.pdf-mode .report.container { max-width: none; padding: 0; }
.pdf-mode body { background: #fff; }
.pdf-mode .older-row.hidden { display: table-row !important; }
.pdf-mode .summary-row { display: none !important; }
.pdf-mode details.collapsible .caret { display: none; }
.pdf-mode details.collapsible > summary { cursor: default; }
