:root {
  --ink: #e7ecf3;
  --paper: #0e1114;
  --card: #161b22;
  --line: #2a3140;
  --muted: #8b95a7;
  --green: #7dcea0;
  --rust: #e07a76;
  --gold: #e0a45a;
  --good: #7dcea0;
  --blue: #6d8fd6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
a { color: #9eb6e0; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.9em; }

.top {
  background: #090b0e;
  color: var(--ink);
  padding: 0.85rem 1.2rem 0.65rem;
  border-bottom: 1px solid var(--line);
}
.top a { color: inherit; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 0.55rem; }
.brand a { font-size: 1.05rem; font-weight: 650; letter-spacing: 0.01em; }
.version { color: var(--muted); font-size: 0.75rem; }
.tag { margin: 0.25rem 0 0.55rem; color: var(--muted); font-size: 0.8rem; }
.top-bar { display: flex; align-items: flex-end; gap: 1rem; }
.who { color: var(--muted); font-size: 0.78rem; margin-left: auto; }
.view-only { margin-left: 0.35rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.05rem 0.45rem; font-size: 0.68rem; letter-spacing: 0.02em; }
.logout { margin-left: 0.4rem; }
.activity-filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; margin: 0.5rem 0 1rem; }
.activity-filters label { display: grid; gap: 0.2rem; font-size: 0.78rem; color: var(--muted); }
.activity-filters input { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 0.3rem 0.45rem; }
.logout button { padding: 0.25rem 0.6rem; font-size: 0.78rem; }
.top nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.85rem;
  overflow-x: auto;
  scrollbar-width: thin;
  flex: 1;
  min-width: 0;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.nav-search { position: relative; flex: 0 0 16.5rem; }
.nav-search input {
  width: 100%;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 0.32rem 0.75rem;
}
.nav-search input:focus {
  border-color: var(--gold);
  outline: 2px solid rgba(224, 164, 90, 0.45);
  outline-offset: 1px;
}
.nav-search-list, #desk-search-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 22rem;
  overflow: auto;
}
#desk-search-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.5rem;
  align-items: center;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  cursor: pointer;
}
#desk-search-list li[aria-selected="true"] { background: #243040; box-shadow: inset 2px 0 0 var(--gold); }
#desk-search-list strong { font-size: 0.86rem; }
#desk-search-list .search-sector, #desk-search-list .search-held { color: var(--muted); font-size: 0.72rem; }
.top nav a {
  font-size: 0.84rem;
  padding: 0.2rem 0 0.35rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  color: #b7c0ce;
}
.top nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }

.pill {
  display: inline-block;
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pill.bad { background: var(--rust); border-color: transparent; color: #1a0d0c; }
.pill.good { background: var(--green); border-color: transparent; color: #0d1a14; }
.pill.verdict-pass { border-color: var(--green); color: var(--green); }
.pill.verdict-caution { border-color: var(--gold); color: var(--gold); }
.pill.verdict-reject { border-color: var(--rust); color: var(--rust); }
.pill.verdict-none { border-color: var(--muted); color: var(--muted); }

main { padding: 1.1rem 1.2rem 2rem; max-width: 1180px; margin: 0 auto; }
footer {
  padding: 0.4rem 1.2rem 1.6rem;
  color: var(--muted);
  font-size: 0.78rem;
  max-width: 1180px;
  margin: 0 auto;
}
h1, h2, h3 { font-weight: 620; letter-spacing: -0.015em; }
h1 { margin: 0 0 0.35rem; font-size: 1.7rem; }
h2 { margin: 1.5rem 0 0.45rem; font-size: 1.05rem; }
h3 { margin: 0; font-size: 0.95rem; }
.page-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }

.glance, .summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.2rem, 1fr));
  gap: 0.55rem;
  margin: 0.7rem 0 1rem;
}
.glance div, .summary div, .card, .spec > div, .chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}
.glance span, .summary span, dt, .meta, .source, .footnote {
  color: var(--muted);
  font-size: 0.78rem;
}
.glance strong, .summary strong { display: block; font-size: 1.15rem; font-weight: 620; }
.source, .footnote { margin: 0.15rem 0 0.7rem; }
.gain { color: var(--green); }
.loss { color: var(--rust); }

