/* Dirigon institutional workstation — FactSet / 9fin register.
   Tokens from design_handoff_dirigon_workstation. No rounded corners. */
:root {
  --ink: #12161B;
  --ink-2: #43484F;
  --paper: #EFEEE9;
  --surface: #FFFFFF;
  --surface-alt: #F7F6F3;
  --surface-tint: #FBFAF7;
  --hairline: #D6D3CA;
  --hairline-2: #EBE9E2;
  --hairline-3: #E4E2DA;
  --oxblood: #8E2A22;
  --amber: #8A6210;
  --amber-2: #C2802A;
  --green: #1F6B4B;
  --muted: #6E6A61;
  --muted-2: #8B857A;
  --muted-3: #A9A398;
  --slate: #7C8794;
  --cmd-bg: #1C222A;
  --cmd-border: #2E3742;
  --font-ui: "Archivo", system-ui, Helvetica, Arial, sans-serif;
  --font-display: "Archivo Narrow", "Archivo", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --rail-w: 186px;
  --bar-h: 46px;
  --series-0: #8E2A22;
  --series-1: #43484F;
  --series-2: #C2802A;
  --series-3: #1F6B4B;
  --series-4: #2C4463;
  --series-5: #8B857A;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: var(--oxblood); text-decoration: none; }
a:hover { color: var(--ink); }
button { font-family: inherit; }
::selection { background: var(--oxblood); color: #fff; }
input { font-family: inherit; }

/* ── App shell ─────────────────────────────────────────────── */
#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Command bar */
#cmdbar {
  height: var(--bar-h);
  flex: none;
  background: var(--ink);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  border-bottom: 2px solid var(--oxblood);
  z-index: 20;
}
.brand {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  flex: none;
}
.brand-glyph { margin-bottom: 2px; display: block; }
.brand-word {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .16em;
  color: #fff;
  line-height: 1;
  text-transform: uppercase;
}
.brand-desc {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: .18em;
  color: var(--slate);
  text-transform: uppercase;
  line-height: 1;
  padding-bottom: 1px;
}
.cmd-input-wrap {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 26px;
  padding: 0 10px;
  background: var(--cmd-bg);
  border: 1px solid var(--cmd-border);
  cursor: text;
}
.cmd-input-wrap .prompt {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--oxblood);
  letter-spacing: .1em;
}
.cmd-input-wrap .placeholder {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmd-chip {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: #5C6772;
  border: 1px solid var(--cmd-border);
  padding: 1px 5px;
}
.cmd-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  flex: none;
}
.gate-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #A7B0BA;
  letter-spacing: .06em;
}
.gate-dot {
  width: 6px;
  height: 6px;
  background: #2E8B5F;
  display: block;
  flex: none;
}
.asof {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #A7B0BA;
  letter-spacing: .06em;
}
.user-sq {
  width: 24px;
  height: 24px;
  background: var(--cmd-border);
  color: #DDE3E9;
  font-family: var(--font-mono);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Body layout */
#layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Left rail */
#rail {
  width: var(--rail-w);
  flex: none;
  background: var(--surface-alt);
  border-right: 1px solid var(--hairline);
  padding: 10px 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.nav-group-label {
  padding: 12px 12px 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--muted-2);
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 12px;
  cursor: pointer;
  border-left: 2px solid transparent;
  color: var(--ink-2);
  text-decoration: none;
  background: transparent;
}
.nav-item:hover { background: #EDEBE4; color: var(--ink); }
.nav-item.active {
  background: #EFE7E6;
  border-left-color: var(--oxblood);
  color: var(--ink);
  font-weight: 600;
}
.nav-code {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted-3);
  width: 26px;
  flex: none;
}
.nav-item.active .nav-code { color: var(--oxblood); }
.nav-label { font-size: 12.5px; white-space: nowrap; }
.rail-foot {
  margin: 16px 12px 0;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.7;
  color: var(--muted-2);
  margin-top: auto;
}

/* Main */
#main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* page-fill / page-scroll own vertical scroll */
  background: var(--paper);
}
#main > .loading,
#main > .error {
  padding: 60px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
}
#main > .error { color: var(--oxblood); }

/* Page chrome */
.page-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .03em;
  text-transform: uppercase;
  line-height: 1.1;
}
.page-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .06em;
}
.page-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.entity-head {
  flex: none;
  padding: 12px 18px;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
}
.back-link {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--oxblood);
  cursor: pointer;
  margin-bottom: 8px;
  display: inline-block;
  text-decoration: none;
}
.back-link:hover { color: var(--ink); }
.entity-title-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  row-gap: 8px;
  flex-wrap: wrap;
}
.entity-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: .01em;
  line-height: 1.12;
}
.entity-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .06em;
  padding-bottom: 3px;
}
.entity-flags {
  margin-left: auto;
  display: flex;
  gap: 6px;
  padding-bottom: 2px;
  flex-wrap: wrap;
  align-items: center;
}

/* Buttons */
.btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  padding: 5px 10px;
  border: 1px solid #C9C5BA;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.btn:hover { border-color: var(--ink); }
