:root {
  color-scheme: dark;
  --bg: #050605;
  --bg-soft: #070907;
  --surface: #0a0c0b;
  --surface-raised: #0d100e;
  --surface-hover: #111411;
  --line: rgba(239, 233, 218, 0.11);
  --line-strong: rgba(239, 233, 218, 0.2);
  --ivory: #eee9df;
  --ivory-soft: #cec9bf;
  --muted: #8f938e;
  --muted-dark: #656963;
  --gold: #c6a45d;
  --gold-bright: #dfc47f;
  --gold-wash: rgba(198, 164, 93, 0.12);
  --green: #51c878;
  --green-wash: rgba(81, 200, 120, 0.1);
  --red: #d06b72;
  --red-wash: rgba(208, 107, 114, 0.1);
  --orange: #ce824a;
  --blue: #4d7ee8;
  --purple: #a15bcc;
  --sidebar-width: 190px;
  --mobile-nav-height: 70px;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
}

::selection {
  background: var(--gold);
  color: #090a09;
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 14px;
  border: 1px solid var(--gold);
  background: var(--bg);
  color: var(--ivory);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #070807;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  min-height: 83px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 16px;
  text-transform: uppercase;
}

.sidebar-nav {
  display: grid;
  gap: 2px;
  padding: 8px 0;
}

.sidebar-nav a {
  position: relative;
  display: grid;
  grid-template-columns: 21px 1fr;
  align-items: center;
  min-height: 46px;
  padding: 0 20px 0 25px;
  color: #a9aca7;
  font-size: 11px;
  text-transform: uppercase;
  transition: color 160ms ease, background-color 160ms ease;
}

.sidebar-nav a::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: transparent;
  content: "";
}

.sidebar-nav a:hover {
  background: var(--surface-hover);
  color: var(--ivory);
}

.sidebar-nav a.is-active {
  background: var(--gold-wash);
  color: var(--gold-bright);
}

.sidebar-nav a.is-active::before {
  background: var(--gold);
}

.sidebar-nav svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.5;
}

.sidebar-foot {
  margin: auto 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
}

.sidebar-foot p {
  margin: 10px 0 0;
}

.mini-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ivory-soft);
}

.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-dark);
}

.status-dot-success {
  background: var(--green);
}

.status-dot-warning {
  background: var(--orange);
}

.status-dot-danger {
  background: var(--red);
}

.signature-link {
  margin: 28px 20px 22px;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
}

.main-content {
  width: 100%;
  min-width: 0;
  padding: 24px;
}

#route-content {
  width: min(100%, 1320px);
  margin: 0 auto;
}

.mobile-header,
.mobile-nav {
  display: none;
}

.route-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  margin-bottom: 16px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.route-title {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.brand-mark {
  display: inline-grid;
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 13px;
}

.route-title h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(20px, 2vw, 25px);
  font-weight: 400;
  line-height: 1.15;
  text-transform: uppercase;
}

.route-title p {
  margin: 3px 0 0;
  color: var(--ivory-soft);
  font-family: var(--serif);
  font-size: 13px;
}

.status-strip {
  display: flex;
  align-items: center;
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #080a08;
}

.status-item {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 7px;
  padding: 0 16px;
  border-right: 1px solid var(--line);
  color: var(--ivory-soft);
  font-size: 11px;
  white-space: nowrap;
}

.status-item:last-child {
  border-right: 0;
}

.status-item strong {
  color: var(--ivory);
  font-weight: 500;
}

.status-value-success {
  color: var(--green) !important;
}

.status-value-warning {
  color: var(--orange) !important;
}

.status-value-danger {
  color: var(--red) !important;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ivory-soft);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  color: var(--gold-bright);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-button.is-spinning svg {
  animation: spin 800ms linear infinite;
}

.setup-banner,
.notice-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 13px 16px;
  border: 1px solid rgba(198, 164, 93, 0.28);
  border-radius: 5px;
  background: var(--gold-wash);
  color: var(--ivory-soft);
}

.setup-banner svg,
.notice-banner svg {
  width: 18px;
  color: var(--gold-bright);
}

.setup-banner strong,
.notice-banner strong {
  display: block;
  color: var(--ivory);
  font-weight: 500;
}

.setup-banner p,
.notice-banner p {
  margin: 2px 0 0;
  font-size: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 8px;
}