.alerts, .flag, .verdict-reasons {
  background: #2a1c1a;
  border: 1px solid #5a3330;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  color: #f0d2cf;
}
.alerts, .verdict-reasons { list-style: none; margin: 0 0 1rem; padding-left: 0.75rem; }
.alerts.compact { font-size: 0.78rem; padding: 0.35rem 0.6rem; margin-bottom: 0.7rem; }
.alerts.compact h2 { margin: 0 0 0.2rem; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: #f0d2cf; }
.verdict-reasons li, .alerts li { margin: 0.1rem 0; line-height: 1.35; }
.row-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; list-style: none; margin: 0.1rem 0 0.15rem; padding: 0; }
.row-chips li {
  font-size: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  color: var(--ink);
  background: #12171e;
}
details.verdict-note { margin: 0.2rem 0 0.6rem; }
.market-asof { font-size: 0.72rem; margin: 0 0 0.4rem; }
.refresh-row { display: flex; align-items: center; gap: 0.7rem; margin: 0.15rem 0 0.7rem; }
.refresh-row .footnote { margin: 0; }
.refresh-row button { padding: 0.2rem 0.55rem; font-size: 0.78rem; }
.flag { margin-top: 0.5rem; }
.flag.prominent {
  background: #6e2e2b;
  color: #fff;
  border-color: #6e2e2b;
  font-weight: 650;
}
.why-text { display: block; }
.cap-flags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }
.cap-flag {
  display: inline-block;
  background: #2a1c1a;
  border: 1px solid #5a3330;
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
  font-size: 0.75rem;
}
details.more { margin-top: 0.8rem; }
details.more summary { cursor: pointer; margin: 0.6rem 0; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0.7rem; }
.card header { display: flex; flex-wrap: wrap; gap: 0.35rem 0.7rem; align-items: baseline; margin-bottom: 0.35rem; }
.action { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.action-decide .action { text-transform: none; letter-spacing: 0.01em; font-size: 0.92rem; color: var(--ink); }
.action-roll { box-shadow: inset 3px 0 0 var(--rust); }
.action-close { box-shadow: inset 3px 0 0 var(--gold); }
.action-hold { box-shadow: inset 3px 0 0 var(--green); }
.action-decide { box-shadow: inset 3px 0 0 var(--gold); }

dl { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 0.8rem; margin: 0.35rem 0; }
dl div { background: transparent; border: 0; padding: 0; }
dd { margin: 0; }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.spec { display: grid; gap: 0.55rem; }
.spec > div { display: grid; gap: 0.2rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
th, td { text-align: left; padding: 0.38rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.nums td, .nums th { font-variant-numeric: tabular-nums; }
table.compact { font-size: 0.75rem; }
table.compact th, table.compact td { padding: 0.2rem 0.4rem; white-space: nowrap; }
table th a { color: inherit; text-decoration: none; }
.scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
th { color: var(--muted); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.03em; text-transform: uppercase; }
tr.live { background: #2a2418; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.chart { width: 100%; height: auto; background: transparent; border: 0; }
.chart-label { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; fill: currentColor; }
svg.chart text { fill: #c5ceda; }

.chart-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16.5rem;
  gap: 0.7rem;
  align-items: start;
  margin-bottom: 0.8rem;
}
.chart-stage .summary { grid-template-columns: 1fr 1fr; margin: 0; }
.chart-card { padding: 0.4rem 0.4rem 0.7rem; margin-bottom: 0; }
#fg-chart { width: 100%; min-height: 460px; position: relative; touch-action: none; }
#fg-nav { width: 100%; height: 64px; display: block; margin: 0.35rem 0 0.2rem; cursor: ew-resize; touch-action: none; }
#fg-brush { position: absolute; background: rgba(224, 164, 90, 0.18); border: 1px solid #e0a45a; pointer-events: none; display: none; z-index: 2; }
.zoom-bar { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: end; margin: 0.35rem 0 0.7rem; }
.zoom-fields { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: end; }
.zoom-bar.zoom-closed .zoom-fields { display: none; }
.zoom-bar label { color: var(--muted); font-size: 0.85rem; display: flex; flex-direction: column; gap: 0.15rem; }
.zoom-bar input, .zoom-bar button { background: #121820; color: var(--ink); border: 1px solid #243040; border-radius: 4px; padding: 0.28rem 0.5rem; color-scheme: dark; }
.zoom-bar button { cursor: pointer; }
.range-error { color: #e07a76; }
.uplot, .u-legend, .u-legend th, .u-legend td, .u-legend .u-value { color: var(--ink); background: transparent; }
.u-legend .u-value { font-variant-numeric: tabular-nums; min-width: 3.2rem; }
.u-legend .u-marker { border-radius: 2px; }
@media (max-width: 860px) {
  .chart-stage { grid-template-columns: 1fr; }
  .chart-stage .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.toggles { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0.4rem 0 0.6rem; }
.toggles button, .check {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.78rem;
}
.toggles button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.check { display: inline-flex; gap: 0.3rem; align-items: center; }
.check input { width: auto; }
.chip {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
  font-size: 0.82rem;
}
.chip input { width: auto; accent-color: var(--gold); }
.verdict-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  margin: 0.6rem 0 0.9rem;
}
.verdict-head { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.reasons { list-style: none; margin: 0.55rem 0 0; padding: 0; }
.reasons li { margin: 0.35rem 0; }
.reason-status {
  display: inline-block;
  min-width: 2.6rem;
  margin-right: 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.reason-pass .reason-status { color: var(--green); }
.reason-warn .reason-status { color: var(--gold); }
.reason-fail .reason-status { color: var(--rust); }
.change { margin: 0.45rem 0 0; }
.candidate { margin: 0.45rem 0 0; }
.reason-line { max-width: 28rem; white-space: normal; }

.steps { display: grid; gap: 0.4rem; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem 0.55rem 2.2rem; position: relative; }
.steps li::before { content: counter(step); position: absolute; left: 0.6rem; top: 0.55rem; color: var(--muted); }
.steps li.on { box-shadow: inset 3px 0 0 var(--green); }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; }
.chips a, .chips li { font-size: 0.86rem; }
.chips a { border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.6rem; text-decoration: none; background: var(--card); color: var(--ink); }
.chips a[aria-current="page"] { background: #e7ecf3; color: #111418; }

form button, button {
  font: inherit;
  background: #e7ecf3;
  color: #111418;
  border: 0;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.grid-form, .stack-form { display: grid; gap: 0.6rem; max-width: 44rem; }
.grid-form { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
label { display: grid; gap: 0.2rem; font-size: 0.78rem; color: var(--muted); }
.wide { grid-column: 1 / -1; }
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: #0e1114;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.38rem 0.48rem;
  width: 100%;
}
select {
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  background-color: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23e0a45a' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 0.7rem;
  border-radius: 999px;
  padding-right: 1.9rem;
}
select:focus {
  border-color: var(--gold);
  outline: 2px solid rgba(224, 164, 90, 0.45);
  outline-offset: 1px;
}
select option { background: #161b22; color: var(--ink); }
select option:checked { background: var(--gold); color: #111418; }
select[multiple] {
  appearance: auto;
  -webkit-appearance: auto;
  background-image: none;
  border-radius: 6px;
  padding-right: 0.48rem;
  min-height: 7.5rem;
}
.grid-form fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.grid-form legend { padding: 0; }
table th a .mark { color: var(--gold); font-size: 0.72rem; margin-left: 0.15rem; }
.desk-select { position: relative; display: block; width: 100%; }
.desk-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.38rem 0.75rem;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.desk-select-btn::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 0.7rem;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(45deg) translateY(-2px);
  flex: none;
}
.desk-select-btn:focus {
  border-color: var(--gold);
  outline: 2px solid rgba(224, 164, 90, 0.45);
  outline-offset: 1px;
}
.desk-select-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 16rem;
  overflow: auto;
}
.desk-select-list [role="option"] {
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
}
.desk-select-list [role="option"][aria-selected="true"] {
  background: #243040;
  box-shadow: inset 2px 0 0 var(--gold);
  color: var(--ink);
}
select.desk-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  pointer-events: none;
}
.row-form { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.notes { list-style: none; padding: 0; display: grid; gap: 0.7rem; }
.notes li { border-top: 1px solid var(--line); padding-top: 0.6rem; }
.empty { color: var(--muted); }
.banner {
  font-size: 0.84rem;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  margin: 0 0 0.7rem;
}
.banner-delayed, .banner-stale, .banner-reference { background: #2a2418; color: #f0e2c4; border: 1px solid #6a5428; }
.banner-missing, .banner-refused { background: #2a1c1a; color: #f0d2cf; border: 1px solid #5a3330; }
.missing-name { margin: 0 0 0.7rem; color: var(--muted); font-size: 0.84rem; }
.banner-imported { background: #14241c; color: #d5efe2; }
.legend { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; font-size: 0.78rem; color: var(--muted); }
.legend.range a { color: var(--muted); text-decoration: none; padding: 0.1rem 0.35rem; }
.legend.range a[aria-current="page"] { color: var(--ink); border-bottom: 2px solid var(--gold); }
.swatch { display: inline-block; width: 1.15rem; height: 0.28rem; margin-right: 0.28rem; vertical-align: middle; background: #fff; }
.swatch.normal { background: #e08a3c; }
.swatch.area { background: rgba(46, 168, 92, 0.75); height: 0.55rem; }
.swatch.pe15 { background: #4c8dff; }
.swatch.dividend { background: #b7d7c3; height: 0.45rem; }
.swatch.forward { background: repeating-linear-gradient(90deg, #e08a3c 0 6px, transparent 6px 10px); }
.crumbs { font-size: 0.85rem; }
pre.doc {
  white-space: pre-wrap;
  background: #10141a;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #d5dbe3;
}

@media (max-width: 720px) {
  .split, dl { grid-template-columns: 1fr; }
  dl.metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding: 0.8rem; }
  h1 { font-size: 1.4rem; }
  .top-bar { flex-wrap: wrap; }
  .nav-search { flex: 1 1 12rem; }
  .top nav {
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 2.6rem), transparent);
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 2.6rem), transparent);
  }
  th, td { font-size: 0.78rem; padding: 0.3rem 0.35rem; }
  table.review thead { display: none; }
  table.review, table.review tbody, table.review tr, table.review td { display: block; width: auto; }
  table.review tr { border-bottom: 1px solid var(--line); padding: 0.45rem 0; }
  table.review td { border: 0; padding: 0.12rem 0.35rem; }
  table.review td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 6.2rem;
    color: var(--muted);
    font-size: 0.72rem;
  }
  .review-scroll { overflow-x: visible; }
  #fg-chart { min-height: 320px; }
}
