:root {
  --bg: #090d14;
  --surface: #111821;
  --surface-alt: #182334;
  --surface-soft: #0b121c;
  --ink: #f4f8fd;
  --muted: #bdc8d8;
  --line: rgba(148, 163, 184, 0.16);
  --line-soft: rgba(148, 163, 184, 0.09);
  --line-strong: rgba(148, 163, 184, 0.24);
  --panel-line: rgba(148, 163, 184, 0.13);
  --control-line: #65748a;
  --accent: #0f766e;
  --accent-dark: #5eead4;
  --on-accent: #ecfeff;
  --amber: #fbbf24;
  --red: #f87171;
  --blue: #93c5fd;
  --sidebar: #090d13;
  --sidebar-line: rgba(189, 200, 216, 0.13);
  --sidebar-ink: #f4f8fd;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
  --active-bg: rgba(94, 234, 212, 0.14);
  --active-border: rgba(94, 234, 212, 0.46);
  --input-bg: #080f18;
  --tooltip-bg: #03070c;
  --content-max: none;
  --content-gutter: clamp(12px, 1.4vw, 22px);
  --section-gap: 8px;
  --font-ui: Geist, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  color-scheme: dark;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.38;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.admin-body {
  min-height: 100vh;
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

strong {
  font-weight: 500;
}

code,
pre {
  font-family: var(--font-mono);
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 58px;
  padding: 0 28px;
  background: rgba(9, 13, 19, 0.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(148, 163, 184, 0.06);
}

.topbar > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-frame {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100vh;
  padding: 14px 10px;
  background:
    linear-gradient(180deg, rgba(16, 24, 36, 0.98), rgba(7, 10, 16, 0.98)),
    var(--sidebar);
  box-shadow: inset -1px 0 rgba(148, 163, 184, 0.06);
}

.mobile-nav-toggle,
.mobile-actions-toggle {
  display: none;
}

.sidebar-branding {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 0 4px 4px;
}

.brand {
  color: var(--ink);
  font-weight: 550;
  letter-spacing: 0;
  text-decoration: none;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  color: var(--sidebar-ink);
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(94, 234, 212, 0.32);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(94, 234, 212, 0.18), rgba(15, 118, 110, 0.16));
  color: var(--accent-dark);
  font-weight: 550;
  font-size: 12px;
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.05);
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 14px;
  font-weight: 620;
  line-height: 1.1;
}

.brand-lockup small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

.environment {
  padding: 3px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  gap: 11px;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 0 8px;
}

.nav-section {
  display: grid;
  gap: 3px;
}

.nav-section > span {
  padding: 0 8px 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: uppercase;
}

.side-nav a,
.sidebar-account a {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 520;
  white-space: nowrap;
  text-decoration: none;
}

.side-nav a {
  gap: 8px;
  position: relative;
}

.side-nav a::before {
  content: attr(data-nav-code);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 24px;
  height: 20px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.025);
  color: #7d8ba1;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 650;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-nav a:hover,
.sidebar-account a:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--sidebar-line);
  color: var(--ink);
}

.side-nav a.active,
.sidebar-account a.active {
  border-color: var(--active-border);
  background: var(--active-bg);
  color: var(--accent-dark);
}

.side-nav a.active::before {
  border-color: rgba(94, 234, 212, 0.36);
  background: rgba(94, 234, 212, 0.12);
  color: var(--accent-dark);
}

.sidebar-account {
  display: grid;
  gap: 9px;
  margin-top: auto;
  padding: 10px;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.account-summary {
  display: grid;
  gap: 5px;
  align-items: center;
}

.account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
}

.sidebar-account span:not(.account-avatar) {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

.sidebar-account strong {
  min-width: 0;
  overflow-wrap: anywhere;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 560;
  line-height: 1.2;
}

.sidebar-account form {
  margin: 0;
}

.account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 6px;
}

.account-actions a,
.sidebar-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--sidebar-line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.account-actions a:hover,
.sidebar-link-button:hover {
  border-color: var(--active-border);
  background: rgba(94, 234, 212, 0.08);
  color: var(--ink);
}

.account-actions a.active {
  border-color: var(--active-border);
  background: var(--active-bg);
  color: var(--accent-dark);
}

.admin-main {
  min-width: 0;
  overflow-x: hidden;
  min-height: 100vh;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 0 var(--content-gutter);
  background: rgba(13, 17, 24, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(148, 163, 184, 0.06);
}

.admin-topbar-context {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 10px;
}

.admin-topbar-context span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-topbar-context strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-topbar-actions {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px;
}

.admin-topbar-link,
.admin-topbar-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}

.admin-topbar-link:hover {
  border-color: var(--active-border);
  color: var(--ink);
}

.admin-topbar-chip {
  color: var(--accent-dark);
}

.admin-shell {
  width: 100%;
  max-width: var(--content-max);
  margin: 0;
  padding: 14px var(--content-gutter) 48px;
}

.admin-shell-fixed {
  display: flex;
  height: calc(100dvh - 52px);
  min-height: 0;
  flex-direction: column;
  gap: var(--section-gap);
  overflow: hidden;
  padding-bottom: 14px;
}

.admin-shell-fixed > .flash {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.admin-shell-fixed > .trading-viewport-page {
  flex: 1 1 auto;
  height: auto;
}

.trading-viewport-page {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: var(--section-gap);
  overflow: hidden;
}

.trading-viewport-page > .page-head {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.trading-viewport-page .panel {
  min-height: 0;
}

.trading-viewport-page .panel-head,
.trading-viewport-page .pagination-bar {
  flex: 0 0 auto;
}

.trading-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  contain: layout paint inline-size;
  overflow: auto;
}

.trading-table-wrap > table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}

.admin-shell.is-replay-loading {
  cursor: progress;
}

.admin-shell.is-replay-loading .backtest-analysis-grid,
.admin-shell.is-replay-loading .backtest-workbench,
.admin-shell.is-replay-loading .backtest-estimate-grid,
.admin-shell.is-replay-loading .selected-options-panel,
.admin-shell.is-replay-loading .dashboard-table-panel:first-of-type {
  opacity: 0.68;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 5px;
  margin-bottom: var(--section-gap);
}

.dashboard-head {
  align-items: center;
}

.page-subtitle {
  max-width: 720px;
  margin: 6px 0 0;
  color: var(--muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-actions form {
  display: inline-flex;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 530;
  letter-spacing: 0;
  line-height: 1.12;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: var(--section-gap);
}

.dashboard-metrics {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.metric-grid-small {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--panel-line);
  border-radius: 8px;
}

.metric {
  min-height: 74px;
  padding: 12px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.metric-emphasis {
  border-color: var(--active-border);
  background: linear-gradient(180deg, var(--surface), rgba(94, 234, 212, 0.08));
}

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

.metric strong {
  display: block;
  margin-top: 9px;
  overflow-wrap: anywhere;
  font-size: 21px;
  font-weight: 540;
  line-height: 1.1;
}

.metric small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.32;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--section-gap);
  margin-bottom: var(--section-gap);
}

.activity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: var(--section-gap);
  align-items: start;
  margin-bottom: var(--section-gap);
}

.activity-grid > .panel {
  margin-bottom: 0;
}

.opportunity-activity-grid,
.report-delivery-grid,
.report-ai-grid,
.report-analysis-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.44fr);
}

.ticker-mentions-table .actions,
.candidate-table .actions {
  white-space: nowrap;
}

.split > .panel,
.metric-grid + .panel,
.dashboard-metrics + .panel {
  margin-bottom: 0;
}

.panel {
  max-width: 100%;
  min-width: 0;
  margin-bottom: var(--section-gap);
  overflow: hidden;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.panel-overflow-visible {
  overflow: visible;
}

.dashboard-table-panel,
.admin-list-panel {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.admin-list-panel {
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
}

.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-head a {
  font-size: 12px;
  font-weight: 500;
}

.panel-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.form-panel {
  padding: 0;
}

.form-panel h2 {
  margin: 0;
}

.form-panel > h2,
.form-panel > .panel-title-row {
  margin: 0;
  padding: 12px 14px;
}

.form-panel > form,
.form-panel > .grid-form,
.form-panel > .stack-form {
  padding: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  contain: inline-size;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.table-wrap::-webkit-scrollbar {
  height: 10px;
}

.table-wrap::-webkit-scrollbar-track {
  background: var(--surface-soft);
}

.table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid var(--surface-soft);
  border-radius: 999px;
  background: var(--line-strong);
}

.table-wrap > table {
  width: 100%;
  min-width: 100%;
}

.admin-list-table-wrap,
.instrument-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: clamp(320px, calc(100dvh - 360px), 680px);
  contain: layout paint inline-size;
  overflow: auto;
}

.instrument-panel-head {
  align-items: flex-end;
  flex-wrap: wrap;
}

.instrument-panel-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
}

.instrument-search-form {
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto auto;
  align-items: end;
  gap: 8px;
}

.instrument-search-form .button {
  min-height: 34px;
}

.instrument-search-field {
  min-width: 0;
}

.instrument-table {
  min-width: 980px;
}

.admin-fit-table {
  table-layout: fixed;
}

.table-wrap > .instrument-table {
  min-width: 980px;
}

.table-wrap > .universes-table {
  min-width: 920px;
}

.admin-fit-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.admin-fit-table th,
.admin-fit-table td {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-subtext {
  display: inline-block;
  max-width: 100%;
  line-height: 1.32;
}

.table-muted-list {
  max-width: 100%;
  line-height: 1.32;
}

.instrument-col-name {
  width: 22%;
}

.instrument-col-price {
  width: 11%;
}

.instrument-col-range {
  width: 13%;
}

.instrument-col-returns {
  width: 11%;
}

.instrument-col-liquidity {
  width: 15%;
}

.instrument-col-universes {
  width: 18%;
}

.instrument-col-freshness {
  width: 10%;
}

.universe-col-name {
  width: 25%;
}

.universe-col-category {
  width: 11%;
}

.universe-col-instruments {
  width: 30%;
}

.universe-col-market-data {
  width: 16%;
}

.universe-col-status {
  width: 86px;
}

.universe-col-actions {
  width: 118px;
}

.symbol-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 56px;
  overflow: hidden;
}

.symbol-chip {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 0 6px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.symbol-chip-muted {
  color: var(--muted);
}

.table-wrap > .instrument-candidates-table {
  min-width: 760px;
}

.table-wrap > .instrument-bars-table {
  min-width: 520px;
}

.table-wrap > .candidate-table {
  min-width: 820px;
}

.table-wrap > .runs-table {
  min-width: 900px;
}

.instrument-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.dense-table th,
.dense-table td {
  padding-top: 8px;
  padding-bottom: 8px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-soft);
}

.pagination-count,
.pagination-page {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.pagination-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pagination-link {
  min-height: 28px;
  padding: 0 9px;
}

.pagination-disabled {
  cursor: default;
  opacity: 0.45;
}

td.actions {
  text-align: right;
  white-space: nowrap;
}

td.actions > * {
  margin-left: 6px;
  vertical-align: middle;
}

td.actions > *:first-child {
  margin-left: 0;
}

td.actions form {
  display: inline-flex;
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.empty {
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.status-good {
  border-color: rgba(94, 234, 212, 0.35);
  color: var(--accent-dark);
  background: rgba(94, 234, 212, 0.1);
}

.status-bad {
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--red);
  background: rgba(248, 113, 113, 0.1);
}

.trend-positive {
  color: var(--accent-dark);
}

.trend-negative {
  color: var(--red);
}

.tooltip {
  position: relative;
  display: inline-flex;
  margin-left: 6px;
  vertical-align: middle;
}

.tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  cursor: help;
}

.tooltip-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: none;
  width: min(380px, 78vw);
  padding: 10px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--tooltip-bg);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.42);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
}

.tooltip:hover .tooltip-panel,
.tooltip:focus-within .tooltip-panel {
  display: block;
}

.button,
input[type="submit"].button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.button-primary,
input[type="submit"].button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.button-ghost,
input[type="submit"].button-ghost {
  background: transparent;
}

.button-danger,
input[type="submit"].button-danger {
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
}

.button:hover,
input[type="submit"].button:hover {
  border-color: var(--accent-dark);
}

.icon-button {
  width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.table-icon-button {
  width: 30px;
  min-height: 30px;
}

.button-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--section-gap);
  align-items: start;
  margin-bottom: var(--section-gap);
}

.command-center-head {
  align-items: center;
}

.command-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--section-gap);
  margin-bottom: var(--section-gap);
}

.reports-summary-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--section-gap);
  margin-bottom: var(--section-gap);
}

.command-summary-card {
  min-width: 0;
  min-height: 68px;
  padding: 11px 12px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface);
}

.report-summary-card {
  min-width: 0;
  min-height: 72px;
  padding: 11px 12px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface);
}

.command-summary-primary {
  border-color: var(--active-border);
  background: linear-gradient(180deg, var(--surface), rgba(94, 234, 212, 0.08));
}

.report-summary-primary {
  border-color: var(--active-border);
  background: linear-gradient(180deg, var(--surface), rgba(94, 234, 212, 0.08));
}