.kpi-card {
  min-width: 0;
  min-height: 104px;
  padding: 15px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  text-align: center;
}

.kpi-label {
  display: block;
  margin-bottom: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.kpi-value {
  display: block;
  overflow: hidden;
  color: var(--ivory);
  font-family: var(--serif);
  font-size: clamp(19px, 1.8vw, 25px);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-meta {
  display: block;
  min-height: 16px;
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.is-positive {
  color: var(--green) !important;
}

.is-negative {
  color: var(--red) !important;
}

.is-gold {
  color: var(--gold-bright) !important;
}

.is-muted {
  color: var(--muted) !important;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.55fr) minmax(250px, 0.78fr);
  gap: 8px;
  margin-bottom: 8px;
}

.side-stack {
  display: grid;
  align-content: start;
  gap: 8px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 50px;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.panel-title svg {
  width: 14px;
  height: 14px;
}

.panel-body {
  padding: 16px;
}

.panel-foot {
  padding: 0 16px 14px;
}

.info-trigger {
  position: relative;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: help;
}

.info-trigger svg {
  width: 13px;
  height: 13px;
}

.info-trigger::after {
  position: absolute;
  z-index: 30;
  right: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #161916;
  color: var(--ivory-soft);
  content: attr(data-tooltip);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  text-transform: none;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.info-trigger:hover::after,
.info-trigger:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.range-selector,
.filter-row {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 3px;
}

.panel-head > .range-selector {
  max-width: 100%;
  flex: 1 1 auto;
  justify-content: flex-end;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.panel-head > .range-selector::-webkit-scrollbar {
  display: none;
}

.range-selector button,
.filter-chip {
  min-width: 42px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #090b09;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.range-selector button:hover,
.filter-chip:hover {
  border-color: var(--line-strong);
  color: var(--ivory);
}

.range-selector button.is-active,
.filter-chip.is-active {
  border-color: rgba(198, 164, 93, 0.4);
  background: var(--gold-wash);
  color: var(--gold-bright);
}

.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 310px;
  padding: 16px 12px 10px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 285px !important;
}

.chart-wrap-compact {
  min-height: 250px;
}

.chart-wrap-compact canvas {
  height: 230px !important;
}

.chart-empty {
  display: grid;
  min-height: 280px;
  place-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.chart-empty svg {
  width: 28px;
  height: 28px;
  margin-bottom: 10px;
  color: var(--gold);
}

.chart-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ivory-soft);
  font-weight: 500;
}

.sr-chart-table-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.sr-chart-table {
  border-collapse: collapse;
  transform: scale(0);
  transform-origin: top left;
}

.thesis-summary {
  display: grid;
  gap: 13px;
  padding: 16px;
}

.summary-metric {
  display: grid;
  gap: 3px;
}

.summary-metric span:first-child {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.summary-metric strong {
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.confidence-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
}

.confidence-row > div {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.gate-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.gate-summary > div {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.gate-summary > div:last-child {
  border-right: 0;
}

.gate-summary span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.gate-summary strong {
  display: inline-block;
  margin-top: 6px;
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 400;
}

.gate-result {
  margin-left: 6px;
  color: var(--orange) !important;
  font-family: var(--sans) !important;
  font-size: 9px !important;
  font-weight: 500 !important;
  text-transform: uppercase;
}

.outline-button,
.primary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 8px;
  padding: 0 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.outline-button {
  width: 100%;
  border: 1px solid rgba(198, 164, 93, 0.45);
  background: transparent;
  color: var(--gold-bright);
}

.outline-button:hover {
  background: var(--gold-wash);
}

.primary-button {
  border: 1px solid var(--gold);
  background: var(--gold);
  color: #080908;
}

.primary-button:hover {
  background: var(--gold-bright);
}

.text-button {
  min-height: 36px;
  padding: 0 4px;
  background: transparent;
  color: var(--gold-bright);
}

.text-button svg,
.outline-button svg,
.primary-button svg {
  width: 15px;
  height: 15px;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.comparison-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.comparison-table th,
.comparison-table td,
.data-table th,
.data-table td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.comparison-table th:first-child,
.comparison-table td:first-child,
.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.comparison-table th,
.data-table th {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
}

.comparison-table td,
.data-table td {
  color: var(--ivory-soft);
  font-size: 11px;
}

.comparison-table tr:last-child td,
.data-table tr:last-child td {
  border-bottom: 0;
}

.series-key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.series-key::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--series-color, var(--muted));
  content: "";
}

.series-challenge {
  --series-color: var(--gold);
}

.series-btc {
  --series-color: var(--blue);
}

.series-mstr {
  --series-color: var(--purple);
}

.alpha-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px 0;
  color: var(--muted);
  font-size: 10px;
}

.position-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 18px;
  padding: 16px;
}

.position-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
}

.tag {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  padding: 0 7px;
  border-radius: 3px;
  background: var(--gold-wash);
  color: var(--gold-bright);
  font-family: var(--sans);
  font-size: 9px;
}

.detail-list {
  display: grid;
  gap: 7px;
  margin: 0;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--ivory-soft);
  font-size: 11px;
}

.detail-row dt {
  color: var(--muted);
}

.detail-row dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.allocation-block {
  display: grid;
  align-content: center;
  gap: 10px;
  text-align: center;
}

.allocation-number {
  display: grid;
  width: 86px;
  height: 86px;
  margin: 0 auto;
  place-items: center;
  border: 7px solid var(--gold);
  border-radius: 50%;
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.allocation-number small {
  display: block;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 8px;
  text-transform: uppercase;
}

.allocation-bar {
  display: block;
  width: 100%;
  height: 5px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #222520;
  color: var(--gold);
  appearance: none;
}

.allocation-bar::-webkit-progress-bar {
  background: #222520;
}

.allocation-bar::-webkit-progress-value {
  background: var(--gold);
}

.allocation-bar::-moz-progress-bar {
  background: var(--gold);
}

.transactions-panel {
  margin-bottom: 8px;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.transaction-link {
  color: var(--ivory);
}

.transaction-link:hover {
  color: var(--gold-bright);
}

.transaction-type {
  color: var(--green);
  font-weight: 500;
}

.transaction-type.type-sell,
.transaction-type.type-withdrawal,
.transaction-type.type-tax,
.transaction-type.type-fee {
  color: var(--red);
}

.transaction-type.type-reset,
.transaction-type.type-undo {
  color: var(--orange);
}

.transaction-cards {
  display: none;
}

.page-grid {
  display: grid;
  gap: 8px;
}

.page-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.page-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(88px, auto);
  gap: 7px;
  padding: 14px;
}

.metric-card {
  display: flex;
  min-width: 0;
  min-height: 88px;
  flex-direction: column;
  justify-content: center;
  padding: 12px 14px;
  border-left: 2px solid var(--line-strong);
  background: var(--bg-soft);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 5px;
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow-wrap: break-word;
  word-break: normal;
}

.page-grid-three .metric-card-grid {
  grid-auto-rows: minmax(78px, auto);
  gap: 5px;
  padding: 12px;
}

.page-grid-three .metric-card {
  min-height: 78px;
  padding: 10px 12px;
}

.page-grid-three .metric-card strong {
  font-size: 16px;
  white-space: nowrap;
}

.metric-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.section-intro {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.indicator-list {
  display: grid;
}

.indicator-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(95px, 0.7fr) minmax(100px, 0.8fr) 92px;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.indicator-row:last-child {
  border-bottom: 0;
}

.indicator-row strong {
  display: block;
  font-size: 11px;
  font-weight: 500;
}

.indicator-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.indicator-value,
.indicator-threshold {
  min-width: 0;
  color: var(--ivory-soft);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
  word-break: normal;
}

.indicator-status {
  display: inline-flex;
  justify-self: end;
  min-height: 25px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.indicator-status.status-pass {
  border-color: rgba(81, 200, 120, 0.3);
  background: var(--green-wash);
  color: var(--green);
}

.indicator-status.status-fail {
  border-color: rgba(208, 107, 114, 0.3);
  background: var(--red-wash);
  color: var(--red);
}

.indicator-status.status-unknown {
  color: var(--orange);
}

.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.search-field {
  position: relative;
  width: min(100%, 260px);
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-field input {
  width: 100%;
  min-height: 38px;
  padding: 0 12px 0 35px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--ivory);
}

.search-field input::placeholder {
  color: var(--muted-dark);
}

.empty-row {
  padding: 36px 18px !important;
  color: var(--muted) !important;
  text-align: center !important;
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 14px;
}

.audit-item {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.audit-item span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.audit-item strong,
.audit-item code {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: var(--ivory-soft);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-button {
  width: 100%;
  margin-top: 8px;
  padding: 0;
  background: transparent;
  color: var(--gold-bright);
  cursor: pointer;
  font-size: 9px;
  text-align: left;
  text-transform: uppercase;
}

.prose {
  max-width: 780px;
  padding: 22px;
  color: var(--ivory-soft);
}

.prose h2,
.prose h3 {
  margin: 30px 0 8px;
  color: var(--ivory);
  font-family: var(--serif);
  font-weight: 400;
}

.prose h2:first-child,
.prose h3:first-child {
  margin-top: 0;
}

.prose p,
.prose li {
  color: var(--ivory-soft);
  font-size: 13px;
  line-height: 1.7;
}

.prose code {
  color: var(--gold-bright);
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.method-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.method-item h2 {
  margin: 0 0 8px;
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
}

.method-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.document-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.document-row:last-child {
  border-bottom: 0;
}

.document-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--gold);
}

.document-icon svg {
  width: 18px;
  height: 18px;
}

.document-row h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
}

.document-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.state-panel {
  display: grid;
  min-height: 360px;
  place-items: center;
  padding: 40px 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  text-align: center;
}

.state-content {
  max-width: 440px;
}

.state-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-bright);
}

.state-icon svg {
  width: 22px;
  height: 22px;
}

.state-content h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
}

.state-content p {
  margin: 9px 0 18px;
  color: var(--muted);
}

.loading-shell {
  display: grid;
  gap: 10px;
}

.skeleton-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #0c0e0c;
}

.skeleton::after {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.025);
  content: "";
  animation: skeleton-pulse 1.2s ease-in-out infinite alternate;
}