.btn-primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn-primary:hover { background: #1C222A; }
.btn-filter.active,
.chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* Tags / badges */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: .1em;
  padding: 1px 4px;
  border: 1px solid;
  flex: none;
  line-height: 1.4;
  text-transform: uppercase;
}
.tag-risk { background: #F3E4E2; color: var(--oxblood); border-color: #E0C6C3; }
.tag-warn { background: #F5EEDF; color: var(--amber); border-color: #E3D6B8; }
.tag-good { background: #E6EFE9; color: var(--green); border-color: #C6DCCF; }
.tag-mute { background: #F2F1EC; color: var(--muted); border-color: #DCD9D0; }
.tag-listed { background: #E9EDF3; color: #2C4463; border-color: #CBD5E1; }
.tag-ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag-est { background: #F5EEDF; color: var(--amber); border-color: #E3D6B8; }

/* Stat strip — 1px gap grid */
.stat-strip {
  flex: none;
  display: grid;
  gap: 1px;
  background: var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.stat-cell {
  background: var(--surface);
  padding: 11px 14px;
  min-width: 0;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--muted-2);
  text-transform: uppercase;
}
.stat-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: -.02em;
  margin-top: 5px;
  color: var(--ink);
}
.stat-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.stat-value.risk, .c-risk { color: var(--oxblood) !important; }
.stat-value.warn, .c-warn { color: var(--amber) !important; }
.stat-value.good, .c-good { color: var(--green) !important; }
.stat-value.muted, .c-muted { color: var(--muted-2) !important; }

/* Panel band */
.panel-band {
  display: grid;
  gap: 1px;
  background: var(--hairline);
  /* Default: size to content. Use .panel-band.fill when a page wants the
     band to consume remaining viewport (desk-style split panes). flex:1 was
     the default and silently ate the holdings region on fund/issuer pages. */
  flex: none;
  min-height: 0;
}
.panel-band.fill {
  flex: 1;
}
.panel {
  background: var(--surface);
  min-width: 0;
  min-height: 0;
  overflow: auto;
}
.panel-alt { background: var(--surface-alt); }
.panel-tint { background: var(--surface-tint); }
.panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 16px 9px;
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 2;
  flex-wrap: wrap;
}
.panel-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.panel-title-sm {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.panel-sub { font-size: 11.5px; color: var(--muted); }
.panel-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
}
.panel-body { padding: 14px 16px; }
.panel-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--muted-2);
  margin-bottom: 8px;
}

/* Instrument / capital-structure collapsible groups (BDC + issuer detail) */
.instr-group {
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}
.instr-group > summary.instr-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 12.5px;
  background: var(--surface-alt);
}
.instr-group > summary.instr-head::-webkit-details-marker { display: none; }
.instr-group > summary.instr-head::before {
  content: "▸";
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  width: 10px;
  flex: none;
}
.instr-group[open] > summary.instr-head::before { content: "▾"; }
.instr-group > summary.instr-head:hover { background: var(--surface-tint); }
.instr-group .instr-label {
  font-weight: 600;
  text-transform: capitalize;
  min-width: 140px;
}
.instr-group .instr-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .02em;
}
.instr-group .instr-meta strong {
  color: var(--ink);
  font-weight: 600;
}
.instr-group .instr-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}
.instr-group .instr-actions .btn {
  font-size: 9px;
  padding: 3px 8px;
}
.instr-filter-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: .06em;
  padding: 6px 16px;
  background: var(--surface-tint);
  border-bottom: 1px solid var(--hairline);
}
.hbar.clickable { cursor: pointer; }
.hbar.clickable:hover { background: var(--surface-tint); }
.hbar.clickable.active {
  outline: 1px solid var(--ink);
  outline-offset: -1px;
}

/* Fund profile — full portfolio controls */
.filer-context-band {
  max-height: 280px;
}
.filer-context-band > .panel {
  max-height: 280px;
  overflow: auto;
}
.filer-holdings-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-alt);
}
.filer-holdings-controls .search-box {
  flex: 1;
  min-width: 200px;
  max-width: 420px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
}
.filer-holdings-controls .search-box:focus {
  outline: 1px solid var(--ink);
  outline-offset: -1px;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.chip {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: capitalize;
  padding: 4px 8px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.chip:hover { background: var(--surface-tint); color: var(--ink); }
.chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.chip .chip-n {
  opacity: 0.7;
  margin-left: 4px;
}
.filer-view-toggle {
  display: flex;
  gap: 0;
  padding: 0 16px 10px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--hairline);
}
.filer-view-toggle .btn {
  border-radius: 0;
  font-size: 9.5px;
  letter-spacing: .08em;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--muted);
  cursor: pointer;
}
.filer-view-toggle .btn + .btn { border-left: 0; }
.filer-view-toggle .btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Tables */
/* Tables size to content by default so multiple tables on one page don't
   each claim flex:1 and crush to zero height (issuer capital structure). */
.table-wrap {
  overflow: auto;
  flex: none;
  background: var(--surface);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
table.data thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--muted-2);
  padding: 7px 14px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-alt);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
table.data thead th.num { text-align: right; }
table.data thead th.sorted-asc::after { content: " ↑"; }
table.data thead th.sorted-desc::after { content: " ↓"; }
table.data tbody tr { border-bottom: 1px solid var(--hairline-2); }
table.data tbody tr:hover { background: #F9F8F4; }
table.data tbody tr.clickable { cursor: pointer; }
table.data td {
  padding: 8px 14px;
  vertical-align: top;
}
table.data td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
table.data td.num.strong {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink);
}
.cell-primary {
  font-weight: 600;
  font-size: 12px;
  color: var(--ink);
}
.cell-secondary {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted-2);
  margin-top: 3px;
  letter-spacing: .04em;
}
.cell-row {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}

/* Method footer */
.method-foot {
  flex: none;
  padding: 13px 18px;
  border-top: 1px solid var(--hairline);
  background: var(--surface-alt);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 960px;
}
.method-eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--muted-2);
  display: block;
  margin-bottom: 2px;
}