.command-summary-card span,
.report-summary-card span,
.instrument-backtest-summary span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 560;
  text-transform: uppercase;
}

.command-summary-card strong,
.report-summary-card strong,
.instrument-backtest-summary strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 19px;
  font-weight: 560;
  line-height: 1.08;
}

.command-summary-card small,
.report-summary-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

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

.options-report-grid {
  grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.48fr);
}

.options-report-summary {
  min-height: 100%;
  color: var(--text);
  line-height: 1.48;
}

.options-report-brief {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--surface-soft);
}

.options-report-brief strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 560;
  line-height: 1.25;
}

.options-report-brief p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.options-report-brief-row {
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.options-candidate-table {
  min-width: 1180px;
}

.options-candidate-table th,
.options-candidate-table td {
  vertical-align: top;
}

.option-opportunity-cell {
  min-width: 250px;
}

.option-underlying-link {
  display: inline-flex;
  width: fit-content;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 620;
  letter-spacing: 0.02em;
}

.option-contract-title {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 14px;
  font-weight: 560;
  line-height: 1.25;
}

.option-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.option-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 540;
  line-height: 1;
  text-transform: uppercase;
}

.option-chip-muted {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.option-table-value {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 560;
  line-height: 1.2;
}

.dashboard-command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.36fr);
  gap: var(--section-gap);
  align-items: start;
}

.dashboard-main-stack,
.dashboard-side-stack {
  display: grid;
  min-width: 0;
  gap: var(--section-gap);
  align-content: start;
}

.dashboard-command-grid .panel,
.dashboard-main-stack .panel,
.dashboard-side-stack .panel,
.command-panel {
  margin-bottom: 0;
}

.reports-workbench-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--section-gap);
  align-items: stretch;
  margin-bottom: var(--section-gap);
}

.reports-ops-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--section-gap);
  align-items: start;
  margin-bottom: var(--section-gap);
}

.reports-ops-grid > .panel,
.reports-type-panel {
  margin-bottom: 0;
}

.reports-type-panel {
  margin-bottom: var(--section-gap);
}

.report-flow-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 14px;
}

.report-flow-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 138px;
  padding: 12px;
  border-radius: 7px;
  background: var(--surface-soft);
}

.report-flow-step > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 560;
}

.report-flow-step strong,
.reports-type-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 540;
  line-height: 1.25;
}

.report-flow-step p,
.reports-type-card p,
.reports-context-row small,
.reports-type-card dd {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.reports-type-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 14px;
}

.reports-type-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border-radius: 7px;
  background: var(--surface-soft);
}

.reports-type-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 560;
  text-transform: uppercase;
}

.reports-type-card dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.reports-type-card dl > div {
  display: grid;
  gap: 2px;
}

.reports-type-card dt {
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 560;
  text-transform: uppercase;
}

.reports-workbench-grid .panel,
.reports-history-panel {
  margin-bottom: 0;
}

.reports-index-page {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.reports-list-head {
  flex: 0 0 auto;
}

.reports-list-panel {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
  flex-direction: column;
}

.reports-list-panel-head {
  flex: 0 0 auto;
}

.reports-list-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  contain: layout paint inline-size;
  overflow: auto;
}

.table-wrap > .reports-list-table {
  min-width: 1060px;
}

.report-window-cell a,
.report-kind-cell strong {
  display: block;
}

.report-window-cell a {
  color: var(--ink);
  font-weight: 520;
  text-decoration: none;
}

.report-window-cell a:hover {
  color: var(--accent-dark);
}

.report-kind-cell strong {
  font-weight: 520;
}

.reports-resend-panel,
.reports-test-panel {
  grid-column: 1 / -1;
}

.recent-report-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(180px, 0.7fr) minmax(120px, 0.4fr);
  gap: 8px;
  padding: 0 14px 12px;
}

.recent-report-summary > div {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 7px;
  background: var(--surface-soft);
}

.recent-report-summary span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 560;
  text-transform: uppercase;
}

.recent-report-summary strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  font-weight: 540;
  line-height: 1.25;
}

.reports-resend-form,
.reports-test-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.scan-delivery-form + .scan-delivery-form {
  padding-top: 0;
}

.reports-form-grid {
  gap: 10px;
}

.reports-form-grid select[multiple] {
  min-height: 98px;
}

.reports-automation-form {
  grid-template-columns: 1fr;
  gap: 10px;
}

.reports-automation-form .span-2 {
  grid-column: 1;
}

.reports-automation-form .checkline {
  align-items: flex-start;
  min-height: 0;
  padding: 8px 9px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.reports-automation-form .checkline input {
  margin-top: 2px;
}

.reports-context-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 14px 14px;
}

.reports-context-row {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.reports-context-row span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 560;
  text-transform: uppercase;
}

.reports-context-row strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 500;
}

.reports-health-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.table-wrap > .reports-table {
  min-width: 900px;
}

.command-table th,
.command-table td {
  white-space: normal;
}

.attention-list,
.compact-list {
  display: grid;
  gap: 5px;
  padding: 8px;
  background: transparent;
}

.attention-row,
.compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.attention-row:first-child,
.compact-row:first-child {
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.attention-row:last-child,
.compact-row:last-child {
  border-bottom-right-radius: 6px;
  border-bottom-left-radius: 6px;
}

.attention-row:hover {
  background: var(--surface-alt);
}

.attention-row span,
.compact-row div {
  min-width: 0;
}

.attention-row strong,
.compact-row strong {
  display: block;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 540;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-row small,
.compact-row span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-row em,
.compact-row em {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 16px;
  font-style: normal;
  font-weight: 560;
}

.attention-good em {
  color: var(--accent-dark);
}

.attention-bad em {
  color: var(--red);
}

.instrument-backtest-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  background: transparent;
}

.instrument-backtest-summary > div {
  min-width: 0;
  padding: 10px;
  border-radius: 6px;
  background: var(--surface);
}

.panel-foot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
}

.scan-command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--section-gap);
  align-items: start;
  margin-bottom: var(--section-gap);
}

.scanner-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--section-gap);
  overflow: visible;
  margin-bottom: var(--section-gap);
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
}

.scanner-summary div {
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.scanner-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.scanner-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 21px;
  font-weight: 540;
  line-height: 1.1;
}

.scanner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--section-gap);
  align-items: start;
  margin-bottom: var(--section-gap);
}

.scanner-primary-panel {
  margin-bottom: 0;
}

.scanner-runs-panel {
  margin-bottom: 0;
}

.scanner-main-column {
  display: grid;
  min-width: 0;
  gap: var(--section-gap);
  align-content: start;
}

.scanner-main-column .panel {
  margin-bottom: 0;
}

.scanner-side {
  display: grid;
  gap: var(--section-gap);
}

.scanner-side .panel {
  margin-bottom: 0;
}

.scanner-candidate-table,
.scanner-runs-table {
  table-layout: fixed;
}

.scanner-candidate-table th:nth-child(1) {
  width: 16%;
}

.scanner-candidate-table th:nth-child(2) {
  width: 25%;
}

.scanner-candidate-table th:nth-child(3) {
  width: 12%;
}

.scanner-candidate-table th:nth-child(4) {
  width: 24%;
}

.scanner-candidate-table th:nth-child(5) {
  width: 16%;
}

.scanner-candidate-table th:nth-child(6) {
  width: 7%;
}

.scanner-runs-table th:nth-child(1) {
  width: 24%;
}

.scanner-runs-table th:nth-child(2) {
  width: 22%;
}

.scanner-runs-table th:nth-child(3) {
  width: 22%;
}

.scanner-runs-table th:nth-child(4) {
  width: 16%;
}

.scanner-runs-table th:nth-child(5) {
  width: 11%;
}

.scanner-runs-table th:nth-child(6) {
  width: 5%;
}

.scanner-data-row td {
  vertical-align: top;
}

.scanner-data-row:hover td {
  background: rgba(148, 163, 184, 0.035);
}

.scanner-identity-cell,
.scanner-stack,
.scanner-signal-cell {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.scanner-inline-head,
.scanner-run-title,
.scanner-score-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.scanner-inline-head strong,
.scanner-run-title a,
.scanner-stack strong,
.scanner-stack code,
.scanner-signal-cell strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.scanner-secondary {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.28;
}

.scanner-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.scanner-chip {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.scanner-metric-cell {
  display: grid;
  gap: 2px;
}

.scanner-metric-cell strong,
.scanner-score {
  font-size: 15px;
  font-weight: 560;
  line-height: 1.1;
}

.scanner-metric-cell span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 560;
  text-transform: uppercase;
}

.scanner-symbol-chip-list {
  max-height: 48px;
}

.scanner-outcome-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 140px;
}

.scanner-outcome-grid > div {
  min-width: 0;
  padding: 7px 8px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.scanner-outcome-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
  text-transform: uppercase;
}

.scanner-outcome-grid strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  font-weight: 560;
}

.scanner-outcome-warning strong {
  color: var(--red);
}

.scanner-action-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.scanner-action-row form {
  display: inline-flex;
}

.options-presets-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.options-presets-page > .page-head {
  flex: 0 0 auto;
}

.options-presets-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}

.options-presets-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  contain: layout paint inline-size;
  overflow: auto;
}

.table-wrap > .presets-table {
  min-width: 1120px;
}

.instrument-page-head {
  align-items: center;
}

.instrument-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.instrument-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: var(--section-gap);
  align-items: start;
  margin-bottom: var(--section-gap);
}

.instrument-chart-panel,
.instrument-main-column .panel,
.instrument-command-column .panel {
  margin-bottom: 0;
}

.instrument-main-column,
.instrument-command-column {
  display: grid;
  gap: var(--section-gap);
  align-content: start;
}

.instrument-overview-grid {
  margin-bottom: 0;
}

.instrument-tv-chart {
  height: 360px;
  padding: 0 12px 10px;
}

.tradingview-frame {
  display: block;
  width: 100%;
  height: calc(100% - 30px);
  min-height: 300px;
  border: 0;
}

.tradingview-widget-copyright {
  padding-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.instrument-forecast-chart {
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
}

.forecast-chart-svg {
  display: block;
  width: 100%;
  min-height: 420px;
  overflow: visible;
}

.forecast-chart-bg {
  fill: var(--surface-soft);
  stroke: var(--line);
  pointer-events: none;
}

.forecast-grid-line {
  stroke: rgba(154, 167, 184, 0.15);
  stroke-width: 1;
}

.forecast-history-line {
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.forecast-indicator-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
  opacity: 0.86;
}

.forecast-indicator-sma20 {
  stroke: #c4b5fd;
}

.forecast-indicator-sma50 {
  stroke: #67e8f9;
}

.forecast-indicator-bollinger {
  stroke: rgba(251, 191, 36, 0.62);
  stroke-dasharray: 4 5;
  stroke-width: 1.1;
  opacity: 0.7;
}

.forecast-cone {
  fill: rgba(94, 234, 212, 0.14);
  stroke: rgba(94, 234, 212, 0.26);
  stroke-width: 1;
}

.forecast-expected-line {
  fill: none;
  stroke: var(--accent-dark);
  stroke-dasharray: 5 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.forecast-current-dot {
  fill: var(--ink);
  stroke: var(--surface-soft);
  stroke-width: 2;
}

.forecast-expected-dot {
  fill: var(--accent-dark);
  stroke: var(--surface-soft);
  stroke-width: 2;
}

.forecast-tooltip-hit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 1.5;
  cursor: help;
  pointer-events: all;
}

[data-forecast-tooltip] {
  cursor: help;
}

path[data-forecast-tooltip],
line[data-forecast-tooltip] {
  pointer-events: stroke;
}

.forecast-tooltip-hit:hover,
.forecast-tooltip-hit:focus {
  fill: rgba(94, 234, 212, 0.16);
  stroke: rgba(94, 234, 212, 0.8);
  outline: none;
}

[data-forecast-tooltip]:focus {
  filter: drop-shadow(0 0 4px rgba(94, 234, 212, 0.55));
  outline: none;
}

.forecast-history-hit:hover,
.forecast-history-hit:focus {
  fill: rgba(147, 197, 253, 0.14);
  stroke: rgba(147, 197, 253, 0.7);
}

.forecast-chart-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: min(280px, calc(100vw - 24px));
  padding: 9px 10px;
  border: 1px solid var(--active-border);
  border-radius: 6px;
  background: var(--tooltip-bg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translate(10px, 10px);
  transition: opacity 120ms ease;
  white-space: pre-line;
}

.forecast-chart-tooltip.visible {
  opacity: 1;
}

.forecast-strike-line {
  stroke: rgba(251, 191, 36, 0.74);
  stroke-dasharray: 3 4;
  stroke-width: 1.2;
}

.forecast-strike-label,
.forecast-axis-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.forecast-strike-label {
  fill: var(--amber);
}

.forecast-x-label {
  text-anchor: middle;
}

.forecast-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.forecast-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.forecast-legend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.forecast-legend-toggle:hover,
.forecast-legend-toggle:focus {
  border-color: var(--line-soft);
  background: var(--surface-soft);
  color: var(--ink);
  outline: 0;
}

.forecast-legend-toggle.active {
  color: var(--ink);
}

.forecast-legend-toggle:not(.active) {
  opacity: 0.52;
}

.forecast-chart-legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

.legend-history {
  background: var(--blue);
}

.legend-cone {
  background: rgba(94, 234, 212, 0.38);
}

.legend-expected {
  background: var(--accent-dark);
}

.legend-pivot {
  background: var(--amber);
}

.forecast-pivot-level {
  fill: none;
  stroke-dasharray: 4 4;
  stroke-linecap: round;
  stroke-width: 1.2;
  opacity: 0.82;
}

.forecast-pivot-support {
  stroke: rgba(94, 234, 212, 0.72);
}

.forecast-pivot-resistance {
  stroke: rgba(248, 113, 113, 0.74);
}

.forecast-pivot-point {
  cursor: pointer;
  stroke: var(--surface-soft);
  stroke-width: 1.5;
}

.forecast-pivot-high {
  fill: var(--red);
}

.forecast-pivot-low {
  fill: var(--accent-dark);
}

.forecast-pivot-level.pivot-selected,
.forecast-pivot-point.pivot-selected {
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.8));
  opacity: 1;
  stroke: var(--amber);
  stroke-width: 2.4;
}