.skeleton-heading {
  height: 76px;
}

.skeleton-card {
  height: 106px;
}

.skeleton-chart {
  height: 420px;
}

.more-sheet {
  width: min(100% - 20px, 520px);
  max-height: calc(100vh - 24px);
  margin: auto 10px 10px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px 6px 0 0;
  background: #0b0d0b;
  color: var(--ivory);
}

.more-sheet::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.sheet-handle {
  width: 36px;
  height: 3px;
  margin: 8px auto 2px;
  border-radius: 2px;
  background: var(--line-strong);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 10px 18px;
  border-bottom: 1px solid var(--line);
}

.sheet-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
}

.sheet-nav {
  display: grid;
}

.sheet-nav a {
  display: grid;
  grid-template-columns: 24px 1fr 18px;
  align-items: center;
  min-height: 54px;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  color: var(--ivory-soft);
}

.sheet-nav a:hover {
  background: var(--surface-hover);
  color: var(--gold-bright);
}

.sheet-nav svg {
  width: 17px;
  height: 17px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 28px));
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #171a17;
  color: var(--ivory);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  white-space: nowrap !important;
}

[hidden] {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes skeleton-pulse {
  from {
    opacity: 0.3;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 1180px) {
  :root {
    --sidebar-width: 174px;
  }

  .main-content {
    padding: 18px;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .overview-grid {
    grid-template-columns: minmax(0, 2fr) minmax(230px, 0.8fr);
  }
}

@media (max-width: 940px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    padding: 0 14px calc(var(--mobile-nav-height) + 18px);
  }

  #route-content {
    width: 100%;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 18;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    min-height: 66px;
    margin: 0 -14px 12px;
    padding: 0 10px;
    border-bottom: 1px solid var(--line);
    background: rgba(5, 6, 5, 0.96);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    gap: 8px;
    font-family: var(--serif);
    font-size: 12px;
    text-transform: uppercase;
  }

  .mobile-brand .brand-mark {
    width: 28px;
    height: 28px;
    font-size: 9px;
  }

  .mobile-nav {
    position: fixed;
    z-index: 25;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: var(--mobile-nav-height);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line-strong);
    background: rgba(7, 8, 7, 0.98);
  }

  .mobile-nav a,
  .mobile-nav button {
    display: flex;
    min-width: 0;
    min-height: 54px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 9px;
  }

  .mobile-nav a.is-active {
    color: var(--gold-bright);
  }

  .mobile-nav svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.5;
  }

  .route-header {
    display: block;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .route-title {
    display: none;
  }

  .status-strip {
    display: grid;
    grid-template-columns: 0.8fr 1fr 1.25fr 44px;
    width: 100%;
  }

  .status-item {
    justify-content: center;
    min-width: 0;
    padding: 0 7px;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
  }

  .status-item span,
  .status-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .overview-grid,
  .lower-grid,
  .page-grid-two,
  .page-grid-three {
    grid-template-columns: 1fr;
  }

  .side-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-card-grid,
  .audit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-wrap {
    min-height: 290px;
  }

  .chart-wrap canvas {
    height: 265px !important;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 13px;
  }

  .main-content {
    padding-right: 8px;
    padding-left: 8px;
  }

  .mobile-header {
    margin-right: -8px;
    margin-left: -8px;
  }

  .setup-banner,
  .notice-banner {
    grid-template-columns: auto 1fr;
  }

  .setup-banner .text-button,
  .notice-banner .text-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .kpi-card {
    min-height: 91px;
    padding: 12px 6px 8px;
  }

  .kpi-label {
    margin-bottom: 6px;
    font-size: 8px;
  }

  .kpi-value {
    font-size: clamp(15px, 4.5vw, 20px);
  }

  .kpi-meta {
    margin-top: 6px;
    font-size: 8px;
  }

  .panel-head {
    min-height: 48px;
    padding: 8px 12px;
  }

  .panel-title {
    font-size: 11px;
  }

  .range-selector {
    flex-wrap: nowrap;
  }

  .range-selector button {
    min-width: 36px;
    min-height: 29px;
    padding: 0 7px;
    font-size: 9px;
  }

  .chart-wrap {
    min-height: 240px;
    padding: 10px 4px 6px;
  }

  .chart-wrap canvas {
    height: 225px !important;
  }

  .side-stack {
    grid-template-columns: 1fr;
  }

  .thesis-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 0;
    padding: 14px 8px;
  }

  .summary-metric {
    padding: 0 8px;
    border-right: 1px solid var(--line);
  }

  .summary-metric:nth-child(2) {
    border-right: 0;
  }

  .summary-metric:last-child {
    grid-column: 1 / -1;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .summary-metric strong {
    overflow-wrap: anywhere;
    font-size: 15px;
  }

  .confidence-row {
    display: block;
  }

  .confidence-row > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
  }

  .position-layout {
    grid-template-columns: minmax(0, 1fr) 110px;
    gap: 10px;
    padding: 13px;
  }

  .allocation-number {
    width: 72px;
    height: 72px;
    border-width: 5px;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 8px 7px;
    font-size: 9px;
  }

  .desktop-transactions {
    display: none;
  }

  .transaction-cards {
    display: grid;
  }

  .transaction-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 74px;
    padding: 13px;
    border-bottom: 1px solid var(--line);
  }

  .transaction-card:last-child {
    border-bottom: 0;
  }

  .transaction-card strong {
    display: block;
    font-size: 11px;
  }

  .transaction-card span,
  .transaction-card small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
  }

  .transaction-card .transaction-card-value {
    color: var(--ivory-soft);
    font-variant-numeric: tabular-nums;
    text-align: right;
  }

  .metric-card-grid,
  .audit-grid,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .indicator-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    padding: 12px;
  }

  .indicator-value,
  .indicator-threshold {
    grid-column: 1;
  }

  .indicator-status {
    grid-row: 1 / 3;
    grid-column: 2;
  }

  .filter-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field {
    width: 100%;
  }

  .document-row {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 14px;
  }

  .document-row .outline-button,
  .document-row .primary-button {
    grid-column: 1 / -1;
  }

  .toast {
    right: 14px;
    bottom: calc(var(--mobile-nav-height) + 12px);
    left: 14px;
  }

  .skeleton-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 390px) {
  .main-content {
    padding-right: 6px;
    padding-left: 6px;
  }

  .mobile-header {
    margin-right: -6px;
    margin-left: -6px;
  }

  .status-item {
    font-size: 8px;
  }

  .kpi-card {
    min-height: 86px;
  }

  .kpi-value {
    font-size: 15px;
  }

  .panel-body {
    padding: 12px;
  }

  .position-layout {
    grid-template-columns: 1fr;
  }

  .allocation-block {
    grid-template-columns: 72px 1fr;
    text-align: left;
  }

  .allocation-number {
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