/* Legend strip */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  padding: 11px 16px;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted-2);
  letter-spacing: .06em;
  align-items: center;
}
.legend .swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  vertical-align: middle;
}
.legend .rule {
  display: inline-block;
  width: 1px;
  height: 11px;
  background: var(--ink);
  margin-right: 5px;
  vertical-align: middle;
}

/* Dot plot (holder marks 30→105) */
.dotplot {
  position: relative;
  height: 16px;
  background: #F2F1EC;
  border-left: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
  width: 180px;
}
.dotplot .band {
  position: absolute;
  top: 0; bottom: 0;
  background: #E4E2DA;
}
.dotplot .dot {
  position: absolute;
  top: 5px;
  width: 5px;
  height: 5px;
  transform: translateX(-2px);
}
.dotplot .cons {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--ink);
}

/* Holder move plot */
.move-plot {
  position: relative;
  height: 154px;
  border-left: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
  background: var(--surface-tint);
}
.move-plot .axis {
  position: absolute;
  top: 0;
  bottom: 16px;
  width: 1px;
  background: var(--hairline-2);
}
.move-plot .axis-lab {
  position: absolute;
  bottom: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted-2);
  transform: translateX(-50%);
}
.move-plot .cons-line {
  position: absolute;
  top: 0;
  bottom: 16px;
  width: 1px;
  background: var(--ink);
}
.move-plot .cons-lab {
  position: absolute;
  top: 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
  background: var(--ink);
  color: #fff;
  padding: 1px 4px;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* History chart */
.hist-wrap {
  display: flex;
  gap: 14px;
  padding: 14px 18px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.hist-chart {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 170px;
  border-left: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-tint);
  margin-bottom: 18px;
}
.hist-chart svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hist-legend {
  flex: none;
  width: 290px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
}
.hist-leg-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
}
.hist-leg-row .line {
  width: 14px;
  height: 2px;
  flex: none;
}
.hist-leg-row .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}
.hist-leg-row .val {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-2);
}
.hist-leg-row .move {
  font-family: var(--font-mono);
  font-size: 10px;
  width: 50px;
  text-align: right;
}

/* Bars */
.bar-track {
  height: 8px;
  background: #F2F1EC;
  position: relative;
  flex: 1;
  min-width: 0;
}
.bar-fill { height: 100%; }
.bar-tick {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: var(--ink);
}
.hbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--hairline-2);
}
.hbar-label {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Stacked wall chart */
.wall-chart {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 300px;
  border-bottom: 1px solid var(--ink);
}
.wall-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  height: 100%;
}
.wall-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.wall-labels {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}
.wall-labels > div {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

/* Side list items */
.side-row {
  padding: 9px 14px;
  border-bottom: 1px solid var(--hairline-3);
  display: flex;
  gap: 10px;
  align-items: baseline;
  cursor: pointer;
}
.side-row:hover { background: #EDEBE4; }
.side-row .name {
  font-weight: 600;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-row .sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-row {
  padding: 8px 14px;
  border-bottom: 1px solid var(--hairline-3);
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.cal-tone {
  flex: none;
  width: 3px;
  height: 22px;
}

/* Sector pressure cells */
.sector-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: var(--hairline);
}
.sector-cell {
  background: var(--surface);
  padding: 9px 11px;
  min-width: 0;
}
.sector-cell .name {
  font-size: 11.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sector-cell .val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  margin-top: 4px;
  color: var(--oxblood);
}
.sector-cell .bar {
  height: 4px;
  background: var(--paper);
  margin-top: 6px;
}
.sector-cell .bar > div {
  height: 4px;
  background: var(--oxblood);
}
.sector-cell .meta {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted-2);
  margin-top: 5px;
}

/* Alerts */
.alert-row {
  display: flex;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--hairline-2);
  cursor: pointer;
}
.alert-row:hover { background: #F9F8F4; }
.alert-row.unread { background: var(--surface-tint); }
.alert-tone { flex: none; width: 3px; }
.alert-kind {
  flex: none;
  width: 96px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  padding-top: 2px;
}
.alert-title {
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1.3;
  display: flex;
  gap: 7px;
  align-items: center;
}
.unread-dot {
  flex: none;
  width: 5px;
  height: 5px;
  background: var(--oxblood);
}
.alert-body {
  font-size: 11.5px;
  color: var(--ink-2);
  margin-top: 3px;
  line-height: 1.45;
}
.alert-rule {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted-2);
  margin-top: 4px;
  letter-spacing: .04em;
}
.toggle {
  flex: none;
  width: 26px;
  height: 14px;
  background: #C9C5BA;
  cursor: pointer;
  position: relative;
}
.toggle.on { background: var(--oxblood); }
.toggle .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  background: var(--surface);
}
.toggle.on .knob { left: 14px; }

/* Studio */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
}
.stepper button {
  font-family: var(--font-mono);
  font-size: 11px;
  width: 22px;
  height: 22px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid #C9C5BA;
  cursor: pointer;
}
.stepper .pct {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  width: 46px;
  text-align: center;
}
.seg-bar {
  display: flex;
  height: 9px;
  background: #F2F1EC;
  width: 100%;
}
.seg-bar > div { height: 9px; }

/* Coverage */
.gate-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--hairline-2);
}
.gate-swatch {
  flex: none;
  width: 9px;
  height: 9px;
}