.legend-sma20 {
  background: #c4b5fd;
}

.legend-sma50 {
  background: #67e8f9;
}

.legend-bollinger {
  background: var(--amber);
}

.legend-strike {
  background: var(--amber);
}

.chart-range-options {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.chart-range-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 42px;
  padding: 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  text-decoration: none;
}

.chart-range-option:hover,
.chart-range-option.active {
  border-color: var(--active-border);
  background: var(--active-bg);
  color: var(--accent-dark);
}

.backtest-setup-grid,
.backtest-workbench {
  display: grid;
  gap: var(--section-gap);
  align-items: start;
  margin-bottom: var(--section-gap);
}

.backtest-analysis-grid {
  display: grid;
  grid-template-areas:
    "time context"
    "chart pivots"
    "events events"
    "overview overview";
  grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
  gap: var(--section-gap);
  align-items: stretch;
  margin-bottom: var(--section-gap);
}

.backtest-setup-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
}

.backtests-index-page {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: var(--section-gap);
  overflow: hidden;
}

.backtests-list-panel {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
  flex-direction: column;
}

.backtests-list-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  contain: layout paint inline-size;
  overflow: auto;
}

.backtest-support-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: var(--section-gap);
  align-items: stretch;
}

.backtest-support-grid .backtest-lab-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0;
}

.backtest-support-grid .backtest-coverage-panel {
  margin-bottom: 0;
}

.backtest-run-cell a {
  color: var(--ink);
  font-weight: 520;
  text-decoration: none;
}

.backtest-run-cell a:hover {
  color: var(--accent-dark);
}

.backtest-workbench {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.backtest-analysis-main,
.backtest-analysis-side {
  display: contents;
}

.backtest-analysis-grid .panel {
  margin-bottom: 0;
}

.backtest-analysis-grid .time-machine-panel {
  grid-area: time;
}

.backtest-analysis-grid .backtest-chart-panel {
  grid-area: chart;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-width: 0;
  min-height: clamp(380px, 42vh, 560px);
}

.backtest-analysis-grid .quant-model-panel {
  grid-area: context;
  align-self: stretch;
  min-width: 0;
}

.backtest-analysis-grid .time-machine-panel .panel-head,
.backtest-analysis-grid .quant-model-panel .panel-head {
  padding: 8px 10px;
}

.backtest-analysis-grid .event-context-panel {
  grid-area: events;
  grid-column: 1 / -1;
  justify-self: stretch;
  width: 100%;
  min-width: 0;
}

.backtest-analysis-grid .pivot-points-panel {
  grid-area: pivots;
  align-self: stretch;
  min-width: 0;
}

.backtest-analysis-grid .quant-overview-panel {
  grid-area: overview;
  min-width: 0;
}

.backtest-chart-panel > .backtest-chart-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.backtest-chart-panel .forecast-chart-svg {
  flex: 1 1 auto;
  min-height: 320px;
}

.backtest-launch-panel,
.backtest-coverage-panel,
.backtest-chart-panel,
.time-machine-panel {
  margin-bottom: 0;
}

.backtest-run-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.backtest-symbol-field input {
  min-height: 44px;
  font-size: 20px;
  font-weight: 560;
  letter-spacing: 0;
  text-transform: uppercase;
}

.backtest-command-panel .panel-head,
.backtest-readiness-panel .panel-head {
  align-items: flex-start;
}

.stock-autocomplete-shell {
  position: relative;
  display: grid;
  gap: 10px;
}

.stock-autocomplete-results {
  position: absolute;
  z-index: 20;
  top: 74px;
  left: 0;
  right: 0;
  display: grid;
  max-height: 316px;
  overflow-y: auto;
  border: 1px solid var(--active-border);
  border-radius: 8px;
  background: var(--tooltip-bg);
  box-shadow: var(--shadow);
}

.stock-autocomplete-results[hidden],
.stock-autocomplete-results:empty {
  display: none;
  border: 0;
  box-shadow: none;
}

.stock-autocomplete-option {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid rgba(50, 60, 76, 0.8);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.stock-autocomplete-option:last-child {
  border-bottom: 0;
}

.stock-autocomplete-option:hover,
.stock-autocomplete-option.active {
  background: var(--active-bg);
}

.stock-autocomplete-option strong,
.stock-autocomplete-option span,
.stock-autocomplete-option small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-autocomplete-option strong {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 650;
}

.stock-autocomplete-option span {
  font-size: 12px;
  font-weight: 520;
}

.stock-autocomplete-option small,
.stock-autocomplete-status {
  color: var(--muted);
  font-size: 11px;
}

.stock-autocomplete-status {
  margin: 0;
  padding: 0;
  line-height: 1.45;
}

.stock-suggestion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 520;
  text-transform: uppercase;
}

.stock-suggestion-head small {
  text-align: right;
  text-transform: none;
}

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

.stock-suggestion-chip {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.stock-suggestion-chip:hover,
.stock-suggestion-chip:focus {
  border-color: var(--active-border);
  background: var(--active-bg);
  outline: 0;
}

.stock-suggestion-chip strong,
.stock-suggestion-chip span,
.stock-suggestion-chip small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-suggestion-chip strong {
  font-size: 14px;
  font-weight: 650;
}

.stock-suggestion-chip span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 520;
}

.stock-suggestion-chip small,
.backtest-form-note,
.backtest-readiness-list small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.backtest-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.backtest-form-grid-secondary {
  grid-template-columns: minmax(120px, 0.6fr) minmax(0, 1.4fr);
}

.backtest-form-actions {
  position: static;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
  padding-top: 12px;
}

.backtest-form-note {
  max-width: 320px;
}

.backtest-readiness-list .status-row {
  align-items: flex-start;
}

.backtest-readiness-list .status-row > div {
  min-width: 0;
}

.backtest-readiness-list .status-row small {
  display: block;
  margin-top: 3px;
}

.table-wrap > .backtest-history-table {
  min-width: 980px;
}

.backtest-terminal-head {
  align-items: flex-start;
}

.run-fact-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.run-fact-strip > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 520;
}

.run-fact-strip strong {
  color: var(--ink);
  font-weight: 650;
}

.quant-kpi-grid,
.quant-forecast-grid {
  display: grid;
  gap: var(--section-gap);
  margin-bottom: var(--section-gap);
}

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

.quant-kpi {
  min-width: 0;
  min-height: 104px;
  padding: 13px 14px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.quant-kpi-primary {
  background: linear-gradient(180deg, rgba(94, 234, 212, 0.09), var(--surface));
}

.quant-kpi span,
.quant-model-readout span,
.quant-level-grid span,
.quant-settings-grid span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
}

.quant-kpi strong {
  display: block;
  margin-top: 9px;
  overflow-wrap: anywhere;
  font-size: 23px;
  font-weight: 590;
  line-height: 1.05;
}

.quant-kpi small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.quant-forecast-grid {
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
}

.quant-overview-panel,
.quant-model-panel,
.pivot-points-panel {
  margin-bottom: 0;
}

.backtest-analysis-grid .quant-model-panel,
.backtest-analysis-grid .pivot-points-panel {
  display: flex;
  flex-direction: column;
}

.backtest-analysis-grid .quant-model-panel .panel-head,
.backtest-analysis-grid .pivot-points-panel .panel-head {
  flex: 0 0 auto;
}

.backtest-analysis-grid .pivot-points-panel .pivot-selector-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 10px 10px;
  overflow: hidden;
}

.backtest-analysis-grid .quant-model-panel .quant-model-readout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 0 9px 8px;
}

.backtest-analysis-grid .pivot-points-panel .pivot-select-list {
  min-height: 0;
  overflow-y: auto;
}

.quant-model-readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 12px 12px;
}

.quant-model-readout > div {
  min-width: 0;
  padding: 7px 8px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.quant-model-readout strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 570;
}

.backtest-analysis-grid .quant-model-panel .quant-model-readout > div {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding-block: 6px;
}

.backtest-analysis-grid .quant-model-panel .quant-model-readout > div strong {
  margin-top: 0;
  text-align: right;
}

.quant-level-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.quant-level-grid > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.quant-level-grid strong {
  display: block;
  margin-top: 7px;
  font-size: 14px;
  font-weight: 570;
}

.quant-level-grid small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.pivot-level-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 10px 6px;
}

.pivot-level-grid > div {
  min-width: 0;
  padding: 7px 8px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.pivot-level-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
  text-transform: uppercase;
}

.pivot-level-grid strong {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 560;
}

.pivot-level-grid small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 430;
}

.pivot-selector-panel {
  margin: 0 10px 10px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.pivot-selector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 4px;
}

.pivot-selector-head span,
.pivot-select-row span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
}

.pivot-selector-head strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 570;
}

.pivot-select-list {
  display: grid;
  gap: 2px;
  padding: 0 5px 5px;
  background: transparent;
}

.pivot-select-row {
  display: grid;
  grid-template-columns: minmax(44px, 0.8fr) minmax(56px, auto);
  gap: 2px 8px;
  min-width: 0;
  padding: 4px 7px;
  border: 0;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.pivot-select-row:hover,
.pivot-select-row.active {
  background: var(--active-bg);
}

.pivot-select-row.active {
  box-shadow: inset 3px 0 0 var(--amber);
}

.pivot-select-row strong {
  justify-self: end;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 560;
}

.pivot-select-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.pivot-select-support strong,
.pivot-select-low strong {
  color: var(--accent-dark);
}

.pivot-select-resistance strong,
.pivot-select-high strong {
  color: var(--red);
}

.quant-settings-panel {
  margin: 0 10px 10px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.quant-settings-panel summary {
  padding: 8px 9px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.quant-settings-grid {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.quant-settings-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 570;
  text-transform: none;
}

.prediction-success-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.prediction-success-card {
  min-width: 0;
  padding: 10px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.prediction-success-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.prediction-success-head span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 560;
  text-transform: uppercase;
}

.prediction-success-head strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 560;
  line-height: 1;
  text-align: right;
}

.prediction-success-bar {
  height: 7px;
  margin: 9px 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
}

.prediction-success-bar span {
  display: block;
  width: var(--success-rate, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
}

.prediction-success-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 8px;
  margin: 0;
}

.prediction-success-card dl div {
  min-width: 0;
}

.prediction-success-card dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
  text-transform: uppercase;
}

.prediction-success-card dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 520;
  line-height: 1.2;
}

.prediction-success-card dd span {
  color: var(--muted);
  font-size: 11px;
}

.prediction-success-note {
  margin: 0;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.strategy-attribution-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.strategy-attribution-card {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  min-height: 118px;
  padding: 11px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.strategy-attribution-card > span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 560;
  line-height: 1.1;
  text-transform: uppercase;
}

.strategy-attribution-card > strong {
  color: var(--ink);
  font-size: clamp(17px, 1.5vw, 22px);
  font-weight: 560;
  line-height: 1;
}

.strategy-attribution-card > small,
.strategy-attribution-card > em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.3;
}

.strategy-simulator-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.strategy-simulator-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  min-width: min(100%, 520px);
  padding: 3px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.strategy-simulator-tab {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.strategy-simulator-tab:hover,
.strategy-simulator-tab.active {
  background: var(--active-bg);
  color: var(--accent-dark);
}

.strategy-simulator-tab strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 580;
  line-height: 1.1;
}

.strategy-simulator-tab span {
  overflow: hidden;
  color: inherit;
  font-size: 10.5px;
  font-weight: 520;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-simulator-panel[hidden] {
  display: none;
}

.candidate-replay-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 12px 12px;
}

.candidate-replay-strip span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 9px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 560;
  text-transform: uppercase;
}

.candidate-replay-strip strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 520;
  text-transform: none;
}

.candidate-metrics-subhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 10px;
}

.candidate-metrics-subhead h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 560;
}

.candidate-paper-head {
  align-items: center;
  padding-top: 2px;
}

