:root {
  color-scheme: dark;
  --font-body: "Open Sans", Arial, sans-serif;
  --font-title: "Montserrat", Arial, sans-serif;
  --page: #07111f;
  --page-soft: #0b1525;
  --surface: #101b2d;
  --surface-alt: #121f34;
  --surface-strong: #16243b;
  --text: #f5f8ff;
  --text-soft: #d9e2f1;
  --muted: #a9b6cb;
  --muted-2: #7f8da6;
  --line: rgba(169, 182, 203, 0.18);
  --line-strong: rgba(169, 182, 203, 0.3);
  --accent: #6574f7;
  --accent-soft: rgba(101, 116, 247, 0.14);
  --good: #31c48d;
  --good-soft: rgba(49, 196, 141, 0.12);
  --watch: #ffd166;
  --watch-soft: rgba(255, 209, 102, 0.12);
  --risk: #ff7a8a;
  --risk-soft: rgba(255, 122, 138, 0.12);
  --info: #85e6f0;
  --shell: 1440px;
  --gutter: max(18px, calc((100vw - var(--shell)) / 2));
  --radius: 6px;
  --radius-large: 8px;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.2);
}

html[data-theme="light"] {
  color-scheme: light;
  --page: #f4f7fb;
  --page-soft: #eaf0f7;
  --surface: #ffffff;
  --surface-alt: #f7f9fc;
  --surface-strong: #edf2f8;
  --text: #101827;
  --text-soft: #27344a;
  --muted: #596981;
  --muted-2: #718098;
  --line: rgba(42, 58, 84, 0.13);
  --line-strong: rgba(42, 58, 84, 0.22);
  --accent-soft: rgba(101, 116, 247, 0.1);
  --good-soft: rgba(26, 146, 100, 0.1);
  --watch: #9c7100;
  --watch-soft: rgba(202, 143, 0, 0.1);
  --risk: #c13f54;
  --risk-soft: rgba(193, 63, 84, 0.1);
  --shadow: 0 18px 46px rgba(30, 48, 76, 0.12);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  padding-top: 76px;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.shell { width: min(var(--shell), calc(100% - 40px)); margin-inline: auto; }

:focus-visible {
  outline: 3px solid rgba(133, 230, 240, 0.72);
  outline-offset: 3px;
}

.top-shell {
  position: fixed;
  z-index: 1000;
  inset: 0 0 auto;
  height: 76px;
  background: #061224;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.16);
}
html[data-theme="light"] .top-shell {
  background: #fff;
  border-bottom-color: #e3e9f3;
}
.site-nav, .nav-inner { height: 100%; }
.nav-inner { display: flex; align-items: center; gap: 28px; }
.brand { flex: 0 0 auto; display: inline-flex; align-items: center; }
.brand img { width: 250px; height: auto; }
html[data-theme="light"] .brand img,
html[data-theme="light"] .footer-brand img { filter: invert(1); }
.nav-links {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 27px;
}
.nav-links a {
  position: relative;
  padding: 28px 0 25px;
  color: #f2f6ff;
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
html[data-theme="light"] .nav-links a { color: #172033; }
.nav-links a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 10px;
  left: 0;
  height: 2px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 160ms ease, transform 160ms ease;
}
.nav-links a:hover::after, .nav-links a.active::after { opacity: 0.45; transform: scaleX(1); }
.nav-links a.active::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 4px;
  background: var(--accent);
}
.nav-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 12px; }
.button {
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.button-primary { background: var(--accent); color: #fff; }
.button-outline { color: #fff; border-color: rgba(255, 255, 255, 0.2); background: transparent; }
html[data-theme="light"] .button-outline { color: #101827; border-color: #ccd6e5; background: #fff; }
.theme-toggle {
  width: 72px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  color: #c7d2e5;
  background: #0d1626;
  cursor: pointer;
}
html[data-theme="light"] .theme-toggle { color: #526078; background: #eef2f8; border-color: #d2dbe8; }
.theme-toggle i { position: relative; z-index: 2; font-size: 13px; }
.theme-knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 180ms ease;
}
html[data-theme="light"] .theme-knob { transform: translateX(36px); }
.nav-menu-button { display: none; }

.product-hero { background: #061224; border-bottom: 1px solid rgba(169, 182, 203, 0.18); }
.product-hero-inner {
  min-height: 210px;
  padding-top: 46px;
  padding-bottom: 42px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
}
.eyebrow, .section-kicker, .context-label {
  margin: 0;
  color: #a9b6cb;
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.product-hero h1 {
  margin: 12px 0 0;
  color: #fff;
  font-family: var(--font-title);
  font-size: 48px;
  line-height: 1.08;
  letter-spacing: 0;
}
.hero-copy { max-width: 700px; margin: 14px 0 0; color: #b7c4d8; font-size: 18px; }
.hero-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.hero-meta span {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(169, 182, 203, 0.24);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #dce5f4;
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 600;
}
.hero-meta i { color: var(--info); }

.workspace { padding: 28px 0 64px; background: var(--page); }
.status-banner {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 209, 102, 0.46);
  border-radius: var(--radius);
  color: var(--text-soft);
  background: var(--watch-soft);
  font-size: 14px;
}
.status-banner.error { border-color: rgba(255, 122, 138, 0.44); background: var(--risk-soft); }
.context-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line-strong); border-radius: var(--radius-large); overflow: hidden; }
.context-card { min-width: 0; padding: 20px 22px; background: var(--surface); border-right: 1px solid var(--line); }
.context-card:last-child { border-right: 0; }
.context-card strong { display: block; margin-top: 8px; overflow-wrap: anywhere; font-family: var(--font-title); font-size: 24px; line-height: 1.2; }
.context-card strong.good { color: var(--good); }
.context-card strong.watch { color: var(--watch); }
.context-card strong.risk, .context-card strong.review { color: var(--risk); }
.context-card p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; margin-top: 18px; align-items: start; }
.queue-panel, .leadership-panel { min-width: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-large); background: var(--surface); }
.queue-panel { padding: 24px; }
.leadership-panel { position: sticky; top: 94px; padding: 22px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.section-heading h2 { margin: 5px 0 0; font-family: var(--font-title); font-size: 24px; line-height: 1.2; letter-spacing: 0; }
.queue-scope { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.section-heading.compact h2 { font-size: 20px; }
.icon-button, .dialog-close {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-soft);
  background: var(--surface-alt);
  cursor: pointer;
}
.icon-button.loading i { animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.queue-controls { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.stage-filter { display: inline-flex; min-width: 0; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-alt); }
.stage-filter button {
  min-height: 38px;
  padding: 0 13px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.stage-filter button span { margin-left: 5px; color: var(--muted-2); }
.stage-filter button.active { color: #fff; background: var(--accent); }
.stage-filter button.active span { color: #fff; }
.search-control {
  width: min(310px, 100%);
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted-2);
  background: var(--surface-alt);
}
.search-control input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; }
.search-control input::placeholder { color: var(--muted-2); }

.table-shell { margin-top: 18px; overflow-x: auto; border-top: 1px solid var(--line); }
.setup-table { width: 100%; min-width: 1040px; border-collapse: collapse; table-layout: fixed; }
.setup-table th { padding: 12px 10px; color: var(--muted-2); font-family: var(--font-title); font-size: 11px; font-weight: 700; text-align: left; text-transform: uppercase; letter-spacing: 0.06em; }
.setup-table th:nth-child(1) { width: 20%; }
.setup-table th:nth-child(2) { width: 17%; }
.setup-table th:nth-child(3) { width: 10%; }
.setup-table th:nth-child(4) { width: 8%; }
.setup-table th:nth-child(5) { width: 12%; }
.setup-table th:nth-child(6) { width: 14%; }
.setup-table th:nth-child(7) { width: 10%; }
.setup-table th:nth-child(8) { width: 9%; }
.setup-table td { padding: 14px 10px; border-top: 1px solid var(--line); color: var(--text-soft); font-size: 13px; vertical-align: middle; }
.setup-table tbody tr[data-ticker] { cursor: pointer; transition: background 140ms ease; }
.setup-table tbody tr[data-ticker]:hover { background: var(--surface-alt); }
.setup-table tbody tr[data-ticker]:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.setup-identity { min-width: 0; }
.setup-identity strong, .setup-identity span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setup-identity strong { color: var(--text); font-family: var(--font-title); font-size: 14px; }
.setup-identity span { max-width: 210px; margin-top: 3px; color: var(--muted); font-size: 11px; }
.stage-badge, .structure-badge, .risk-badge {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  background: var(--surface-alt);
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.stage-triggered { color: var(--good); border-color: rgba(49, 196, 141, 0.35); background: var(--good-soft); }
.stage-developing { color: var(--info); border-color: rgba(133, 230, 240, 0.32); background: rgba(133, 230, 240, 0.1); }
.stage-under-review { color: var(--watch); border-color: rgba(255, 209, 102, 0.36); background: var(--watch-soft); }
.stage-setup-failed { color: var(--risk); border-color: rgba(255, 122, 138, 0.34); background: var(--risk-soft); }
.structure-intact { color: var(--good); border-color: rgba(49, 196, 141, 0.3); background: var(--good-soft); }
.structure-at-risk { color: var(--watch); border-color: rgba(255, 209, 102, 0.34); background: var(--watch-soft); }
.structure-broken { color: var(--risk); border-color: rgba(255, 122, 138, 0.34); background: var(--risk-soft); }
.state-reason-label { display: block; max-width: 155px; margin-top: 5px; overflow: hidden; color: var(--muted-2); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.risk-low { color: var(--good); border-color: rgba(49, 196, 141, 0.3); background: var(--good-soft); }
.risk-moderate { color: var(--watch); border-color: rgba(255, 209, 102, 0.34); background: var(--watch-soft); }
.risk-elevated { color: var(--risk); border-color: rgba(255, 122, 138, 0.34); background: var(--risk-soft); }
.quality-score { font-family: Consolas, "SFMono-Regular", monospace; color: var(--text); font-size: 17px; font-weight: 700; }
.price-cell { color: var(--text); font-family: Consolas, "SFMono-Regular", monospace; }
.as-of { color: var(--muted); font-size: 12px; }
.loading-row td { height: 160px; color: var(--muted); text-align: center; }
.empty-state { min-height: 180px; padding: 30px; display: grid; place-content: center; text-align: center; }
.empty-state strong { font-family: var(--font-title); }
.empty-state span { margin-top: 6px; color: var(--muted); }
.load-more { width: 100%; min-height: 44px; margin-top: 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text-soft); background: var(--surface-alt); font-family: var(--font-title); font-size: 13px; font-weight: 700; cursor: pointer; }

.leadership-block { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.leadership-block h3 { margin: 0 0 10px; color: var(--text-soft); font-family: var(--font-title); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.rank-list { display: grid; gap: 4px; }
.rank-row { min-width: 0; min-height: 44px; padding: 8px 9px; border-radius: 4px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.rank-row:hover { background: var(--surface-alt); }
.rank-name { min-width: 0; }
.rank-name strong, .rank-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name strong { color: var(--text-soft); font-size: 13px; }
.rank-name span { margin-top: 2px; color: var(--muted-2); font-size: 10px; }
.rank-score { font-family: Consolas, "SFMono-Regular", monospace; color: var(--text); font-size: 14px; font-weight: 700; }
.model-note { margin-top: 20px; padding: 14px; border: 1px solid rgba(101, 116, 247, 0.35); border-radius: var(--radius); display: flex; align-items: flex-start; gap: 10px; background: var(--accent-soft); }
.model-note i { margin-top: 3px; color: var(--accent); }
.model-note p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.model-note strong { color: var(--text-soft); }

.locked-section { padding: 54px 0 76px; background: var(--page); }
.locked-layout { display: grid; grid-template-columns: minmax(300px, 0.7fr) minmax(620px, 1.3fr); align-items: center; gap: 44px; }
.premium-badge { min-height: 32px; padding: 0 11px; border: 1px solid rgba(255, 209, 102, 0.36); border-radius: var(--radius); display: inline-flex; align-items: center; gap: 7px; color: var(--watch); background: var(--watch-soft); font-family: var(--font-title); font-size: 12px; font-weight: 700; }
.locked-message h2 { margin: 18px 0 0; font-family: var(--font-title); font-size: 34px; line-height: 1.18; letter-spacing: 0; }
.locked-message p { max-width: 620px; margin: 16px 0 0; color: var(--muted); font-size: 17px; }
.locked-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.locked-preview { min-height: 330px; padding: 24px; border: 1px solid var(--line-strong); border-radius: var(--radius-large); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.preview-toolbar { height: 52px; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); }
.preview-toolbar span { width: 72px; height: 12px; border-radius: 3px; background: var(--surface-strong); }
.preview-context { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 18px 0; }
.preview-context b { height: 64px; border-radius: var(--radius); background: var(--surface-alt); }
.preview-row { min-height: 60px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 42px 1.4fr 0.8fr 0.7fr; align-items: center; gap: 14px; }
.preview-row i { width: 36px; height: 36px; border-radius: var(--radius); background: var(--surface-strong); }
.preview-row span { height: 9px; border-radius: 3px; background: var(--surface-strong); }
.live-preview { min-height: 0; }
.live-preview-heading { min-height: 58px; padding-bottom: 16px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.live-preview-heading span { display: block; color: var(--muted-2); font-family: var(--font-title); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
.live-preview-heading strong { display: block; margin-top: 4px; color: var(--text); font-family: var(--font-title); font-size: 19px; }
.live-preview-heading .live-preview-badge { padding: 6px 9px; border-radius: var(--radius); color: var(--info); background: rgba(133, 230, 240, 0.1); white-space: nowrap; }
.live-preview-freshness { display: grid; justify-items: end; gap: 5px; text-align: right; }
.live-preview-freshness small { color: var(--muted-2); font-size: 10px; }
.live-preview-context { margin: 16px 0 4px; display: grid; grid-template-columns: 1.2fr .8fr 1fr 1fr; gap: 1px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); }
.live-preview-context article { min-width: 0; padding: 12px 13px; background: var(--surface-alt); }
.live-preview-context article > span, .live-preview-context article > strong, .live-preview-context article > small { display: block; overflow: hidden; text-overflow: ellipsis; }
.live-preview-context article > span { color: var(--muted-2); font-family: var(--font-title); font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; }
.live-preview-context article > strong { margin-top: 5px; color: var(--text); font-family: var(--font-title); font-size: 14px; white-space: nowrap; }
.live-preview-context article > small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.live-preview-context .cluster-scope { display: inline-flex; margin-left: 4px; padding: 2px 5px; border: 1px solid rgba(255, 209, 102, .26); border-radius: var(--radius); color: var(--watch); background: var(--watch-soft); font-size: 7px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; vertical-align: 1px; }
.live-preview-context article.tone-risk > strong { color: var(--risk); }
.live-preview-context article.tone-good > strong { color: var(--good); }
.live-preview-context article.tone-watch > strong { color: var(--watch); }
.live-preview-columns, .live-preview-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(240px, 1.9fr) 64px 104px; align-items: center; gap: 14px; }
.live-preview-columns { min-height: 38px; color: var(--muted-2); font-family: var(--font-title); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.live-preview-row { min-height: 74px; padding: 11px 0; border-top: 1px solid var(--line); }
.live-preview-row:first-child { border-top: 0; }
.live-preview-identity strong, .live-preview-identity span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-preview-identity strong { color: var(--text); font-family: var(--font-title); font-size: 14px; }
.live-preview-identity span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.live-preview-evidence { display: flex; flex-wrap: wrap; gap: 5px; }
.live-preview-evidence span { padding: 4px 6px; border: 1px solid rgba(133, 230, 240, .18); border-radius: var(--radius); color: var(--info); background: rgba(133, 230, 240, .06); font-size: 9px; line-height: 1; white-space: nowrap; }
.live-preview .quality-score { display: grid; gap: 3px; }
.live-preview .quality-score span { display: none; color: var(--muted-2); font-family: var(--font-body); font-size: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.live-preview-risk { display: grid; justify-items: start; gap: 5px; }
.live-preview-risk small { color: var(--muted-2); font-size: 9px; line-height: 1.2; }
.live-preview-empty { min-height: 160px; padding: 30px; display: grid; place-items: center; color: var(--muted); text-align: center; }
.live-preview-note { margin: 15px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 11px; }
.live-preview-note i { margin-right: 6px; color: var(--watch); }

.setup-dialog { width: min(900px, calc(100% - 32px)); max-height: min(880px, calc(100vh - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-large); color: var(--text); background: var(--surface); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); overflow: auto; }
.setup-dialog::backdrop { background: rgba(2, 8, 17, 0.75); }
.dialog-close { position: sticky; z-index: 2; top: 14px; float: right; margin: 14px 14px 0 0; }
.dialog-body { padding: 30px; }
.dialog-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-right: 50px; }
.dialog-title-row h2 { margin: 0; font-family: var(--font-title); font-size: 30px; }
.dialog-subtitle { margin: 5px 0 0; color: var(--muted); }
.dialog-levels, .score-grid { display: grid; gap: 1px; margin-top: 22px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); }
.dialog-levels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.score-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dialog-metric, .score-item { min-width: 0; padding: 15px; background: var(--surface-alt); }
.dialog-metric span, .score-item span { display: block; color: var(--muted-2); font-family: var(--font-title); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.dialog-metric strong, .score-item strong { display: block; margin-top: 5px; color: var(--text); font-family: Consolas, "SFMono-Regular", monospace; font-size: 18px; }
.current-state-block { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; background: var(--line); gap: 1px; }
.current-state-block > div { min-width: 0; padding: 14px; background: var(--surface-alt); }
.current-state-block span, .level-trace span { display: block; color: var(--muted-2); font-family: var(--font-title); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.current-state-block strong, .level-trace strong { display: block; margin-top: 5px; color: var(--text-soft); font-size: 13px; line-height: 1.5; }
.current-state-block .state-reason-wide { grid-column: 1 / -1; }
.dialog-copy { margin-top: 22px; display: grid; gap: 14px; }
.dialog-copy article { padding-left: 14px; border-left: 2px solid var(--line-strong); }
.dialog-copy article.confirm { border-left-color: var(--good); }
.dialog-copy article.invalidate { border-left-color: var(--risk); }
.dialog-copy h3 { margin: 0; font-family: var(--font-title); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.dialog-copy p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.risk-flags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.risk-flag { padding: 5px 8px; border-radius: 4px; color: var(--risk); background: var(--risk-soft); font-size: 11px; }
.event-risk-card { margin-top: 14px; border: 1px solid rgba(255, 209, 102, 0.28); border-radius: var(--radius); display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 1px; overflow: hidden; background: rgba(255, 209, 102, 0.18); }
.event-risk-card div { min-width: 0; padding: 12px 13px; background: var(--surface-alt); }
.event-risk-card span, .event-risk-card strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-risk-card span { color: var(--muted-2); font-family: var(--font-title); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.event-risk-card strong { margin-top: 4px; color: var(--watch); font-size: 12px; text-transform: capitalize; }
.level-trace { margin-top: 20px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-alt); }
.level-trace h3 { margin: 0 0 12px; font-family: var(--font-title); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.level-trace-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.level-trace p { margin: 13px 0 0; color: var(--muted); font-size: 11px; }
.stage-history { margin-top: 20px; color: var(--muted); font-size: 12px; }

.site-footer { padding-top: 54px; border-top: 1px solid var(--line); background: #061224; color: #fff; }
html[data-theme="light"] .site-footer { background: #fff; color: #101827; }
.footer-main { padding-bottom: 42px; display: grid; grid-template-columns: 1.7fr repeat(4, 1fr); gap: 38px; }
.footer-brand img { width: 250px; }
.footer-brand p { max-width: 310px; margin: 16px 0 0; color: #9caac0; font-size: 14px; }
.social-links { display: flex; gap: 9px; margin-top: 18px; }
.social-links a { width: 36px; height: 36px; border: 1px solid rgba(169, 182, 203, 0.22); border-radius: var(--radius); display: grid; place-items: center; color: #b9c5d7; }
.footer-column { display: grid; align-content: start; gap: 9px; }
.footer-column h2 { margin: 0 0 6px; font-family: var(--font-title); font-size: 13px; }
.footer-column a { color: #9caac0; font-size: 13px; }
.footer-column a:hover { color: var(--info); }
.footer-bottom { padding: 18px 0; border-top: 1px solid rgba(169, 182, 203, 0.16); color: #8695ad; font-size: 12px; }
.footer-bottom .shell { display: flex; justify-content: space-between; gap: 20px; }

@media (max-width: 1180px) {
  .brand img, .footer-brand img { width: 210px; }
  .nav-links { gap: 18px; }
  .nav-links a { font-size: 14px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .queue-controls { align-items: stretch; flex-direction: column; }
  .search-control { width: 100%; }
  .context-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .context-card:nth-child(2) { border-right: 0; }
  .context-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 1020px) {
  .locked-layout { grid-template-columns: 1fr; gap: 34px; }
}

@media (max-width: 900px) {
  body { padding-top: 68px; }
  .top-shell { height: 68px; }
  .shell { width: min(var(--shell), calc(100% - 30px)); }
  .nav-inner { gap: 14px; }
  .brand img { width: 190px; }
  .nav-menu-button { order: 3; width: 42px; height: 42px; padding: 0; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: var(--radius); display: grid; place-items: center; color: #fff; background: transparent; }
  html[data-theme="light"] .nav-menu-button { color: #172033; border-color: #d4ddea; }
  .nav-actions { margin-left: auto; }
  .sign-in { display: none; }
  .nav-links { position: fixed; inset: 68px 0 auto; padding: 12px 15px 18px; border-bottom: 1px solid var(--line); display: none; align-items: stretch; flex-direction: column; gap: 0; background: #061224; box-shadow: var(--shadow); }
  html[data-theme="light"] .nav-links { background: #fff; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 6px; }
  .nav-links a.active::before, .nav-links a::after { display: none; }
  .product-hero-inner { min-height: 230px; padding-top: 36px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 22px; }
  .product-hero h1 { font-size: 42px; }
  .hero-meta { justify-content: flex-start; }
  .workspace-grid { grid-template-columns: 1fr; }
  .leadership-panel { position: static; }
  .locked-layout { grid-template-columns: 1fr; gap: 34px; }
  .footer-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .shell { width: min(var(--shell), calc(100% - 24px)); }
  .brand img { width: 165px; }
  .theme-toggle { width: 62px; }
  html[data-theme="light"] .theme-knob { transform: translateX(26px); }
  .product-hero-inner { min-height: 250px; padding-top: 30px; padding-bottom: 30px; }
  .product-hero h1 { font-size: 36px; }
  .hero-copy { font-size: 16px; }
  .hero-meta span { font-size: 11px; }
  .workspace { padding-top: 16px; }
  .context-grid { grid-template-columns: 1fr; }
  .context-card { border-right: 0; border-bottom: 1px solid var(--line); }
  .context-card:last-child { border-bottom: 0; }
  .queue-panel, .leadership-panel { padding: 18px 14px; }
  .stage-filter { width: 100%; overflow-x: auto; }
  .stage-filter button { flex: 0 0 auto; }
  .table-shell { overflow: visible; }
  .setup-table { min-width: 0; }
  .setup-table thead { display: none; }
  .setup-table, .setup-table tbody, .setup-table tr, .setup-table td { display: block; width: 100%; }
  .setup-table tbody { display: grid; gap: 9px; }
  .setup-table tbody tr[data-ticker] { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; background: var(--surface-alt); }
  .setup-table td { padding: 0; border: 0; }
  .setup-table td:first-child { grid-column: 1 / -1; }
  .setup-table td:nth-child(2), .setup-table td:nth-child(3), .setup-table td:nth-child(5), .setup-table td:nth-child(7) { text-align: left; }
  .setup-table td:nth-child(4), .setup-table td:nth-child(6), .setup-table td:nth-child(8) { text-align: right; }
  .setup-table td:nth-child(3)::before { content: "Structure "; color: var(--muted-2); }
  .setup-table td:nth-child(5)::before { content: "Confirmation "; color: var(--muted-2); }
  .setup-table td:nth-child(6)::before { content: "Structural invalidation "; color: var(--muted-2); }
  .setup-table td:nth-child(8)::before { content: "As of "; color: var(--muted-2); }
  .loading-row { display: block !important; }
  .loading-row td { padding: 50px 10px; }
  .locked-section { padding-top: 38px; }
  .locked-layout { display: block; }
  .locked-message h2 { font-size: 28px; }
  .locked-preview { min-height: 250px; margin-top: 34px; padding: 16px; }
  .live-preview-context { grid-template-columns: 1fr 1fr; }
  .live-preview-columns { display: none; }
  .live-preview-row { grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px 12px; }
  .live-preview-row .quality-score { grid-column: 2; grid-row: 1; justify-items: end; font-size: 14px; }
  .live-preview-row .quality-score span { display: block; }
  .live-preview-row .quality-score::before { content: none; }
  .live-preview-evidence { grid-column: 1 / -1; grid-row: 2; }
  .live-preview-risk { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; }
  .live-preview-heading { display: block; }
  .live-preview-freshness { margin-top: 10px; justify-items: start; text-align: left; }
  .live-preview-heading .live-preview-badge { display: inline-block; }
  .preview-context { grid-template-columns: 1fr 1fr; }
  .preview-context b:last-child { display: none; }
  .dialog-body { padding: 22px 18px; }
  .dialog-levels, .score-grid, .current-state-block, .level-trace-grid, .event-risk-card { grid-template-columns: 1fr 1fr; }
  .footer-main { grid-template-columns: 1fr 1fr; gap: 30px 20px; }
  .footer-bottom .shell { flex-direction: column; }
}

@media (max-width: 420px) {
  .live-preview-context { grid-template-columns: 1fr; }
  .event-risk-card { grid-template-columns: 1fr; }
}

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