/* Scroll body for full-page content */
.page-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}
.page-fill {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* Critical: without this, long entity pages (issuer detail, multi-table
     fund views) are clipped by #main { overflow:hidden } and appear to
     "only show the top section". Nested .page-scroll still works when used. */
  overflow-y: auto;
}
/* Table-primary pages: head + stats sticky-ish, table fills remaining height */
.page-fill.table-page {
  overflow: hidden;
}
.page-fill.table-page > .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* ── Desk (#/desk): document scroll, full-width queue ─────────────────────
   Nested flex:1 panes crushed the watchlist into a ~1-row strip. Desk uses
   one page-scroll; table grows with rows; secondary cards sit below. */
.desk-page {
  overflow: hidden; /* only .desk-scroll scrolls */
}
.desk-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
  padding-bottom: 32px;
}
.desk-digest {
  margin: 0 16px 10px;
  border: 1px solid var(--hairline);
  background: var(--paper);
}
.desk-digest-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
}
.desk-digest-head:hover { background: #EDEBE4; }
.desk-digest-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  flex: none;
  font-weight: 600;
}
.desk-digest-summary {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink);
}
.desk-digest-toggle {
  flex: none;
  font-size: 10px;
  color: var(--oxblood);
  letter-spacing: 0.04em;
}
.desk-digest-body {
  padding: 0 14px 12px;
  border-top: 1px solid var(--hairline);
}
.desk-digest-bullets {
  margin: 10px 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.5;
}
.desk-digest-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted-2);
  margin: 10px 0 6px;
}
.desk-digest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.desk-queue {
  margin: 8px 0 0;
  border-top: 1px solid var(--hairline);
}
.desk-queue-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px 10px;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 3;
  border-bottom: 1px solid var(--hairline);
}
.desk-queue-titles {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
/* Table is content-height — no nested max-height / flex crush */
.desk-queue .desk-queue-table,
.desk-queue .table-wrap {
  max-height: none !important;
  overflow: visible !important;
  flex: none !important;
  min-height: 280px;
}
.desk-queue .table-wrap.sticky-col {
  overflow-x: auto !important;
  overflow-y: visible !important;
}
.desk-legend {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--hairline);
}
.desk-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--hairline);
  border-top: 1px solid var(--hairline);
  margin-top: 8px;
}
.desk-card {
  background: var(--surface-alt);
  min-width: 0;
  padding-bottom: 8px;
}
.desk-card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 14px 6px;
  flex-wrap: wrap;
}
.desk-card-link {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--oxblood);
}
.desk-card-note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  padding: 0 14px 8px;
}
.desk-card-foot {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted-2);
  letter-spacing: 0.06em;
  border-top: 1px solid var(--hairline);
}
.desk-sectors {
  border-top: 1px solid var(--hairline);
  background: var(--surface);
  padding: 14px 16px 20px;
}
.desk-sectors-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
@media (max-width: 960px) {
  .desk-secondary {
    grid-template-columns: 1fr;
  }
}

/* ── Fund packs index + detail ─────────────────────────────────────────── */
.fund-packs-page {
  overflow: hidden;
}
.fund-packs-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
  padding-bottom: 40px;
}
.fund-packs-table,
.fund-packs-table.table-wrap {
  max-height: none !important;
  overflow: visible !important;
  flex: none !important;
  min-height: 240px;
}
.fund-packs-table.sticky-col {
  overflow-x: auto !important;
  overflow-y: visible !important;
}
.fp-detail-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 12px;
  margin: 12px 16px;
}
.fp-detail-card {
  border: 1px solid var(--hairline);
  background: var(--surface);
  min-width: 0;
}
.fp-detail-card .table-wrap {
  max-height: none !important;
  overflow: visible !important;
}
.fp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px;
  padding-top: 4px;
}
.fp-actions-hint {
  font-size: 11px;
  color: var(--muted-2);
  margin-left: 4px;
}
.fp-actions .btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.fund-pack-panel .stat-strip {
  margin: 0;
}
@media (max-width: 960px) {
  .fp-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* Allocator studio — left rail builder · right results pane */
.studio-page {
  overflow: hidden; /* columns own scroll */
}
.studio-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  background: var(--hairline);
  gap: 1px;
}
.studio-rail {
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.studio-rail-top {
  flex: none;
  padding: 14px 14px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.studio-rail-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.studio-rail-meta {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .02em;
}
.studio-rail-meta b {
  color: var(--ink);
  font-weight: 600;
}
.studio-rail-meta .dot {
  margin: 0 6px;
  color: var(--muted-3);
}
.studio-comp {
  display: flex;
  height: 8px;
  margin-top: 12px;
  background: var(--hairline-3);
}
.studio-comp.empty {
  height: 28px;
  align-items: center;
  justify-content: center;
  background: var(--surface-tint);
}
.studio-comp.empty span {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .08em;
  color: var(--muted-2);
  text-transform: uppercase;
}
.studio-comp-seg {
  height: 100%;
  min-width: 2px;
}
.studio-section-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 10px 14px 6px;
}
.studio-section-label span {
  color: var(--muted-3);
  letter-spacing: .04em;
  text-transform: none;
  margin-left: 6px;
}
.studio-active {
  flex: none;
  max-height: 42%;
  overflow: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.studio-hint {
  padding: 8px 14px 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.studio-hint b { color: var(--ink); font-weight: 600; }
.studio-weight-list {
  padding: 0 0 8px;
}
.studio-weight-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline-2);
}
.studio-swatch {
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--hairline);
}
.studio-weight-info {
  flex: 1;
  min-width: 0;
}
.studio-weight-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.studio-weight-sub {
  font-size: 9.5px;
  color: var(--muted-2);
  margin-top: 1px;
  letter-spacing: .03em;
}
.studio-weight-ctl {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
}
.studio-weight-ctl .btn {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 13px;
  line-height: 1;
}
.studio-weight-input {
  width: 44px;
  height: 24px;
  border: 1px solid var(--hairline);
  background: var(--surface-alt);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
}
.studio-weight-input:focus {
  outline: 1px solid var(--ink);
  outline-offset: -1px;
  background: var(--surface);
}
.studio-lib {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-alt);
}
.studio-lib-head {
  flex: none;
  padding: 0 14px 8px;
  border-bottom: 1px solid var(--hairline-2);
}
.studio-lib-head .studio-section-label {
  padding-left: 0;
  padding-right: 0;
}
.studio-search {
  width: 100%;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
}
.studio-search:focus {
  outline: 1px solid var(--ink);
  outline-offset: -1px;
}
.studio-lib-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.studio-lib-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--hairline-2);
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--ink-2);
}
.studio-lib-row:hover { background: var(--surface); color: var(--ink); }
.studio-lib-row.on { background: var(--surface); color: var(--ink); }
.studio-lib-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.studio-lib-name {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.studio-lib-sub {
  font-size: 9.5px;
  color: var(--muted-2);
  letter-spacing: .03em;
}
.studio-lib-w {
  flex: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--muted-2);
  min-width: 36px;
  text-align: right;
}
.studio-lib-row.on .studio-lib-w { color: var(--oxblood); }