.candidate-replay-window-form {
  display: grid;
  grid-template-columns: minmax(210px, 0.38fr) minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  margin: 0 12px 12px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.candidate-replay-window-form > div:first-child {
  min-width: 0;
}

.candidate-replay-window-form strong,
.candidate-replay-window-form span {
  display: block;
}

.candidate-replay-window-form strong {
  margin-top: 2px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 570;
}

.candidate-replay-window-form span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.candidate-replay-window-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr)) auto auto;
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.candidate-replay-window-fields label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.candidate-replay-window-fields label span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 560;
  text-transform: uppercase;
}

.candidate-replay-window-fields input[type="date"],
.candidate-replay-window-fields .button {
  min-height: 36px;
}

.candidate-calculator-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  min-width: min(100%, 310px);
  padding: 3px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.candidate-calculator-mode {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.candidate-calculator-mode:hover,
.candidate-calculator-mode.active {
  background: var(--active-bg);
  color: var(--accent-dark);
}

.candidate-calculator-mode strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 580;
  line-height: 1.1;
}

.candidate-calculator-mode span {
  overflow: hidden;
  color: inherit;
  font-size: 10.5px;
  font-weight: 520;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-paper-mode[hidden] {
  display: none;
}

.candidate-replay-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin: 2px 0 8px;
}

.candidate-replay-section-head h4 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 560;
  line-height: 1.25;
}

.candidate-replay-section-head > span {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 560;
  text-align: right;
}

.candidate-paper-matrix {
  overflow-x: auto;
  padding: 0 12px 12px;
}

.candidate-paper-matrix table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0 6px;
}

.candidate-signal-matrix table,
.candidate-option-matrix table {
  min-width: 760px;
}

.candidate-option-empty {
  margin: 0 12px 12px;
}

.candidate-paper-matrix th,
.candidate-paper-matrix td {
  text-align: left;
  vertical-align: top;
}

.candidate-paper-matrix thead th {
  padding: 0 10px 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
  letter-spacing: 0;
  text-transform: uppercase;
}

.candidate-paper-matrix thead span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 430;
  text-transform: none;
}

.candidate-paper-matrix tbody th,
.candidate-paper-matrix tbody td {
  padding: 10px;
  background: var(--surface-soft);
}

.candidate-paper-matrix tbody th {
  width: 180px;
  border-radius: 6px 0 0 6px;
}

.candidate-paper-matrix tbody td:last-child {
  border-radius: 0 6px 6px 0;
}

.candidate-paper-matrix tbody th strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 560;
}

.candidate-paper-matrix tbody th span,
.candidate-paper-matrix tbody td span,
.candidate-paper-matrix tbody td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.candidate-paper-matrix tbody td > strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  font-weight: 560;
  line-height: 1;
}

.candidate-paper-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.candidate-paper-card {
  min-width: 0;
  padding: 11px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.candidate-paper-card > span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 560;
  text-transform: uppercase;
}

.candidate-paper-card > strong {
  display: block;
  margin-top: 7px;
  font-size: 20px;
  font-weight: 560;
  line-height: 1;
}

.candidate-paper-card > small {
  display: block;
  min-height: 30px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.candidate-paper-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 8px;
  margin: 10px 0 0;
}

.candidate-paper-card dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
  text-transform: uppercase;
}

.candidate-paper-card dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 520;
}

@media (max-width: 1180px) {
  .stock-suggestion-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .backtest-setup-grid,
  .backtest-support-grid,
  .backtest-analysis-grid,
  .quant-forecast-grid {
    grid-template-columns: 1fr;
  }

  .backtest-analysis-grid {
    grid-template-areas:
      "time"
      "context"
      "chart"
      "pivots"
      "events"
      "overview";
  }

  .backtest-analysis-grid .quant-model-panel .quant-model-readout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .backtest-support-grid .backtest-lab-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .strategy-attribution-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .stock-suggestion-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .stock-suggestion-head small {
    text-align: left;
  }

  .stock-suggestion-grid {
    grid-template-columns: 1fr;
  }

  .backtest-form-actions .button,
  .backtest-form-actions input[type="submit"].button {
    width: 100%;
  }

  .quant-kpi-grid,
  .quant-model-readout,
  .quant-level-grid {
    grid-template-columns: 1fr;
  }

  .backtests-index-page,
  .backtests-list-panel {
    min-height: auto;
  }

  .backtests-list-table-wrap {
    max-height: none;
    overflow: visible;
  }

  .backtest-analysis-grid .pivot-points-panel .pivot-selector-panel {
    max-height: none;
    margin: 0 12px 12px;
  }

  .run-fact-strip,
  .quant-kpi-grid,
  .quant-model-readout,
  .quant-level-grid,
  .prediction-success-grid,
  .strategy-attribution-grid,
  .candidate-replay-strip,
  .candidate-paper-grid {
    display: grid;
  }

  .prediction-success-grid,
  .backtest-support-grid .backtest-lab-metrics,
  .strategy-attribution-grid,
  .candidate-replay-strip,
  .candidate-paper-grid {
    grid-template-columns: 1fr;
  }

  .candidate-paper-matrix {
    overflow-x: visible;
  }

  .candidate-paper-matrix table,
  .candidate-paper-matrix thead,
  .candidate-paper-matrix tbody,
  .candidate-paper-matrix tr,
  .candidate-paper-matrix th,
  .candidate-paper-matrix td {
    display: block;
    min-width: 0;
    width: auto;
  }

  .candidate-paper-matrix thead {
    display: none;
  }

  .candidate-paper-matrix table {
    min-width: 0;
    border-spacing: 0;
  }

  .candidate-paper-matrix tbody {
    display: grid;
    gap: 8px;
  }

  .candidate-paper-matrix tbody tr {
    display: grid;
    gap: 6px;
    padding: 10px;
    border-radius: 6px;
    background: var(--surface-soft);
  }

  .candidate-paper-matrix tbody th,
  .candidate-paper-matrix tbody td,
  .candidate-paper-matrix tbody td:last-child {
    padding: 0;
    border-radius: 0;
    background: transparent;
  }

  .candidate-paper-matrix tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 560;
    text-transform: uppercase;
  }

  .candidate-metrics-subhead {
    flex-direction: column;
  }

  .candidate-replay-window-form,
  .candidate-replay-window-fields {
    grid-template-columns: 1fr;
  }

  .candidate-replay-window-fields .button {
    width: 100%;
  }

  .candidate-replay-section-head {
    flex-direction: column;
  }

  .candidate-replay-section-head > span {
    text-align: left;
  }

  .candidate-calculator-switch {
    width: 100%;
  }

  .strategy-simulator-toolbar,
  .strategy-simulator-tabs {
    width: 100%;
  }

  .strategy-simulator-tabs {
    grid-template-columns: 1fr;
  }

  .run-fact-strip > span {
    width: 100%;
    justify-content: space-between;
  }
}

.prediction-settings-disclosure {
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.prediction-settings-disclosure summary {
  padding: 11px 12px;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.prediction-settings-disclosure .backtest-prediction-override-toggle,
.prediction-settings-disclosure .prediction-settings-section,
.prediction-settings-disclosure .backtest-settings-json {
  margin: 0 12px 12px;
}

.backtest-settings-json textarea {
  min-height: 96px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.backtest-chart-body {
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
}

.backtest-forecast-chart {
  aspect-ratio: 1180 / 560;
  height: auto;
  min-height: 0;
}

.backtest-actual-line {
  fill: none;
  stroke: var(--muted);
  stroke-dasharray: 5 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.backtest-overview-panel {
  margin-bottom: 0;
}

.backtest-overview-chart {
  aspect-ratio: 920 / 360;
  height: auto;
  min-height: 0;
}

.backtest-analysis-grid .backtest-overview-panel .backtest-overview-chart {
  aspect-ratio: 920 / 280;
  opacity: 0.88;
}

.backtest-overview-prediction-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  opacity: 0.86;
}

.backtest-overview-actual-line {
  stroke-width: 2.2;
}

.backtest-overview-dot {
  stroke: var(--surface-soft);
  stroke-width: 1.2;
  opacity: 0.78;
}

.backtest-overview-dot-winning {
  stroke: var(--accent-dark);
  stroke-width: 2.4;
  filter: drop-shadow(0 0 5px rgba(94, 234, 212, 0.72));
  opacity: 1;
}

.backtest-overview-dot:hover,
.backtest-overview-dot:focus {
  opacity: 1;
}

.overview-series-hidden {
  display: none;
}

.backtest-overview-legend {
  gap: 10px 14px;
}

.legend-actual {
  background: var(--muted);
}

.legend-winning {
  border: 2px solid var(--accent-dark);
  background: transparent;
}

.time-machine-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 10px;
}

.time-machine-controls {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  gap: 6px;
  align-items: center;
  min-width: 0;
  min-height: 66px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(8, 15, 24, 0.68);
}

.time-machine-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-width: 30px;
  min-height: 38px;
  padding: 0;
  border-color: rgba(148, 163, 184, 0.12);
  background: rgba(148, 163, 184, 0.06);
}

.time-machine-nav-spacer {
  width: 30px;
  min-height: 38px;
}

.time-machine-date-card {
  display: grid;
  place-content: center;
  min-width: 0;
  min-height: 48px;
  text-align: center;
}

.time-machine-date-card span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
}

.time-machine-date-card strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  font-size: 18px;
  font-weight: 560;
  line-height: 1.1;
}

.time-machine-date-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.time-machine-rail-card {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 58px;
  order: -1;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(8, 15, 24, 0.68);
}

.time-machine-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.time-machine-rail-head span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
}

.time-machine-rail-head strong {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 520;
}

.time-machine-slider-shell {
  position: relative;
  height: 30px;
}

.time-machine-track {
  position: absolute;
  inset: 11px 0 auto;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent calc(20% - 1px),
      rgba(189, 200, 216, 0.18) calc(20% - 1px),
      rgba(189, 200, 216, 0.18) 20%
    ),
    rgba(148, 163, 184, 0.12);
}

.time-machine-track span {
  display: block;
  width: var(--time-machine-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
}

.time-machine-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 30px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: ew-resize;
}

.time-machine-input::-webkit-slider-runnable-track {
  height: 30px;
  background: transparent;
}

.time-machine-input::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: 5px;
  border: 3px solid #071019;
  border-radius: 50%;
  appearance: none;
  background: var(--accent-dark);
  box-shadow: 0 0 0 1px var(--active-border), 0 8px 18px rgba(0, 0, 0, 0.36);
}

.time-machine-input::-moz-range-track {
  height: 30px;
  background: transparent;
}

.time-machine-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #071019;
  border-radius: 50%;
  background: var(--accent-dark);
  box-shadow: 0 0 0 1px var(--active-border), 0 7px 18px rgba(0, 0, 0, 0.35);
}

.time-machine-bounds {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.time-machine-bounds span:nth-child(2) {
  text-align: center;
}

.time-machine-bounds span:last-child {
  text-align: right;
}

.time-machine-date-jump {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: end;
  min-width: 0;
  min-height: 66px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(8, 15, 24, 0.68);
}

.time-machine-date-jump label {
  display: grid;
  gap: 5px;
}

.time-machine-date-jump label span,
.time-machine-jump-row > span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
}

.time-machine-date-jump input[type="date"] {
  min-height: 32px;
}

.time-machine-date-jump .button {
  min-height: 32px;
}

.time-machine-jump-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 2px 2px 0;
}

.time-machine-ticks {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.time-machine-ticks::-webkit-scrollbar {
  display: none;
}

.time-machine-tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 550;
  text-decoration: none;
}

.time-machine-tick:hover,
.time-machine-tick.active {
  background: var(--active-bg);
  color: var(--accent-dark);
}

@media (min-width: 920px) {
  .backtest-analysis-grid .time-machine-panel .time-machine-form {
    grid-template-columns: minmax(0, 1fr) minmax(170px, 220px);
    align-items: stretch;
    gap: 6px;
  }

  .backtest-analysis-grid .time-machine-panel .time-machine-controls {
    grid-column: 1;
    grid-row: 2;
    min-height: 60px;
  }

  .backtest-analysis-grid .time-machine-panel .time-machine-rail-card {
    grid-template-columns: minmax(104px, auto) minmax(0, 1fr) minmax(132px, auto);
    grid-column: 1 / -1;
    grid-row: 1;
    align-items: center;
    min-height: 48px;
  }

  .backtest-analysis-grid .time-machine-panel .time-machine-rail-head {
    display: grid;
    gap: 1px;
    justify-content: start;
  }

  .backtest-analysis-grid .time-machine-panel .time-machine-bounds {
    min-width: 132px;
  }

  .backtest-analysis-grid .time-machine-panel .time-machine-date-jump {
    grid-column: 2;
    grid-row: 2;
    min-height: 60px;
  }

  .backtest-analysis-grid .time-machine-panel .time-machine-jump-row {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

.backtest-estimate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: var(--section-gap);
}

.estimate-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.estimate-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 4px;
}

.estimate-card-head span,
.estimate-card dt {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
}