/* Right results pane */
.studio-pane {
  background: var(--paper);
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.studio-pane-empty {
  margin: auto;
  max-width: 420px;
  padding: 48px 24px;
  text-align: left;
}
.studio-pane-empty-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--muted-2);
  margin-bottom: 8px;
}
.studio-pane-empty-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .03em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.studio-pane-empty-body {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 18px;
}
.studio-pane-empty-actions { display: flex; gap: 8px; }

/* Dense secondary metrics — replaces the second full stat strip */
.studio-chips {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.studio-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 10px 6px;
  border: 1px solid var(--hairline);
  background: var(--surface-alt);
  min-width: 64px;
}
.studio-chip-k {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.studio-chip-v {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .02em;
}
.studio-chip.tone-warn .studio-chip-v { color: #8B6914; }
.studio-chip.tone-risk .studio-chip-v { color: #8E2A22; }

/* Collapsible panels — quality / wall / shared / pairs / method */
.studio-sec {
  flex: none;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.studio-sec > summary.studio-sec-sum {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: var(--surface-alt);
}
.studio-sec > summary.studio-sec-sum::-webkit-details-marker { display: none; }
.studio-sec > summary.studio-sec-sum::before {
  content: "▸";
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  width: 10px;
  flex: none;
}
.studio-sec[open] > summary.studio-sec-sum::before { content: "▾"; }
.studio-sec > summary.studio-sec-sum:hover { background: var(--surface-tint); }
.studio-sec-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
}
.studio-sec-meta {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: .04em;
}
.studio-sec-body {
  border-top: 1px solid var(--hairline-2);
}

.studio-quality {
  flex: none;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.studio-qgrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--hairline);
}
.studio-qcell {
  background: var(--surface);
  padding: 10px 12px 12px;
  min-height: 72px;
}
.studio-qcell-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 4px;
}
.studio-qcell-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.1;
}
.studio-qcell-note {
  margin-top: 5px;
  font-size: 9.5px;
  color: var(--muted-2);
  letter-spacing: .03em;
  line-height: 1.35;
}

/* Maturity wall inside collapsed section */
.studio-wall {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 14px;
  align-items: flex-end;
}
.studio-wall-col {
  flex: 1 1 48px;
  min-width: 48px;
  max-width: 72px;
  text-align: center;
}
.studio-wall-bar-wrap {
  height: 44px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.studio-wall-bar {
  width: 26px;
  background: #43484F;
  border-radius: 2px 2px 0 0;
  min-height: 4px;
}
.studio-wall-yr {
  font-size: 9.5px;
  margin-top: 4px;
  color: var(--ink-2);
}
.studio-wall-v {
  font-size: 9px;
  color: var(--muted-2);
}

.studio-exposure-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.studio-legend {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 16px;
  background: var(--surface-tint);
  border-bottom: 1px solid var(--hairline-2);
}
.studio-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .06em;
  color: var(--muted);
  text-transform: uppercase;
}
.studio-exposure-body .table-wrap {
  max-height: min(52vh, 480px);
  overflow: auto;
}

.studio-pairs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px 14px;
}
.studio-pair {
  flex: 1 1 160px;
  max-width: 240px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  background: var(--surface-alt);
}
.studio-pair-names {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
}
.studio-pair-amt {
  font-size: 13px;
  font-weight: 600;
  color: var(--oxblood);
}
.studio-pair-n {
  font-size: 9.5px;
  color: var(--muted-2);
  letter-spacing: .04em;
  margin-top: 2px;
}

.studio-method {
  padding: 12px 16px 16px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 720px;
}
.studio-method p { margin: 0 0 8px; }
.studio-method p:last-child { margin-bottom: 0; }
.studio-method b { color: var(--ink-2); font-weight: 600; }