.estimate-card-head strong {
  font-size: 20px;
  font-weight: 560;
}

.estimate-card dl {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
}

.estimate-card dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.estimate-card dt,
.estimate-card dd {
  margin: 0;
}

.estimate-card dd {
  color: var(--ink);
  font-weight: 520;
  text-align: right;
}

.snapshot-list {
  display: grid;
  gap: 0;
}

.snapshot-list-compact {
  margin-top: 14px;
}

.snapshot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}

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

.snapshot-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.snapshot-row strong {
  min-width: 0;
  text-align: right;
  font-size: 13px;
}

.snapshot-row-emphasis strong {
  font-size: 20px;
  font-weight: 540;
  line-height: 1;
}

.indicator-list {
  display: grid;
  gap: 0;
}

.indicator-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(128px, auto);
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}

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

.indicator-row span,
.indicator-row small {
  display: block;
}

.indicator-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.indicator-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.indicator-row strong {
  display: grid;
  gap: 5px;
  justify-items: end;
  min-width: 0;
  font-size: 13px;
  font-weight: 540;
  text-align: right;
}

.indicator-row em {
  font-style: normal;
}

.forecast-mini {
  display: grid;
  gap: 5px;
  min-width: 150px;
}

.forecast-mini strong,
.forecast-card-head strong {
  font-weight: 540;
}

.forecast-mini > span:not(.status) {
  color: var(--muted);
  font-size: 11px;
}

.scan-candidate-list {
  display: grid;
  padding: 0;
}

.scan-candidate-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
}

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

.scan-candidate-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.candidate-contract-title {
  min-width: 0;
}

.candidate-contract-title h3 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 6px;
  font-size: 19px;
  line-height: 1.15;
}

.candidate-contract-title h3 span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
}

.candidate-subline,
.candidate-head-actions,
.scan-candidate-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.candidate-subline {
  color: var(--muted);
  font-size: 12px;
}

.candidate-head-actions {
  align-items: center;
  justify-content: flex-end;
  min-width: 260px;
}

.candidate-head-actions .tooltip {
  margin-left: 0;
}

.candidate-score {
  display: grid;
  justify-items: end;
  min-width: 58px;
  padding: 4px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface-alt);
}

.candidate-score small,
.candidate-metric span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

.candidate-score strong {
  font-size: 15px;
  font-weight: 560;
}

.scan-candidate-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.45fr) minmax(260px, 1.35fr) repeat(2, minmax(130px, 0.7fr));
  gap: 10px;
}

.candidate-metric {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 98px;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--surface-alt);
}

.candidate-metric strong {
  font-size: 15px;
  font-weight: 560;
  line-height: 1.25;
}

.candidate-metric small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.candidate-estimate > strong {
  font-size: 22px;
  line-height: 1;
}

.candidate-calculator {
  gap: 8px;
}

.contract-scenario-list {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.contract-scenario {
  display: grid;
  grid-template-columns: minmax(62px, 0.85fr) auto minmax(96px, 1fr);
  gap: 8px;
  align-items: baseline;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
}

.contract-scenario b,
.contract-scenario strong {
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

.contract-scenario small {
  display: block;
  font-size: 11px;
}

.candidate-forecast .forecast-strip {
  width: 100%;
  min-width: 0;
}

.forecast-strip {
  position: relative;
  height: 18px;
  min-width: 128px;
}

.forecast-strip::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  height: 2px;
  border-radius: 999px;
  background: var(--line-soft);
}

.forecast-band {
  position: absolute;
  left: var(--forecast-low, 0%);
  right: calc(100% - var(--forecast-high, 100%));
  top: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(94, 234, 212, 0.24);
}

.forecast-marker {
  position: absolute;
  top: 3px;
  width: 2px;
  height: 12px;
  border-radius: 999px;
  background: var(--muted);
}

.forecast-marker-current {
  left: var(--forecast-current, 0%);
  background: var(--ink);
}

.forecast-marker-expected {
  left: var(--forecast-expected, 0%);
  width: 6px;
  height: 6px;
  top: 6px;
  margin-left: -2px;
  background: var(--accent-dark);
}

.forecast-marker-strike {
  left: var(--forecast-strike, 0%);
  background: var(--amber);
}

.forecast-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  background: transparent;
}

.forecast-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border-radius: 6px;
  background: var(--surface);
}

.forecast-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.forecast-card-head,
.forecast-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.forecast-card-head span,
.forecast-card-foot {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.forecast-strip-large {
  min-width: 100%;
}

.forecast-controls {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.forecast-horizon-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.forecast-horizon-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  min-width: 45px;
  padding: 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  text-decoration: none;
}

.forecast-horizon-option:hover,
.forecast-horizon-option.active {
  border-color: var(--active-border);
  background: var(--active-bg);
  color: var(--accent-dark);
}

.forecast-option-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.forecast-option-form label,
.forecast-card-meta span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.forecast-option-form input[type="number"] {
  min-height: 32px;
}

.forecast-option-form .button {
  min-height: 32px;
}

.forecast-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.forecast-card-meta .status {
  text-transform: none;
}

.instrument-range-body {
  padding: 12px;
}

.range-current {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.range-current span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.range-current strong {
  font-size: 19px;
  font-weight: 540;
}

.range-track {
  height: 9px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-alt);
}

.range-track span {
  display: block;
  width: var(--range-position, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.instrument-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--section-gap);
  margin-bottom: var(--section-gap);
}

.instrument-detail-grid.instrument-overview-grid {
  margin-bottom: 0;
}

.instrument-detail-grid.instrument-secondary-grid {
  margin-bottom: 0;
}

.instrument-detail-grid .panel {
  margin-bottom: 0;
}

.candidate-table td:first-child {
  min-width: 130px;
}

.strategy-run-list {
  display: grid;
  gap: 0;
}

.strategy-run-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
}

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

.strategy-run-card strong,
.strategy-run-card span {
  display: block;
}

.strategy-run-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.preset-run-form,
.strategy-target-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(92px, 0.7fr) auto;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.preset-run-form select,
.preset-run-form input,
.strategy-target-form select,
.strategy-target-form input {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.preset-run-form {
  min-width: 330px;
}

.strategy-target-form {
  grid-template-columns: minmax(0, 1fr) minmax(88px, 0.7fr) auto;
}

.dashboard-primary {
  margin-bottom: 0;
}

.dashboard-side {
  display: grid;
  gap: var(--section-gap);
}

.dashboard-side .panel {
  margin-bottom: 0;
}

.quick-scan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.advanced-panel {
  padding-top: 12px;
}

.advanced-panel summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.advanced-panel textarea {
  margin-top: 10px;
}

.status-list {
  display: grid;
  gap: 0;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}

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

.status-row strong,
.status-row span {
  display: block;
}

.status-row div span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.status-row-subtle {
  padding-top: 7px;
  padding-bottom: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

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

.inventory-list div {
  padding: 12px;
  border-right: 1px solid var(--line-soft);
}

.inventory-list div:last-child {
  border-right: 0;
}

.inventory-list span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.inventory-list strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  font-weight: 540;
}

.scan-inventory-list {
  grid-template-columns: 1fr;
}

.scan-inventory-list div {
  border-right: 0;
  border-bottom: 1px solid var(--line-soft);
}

.scan-inventory-list div:last-child {
  border-bottom: 0;
}

.opportunity-metrics {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.opportunity-queue-list {
  display: grid;
  padding: 0;
}

.opportunity-queue-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
}

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

.opportunity-queue-card .candidate-head-actions {
  max-width: min(100%, 360px);
  min-width: 0;
}

.opportunity-queue-grid {
  display: grid;
  grid-template-columns: minmax(145px, 0.8fr) minmax(215px, 1.35fr) minmax(115px, 0.65fr) minmax(185px, 1.1fr);
  gap: 10px;
}

.opportunity-queue-grid .candidate-metric {
  min-height: 92px;
}

.opportunity-queue-grid .candidate-metric strong {
  overflow-wrap: anywhere;
}

.opportunity-table-wrap {
  scrollbar-gutter: stable;
}

.table-wrap > .opportunity-activity-table {
  min-width: min(980px, 100%);
}

.opportunity-activity-grid {
  grid-template-columns: minmax(0, 1fr);
}

.opportunity-activity-table th,
.opportunity-activity-table td {
  vertical-align: top;
}

.opportunity-run-col {
  width: 32%;
}

.opportunity-setup-col {
  width: 18%;
}

.opportunity-result-col {
  width: 24%;
}

.opportunity-time-col {
  width: 18%;
}

.opportunity-action-col {
  width: 54px;
}

.opportunity-report-col {
  width: 36%;
}

.opportunity-delivery-col {
  width: 20%;
}

.opportunity-table-row:hover td {
  background: rgba(255, 255, 255, 0.018);
}

.opportunity-table-primary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.opportunity-table-primary a {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 560;
}

.opportunity-table-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.opportunity-table-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.opportunity-cell-stack,
.opportunity-time-stack {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.opportunity-cell-stack strong,
.opportunity-time-stack strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 560;
}

.opportunity-symbol-list {
  margin-top: 8px;
}

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

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

.opportunity-mini-grid div {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface-soft);
}

.opportunity-mini-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.2;
  text-transform: uppercase;
}

.opportunity-mini-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 560;
  line-height: 1.1;
}

.opportunity-mini-grid .opportunity-mini-warning {
  border-color: rgba(248, 113, 113, 0.32);
  background: rgba(248, 113, 113, 0.08);
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--section-gap);
  margin-bottom: var(--section-gap);
}

.workflow-card {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.workflow-body {
  display: grid;
  gap: 14px;
}

.workflow-body p {
  min-height: 66px;
  margin: 0;
  padding: 14px 14px 0;
  color: var(--muted);
}

.workflow-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--section-gap);
  margin-bottom: var(--section-gap);
}

.research-workflows-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.research-workflows-page > .page-head {
  flex: 0 0 auto;
}

.workflow-command-grid,
.workflow-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: var(--section-gap);
  align-items: start;
  margin-bottom: var(--section-gap);
}

.workflow-command-grid-primary {
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  min-height: 0;
  align-items: stretch;
  margin-bottom: 0;
}

.workflow-show-page {
  min-height: 0;
}

.workflow-show-page > .page-head {
  margin-bottom: 0;
}

.workflow-command-strip {
  display: grid;
  grid-template-columns: minmax(230px, 0.36fr) minmax(0, 1fr);
  align-items: stretch;
  margin-bottom: 0;
  overflow: hidden;
}

.workflow-command-copy {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 13px 14px;
  background: var(--surface-soft);
}

.workflow-command-copy h2 {
  margin-top: 3px;
  font-size: 15px;
}

.workflow-command-copy > .status {
  justify-self: start;
}

.workflow-status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-soft);
}

.workflow-status-item {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 4px;
  padding: 12px 13px;
  background: var(--surface);
}

.workflow-status-item span,
.workflow-config-details summary small,
.workflow-json-details summary small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 520;
  text-transform: uppercase;
}

.workflow-status-item strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 530;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-status-item small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-operating-grid {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(350px, 0.78fr) minmax(0, 1.22fr);
  gap: var(--section-gap);
  min-height: 0;
  align-items: start;
}

.workflow-operating-grid > .panel,
.workflow-show-page .workflow-runs-panel,
.workflow-strategy-summary-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  margin-bottom: 0;
}

.workflow-show-page .workflow-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(46dvh, 520px);
  overflow: auto;
}

.workflow-strategy-summary-table {
  table-layout: fixed;
}

.table-wrap > .workflow-strategy-summary-table {
  min-width: 100%;
}

.table-wrap > .workflow-run-table {
  table-layout: fixed;
}

.workflow-run-table th:nth-child(1) {
  width: 17%;
}

.workflow-run-table th:nth-child(2) {
  width: 13%;
}

.workflow-run-table th:nth-child(3) {
  width: 21%;
}

.workflow-run-table th:nth-child(4) {
  width: 12%;
}

.workflow-run-table th:nth-child(5) {
  width: 25%;
}

.workflow-run-table th:nth-child(6) {
  width: 12%;
}

.workflow-config-details {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.workflow-config-details > summary,
.workflow-json-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.workflow-config-details > summary {
  padding: 12px 14px;
}

.workflow-json-details > summary {
  min-height: 38px;
  padding: 0 0 8px;
}

.workflow-config-details > summary::-webkit-details-marker,
.workflow-json-details > summary::-webkit-details-marker {
  display: none;
}

.workflow-config-details summary span,
.workflow-json-details summary span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.workflow-config-details summary strong,
.workflow-json-details summary strong {
  color: var(--ink);
  font-weight: 530;
}

.workflow-details-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}

.workflow-config-details[open] .workflow-details-caret {
  color: var(--accent-dark);
}

.workflow-json-details {
  padding: 10px 11px 0;
  border-radius: 7px;
  background: var(--surface-soft);
}

.workflow-json-details label {
  display: grid;
  gap: 6px;
}

.workflow-scan-more {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11.5px;
}

.workflow-list-panel,
.workflow-model-panel,
.workflow-config-panel,
.workflow-run-health-panel,
.workflow-runs-panel {
  margin-bottom: 0;
}