@media (max-width: 1100px) {
  .studio-qgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .studio-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 40vh) minmax(0, 1fr);
  }
  .studio-qgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Legacy card surface (scenarios.js engines; pre-redesign pages) */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  margin-bottom: 14px;
}
.card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-alt);
}
.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.card-note {
  font-size: 11.5px;
  color: var(--muted);
  padding: 8px 16px 0;
  line-height: 1.45;
}
.card .disclaimer {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: .04em;
  padding: 6px 16px 10px;
  border-bottom: 1px solid var(--hairline-2);
}
.card .kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--hairline);
  margin: 0;
}
.scenario-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hairline-2);
}
.scenario-bar button {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .04em;
  padding: 5px 10px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.scenario-bar button.active,
.scenario-bar button:hover {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.scenario-bar input[type="number"] {
  width: 96px;
  height: 28px;
  border: 1px solid var(--hairline);
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Command palette */
#palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 22, 27, .42);
  z-index: 100;
  display: none;
}
#palette-overlay.open { display: block; }
#palette {
  position: fixed;
  top: 96px;
  left: 50%;
  transform: translateX(-50%);
  width: 560px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--ink);
  z-index: 101;
  display: none;
  box-shadow: 0 24px 60px rgba(18, 22, 27, .28);
}
#palette.open { display: block; }
.palette-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
}
.palette-input-row .prompt {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--oxblood);
}
.palette-input-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
}
.palette-hit {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 10px 14px;
  cursor: pointer;
  border-left: 2px solid transparent;
  border-bottom: 1px solid var(--hairline-2);
}
.palette-hit:hover,
.palette-hit.sel {
  background: var(--surface-alt);
  border-left-color: var(--oxblood);
}
.palette-kind {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  color: var(--muted-2);
  width: 64px;
  flex: none;
}
.palette-label {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  flex: none;
}
.palette-empty {
  padding: 14px;
  font-size: 12px;
  color: var(--muted);
}
.palette-foot {
  padding: 9px 14px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted-2);
  letter-spacing: .06em;
  border-top: 1px solid var(--hairline);
}

/* Utility */
.mono { font-family: var(--font-mono); }
.trunc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flex-1 { flex: 1; min-width: 0; }
.mt-auto { margin-left: auto; }
.pad-block { padding: 14px 16px; }
.risk-tone { color: var(--oxblood); }
.warn-tone { color: var(--amber); }
.good-tone { color: var(--green); }

/* Print: hide chrome */
@media print {
  #cmdbar, #rail, #palette-overlay, #palette, .page-actions, .no-print { display: none !important; }
  #layout { display: block; }
  #main { overflow: visible; }
  body { overflow: visible; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Credit-analyst UX layer (2026-08-05)
   ═══════════════════════════════════════════════════════════════════════════ */

.unit-cents {
  font-size: 9px;
  color: var(--muted-2);
  margin-left: 1px;
  font-weight: 500;
}

.mark-scale-legend {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: .04em;
  flex-wrap: wrap;
}
.mark-scale-legend .ms-lab {
  font-weight: 600;
  color: var(--ink-2);
  margin-right: 4px;
}
.mark-scale-legend .ms-bar {
  display: inline-block;
  width: 28px;
  height: 3px;
  background: linear-gradient(90deg, #8E2A22, #C2802A, #7C8794, #43484F);
  vertical-align: middle;
}

.period-strip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.period-strip-lab {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--muted-2);
  font-weight: 600;
}
.period-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 7px;
  border: 1px solid var(--hairline);
  background: var(--surface-alt);
  color: var(--ink-2);
  letter-spacing: .03em;
}
.period-chip.frontier {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}
.period-chip.lag {
  border-color: #C2802A;
  color: #8A6210;
  background: #FBF6EC;
}
.period-strip-note {
  font-size: 11px;
  color: var(--muted);
  margin-left: 4px;
}
.period-cell {
  font-size: 11px;
  padding: 1px 5px;
  border: 1px solid transparent;
}
.period-cell.frontier { color: var(--ink); font-weight: 600; }
.period-cell.lag {
  color: #8A6210;
  background: #FBF6EC;
  border-color: #E8D9B0;
}

.entity-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.ux-filter-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.ux-search {
  flex: 1;
  min-width: 200px;
  max-width: 480px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-tint);
}
.ux-search:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--surface);
}
.ux-chips { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.ux-filter-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: .06em;
}
.ux-num-lab {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: .06em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.ux-num {
  width: 52px;
  height: 24px;
  border: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 4px;
  text-align: right;
}
.ux-thresh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}
.chip {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .06em;
  padding: 4px 8px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chip .chip-n { opacity: .7; margin-left: 3px; }

/* Sticky first column on data tables */
.table-wrap.sticky-col { position: relative; }
.table-wrap.sticky-col table.data thead th:first-child,
.table-wrap.sticky-col table.data tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--hairline);
}
.table-wrap.sticky-col table.data thead th:first-child {
  z-index: 3;
  background: var(--surface-alt);
}
.table-wrap.sticky-col table.data tbody tr:hover td:first-child {
  background: #F9F8F4;
}

.compare-strip {
  flex: none;
  padding: 12px 18px;
  background: var(--surface-tint);
  border-bottom: 1px solid var(--hairline);
}
.compare-lab {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--muted-2);
  margin-bottom: 8px;
  font-weight: 600;
}
.compare-grid {
  display: grid;
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
}
.compare-cell {
  background: var(--surface);
  padding: 10px 12px;
}
.compare-cell .cc-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}
.compare-cell .cc-mark {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.compare-cell .cc-meta {
  font-size: 10px;
  color: var(--muted-2);
  margin-top: 3px;
}

.sector-cell-click { cursor: pointer; }
.sector-cell-click:hover { background: #F3EDEA; }

.est-banner {
  flex: none;
  padding: 7px 18px;
  background: #FBF6EC;
  border-bottom: 1px solid #E8D9B0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .06em;
  color: #8A6210;
}

.nowcast-scatter-wrap {
  flex: none;
  padding: 14px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.nowcast-scatter {
  position: relative;
  height: 280px;
  background: var(--surface-tint);
  border: 1px solid var(--hairline);
  overflow: hidden; /* out-of-range dots must not leak into the filter bar */
}
.nowcast-scatter .scatter-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.scatter-dot {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  opacity: .85;
  border: 1px solid rgba(0,0,0,.15);
  z-index: 1;
}
.scatter-dot:hover { opacity: 1; outline: 2px solid var(--ink); z-index: 2; }
.scatter-axis-x {
  position: absolute;
  bottom: 6px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted-2);
  letter-spacing: .06em;
  z-index: 1;
  background: rgba(245, 244, 240, .85);
  padding: 1px 4px;
}
.scatter-axis-y {
  position: absolute;
  top: 8px;
  left: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted-2);
  letter-spacing: .06em;
  z-index: 1;
  background: rgba(245, 244, 240, .85);
  padding: 1px 4px;
}
/* Corner tick labels for the shared ¢ scale (x and y share lo–hi) */
.scatter-tick {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--muted-3);
  letter-spacing: .04em;
  pointer-events: none;
  z-index: 1;
}
.scatter-tick-lo { bottom: 6px; left: 8px; }
.scatter-tick-mid { bottom: 6px; left: 50%; transform: translateX(-50%); }
.scatter-tick-hi { top: 8px; right: 10px; }

/* Secondary rail tools (fund packs, client tape) */
.nav-group-secondary {
  opacity: 0.85;
  margin-top: 4px;
}
.nav-item-secondary .nav-label {
  color: var(--muted);
  font-size: 11px;
}
.nav-item-secondary .nav-code {
  color: var(--muted-2);
}

/* Scenarios shard-load progress */
.scen-load {
  max-width: 420px;
  margin: 48px auto;
  padding: 24px 28px;
  background: var(--surface);
  border: 1px solid var(--hairline);
}
.scen-load-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.scen-load-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.4;
}
.scen-load-bar {
  height: 6px;
  background: var(--hairline);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}
.scen-load-fill {
  height: 100%;
  background: var(--oxblood, #8E2A22);
  transition: width .15s ease-out;
  min-width: 2%;
}
.scen-load-meta {
  font-size: 11px;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.scen-load-hint {
  font-size: 11px;
  color: var(--muted-2);
}

/* Screener filing-period mix banner */
.period-mix-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 16px;
  background: #FBF8F0;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--ink-2);
}
.period-mix-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  color: #8B6914;
  font-weight: 600;
}
.period-mix-body { flex: 1; min-width: 200px; line-height: 1.4; }
.period-mix-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.period-mix-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--muted);
}
.period-mix-chip.front {
  border-color: #1F6B4B;
  color: #1F6B4B;
  font-weight: 600;
}
.period-mix-chip.deep {
  border-color: #8E2A22;
  color: #8E2A22;
}
.period-mix-chip b { margin-right: 4px; }

/* Issuer early-read estimate drawer */
.estimate-drawer {
  background: var(--surface)BF5;
  border-bottom: 1px solid #E8D9B8;
}
.estimate-drawer-sum {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.estimate-drawer-sum::-webkit-details-marker { display: none; }
.estimate-drawer-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}
.estimate-drawer-meta {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--muted);
}
.estimate-drawer-body {
  padding: 0 16px 14px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  border-top: 1px solid #E8D9B8;
}
.estimate-drawer-body p { margin: 10px 0; max-width: 720px; }
.estimate-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0;
}
.estimate-kpis > div {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--hairline);
}
.estimate-kpis .ek-l {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 4px;
}
.estimate-kpis .ek-v {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.estimate-foot {
  font-size: 11.5px;
  color: var(--muted-2);
}
@media (max-width: 720px) {
  .estimate-kpis { grid-template-columns: 1fr 1fr; }
}

/* Credit-analyst workflow strip (desk landing) */
.analyst-path {
  flex: none;
  padding: 12px 18px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.analyst-path-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .14em;
  color: var(--muted-2);
  margin-bottom: 8px;
}
.analyst-path-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}
.analyst-step {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--hairline);
  background: var(--surface-alt);
  text-decoration: none;
  color: var(--ink);
  min-height: 56px;
}
.analyst-step:hover {
  background: var(--surface-tint);
  border-color: var(--ink-2);
}
.analyst-step b {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  font-weight: 600;
}
.analyst-step span {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.35;
}
.analyst-path-legend {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}
.analyst-path-legend .tag { margin-right: 2px; vertical-align: middle; }
.rail-foot-frontier,
.rail-foot-lag {
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: .04em;
}
.product-notes {
  padding: 12px 16px 14px;
  background: var(--surface-tint);
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.product-notes summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--ink-2);
  list-style: none;
}
.product-notes summary::-webkit-details-marker { display: none; }
.product-notes ul {
  margin: 8px 0 0;
  padding-left: 18px;
}
.product-notes li { margin-bottom: 4px; }

@media (max-width: 1100px) {
  .analyst-path-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .analyst-path-steps { grid-template-columns: 1fr 1fr; }
}