.workflow-command-grid-primary .workflow-list-panel,
.workflow-command-grid-primary .workflow-runs-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.workflow-card-list,
.workflow-flow-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.workflow-table-wrap {
  display: block;
  padding: 0;
}

.workflow-command-grid-primary .workflow-card-list {
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  overflow: auto;
}

.table-wrap > .workflow-index-table {
  min-width: 720px;
  table-layout: fixed;
}

.table-wrap > .workflow-index-runs-table {
  min-width: 760px;
  table-layout: fixed;
}

.workflow-index-table th:nth-child(1) {
  width: 18%;
}

.workflow-index-table th:nth-child(2) {
  width: 16%;
}

.workflow-index-table th:nth-child(3) {
  width: 13%;
}

.workflow-index-table th:nth-child(4) {
  width: 15%;
}

.workflow-index-table th:nth-child(5) {
  width: 14%;
}

.workflow-index-table th:nth-child(6) {
  width: 8%;
}

.workflow-index-table th:nth-child(7) {
  width: 16%;
}

.workflow-index-table .table-subtext {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-table-name a {
  color: var(--ink);
  font-weight: 520;
  text-decoration: none;
}

.workflow-index-strategy-cell,
.workflow-index-recipient-cell {
  position: relative;
}

.workflow-strategy-tooltip,
.workflow-recipient-tooltip {
  margin-left: 0;
}

.workflow-strategy-count,
.workflow-recipient-count {
  width: auto;
  min-width: 0;
  height: 26px;
  padding: 0 9px;
  border-color: var(--line-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 11.5px;
  white-space: nowrap;
}

.workflow-strategy-count:hover,
.workflow-strategy-count:focus-visible,
.workflow-recipient-count:hover,
.workflow-recipient-count:focus-visible {
  border-color: var(--active-border);
  color: var(--accent-dark);
}

.workflow-strategy-tooltip-panel,
.workflow-recipient-tooltip-panel {
  top: calc(100% + 9px);
  left: auto;
  right: 0;
  bottom: auto;
  width: min(340px, 70vw);
}

.workflow-strategy-tooltip-panel strong,
.workflow-recipient-tooltip-panel strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 540;
}

.workflow-strategy-tooltip-panel ul,
.workflow-recipient-tooltip-panel ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-strategy-tooltip-panel li,
.workflow-recipient-tooltip-panel li {
  overflow-wrap: anywhere;
  color: var(--muted);
}

.workflow-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.workflow-card-main,
.workflow-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.workflow-card-main > div {
  min-width: 0;
}

.workflow-card-main strong,
.workflow-card-main span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-card-main strong {
  font-size: 14px;
  font-weight: 540;
}

.workflow-card-main span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
}

.workflow-card-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.workflow-card-meta > div,
.workflow-flow-list > div {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 6px;
  background: var(--surface);
}

.workflow-card-meta span,
.workflow-flow-list span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
  text-transform: uppercase;
}

.workflow-card-meta strong,
.workflow-flow-list strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 540;
}

.workflow-card-meta small,
.workflow-flow-list p {
  display: block;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.workflow-card-actions {
  justify-content: flex-end;
}

.workflow-card-actions form {
  display: inline-flex;
}

.workflow-run-list {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  gap: 8px;
  padding: 10px;
  overflow: auto;
}

.workflow-card-list.workflow-table-wrap,
.workflow-run-list.workflow-table-wrap {
  display: block;
  gap: 0;
  padding: 0;
}

.workflow-run-card {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding: 11px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.workflow-run-card-main,
.workflow-run-card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.workflow-run-card-main strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 540;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-run-card-main a {
  color: var(--ink);
  text-decoration: none;
}

.workflow-run-card-main a:hover {
  color: var(--accent-dark);
}

.workflow-run-card-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.workflow-run-card-meta > div {
  min-width: 0;
  padding: 8px 9px;
  border-radius: 6px;
  background: var(--surface);
}

.workflow-run-card-meta span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
  text-transform: uppercase;
}

.workflow-run-card-meta strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 540;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-form {
  padding: 14px;
}

.workflow-weekdays,
.workflow-strategy-picker {
  padding-top: 10px;
}

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

.workflow-strategy-option {
  align-items: flex-start;
  min-height: 58px;
  padding: 9px 10px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.workflow-strategy-option input {
  margin-top: 3px;
}

.workflow-strategy-option strong,
.workflow-strategy-option small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-strategy-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-transform: none;
}

.workflow-health-list {
  grid-template-columns: 1fr;
}

.workflow-scan-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workflow-scan-link-list a {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 11.5px;
  text-decoration: none;
}

.table-wrap > .workflow-runs-table {
  min-width: 860px;
}

.panel-note {
  padding: 12px;
}

.system-metrics {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.system-overview {
  align-items: stretch;
}

.resource-card-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.resource-card-body .status-list {
  margin: -12px;
  margin-top: 0;
}

.usage-meter {
  height: 9px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-alt);
}

.usage-meter span {
  display: block;
  width: var(--usage, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.usage-meter-warn span {
  background: var(--amber);
}

.usage-meter-bad span {
  background: var(--red);
}

.disk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 12px;
}

.disk-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.disk-card-head,
.disk-card-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.disk-card-head strong,
.disk-card-head span {
  display: block;
}

.disk-card-head > div span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.disk-card-foot {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.admin-form-panel {
  width: min(680px, calc(100vw - 24px));
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: -16px 0 36px rgba(0, 0, 0, 0.24);
  position: fixed;
  inset: 0 0 0 auto;
  overflow: hidden;
}

.admin-form-panel-wide {
  width: min(860px, calc(100vw - 24px));
}

.admin-form-panel[open] {
  display: flex;
  flex-direction: column;
  animation: admin-panel-in 170ms ease-out;
}

.admin-form-panel::backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(2px);
}

.admin-form-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
}

.admin-form-panel-head h2 {
  margin: 2px 0 0;
}

.admin-form-panel-body {
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
}

.admin-form-panel-body .grid-form,
.admin-form-panel-body .stack-form {
  align-content: start;
}

@keyframes admin-panel-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.criteria-section {
  margin: 4px 0 0;
  padding: 12px 0 0;
  border: 0;
}

.criteria-section legend {
  padding: 0 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

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

label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

input[type="text"],
input[type="search"],
input[type="url"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
select,
textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--control-line);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--ink);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.span-2 {
  grid-column: span 2;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.checkline span {
  margin: 0;
}

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

.automation-weekdays {
  padding-top: 10px;
}

.panel-foot-actions {
  padding: 10px 14px;
  background: var(--surface-soft);
  text-align: right;
}

.panel-foot-actions a {
  font-size: 12px;
  font-weight: 500;
}

.field-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

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

.schedule-timezone-hint {
  display: block;
  margin-top: 6px;
  line-height: 1.35;
}

.schedule-zone-token {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent-dark);
  font-size: 10px;
  font-style: normal;
  font-weight: 520;
  text-decoration: none;
}

.provider-config {
  display: grid;
  gap: 12px;
}

.provider-panel {
  display: grid;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.provider-panel[hidden] {
  display: none;
}

.provider-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

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

.credential-grid {
  display: grid;
  gap: 10px;
}

.credential-fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
}

.credential-fieldset legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.auth-panel {
  width: min(420px, 100%);
  margin: 56px auto;
}

.form-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: end;
  justify-content: flex-end;
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 10px;
  background: linear-gradient(180deg, rgba(18, 23, 34, 0.82), var(--surface));
}

.flash {
  margin-bottom: 16px;
  padding: 9px 11px;
  border-radius: 6px;
  border: 1px solid var(--panel-line);
  font-weight: 500;
}

.flash-notice {
  border-color: rgba(94, 234, 212, 0.35);
  background: rgba(94, 234, 212, 0.1);
  color: var(--accent-dark);
}

.flash-alert {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
}

.summary,
.json-block {
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  background: var(--surface-soft);
}

.json-block {
  max-height: 520px;
}

@media (max-width: 900px) {
  .admin-frame,
  .dashboard-grid,
  .reports-ops-grid,
  .reports-workbench-grid,
  .workflow-command-grid,
  .workflow-detail-grid,
  .workflow-command-strip,
  .workflow-operating-grid,
  .scan-command-grid,
  .scanner-layout,
  .activity-grid,
  .instrument-workbench,
  .instrument-detail-grid {
    display: block;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 0;
    box-shadow: 0 1px 0 rgba(148, 163, 184, 0.06);
  }

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

  .topbar,
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .metric-grid-small,
  .reports-summary-grid,
  .workflow-summary-grid,
  .recent-report-summary,
  .report-flow-list,
  .reports-type-grid,
  .opportunity-metrics,
  .workflow-grid,
  .disk-grid,
  .split,
  .activity-grid,
  .grid-form,
  .backtest-setup-grid,
  .backtest-analysis-grid,
  .backtest-workbench,
  .backtest-form-grid,
  .backtest-form-grid-secondary,
  .criteria-grid,
  .provider-field-grid,
  .quick-scan-grid,
  .scan-form-grid,
  .dashboard-metrics,
  .scanner-summary,
  .inventory-list {
    grid-template-columns: 1fr;
  }

  .dashboard-side,
  .scanner-side,
  .instrument-command-column {
    margin-top: var(--section-gap);
  }

  .instrument-tv-chart {
    height: 420px;
  }

  .tradingview-frame {
    min-height: 350px;
  }

  .forecast-chart-svg {
    min-height: 300px;
  }

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

  .scan-candidate-head,
  .candidate-head-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .candidate-head-actions {
    min-width: 0;
  }

  .scan-candidate-card .candidate-head-actions,
  .opportunity-queue-card .candidate-head-actions {
    align-items: center;
    flex-direction: row;
    justify-content: flex-start;
    max-width: 100%;
  }

  .scan-candidate-grid,
  .opportunity-queue-grid {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    padding: 16px 12px 44px;
  }

  .pagination-bar,
  .pagination-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-page {
    text-align: center;
  }

  .instrument-panel-tools,
  .instrument-search-form {
    width: 100%;
  }

  .instrument-panel-tools {
    align-items: stretch;
    justify-content: stretch;
  }

  .instrument-search-form {
    grid-template-columns: 1fr;
  }

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

  .admin-form-panel,
  .admin-form-panel-wide {
    width: 100vw;
    max-width: 100vw;
  }

  .span-2 {
    grid-column: span 1;
  }

.backtest-run-form,
.time-machine-form {
  padding: 9px;
}

.backtest-symbol-field input {
  min-height: 40px;
  font-size: 18px;
}

.backtest-forecast-chart {
  min-height: 0;
}

.time-machine-date-card strong {
  font-size: 17px;
}

.time-machine-ticks {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.time-machine-ticks::-webkit-scrollbar {
  display: none;
}

.time-machine-tick {
  flex: 0 0 auto;
}

.table-wrap > .backtest-history-table {
  min-width: 0;
}

.backtest-history-table thead {
  display: none;
}

.backtest-history-table,
.backtest-history-table tbody,
.backtest-history-table tr,
.backtest-history-table td {
  display: block;
  width: 100%;
}

.backtest-history-table tr {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.backtest-history-table tr:last-child {
  border-bottom: 0;
}

.backtest-history-table td {
  display: grid;
  grid-template-columns: minmax(76px, 0.34fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 5px 0;
  border-bottom: 0;
  text-align: left;
  white-space: normal;
}

.backtest-history-table td::before {
  content: attr(data-label);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  line-height: 1.35;
  text-transform: uppercase;
}

.backtest-history-table .mobile-primary-cell {
  display: block;
  padding-bottom: 8px;
}

.backtest-history-table .mobile-primary-cell::before,
.backtest-history-table td[colspan]::before {
  display: none;
}

.backtest-history-table td.actions {
  display: grid;
  grid-template-columns: minmax(76px, 0.34fr) minmax(0, 1fr);
}

.backtest-history-table td.actions::before {
  grid-column: 1;
}

.backtest-history-table td.actions > * {
  grid-column: 2;
  justify-self: start;
}

  th,
  td {
    padding: 9px;
  }
}

@media (max-width: 900px) {
  :root {
    --content-gutter: 10px;
    --section-gap: 12px;
  }

  html,
  body,
  .admin-body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 12.5px;
  }

  .admin-frame {
    min-height: auto;
  }

  .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    gap: 8px;
    padding: 8px 10px 9px;
    background: rgba(9, 13, 19, 0.96);
    backdrop-filter: blur(12px);
  }

  .admin-topbar {
    display: none;
  }

  .sidebar-branding {
    min-height: 28px;
    padding: 0;
    border-bottom: 0;
  }

  .brand-mark {
    width: 24px;
    height: 24px;
  }

  .side-nav {
    display: flex;
    gap: 6px;
    min-height: 0;
    margin: 0 -10px;
    padding: 0 10px 3px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .side-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-section {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
  }

  .nav-section > span {
    display: none;
  }

  .side-nav a,
  .sidebar-account a {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 10px;
    border-color: var(--line);
    background: var(--surface-soft);
  }

  .sidebar-account {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 0;
    padding: 0;
    border-top: 0;
  }

  .sidebar-account .account-summary {
    display: none;
  }

  .sidebar-account strong {
    max-width: 58vw;
  }

  .account-actions {
    flex: 0 0 auto;
  }

  .admin-main {
    width: 100%;
    overflow-x: hidden;
  }

  .admin-shell {
    padding: 12px var(--content-gutter) 36px;
  }

  .page-head {
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
  }

  .page-subtitle {
    max-width: none;
    margin-top: 5px;
  }

  h1 {
    font-size: 22px;
  }

  .page-actions,
  .panel-actions {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .page-actions::-webkit-scrollbar,
  .panel-actions::-webkit-scrollbar {
    display: none;
  }

  .page-actions > *,
  .page-actions .button,
  .page-actions form,
  .panel-actions > *,
  .panel-actions .button {
    flex: 0 0 auto;
  }

  .button,
  input[type="submit"].button {
    min-height: 34px;
    white-space: nowrap;
  }

  .metric-grid,
  .metric-grid-small,
  .dashboard-metrics,
  .opportunity-metrics,
  .scanner-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric {
    min-height: 64px;
    padding: 10px;
  }

  .metric strong,
  .scanner-summary strong,
  .inventory-list strong {
    margin-top: 6px;
    font-size: 18px;
  }

  .scanner-summary {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .scanner-summary div {
    min-height: 62px;
    border: 1px solid var(--panel-line);
    border-radius: 8px;
    background: var(--surface);
  }

  .panel,
  .metric {
    box-shadow: none;
  }

  .panel-head,
  .panel-title-row {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    padding: 11px 12px;
  }

  .panel-head > .status,
  .panel-title-row > .status {
    flex: 0 0 auto;
  }

  .table-wrap {
    max-height: min(68dvh, 620px);
    overflow: auto;
  }

  .admin-list-table-wrap,
  .instrument-table-wrap {
    max-height: min(66dvh, 600px);
  }

  .table-wrap > .mobile-card-table {
    min-width: 0 !important;
    table-layout: auto;
  }

  .mobile-card-table thead,
  .mobile-card-table colgroup {
    display: none;
  }

  .mobile-card-table,
  .mobile-card-table tbody,
  .mobile-card-table tr,
  .mobile-card-table td {
    display: block;
    width: 100%;
  }

  .mobile-card-table tr {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
  }

  .mobile-card-table tr:last-child {
    border-bottom: 0;
  }

  .mobile-card-table td {
    display: grid;
    grid-template-columns: minmax(84px, 0.42fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 6px 0;
    border-bottom: 0;
    text-align: left;
    white-space: normal;
  }

  .mobile-card-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    line-height: 1.35;
    text-transform: uppercase;
  }

  .mobile-card-table td:not(.mobile-primary-cell) > br {
    display: none;
  }

  .mobile-card-table td:not(.mobile-primary-cell) > a,
  .mobile-card-table td:not(.mobile-primary-cell) > code,
  .mobile-card-table td:not(.mobile-primary-cell) > strong,
  .mobile-card-table td:not(.mobile-primary-cell) > span,
  .mobile-card-table td:not(.mobile-primary-cell) > form,
  .mobile-card-table td:not(.mobile-primary-cell) > .tooltip,
  .mobile-card-table td:not(.mobile-primary-cell) > .opportunity-cell-stack,
  .mobile-card-table td:not(.mobile-primary-cell) > .opportunity-mini-grid,
  .mobile-card-table td:not(.mobile-primary-cell) > .opportunity-time-stack {
    grid-column: 2;
  }

  .mobile-card-table .table-subtext,
  .mobile-card-table td:not(.mobile-primary-cell) > .empty,
  .mobile-card-table td:not(.mobile-primary-cell) > .status,
  .mobile-card-table td:not(.mobile-primary-cell) > .tooltip,
  .mobile-card-table td:not(.mobile-primary-cell) > form {
    grid-column: 2 !important;
    justify-self: start;
  }

  .mobile-card-table .mobile-primary-cell {
    display: block;
    padding-bottom: 9px;
  }

  .mobile-card-table .mobile-primary-cell::before,
  .mobile-card-table td[colspan]::before {
    display: none;
  }

  .mobile-card-table td[colspan] {
    display: block;
  }

  .mobile-card-table td.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: stretch;
  }

  .mobile-card-table td.actions::before {
    flex: 0 0 84px;
  }

  .mobile-card-table td.actions > * {
    margin-left: 0;
  }

  .mobile-card-table td.actions .scanner-action-row {
    flex: 1 1 0;
    justify-content: flex-start;
  }

  .mobile-card-table td.actions form {
    display: inline-flex;
  }

  .symbol-chip-list {
    max-height: 80px;
  }

  .opportunity-mini-grid,
  .opportunity-mini-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .instrument-page-head {
    align-items: flex-start;
  }

  .instrument-title-line {
    gap: 6px;
  }

  .instrument-tv-chart {
    height: 320px;
    padding: 0 8px 8px;
  }

  .tradingview-frame {
    min-height: 260px;
  }

  .instrument-forecast-chart {
    padding: 8px;
  }

  .forecast-chart-svg {
    min-height: 260px;
  }

  .chart-range-options,
  .forecast-horizon-options {
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .chart-range-options::-webkit-scrollbar,
  .forecast-horizon-options::-webkit-scrollbar {
    display: none;
  }

  .chart-range-option,
  .forecast-horizon-option {
    flex: 0 0 auto;
  }

  .forecast-option-form,
  .preset-run-form,
  .strategy-target-form {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .scan-candidate-card,
  .opportunity-queue-card {
    gap: 11px;
    padding: 12px;
  }

  .candidate-contract-title h3 {
    font-size: 17px;
  }

  .candidate-subline,
  .candidate-head-actions {
    gap: 6px;
  }

  .scan-candidate-card .candidate-head-actions,
  .opportunity-queue-card .candidate-head-actions {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .candidate-metric {
    min-height: auto;
    padding: 10px;
  }

  .contract-scenario {
    grid-template-columns: minmax(54px, 0.8fr) minmax(58px, auto);
    gap: 6px;
  }

  .contract-scenario > small {
    grid-column: 1 / -1;
  }

  .indicator-row,
  .snapshot-row,
  .status-row {
    gap: 10px;
    padding: 9px 10px;
  }

  .indicator-row {
    grid-template-columns: 1fr;
  }

  .indicator-row strong {
    justify-items: start;
    text-align: left;
  }

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

  .inventory-list div {
    padding: 10px;
  }

  .admin-form-panel,
  .admin-form-panel-wide {
    width: 100vw;
    max-width: 100vw;
    border-left: 0;
  }

  .admin-form-panel-head,
  .admin-form-panel-body {
    padding: 12px;
  }
}

@media (max-width: 360px) {
  .metric-grid,
  .metric-grid-small,
  .dashboard-metrics,
  .opportunity-metrics,
  .scanner-summary,
  .inventory-list,
  .workflow-status-strip {
    grid-template-columns: 1fr;
  }

  .sidebar-account {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .mobile-card-table td {
    grid-template-columns: minmax(76px, 0.38fr) minmax(0, 1fr);
    gap: 8px;
  }
}

@media (max-width: 900px) {
  .admin-sidebar {
    gap: 6px;
    padding: 8px 10px;
  }

  .sidebar-branding {
    justify-content: flex-start;
  }

  .sidebar-account {
    min-height: 0;
    justify-content: flex-start;
  }

  .account-actions {
    gap: 8px;
  }

  .account-actions a,
  .sidebar-link-button {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    background: var(--surface-soft);
  }

  .admin-shell {
    padding-top: 10px;
  }

  .page-head {
    display: grid;
    gap: 10px;
  }

  h1 {
    font-size: 20px;
  }

  h2 {
    font-size: 13.5px;
  }

  .page-subtitle {
    font-size: 12.5px;
    line-height: 1.35;
  }

  .page-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    padding-bottom: 0;
  }

  .page-actions > *,
  .page-actions .button,
  .page-actions form,
  .page-actions form .button,
  .page-actions input[type="submit"].button {
    width: 100%;
    min-width: 0;
  }

  .page-actions .button,
  .page-actions input[type="submit"].button {
    white-space: normal;
  }

  .metric {
    min-height: 58px;
    padding: 9px 10px;
  }

  .metric strong,
  .scanner-summary strong,
  .inventory-list strong {
    margin-top: 5px;
    font-size: 17px;
  }

  .panel {
    margin-bottom: 10px;
  }

  .panel-head,
  .panel-title-row {
    padding: 10px 11px;
  }

  .backtest-run-form,
  .time-machine-form {
    padding: 9px;
  }

  .backtest-symbol-field input {
    min-height: 40px;
    font-size: 18px;
  }

  .time-machine-date-card strong {
    font-size: 17px;
  }

  .time-machine-ticks {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .time-machine-ticks::-webkit-scrollbar {
    display: none;
  }

  .time-machine-tick {
    flex: 0 0 auto;
  }

  .panel-actions {
    justify-content: flex-start;
    overflow: visible;
  }

  .table-wrap {
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .table-wrap:has(> .mobile-card-table) {
    contain: none;
    overflow: visible;
  }

  .mobile-card-table tr {
    padding: 8px 10px;
  }

  .mobile-card-table td {
    grid-template-columns: minmax(70px, 0.32fr) minmax(0, 1fr);
    gap: 8px;
    padding: 5px 0;
    font-size: 12.5px;
  }

  .mobile-card-table td::before {
    font-size: 9.5px;
  }

  .mobile-card-table .mobile-primary-cell {
    padding-bottom: 7px;
  }

  .mobile-card-table .mobile-primary-cell,
  .mobile-card-table .mobile-primary-cell a,
  .mobile-card-table .mobile-primary-cell strong {
    font-size: 14px;
    line-height: 1.25;
  }

  .mobile-card-table td.actions {
    display: grid;
    grid-template-columns: minmax(70px, 0.32fr) minmax(0, 1fr);
    justify-content: stretch;
  }

  .mobile-card-table td.actions::before {
    grid-column: 1;
    flex-basis: auto;
  }

  .mobile-card-table td.actions > * {
    grid-column: 2;
    justify-self: start;
  }

  .mobile-card-table td.actions form {
    grid-column: 2;
  }

  .mobile-card-table code,
  .mobile-card-table a,
  .mobile-card-table .empty {
    overflow-wrap: anywhere;
  }

  .mobile-card-table .status {
    white-space: normal;
  }

  .pagination-bar {
    padding: 9px 10px;
  }

  .pagination-actions {
    gap: 6px;
  }

  .admin-form-panel,
  .admin-form-panel-wide {
    height: 100dvh;
  }
}

@media (max-width: 1180px) {
  .command-summary-grid,
  .reports-summary-grid,
  .workflow-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .reports-ops-grid {
    grid-template-columns: 1fr;
  }

  .report-flow-list,
  .reports-type-grid,
  .reports-health-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-command-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

@media (max-width: 900px) {
  .mobile-nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .admin-sidebar:not(.nav-open) .side-nav,
  .admin-sidebar:not(.nav-open) .sidebar-account {
    display: none;
  }

  .admin-sidebar.nav-open .side-nav {
    display: flex;
  }

  .admin-sidebar.nav-open .sidebar-account {
    display: flex;
  }

  .mobile-actions-toggle {
    display: inline-flex;
    width: max-content;
  }

  .page-head .page-actions {
    display: none;
  }

  .page-head.actions-open .page-actions {
    display: grid;
  }

  .command-summary-grid,
  .reports-summary-grid,
  .workflow-summary-grid,
  .workflow-status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .workflow-show-page.trading-viewport-page {
    display: block;
    height: auto;
    overflow: visible;
  }

  .workflow-command-strip {
    overflow: visible;
  }

  .workflow-command-copy,
  .workflow-status-item {
    padding: 11px 12px;
  }

  .workflow-operating-grid > .panel {
    margin-bottom: 8px;
  }

  .workflow-card-meta,
  .workflow-run-card-meta,
  .workflow-strategy-grid {
    grid-template-columns: 1fr;
  }

  .workflow-model-panel,
  .workflow-run-health-panel,
  .workflow-runs-side-panel {
    margin-top: 8px;
  }

  .workflow-command-grid-primary {
    min-height: auto;
  }

  .workflow-command-grid-primary .workflow-card-list,
  .workflow-run-list {
    max-height: none;
    overflow: visible;
  }

  .report-flow-list,
  .reports-type-grid,
  .reports-health-list {
    grid-template-columns: 1fr;
  }

  .command-summary-card,
  .report-summary-card {
    min-height: 58px;
    padding: 9px 10px;
  }

  .command-summary-card strong,
  .report-summary-card strong,
  .instrument-backtest-summary strong {
    font-size: 17px;
  }

  .dashboard-command-grid {
    display: block;
  }

  .dashboard-main-stack,
  .dashboard-side-stack {
    gap: 8px;
  }

  .dashboard-main-stack {
    margin-bottom: 8px;
  }

  .reports-workbench-grid > .panel + .panel {
    margin-top: 8px;
  }

  .reports-index-page,
  .reports-list-panel {
    min-height: auto;
  }

  .reports-list-table-wrap {
    max-height: none;
    overflow: visible;
  }

  .reports-context-list {
    grid-template-columns: 1fr;
  }

  .attention-list,
  .compact-list {
    padding: 6px;
  }

  .attention-row,
  .compact-row {
    padding: 8px;
  }

  .panel-foot-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .command-summary-grid,
  .reports-summary-grid,
  .workflow-summary-grid,
  .instrument-backtest-summary {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 901px) {
  .button.mobile-actions-toggle {
    display: none;
  }
}

/* Dense admin screens read better with restrained weights and clearer contrast. */
.admin-body h1,
.admin-body h2,
.admin-body .candidate-contract-title h3 {
  font-weight: 480;
}

.admin-body .brand,
.admin-body .brand-lockup strong,
.admin-body .brand-lockup small,
.admin-body .environment,
.admin-body .nav-section > span,
.admin-body .side-nav a::before,
.admin-body .sidebar-account span:not(.account-avatar),
.admin-body .account-actions a,
.admin-body .sidebar-link-button,
.admin-body .admin-topbar-context span,
.admin-body .admin-topbar-link,
.admin-body .admin-topbar-chip,
.admin-body .eyebrow,
.admin-body th,
.admin-body .pagination-count,
.admin-body .pagination-page,
.admin-body .status,
.admin-body .tooltip-trigger,
.admin-body .chart-range-option,
.admin-body .time-machine-tick,
.admin-body .button,
.admin-body input[type="submit"].button {
  font-weight: 450;
}

.admin-body .side-nav a,
.admin-body .sidebar-account strong,
.admin-body .admin-topbar-context strong,
.admin-body .stock-autocomplete-option span,
.admin-body .stock-suggestion-chip span,
.admin-body .estimate-card dd {
  font-weight: 400;
}

.admin-body .metric strong,
.admin-body .command-summary-card strong,
.admin-body .instrument-backtest-summary strong,
.admin-body .scanner-summary strong,
.admin-body .attention-row em,
.admin-body .compact-row em,
.admin-body .backtest-symbol-field input,
.admin-body .run-fact-strip strong,
.admin-body .quant-kpi strong,
.admin-body .quant-model-readout strong,
.admin-body .quant-level-grid strong,
.admin-body .pivot-level-grid strong,
.admin-body .pivot-selector-head strong,
.admin-body .pivot-select-row strong,
.admin-body .quant-settings-grid strong,
.admin-body .time-machine-date-card strong,
.admin-body .estimate-card-head strong,
.admin-body .snapshot-row strong,
.admin-body .snapshot-row-emphasis strong,
.admin-body .indicator-row strong,
.admin-body .forecast-mini strong,
.admin-body .forecast-card-head strong,
.admin-body .candidate-score strong,
.admin-body .candidate-metric strong,
.admin-body .contract-scenario b,
.admin-body .contract-scenario strong {
  font-weight: 480;
}

.admin-body .metric span,
.admin-body .command-summary-card span,
.admin-body .instrument-backtest-summary span,
.admin-body .scanner-summary span,
.admin-body .attention-row strong,
.admin-body .compact-row strong,
.admin-body .stock-autocomplete-option strong,
.admin-body .stock-suggestion-head,
.admin-body .stock-suggestion-chip strong,
.admin-body .run-fact-strip > span,
.admin-body .quant-kpi span,
.admin-body .quant-model-readout span,
.admin-body .quant-level-grid span,
.admin-body .pivot-level-grid span,
.admin-body .quant-settings-grid span,
.admin-body .pivot-selector-head span,
.admin-body .pivot-select-row span,
.admin-body .quant-settings-panel summary,
.admin-body .prediction-settings-disclosure summary,
.admin-body .time-machine-date-card span,
.admin-body .estimate-card-head span,
.admin-body .estimate-card dt,
.admin-body .snapshot-row span,
.admin-body .indicator-row span,
.admin-body .candidate-contract-title h3 span,
.admin-body .candidate-score small,
.admin-body .candidate-metric span,
.admin-body .forecast-chart-tooltip {
  font-weight: 430;
}

.market-calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.34fr);
  gap: var(--section-gap);
  align-items: start;
}

.market-calendar-side {
  display: grid;
  gap: var(--section-gap);
}

.market-calendar-filters {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 0.7fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.market-calendar-filters label,
.compact-form label {
  display: grid;
  gap: 5px;
}

.market-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.market-calendar-weekday {
  padding: 4px 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

.market-calendar-day {
  min-height: 112px;
  padding: 7px;
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 7px;
  background: rgba(8, 15, 24, 0.74);
}

.market-calendar-day.muted {
  opacity: 0.52;
}

.market-calendar-day.today {
  border-color: rgba(94, 234, 212, 0.36);
  background: rgba(15, 118, 110, 0.11);
}

.market-calendar-date {
  color: var(--ink);
  font-size: 12px;
  font-weight: 480;
}

.market-calendar-events {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

.market-event-chip {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 5px 6px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--ink);
  text-decoration: none;
}

.market-event-chip span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.market-event-chip strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 480;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-event-fomc {
  background: rgba(147, 197, 253, 0.12);
}

.market-event-earnings {
  background: rgba(94, 234, 212, 0.12);
}

.market-event-regime_shift {
  background: rgba(251, 191, 36, 0.12);
}

.market-event-more {
  color: var(--muted);
  font-size: 11px;
}

.market-sync-stack,
.market-event-list,
.market-regime-list {
  display: grid;
  gap: 8px;
}

.compact-form {
  padding: 8px;
  border-radius: 7px;
  background: rgba(8, 15, 24, 0.5);
}

.market-event-list article,
.market-regime-list article,
.event-context-list article {
  display: grid;
  gap: 3px;
  padding: 8px;
  border-radius: 7px;
  background: rgba(8, 15, 24, 0.58);
}

.market-event-list strong,
.market-regime-list strong,
.event-context-list strong {
  font-weight: 480;
}

.market-event-list small,
.market-regime-list small,
.event-context-list small {
  color: var(--muted);
}

.event-context-panel {
  display: grid;
  gap: 8px;
}

.event-context-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.event-context-summary div {
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 7px;
  background: rgba(8, 15, 24, 0.58);
}

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

.event-context-summary strong {
  font-size: 16px;
  font-weight: 480;
}

@media (max-width: 980px) {
  .market-calendar-layout,
  .market-calendar-filters {
    grid-template-columns: 1fr;
  }

  .market-calendar-grid {
    display: block;
  }

  .market-calendar-weekday {
    display: none;
  }

  .market-calendar-day {
    min-height: 0;
    margin-bottom: 6px;
  }

  .market-calendar-day.muted {
    display: none;
  }

  .event-context-summary {
    grid-template-columns: 1fr;
  }
}

.scan-workbench-head .page-subtitle {
  max-width: none;
}

.scan-workbench-telemetry {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: var(--section-gap);
}

.scan-workbench-telemetry > div {
  display: grid;
  gap: 6px;
  min-height: 64px;
  padding: 11px 12px;
  border: 1px solid rgba(86, 104, 124, 0.28);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.scan-workbench-telemetry span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
  line-height: 1.25;
  text-transform: uppercase;
}

.scan-workbench-telemetry strong {
  display: flex;
  align-items: end;
  min-width: 0;
  font-size: 19px;
  font-weight: 520;
  line-height: 1;
}

.scan-workbench-telemetry strong .status {
  font-size: 11px;
}

.scan-workbench-panel,
.scan-secondary-grid .panel {
  margin-bottom: var(--section-gap);
}

.scan-workbench-panel-head {
  align-items: flex-start;
}

.scan-workbench-headline {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.table-wrap > .scan-workbench-table {
  min-width: 1010px;
}

.table-wrap > .scan-stock-table {
  min-width: 860px;
}

.scan-workbench-table {
  table-layout: fixed;
}

.scan-workbench-table th:nth-child(1) {
  width: 16%;
}

.scan-workbench-table th:nth-child(2) {
  width: 21%;
}

.scan-workbench-table th:nth-child(3) {
  width: 12%;
}

.scan-workbench-table th:nth-child(4) {
  width: 12%;
}

.scan-workbench-table th:nth-child(5) {
  width: 22%;
}

.scan-workbench-table th:nth-child(6) {
  width: 9%;
}

.scan-workbench-table th:nth-child(7) {
  width: 8%;
}

.scan-workbench-table thead th,
.scan-stock-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.scan-workbench-row td,
.scan-stock-table td {
  vertical-align: top;
}

.scan-workbench-row:hover td,
.scan-stock-table tr:hover td {
  background: rgba(148, 163, 184, 0.035);
}

.scan-forecast-cell {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.scan-forecast-cell strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 520;
  line-height: 1.25;
}

.scan-forecast-cell .forecast-strip {
  width: min(100%, 230px);
  min-width: 0;
}

.scan-score-cell strong {
  font-size: 18px;
}

.scan-workbench-detail-row > td {
  padding: 0 12px 10px;
  background: rgba(8, 15, 24, 0.28);
}

.scan-workbench-detail-row:hover > td {
  background: rgba(8, 15, 24, 0.34);
}

.candidate-detail-panel {
  border: 1px solid rgba(86, 104, 124, 0.24);
  border-radius: 8px;
  background: rgba(10, 18, 29, 0.72);
}

.candidate-detail-panel summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 12px;
  color: var(--muted);
  cursor: pointer;
}

.candidate-detail-panel summary::marker {
  color: var(--muted);
}

.candidate-detail-panel summary span {
  font-size: 10px;
  font-weight: 560;
  text-transform: uppercase;
}

.candidate-detail-panel summary strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 520;
}

.candidate-detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) repeat(2, minmax(190px, 1fr));
  gap: 8px;
  padding: 0 10px 10px;
}

.candidate-detail-card {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 10px;
  border-radius: 7px;
  background: rgba(8, 15, 24, 0.58);
}

.candidate-detail-card > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
  text-transform: uppercase;
}

.candidate-detail-card > strong {
  font-size: 16px;
  font-weight: 520;
  line-height: 1.2;
}

.candidate-detail-card small {
  color: var(--muted);
  line-height: 1.35;
}

.candidate-detail-card .contract-scenario {
  grid-template-columns: minmax(62px, 1fr) auto minmax(90px, 0.9fr);
  gap: 7px;
}

.scan-secondary-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1.15fr) minmax(320px, 1fr) minmax(280px, 0.85fr);
  gap: var(--section-gap);
  align-items: start;
}

.scan-secondary-grid .panel {
  margin-bottom: 0;
}

.scan-json-panel {
  grid-column: 1 / -1;
}

.scan-delivery-compact {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.scan-delivery-compact + .scan-delivery-compact {
  margin-top: 8px;
}

.scan-delivery-compact .form-actions {
  margin-top: 0;
}

.scan-definition-grid {
  display: grid;
  gap: 6px;
}

.scan-delivery-panel .scan-definition-grid {
  margin-top: 10px;
}

.scan-definition-row {
  display: grid;
  grid-template-columns: minmax(108px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 9px;
  border-radius: 7px;
  background: var(--surface-alt);
}

.scan-definition-row span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
  text-transform: uppercase;
}

.scan-definition-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 500;
}

.scan-symbols-details,
.scan-json-details {
  margin-top: 10px;
}

.scan-symbols-details summary,
.scan-json-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  background: var(--surface-alt);
  color: var(--muted);
  cursor: pointer;
}

.scan-json-details summary span {
  display: grid;
  gap: 3px;
}

.scan-json-details summary strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 520;
}

.scan-json-details .json-block {
  max-height: 360px;
  margin-top: 10px;
  overflow: auto;
}

.scan-empty-state {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 7px;
  background: var(--surface-alt);
}

.scan-empty-state strong {
  font-weight: 520;
}

.scan-empty-state span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 1180px) {
  .scan-workbench-telemetry {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .scan-secondary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .scan-errors-panel,
  .scan-json-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .scan-workbench-telemetry,
  .scan-secondary-grid,
  .candidate-detail-grid,
  .scan-delivery-compact {
    grid-template-columns: 1fr;
  }

  .scan-workbench-telemetry > div {
    min-height: 58px;
  }

  .scan-workbench-panel-head,
  .scan-workbench-headline,
  .candidate-detail-panel summary {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .candidate-detail-panel summary {
    flex-direction: column;
  }

  .scan-workbench-detail-row {
    padding: 0;
  }

  .scan-workbench-detail-row > td {
    padding: 0 0 10px;
  }

  .scan-workbench-table .scan-workbench-detail-row {
    border-bottom: 1px solid var(--line-soft);
  }

  .scan-workbench-detail-row td[colspan] {
    display: block;
  }

  .candidate-detail-card .contract-scenario {
    grid-template-columns: minmax(70px, 1fr) auto;
  }

  .candidate-detail-card .contract-scenario small:last-child {
    grid-column: 1 / -1;
  }

  .scan-definition-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