.risk-strip {
  flex: none;
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  overflow-x: auto;
}
.risk-strip-title {
  flex: none;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--muted-2);
  padding: 10px 6px;
  background: var(--surface-alt);
  border-right: 1px solid var(--hairline);
  font-weight: 600;
}
.risk-cell {
  flex: 1;
  min-width: 100px;
  padding: 10px 14px;
  border-right: 1px solid var(--hairline-2);
}
.risk-cell .lab {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  color: var(--muted-2);
}
.risk-cell .val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  margin-top: 3px;
  color: var(--ink);
}
.risk-cell .sub {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.ux-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  padding: 10px 16px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.ux-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.page-fill.table-page > .ux-filter-bar,
.page-fill.table-page > .mark-scale-legend {
  flex: none;
}
.page-fill.table-page > .table-wrap.sticky-col {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* Instrument badge + dual-period fund portfolio */
.instr-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  padding: 0 4px;
  border: 1px solid var(--hairline);
  background: #F2F1EC;
  color: var(--ink);
  vertical-align: middle;
  margin-right: 4px;
  line-height: 1.5;
}
.cell-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell-stack .cell-secondary { font-size: 10px; }
.filer-policy-chips { flex-wrap: wrap; }
.filer-spark-host { padding: 10px 14px 4px; border-bottom: 1px solid var(--hairline); background: #FBFBF9; }
.mark-spark-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.spark-row { display: flex; align-items: flex-end; gap: 10px; height: 64px; }
.spark-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; flex: 1; min-width: 36px; height: 100%; }
.spark-bar { width: 100%; max-width: 36px; border-radius: 2px 2px 0 0; min-height: 4px; }
.spark-lab { font-family: var(--font-mono); font-size: 8.5px; color: var(--muted-2); letter-spacing: .02em; white-space: nowrap; }
.c-muted { color: var(--muted) !important; }

/* Desk book pulse + flow waterfalls */
.desk-book-pulse {
  border-bottom: 1px solid var(--hairline);
  background: #FBFBF9;
  padding: 12px 16px 14px;
}
.desk-book-pulse-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.desk-spark { padding: 0; border: none; background: transparent; }
.flow-waterfall { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-width: 520px; }
.fw-row { display: flex; align-items: center; gap: 10px; }
.fw-lab { width: 110px; flex: none; font-size: 11.5px; color: var(--ink-2); }
.fw-track { flex: 1; height: 10px; background: #ECEAE4; min-width: 80px; }
.fw-fill { height: 10px; min-width: 2px; }
.fw-new { background: #2F6B4F; }
.fw-exit { background: #8E2A22; }
.fw-val { width: 72px; text-align: right; font-size: 11.5px; font-weight: 600; }

/* Client tape */
.client-tape-drop { border-bottom: 1px solid var(--hairline); }
.client-tape-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.client-tape-paste {
  width: 100%;
  max-width: 720px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 10px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink);
  resize: vertical;
  margin-bottom: 10px;
}
.btn.primary, label.btn.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Issuer holder ladder labels */
.move-plot { position: relative; padding-left: 132px; }
.move-filer-lab {
  position: absolute;
  left: 0;
  width: 124px;
  font-size: 10.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Period pair pickers (SOI tape) */
.ux-select {
  font: inherit;
  font-size: 11px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  padding: 4px 8px;
  border: 1px solid var(--hairline, #ddd);
  background: var(--surface);
  color: inherit;
  border-radius: 2px;
  max-width: 140px;
}

/* ── Dark theme (My account → Appearance; persists via dirigon.prefs.v1) ── */
[data-theme="dark"] {
  --ink: #EFEEE9;
  --ink-2: #B8B4AC;
  --paper: #141312;
  --surface: #1D1C1A;
  --surface-alt: #232220;
  --surface-tint: #191816;
  --hairline: #33312D;
  --hairline-2: #292724;
  --hairline-3: #2E2C29;
  --oxblood: #B6543F;
  --amber: #D89A40;
  --amber-2: #D89A40;
  --green: #3D9A72;
  --muted: #A8A49C;
  --muted-2: #8B857A;
  --muted-3: #6E6A61;
  --slate: #93A0AE;
  --cmd-bg: #0F1215;
  --cmd-border: #2E3742;
  --series-0: #C65A4E;
  --series-1: #9AA1A9;
  --series-2: #D89A40;
  --series-3: #3D9A72;
  --series-4: #5B7BA0;
  --series-5: #8B857A;
}
[data-theme="dark"] ::selection { color: #141312; }
[data-theme="dark"] .stat-cell,
[data-theme="dark"] .panel,
[data-theme="dark"] .instr-group,
[data-theme="dark"] .table-wrap,
[data-theme="dark"] .dotplot { background: var(--surface); }
[data-theme="dark"] .dotplot .band { background: var(--surface-alt); }
[data-theme="dark"] .nav-item.active { background: var(--surface-alt); }
[data-theme="dark"] table.data tbody tr:hover { background: var(--surface-alt); }
[data-theme="dark"] .tag-listed { background: #232B36; color: #93A0AE; border-color: #2E3742; }
[data-theme="dark"] .table-wrap.sticky-col table.data tbody td:first-child { background: var(--surface); }
[data-theme="dark"] .table-wrap.sticky-col table.data thead th:first-child { background: var(--surface-alt); }
[data-theme="dark"] .estimate-drawer { background: #241F18; border-bottom-color: #4A3B22; }
[data-theme="dark"] .table-wrap.sticky-col table.data tbody tr:hover td:first-child { background: var(--surface-alt); }
[data-theme="dark"] .alert-row:hover { background: var(--surface-alt); }
