:root {
  color-scheme: dark;
  --brand-ink: #09090B;
  --brand-navy: #00112B;
  --brand-navy-2: #081D3D;
  --brand-orange: #FDA821;
  --brand-cloud: #F5F7FA;
  --brand-slate: #CBD5E1;
  --canvas: #09090b;
  --overlay-surface: #09090b;
  --surface-raised: #19191f;
  --surface-contrast: #202027;
  --on-surface: #ffffff;
  --bg: #09090b;
  --background: var(--bg);
  --sidebar: #09090b;
  --surface: #121217;
  --surface-2: #19191f;
  --surface-3: #202026;
  --line: #2b2b33;
  --line-soft: rgba(43, 43, 51, 0.72);
  --border: var(--line);
  --border-strong: #3a3a44;
  --text: var(--brand-cloud);
  --muted: var(--text);
  --muted-2: var(--brand-slate);
  --cyan: var(--brand-orange);
  --blue: var(--cyan);
  --green: #46d3a3;
  --mint: var(--green);
  --coral: #ff6678;
  --red: var(--coral);
  --amber: var(--brand-orange);
  --violet: #8c7bff;
  --focus-ring: rgba(53, 194, 229, 0.28);
  --shadow-popover: 0 14px 34px rgba(0, 0, 0, 0.42);
  --radius: 4px;
  --control-height: 30px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Apple SD Gothic Neo", "Noto Sans KR", Arial, sans-serif;
}

/* Readability pass: keep the dense UW-like layout while lifting the type scale. */
body {
  font-size: var(--fs-body);
}

button,
input,
select,
textarea {
  font-size: var(--fs-control);
}

.flow-sidebar,
.sidebar-nav,
.watchlist-panel,
.alerts-drawer-panel {
  font-size: var(--fs-table);
}

.flow-table th,
.pattern-table th,
.timeline-table th,
.flow-table td,
.pattern-table td,
.timeline-table td {
  font-size: var(--fs-table);
}

.flow-table th,
.pattern-table th,
.timeline-table th,
.eyebrow,
.panel-kicker,
.section-kicker {
  font-size: var(--fs-label);
}

.flow-reason,
.flow-time,
.stock-code,
.alerts-storage-note,
.timeline-event-meta {
  font-size: var(--fs-meta);
}

.instrument-detail-dialog,
.instrument-detail-dialog button,
.instrument-detail-dialog input,
.instrument-detail-dialog select {
  font-size: var(--fs-control);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scrollbar-color: #3a4251 var(--bg);
  scrollbar-width: thin;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: 1.35;
  text-rendering: optimizeLegibility;
}

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

button,
select,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

button,
input,
select,
textarea,
a,
[tabindex]:not([tabindex="-1"]) {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

a {
  color: var(--cyan);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 700;
}

h1 {
  margin-bottom: 0;
  font-size: var(--fs-page-title);
  letter-spacing: -0.01em;
}

h2 {
  margin-bottom: 0;
  font-size: var(--fs-section-title);
  letter-spacing: -0.005em;
}

h3 {
  margin-bottom: 0;
  font-size: var(--fs-subsection-title);
}

[hidden],
.is-hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Application frame */
.flow-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  background: var(--bg);
}

.flow-stage {
  min-width: 0;
  padding: 0 14px 44px;
}

.app-shell {
  width: min(1760px, 100%);
  margin: 0 auto;
  padding: 0 20px 40px;
}

.flow-sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden auto;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.flow-sidebar .brand-block,
.sidebar-brand {
  min-height: 50px;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border-bottom: 1px solid var(--line);
}

.flow-brand {
  min-height: 50px;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.flow-brand:hover {
  background: var(--brand-navy-2);
}

.flow-brand-logo {
  width: min(100%, 174px);
  height: 42px;
  display: block;
  object-fit: contain;
  object-position: left center;
}

.brand-block,
.topbar-status,
.instrument-title-row,
.price-row,
.chart-labels,
.panel-footer,
.summary-label-row,
.heading-with-help {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 10px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  border: 1px solid rgba(53, 194, 229, 0.55);
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted-2);
  font-size: var(--fs-label);
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.1;
  text-transform: uppercase;
}

.flow-nav,
.sidebar-nav,
.flow-sidebar nav {
  display: grid;
  gap: 2px;
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
}

.flow-nav-section-label {
  margin: 2px 9px 1px;
  color: var(--muted-2);
  font: 800 8px/1.2 var(--mono);
  letter-spacing: 0.14em;
}

.flow-nav-section-label-spaced {
  margin-top: 12px;
}

.flow-nav-support {
  display: grid;
  gap: 2px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.flow-nav a,
.flow-nav button,
.flow-nav-item,
.sidebar-nav a,
.sidebar-nav button,
.flow-sidebar nav a,
.flow-sidebar nav button {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
}

.flow-nav a:hover,
.flow-nav button:hover,
.flow-nav-item:hover,
.sidebar-nav a:hover,
.sidebar-nav button:hover,
.flow-sidebar nav a:hover,
.flow-sidebar nav button:hover {
  background: var(--surface);
  color: var(--text);
}

.flow-nav .is-active,
.flow-nav [aria-current="page"],
.flow-nav-item.is-active,
.sidebar-nav .is-active,
.sidebar-nav [aria-current="page"],
.flow-sidebar nav .is-active,
.flow-sidebar nav [aria-current="page"] {
  background: var(--brand-navy);
  color: var(--brand-orange);
}

.flow-nav-icon {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 20px;
  opacity: 0.82;
}

.flow-nav-item:hover .flow-nav-icon,
.flow-nav-item.is-active .flow-nav-icon,
.flow-nav [aria-current="page"] .flow-nav-icon {
  opacity: 1;
}

.flow-nav-key {
  min-width: 22px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted-2);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.flow-nav .is-active .flow-nav-key,
.flow-nav [aria-current="page"] .flow-nav-key {
  border-color: rgba(53, 194, 229, 0.45);
  color: var(--cyan);
}

.sidebar-section-title,
.flow-sidebar-label {
  margin: 0;
  padding: 10px 12px 5px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.sidebar-watchlist {
  display: grid;
  gap: 8px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--sidebar);
}

.sidebar-watchlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-watchlist h2 {
  margin: 0;
  color: var(--on-surface);
  font-size: 13px;
  line-height: 1.2;
}

.watchlist-count {
  min-width: 22px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 9px;
  font-weight: 800;
}

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

.watchlist-action,
.watchlist-pin,
.watchlist-remove {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  font-size: 10px;
  font-weight: 750;
}

.watchlist-action:hover,
.watchlist-action.is-active,
.watchlist-pin:hover,
.watchlist-pin[aria-pressed="true"],
.watchlist-remove:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.watchlist-action:disabled {
  opacity: 0.48;
}

.watchlist-active-filter {
  margin: 0;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
  font-size: 10px;
  font-weight: 650;
}

.watchlist-body {
  display: grid;
  gap: 1px;
}

.watchlist-empty {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 10px;
  line-height: 1.45;
}

.watchlist-empty strong {
  color: var(--on-surface);
  font-size: 10px;
}

.watchlist-empty span {
  color: var(--text);
  font-size: 9px;
}

.watchlist-preview-label {
  margin: 3px 2px 0;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.watchlist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: stretch;
  border: 1px solid var(--line);
  background: var(--surface);
}

.watchlist-row.is-selected {
  background: var(--surface-2);
}

.watchlist-preview-row .watchlist-pin {
  min-width: 28px;
  min-height: 100%;
  padding: 0 3px;
  border-width: 0;
  border-radius: 0;
  color: var(--cyan);
  font-size: 9px;
}

.watchlist-select {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border: 0;
  background: transparent;
  color: #ffffff;
  text-align: left;
}

.watchlist-select strong {
  overflow: hidden;
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watchlist-select span {
  color: var(--text);
  font-size: 9px;
}

.watchlist-remove {
  min-width: 28px;
  min-height: 100%;
  border-width: 0;
  border-radius: 0;
}

.flow-sidebar .ranking-panel {
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.flow-sidebar .ranking-panel .panel-header {
  min-height: 42px;
  padding: 7px 10px;
}

.flow-sidebar .ranking-panel .table-scroll {
  flex: 1 1 auto;
  max-height: none;
}

.flow-sidebar .ranking-table {
  min-width: 0;
  table-layout: fixed;
}

.flow-sidebar .ranking-table th:nth-child(2),
.flow-sidebar .ranking-table td:nth-child(2),
.flow-sidebar .ranking-table th:nth-child(4),
.flow-sidebar .ranking-table td:nth-child(4) {
  display: none;
}

.flow-sidebar .ranking-table th:nth-child(3) {
  width: 64px;
}

.flow-sidebar-footer,
.sidebar-footer {
  margin-top: auto;
  padding: 9px 11px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 9px;
}

.sidebar-alerts {
  margin-top: 0;
  padding: 8px 9px;
  border-top: 1px solid var(--line);
}

.sidebar-research {
  margin-top: auto;
  padding: 8px 9px 0;
  border-top: 1px solid var(--line);
}

.sidebar-research-toggle {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 7px;
  padding: 0 5px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
}

.sidebar-research-toggle:hover,
.sidebar-research-toggle.is-active {
  background: var(--surface-2);
  color: var(--cyan);
}

.sidebar-research-icon {
  color: var(--cyan);
  font-size: 17px;
  line-height: 1;
  text-align: center;
}

.sidebar-research-chevron {
  color: currentColor;
  font-size: 14px;
  text-align: center;
  transition: transform 160ms ease;
}

.sidebar-research-toggle[aria-expanded="true"] .sidebar-research-chevron { transform: rotate(180deg); }

.sidebar-research-menu {
  display: grid;
  gap: 1px;
  margin-top: 5px;
  padding: 4px 0 2px 25px;
}

.sidebar-research-menu[hidden] { display: none; }

.sidebar-research-link {
  min-height: 26px;
  padding: 0 6px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  font-size: 10px;
  text-align: left;
}

.sidebar-research-link:hover,
.sidebar-research-link.is-active {
  background: var(--surface-2);
  color: var(--cyan);
}

.sidebar-alerts-button {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 0 5px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
}

.sidebar-alerts-button:hover,
.sidebar-alerts-button[aria-expanded="true"] {
  background: var(--surface-2);
  color: var(--cyan);
}

.sidebar-alerts-icon {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--amber);
  font-size: 10px;
  line-height: 1;
}

.sidebar-alerts-count {
  min-width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--amber);
  color: #09090b;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.sidebar-alerts-count[hidden],
.alerts-tab-dot[hidden] {
  display: none;
}

/* Alerts follows the UW pattern: the entry stays in the lower-left utility
   area while the drawer overlays the workspace from the right. */
.alerts-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
}

.alerts-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.56);
}

.alerts-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(390px, calc(100vw - 18px));
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: auto;
  border: 0;
  background: var(--overlay-surface);
  box-shadow: -18px 0 48px rgba(0, 0, 0, 0.48);
}

.alerts-drawer-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.alerts-drawer-header h2 {
  margin: 2px 0 0;
  color: var(--on-surface);
  font-size: 17px;
}

.alerts-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.alerts-tabs {
  min-height: 42px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.alerts-tabs button {
  position: relative;
  min-height: 42px;
  padding: 0 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 10px;
  font-weight: 750;
}

.alerts-tabs button:hover,
.alerts-tabs button.is-active {
  border-bottom-color: var(--amber);
  color: var(--on-surface);
}

.alerts-tab-dot {
  width: 5px;
  height: 5px;
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--amber);
}

.alerts-tab-panel {
  padding: 14px;
}

.alerts-panel-intro {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.alerts-panel-intro h3 {
  margin: 3px 0 4px;
  color: var(--on-surface);
  font-size: 15px;
}

.alerts-panel-intro p:last-child {
  margin: 0;
  color: var(--text);
  font-size: 10px;
}

.browser-notification-card {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
}

.browser-notification-card h3 {
  margin: 3px 0 4px;
  color: var(--on-surface);
  font-size: 13px;
}

.browser-notification-card p:last-child {
  margin: 0;
  color: var(--text);
  font-size: 10px;
  line-height: 1.45;
}

.browser-notification-card button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--amber);
  border-radius: 2px;
  background: transparent;
  color: var(--amber);
  font-size: 10px;
  font-weight: 750;
}

.browser-notification-card button:hover:not(:disabled) {
  background: rgba(253, 168, 33, 0.08);
}

.telegram-account-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.telegram-account-controls input {
  width: 180px;
  min-height: 36px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.telegram-account-summary {
  display: inline-block;
  margin-top: 7px;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.3;
}

.telegram-account-summary.is-saved {
  color: var(--mint);
}

.alert-preference-list {
  display: grid;
  gap: 1px;
  margin-top: 12px;
  background: var(--line);
}

.alert-preference-list label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 11px;
  background: var(--surface-raised);
}

.alert-preference-list input {
  width: 14px;
  height: 14px;
  margin: 1px 0 0;
  accent-color: var(--amber);
}

.alert-preference-list strong,
.alert-preference-list small {
  display: block;
}

.alert-scope-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
}

.alert-scope-list legend {
  padding: 0 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.alert-scope-list label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
  cursor: pointer;
}

.alert-scope-list input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--amber);
}

.alert-scope-list strong,
.alert-scope-list small { display: block; white-space: normal; }
.alert-scope-list strong { color: var(--on-surface); font-size: 14px; line-height: 1.25; }
.alert-scope-list small { margin-top: 4px; color: var(--muted-2); font-size: 11px; line-height: 1.35; }

@media (max-width: 560px) {
  .alert-scope-list { grid-template-columns: 1fr; gap: 12px; }
}

.alert-preference-list strong {
  color: var(--on-surface);
  font-size: 11px;
}

.alert-preference-list small {
  margin-top: 3px;
  color: var(--text);
  font-size: 10px;
}

.alerts-storage-note {
  margin: 12px 0 0;
  color: var(--amber);
  font-size: 10px;
  line-height: 1.5;
}

.notice-card {
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
}

.notice-card + .notice-card {
  margin-top: 8px;
}

.notice-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--amber);
  font-size: 9px;
  font-weight: 750;
}

.notice-card h3 {
  margin: 9px 0 5px;
  color: var(--on-surface);
  font-size: 14px;
}

.notice-card p {
  margin: 0;
  color: var(--text);
  font-size: 11px;
  line-height: 1.55;
}

.notice-card ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin: 12px 0 0;
  padding-left: 17px;
  color: var(--on-surface);
  font-size: 10px;
  line-height: 1.4;
}

/* Header and live status */
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 9, 11, 0.97);
}

.topbar-status {
  min-width: 0;
  position: relative;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.flow-page-title {
  min-width: 0;
}

.flow-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: var(--fs-micro);
}

.auth-user[hidden] {
  display: none;
}

.auth-user form {
  margin: 0;
}

.auth-logout,
.topbar button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-micro);
}

.auth-logout:hover,
.topbar button:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.simulation-badge,
.connection-pill,
.quality-chip,
.ticker-code,
.panel-count,
.status-chip,
.flow-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  white-space: nowrap;
}

.simulation-badge {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(242, 191, 91, 0.36);
  background: rgba(242, 191, 91, 0.08);
  color: var(--amber);
  font-size: var(--fs-micro);
  font-weight: 750;
}

.market-clock {
  color: var(--muted);
  font-size: var(--fs-meta);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.connection-pill,
.status-chip {
  min-height: 24px;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid rgba(70, 211, 163, 0.3);
  background: rgba(70, 211, 163, 0.07);
  color: var(--green);
  font-size: var(--fs-micro);
  font-weight: 700;
}

.topbar .connection-pill {
  cursor: pointer;
  font: inherit;
}

.topbar .connection-pill:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.connection-detail-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  width: min(320px, calc(100vw - 20px));
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.48);
}

.connection-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.connection-detail-header h2 {
  margin: 0;
  color: #ffffff;
  font-size: 13px;
}

.connection-detail-close {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.connection-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 8px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.connection-detail-grid > div {
  min-width: 0;
  padding: 7px 8px;
  background: var(--surface-2);
}

.connection-detail-grid dt,
.connection-detail-grid dd {
  margin: 0;
}

.connection-detail-grid dt {
  color: var(--text);
  font-size: 9px;
}

.connection-detail-grid dd {
  margin-top: 3px;
  overflow: hidden;
  color: #ffffff;
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-detail-note {
  margin: 8px 1px 0;
  color: var(--text);
  font-size: 9px;
  line-height: 1.4;
}

.connection-pill i,
.status-chip i,
.status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: currentColor;
}

.connection-pill.is-disconnected,
.connection-pill.is-stale,
.status-chip.is-stale,
[data-status="STALE"],
[data-status="DISCONNECTED"],
[data-stale="true"] {
  border-color: rgba(255, 102, 120, 0.38);
  background: rgba(255, 102, 120, 0.08);
  color: var(--coral);
}

.connection-pill.is-reconnecting,
.status-chip.is-reconnecting,
[data-status="RECONNECTING"],
[data-status="CONNECTING"] {
  border-color: rgba(242, 191, 91, 0.4);
  border-style: dashed;
  background: rgba(242, 191, 91, 0.08);
  color: var(--amber);
}

.status-chip.is-restored,
.connection-pill.is-restored,
[data-status="RESTORED"],
[data-status="restored"] {
  border-color: rgba(140, 123, 255, 0.38);
  background: rgba(140, 123, 255, 0.08);
  color: var(--violet);
}

main {
  min-width: 0;
  padding-top: 10px;
}

main.flow-stage {
  padding-top: 0;
}

/* Compact market summary */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.summary-card {
  min-width: 0;
  min-height: 58px;
  padding: 8px 11px 7px;
  border: 0;
  border-top: 2px solid currentColor;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.summary-label-row,
.heading-with-help {
  min-width: 0;
  gap: 6px;
}

.summary-label-row > span,
.summary-card > span,
.metric-block > span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-card strong {
  display: block;
  margin: 3px 0 1px;
  color: var(--text);
  font-size: 18px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.summary-card small,
.metric-block small {
  display: block;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accent-blue {
  color: var(--cyan);
}

.accent-mint {
  color: var(--green);
}

.accent-amber {
  color: var(--amber);
}

.accent-violet {
  color: var(--violet);
}

.flow-status-banner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 10px 0 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.flow-status-item {
  min-width: 0;
  min-height: 58px;
  padding: 7px 10px 6px;
  background: var(--surface);
}

.flow-status-item strong {
  display: block;
  margin: 3px 0 1px;
  color: var(--text);
  font-size: var(--fs-metric);
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.flow-status-item small {
  display: block;
  overflow: hidden;
  color: var(--muted-2);
  font-size: var(--fs-micro);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-tabs {
  min-height: 34px;
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow: auto hidden;
  margin-bottom: 7px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.flow-tabs::-webkit-scrollbar {
  display: none;
}

.flow-tab {
  min-width: 86px;
  min-height: 33px;
  flex: 0 0 auto;
  padding: 0 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-control);
  font-weight: 700;
}

.flow-tab:hover {
  color: var(--text);
}

.flow-tab.is-active,
.flow-tab[aria-selected="true"] {
  border-bottom-color: var(--cyan);
  color: var(--cyan);
}

/* Command and filter surfaces */
.flow-commandbar {
  position: sticky;
  top: 50px;
  z-index: 20;
  min-height: 40px;
  display: block;
  margin-bottom: 8px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 18, 23, 0.97);
}

.flow-commandbar-main {
  min-height: 30px;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.flow-command-label,
.flow-command-actions,
.flow-status {
  display: flex;
  min-width: 0;
  align-items: center;
}

.flow-command-label {
  gap: 10px;
  color: var(--muted-2);
  font-size: 9px;
}

.flow-command-actions {
  flex: 0 0 auto;
  gap: 5px;
}

.flow-status {
  gap: 6px;
  color: var(--green);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.flow-status strong {
  color: currentColor;
  font-size: 9px;
}

.live-pulse {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 2px rgba(70, 211, 163, 0.13);
}

.flow-status.is-simulation {
  color: var(--violet);
}

.flow-status.is-reconnecting {
  color: var(--amber);
}

.flow-status.is-offline,
.flow-status.is-stale {
  color: var(--coral);
}

.flow-status.is-replay,
.flow-status.is-paused {
  color: var(--violet);
}

.flow-commandbar .command-group,
.command-group {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.flow-commandbar .command-spacer,
.command-spacer {
  flex: 1 1 auto;
}

.flow-commandbar button,
.flow-commandbar input,
.flow-commandbar select,
.command-button {
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 10px;
}

.flow-commandbar button,
.command-button {
  padding: 0 9px;
  color: var(--muted);
  font-weight: 700;
}

.flow-commandbar button:hover,
.flow-commandbar button.is-active,
.command-button:hover,
.command-button.is-active,
.command-button[aria-pressed="true"] {
  border-color: rgba(53, 194, 229, 0.5);
  color: var(--cyan);
}

.flow-commandbar input,
.flow-commandbar select {
  min-width: 0;
  padding: 0 8px;
}

.flow-commandbar .command-search,
.flow-commandbar input[type="search"] {
  width: clamp(150px, 24vw, 340px);
}

#flow-filter-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px 14px;
  margin: -1px 0 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
}

#flow-filter-panel.is-collapsed,
#flow-filter-panel[aria-hidden="true"] {
  display: none;
}

#flow-filter-panel fieldset,
.flow-filter-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

#flow-filter-panel legend,
.flow-filter-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#flow-column-panel {
  position: fixed;
  top: 98px;
  right: 14px;
  z-index: 90;
  width: min(264px, calc(100vw - 28px));
  max-height: min(520px, calc(100vh - 116px));
  display: grid;
  gap: 2px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow-popover);
}

#flow-column-panel[hidden] {
  display: none;
}

#flow-column-panel header,
.column-panel-header {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 5px 5px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 10px;
  font-weight: 750;
}

#flow-column-panel label,
.column-option {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  border-radius: 3px;
  color: var(--muted);
  font-size: 10px;
}

#flow-column-panel label:hover,
.column-option:hover {
  background: var(--surface-3);
  color: var(--text);
}

#flow-column-panel > p {
  margin: 0;
  padding: 3px 5px 7px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 10px;
  font-weight: 750;
}

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

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--cyan);
}

.column-hidden,
.is-column-hidden,
[data-column-hidden="true"],
[data-column].is-hidden {
  display: none !important;
}

.flow-app[data-hidden-columns~="time"] [data-column="time"],
body[data-hidden-columns~="time"] [data-column="time"],
.flow-app[data-hidden-columns~="ticker"] [data-column="ticker"],
body[data-hidden-columns~="ticker"] [data-column="ticker"],
.flow-app[data-hidden-columns~="side"] [data-column="side"],
body[data-hidden-columns~="side"] [data-column="side"],
.flow-app[data-hidden-columns~="quantity"] [data-column="quantity"],
body[data-hidden-columns~="quantity"] [data-column="quantity"],
.flow-app[data-hidden-columns~="evidence"] [data-column="evidence"],
body[data-hidden-columns~="evidence"] [data-column="evidence"],
.flow-app[data-hidden-columns~="interval"] [data-column="interval"],
body[data-hidden-columns~="interval"] [data-column="interval"],
.flow-app[data-hidden-columns~="price"] [data-column="price"],
body[data-hidden-columns~="price"] [data-column="price"],
.flow-app[data-hidden-columns~="score"] [data-column="score"],
body[data-hidden-columns~="score"] [data-column="score"],
.flow-app[data-hidden-columns~="state"] [data-column="state"],
body[data-hidden-columns~="state"] [data-column="state"],
.flow-app[data-hidden-columns~="alert"] [data-column="alert"],
body[data-hidden-columns~="alert"] [data-column="alert"],
.flow-app[data-hidden-columns~="verification"] [data-column="verification"],
body[data-hidden-columns~="verification"] [data-column="verification"],
.flow-app[data-hidden-columns~="reason"] [data-column="reason"],
body[data-hidden-columns~="reason"] [data-column="reason"] {
  display: none !important;
}

/* Panels and workspace */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.flow-stage .workspace-grid {
  grid-template-columns: minmax(0, 1fr);
}

.detail-stack {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.flow-content {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
}

.panel-header {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.panel-count {
  min-width: 23px;
  height: 21px;
  justify-content: center;
  padding: 0 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.info-tip {
  width: 16px;
  height: 16px;
  display: inline-grid;
  flex: 0 0 16px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted-2);
  cursor: help;
  font: 700 9px/1 Georgia, serif;
}

.info-tip:hover,
.info-tip:focus-visible {
  border-color: var(--cyan);
  color: var(--cyan);
}

.region-tooltip {
  position: fixed;
  z-index: 1000;
  width: min(290px, calc(100vw - 20px));
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-popover);
  font-size: 10px;
  line-height: 1.5;
  pointer-events: none;
}

.region-tooltip[hidden] {
  display: none;
}

.ranking-panel {
  position: sticky;
  top: 60px;
}

.sort-tabs,
.side-filters,
.state-filters,
.signal-filters,
.alert-filters {
  display: flex;
  align-items: center;
  gap: 3px;
}

.sort-tabs {
  overflow: auto hidden;
  padding: 7px 8px 0;
  scrollbar-width: none;
}

.sort-tabs::-webkit-scrollbar,
.side-filters::-webkit-scrollbar,
.state-filters::-webkit-scrollbar,
.signal-filters::-webkit-scrollbar,
.alert-filters::-webkit-scrollbar {
  display: none;
}

.ranking-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
}

.ranking-search input,
.trade-controls select,
.trade-controls input,
.trade-controls button {
  height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 10px;
}

.ranking-search input {
  width: 100%;
  padding: 0 8px;
}

input::placeholder {
  color: var(--muted-2);
  opacity: 1;
}

.ranking-alert-toggle {
  min-height: var(--control-height);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.ranking-alert-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.sort-tab,
.side-filter,
.pattern-state-filter,
.signal-filter,
.alert-filter {
  min-height: 27px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.sort-tab:hover,
.side-filter:hover,
.pattern-state-filter:hover,
.signal-filter:hover,
.alert-filter:hover {
  background: var(--surface-3);
  color: var(--text);
}

.sort-tab.is-active,
.side-filter.is-active,
.pattern-state-filter.is-active,
.signal-filter.is-active,
.alert-filter.is-active,
.sort-tab[aria-pressed="true"],
.side-filter[aria-pressed="true"],
.pattern-state-filter[aria-pressed="true"],
.signal-filter[aria-pressed="true"],
.alert-filter[aria-pressed="true"] {
  border-color: rgba(53, 194, 229, 0.46);
  background: rgba(53, 194, 229, 0.08);
  color: var(--cyan);
}

/* Dense data tables */
.table-scroll {
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

th,
td {
  height: 31px;
  padding: 6px 9px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 29px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.035em;
  text-transform: none;
}

th::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: var(--line);
  content: "";
}

th:first-child,
td:first-child {
  padding-left: 11px;
  text-align: left;
}

th:last-child,
td:last-child {
  padding-right: 11px;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

tbody tr:hover {
  background: rgba(53, 194, 229, 0.045);
}

tbody tr.is-selected,
tbody tr[aria-selected="true"],
.ranking-row.is-selected,
.pattern-row.is-selected {
  background: rgba(53, 194, 229, 0.08);
}

.ranking-row {
  cursor: pointer;
  outline: none;
}

.ranking-row:focus-visible {
  background: rgba(53, 194, 229, 0.07);
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.stock-name {
  display: block;
  max-width: 150px;
  overflow: hidden;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 11px;
  font-weight: 720;
  text-overflow: ellipsis;
}

.stock-code {
  color: var(--muted-2);
  font-size: 9px;
}

.stock-meta {
  display: flex;
  align-items: center;
  gap: 7px;
}

.positive,
.buy-text {
  color: var(--green) !important;
}

.negative,
.sell-text {
  color: var(--coral) !important;
}

.unknown-text {
  color: var(--amber) !important;
}

.row-quality {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 8px;
}

.row-quality i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

.row-quality.degraded i {
  background: var(--amber);
}

.capture-count,
.pattern-side,
.state-pill,
.signal-pill,
.alert-badge {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.capture-count {
  min-width: 42px;
  border-color: rgba(70, 211, 163, 0.28);
  background: rgba(70, 211, 163, 0.07);
  color: var(--green);
}

.capture-count.has-alert,
.alert-badge.eligible {
  border-color: rgba(242, 191, 91, 0.36);
  background: rgba(242, 191, 91, 0.08);
  color: var(--amber);
}

.capture-count.is-empty {
  border-color: transparent;
  background: transparent;
  color: var(--muted-2);
}

.pattern-side {
  min-width: 42px;
}

.pattern-side.buy {
  border-color: rgba(70, 211, 163, 0.32);
  background: rgba(70, 211, 163, 0.08);
  color: var(--green);
}

.pattern-side.sell {
  border-color: rgba(255, 102, 120, 0.34);
  background: rgba(255, 102, 120, 0.08);
  color: var(--coral);
}

.pattern-side.unknown,
.state-pill.weakening,
.signal-pill.watch {
  border-color: rgba(242, 191, 91, 0.34);
  background: rgba(242, 191, 91, 0.08);
  color: var(--amber);
}

.state-pill.active,
.signal-pill.strong {
  border-color: rgba(70, 211, 163, 0.32);
  background: rgba(70, 211, 163, 0.08);
  color: var(--green);
}

.state-pill.degraded {
  border-color: rgba(255, 102, 120, 0.34);
  background: rgba(255, 102, 120, 0.08);
  color: var(--coral);
}

.signal-pill {
  min-width: 52px;
}

.signal-pill.weak,
.alert-badge {
  color: var(--muted-2);
}

.ranking-empty,
.empty-state {
  padding: 34px 12px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.panel-footer {
  min-height: 35px;
  gap: 12px;
  padding: 0 10px;
  color: var(--muted-2);
  font-size: 9px;
}

.legend-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
}

.legend-dot.buy {
  background: var(--green);
}

.legend-dot.sell {
  background: var(--coral);
}

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

/* Pattern evidence is the primary live viewport */
.pattern-panel {
  border-color: #303745;
}

.flow-table-note {
  color: var(--muted-2);
  font-size: 8px;
  white-space: nowrap;
}

.pattern-header {
  min-height: 46px;
  flex-wrap: wrap;
}

.pattern-filter-bar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.pattern-scroll {
  min-height: 390px;
  max-height: calc(100vh - 208px);
  overflow: auto;
}

.flow-stage .pattern-scroll {
  min-height: clamp(430px, 58vh, 710px);
}

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

.flow-row {
  cursor: pointer;
}

.flow-row.is-degraded td {
  border-bottom-color: rgba(242, 191, 91, 0.24);
}

.flow-time {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.score-cell {
  display: inline-grid;
  grid-template-columns: 25px 52px;
  align-items: center;
  justify-content: end;
  gap: 6px;
}

.score-cell strong {
  color: var(--text);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.score-meter {
  width: 52px;
  height: 4px;
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.score-meter-fill {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--muted-2);
}

.score-meter-fill.strong {
  background: var(--green);
}

.score-meter-fill.watch {
  background: var(--amber);
}

.score-meter-fill.weak {
  background: var(--violet);
}

.flow-reason {
  max-width: 230px;
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-verification-text {
  display: block;
  max-width: 92px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-tags {
  display: flex;
  max-width: 230px;
  gap: 3px;
  overflow: hidden;
  margin-top: 3px;
}

.flow-tags > span {
  min-height: 17px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted-2);
  font-size: 7px;
  font-weight: 700;
  white-space: nowrap;
}

.pattern-pagination {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.pattern-pagination button {
  min-width: 48px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--cyan);
  font-size: 9px;
  font-weight: 750;
}

/* Selected instrument */
.instrument-hero {
  padding: 11px;
}

.instrument-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.instrument-title-row {
  min-width: 0;
  gap: 7px;
  flex-wrap: wrap;
}

.instrument-title-row h2 {
  font-size: 17px;
}

.ticker-code,
.quality-chip {
  min-height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
}

.quality-chip {
  border-color: rgba(70, 211, 163, 0.3);
  background: rgba(70, 211, 163, 0.07);
  color: var(--green);
}

.quality-chip.degraded {
  border-color: rgba(242, 191, 91, 0.36);
  background: rgba(242, 191, 91, 0.08);
  color: var(--amber);
}

.price-row {
  gap: 8px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.price-row strong {
  color: var(--text);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.price-row span {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--line);
}

.metric-block {
  min-width: 0;
  padding: 8px 9px;
  background: var(--surface-2);
}

.market-context-panel {
  display: grid;
  gap: 0;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-top: 2px solid rgba(253, 168, 33, 0.72);
  background:
    linear-gradient(135deg, rgba(253, 168, 33, 0.045), transparent 34%),
    var(--surface-raised);
}

.market-context-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 14px 12px;
}

.market-context-heading h3 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: var(--fs-subsection-title);
}

.market-context-heading > div > p:last-child {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: var(--fs-meta);
}

.market-context-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: var(--fs-meta);
  font-weight: 750;
}

.market-context-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.market-context-status.is-available {
  border-color: rgba(253, 168, 33, 0.35);
  color: var(--brand-orange);
}

.market-context-status.is-available i {
  background: var(--brand-orange);
  box-shadow: 0 0 0 3px rgba(253, 168, 33, 0.12);
}

.market-context-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.market-context-card {
  min-width: 0;
  padding: 12px 13px 13px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
}

.market-context-card:last-child {
  border-right: 0;
}

.market-context-card > span,
.market-context-card > small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-meta);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-context-card > strong {
  display: block;
  overflow: hidden;
  margin: 6px 0 3px;
  color: var(--text);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-context-card > strong.is-positive {
  color: var(--green);
}

.market-context-card > strong.is-negative {
  color: var(--coral);
}

.market-context-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 14px;
}

.market-context-footer > p {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}

.market-context-footer > p strong {
  flex: 0 0 auto;
  color: var(--brand-orange);
  font-size: var(--fs-micro);
  letter-spacing: 0.08em;
}

.market-context-footer > p span {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-meta);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-projection-status {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--fs-meta);
}

.context-projection-status > span:first-child {
  margin-right: 2px;
}

.context-projection-status > span:not(:first-child) {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.context-projection-status b {
  color: var(--text);
  font-weight: 750;
}

.context-projection-status em {
  color: var(--muted);
  font-style: normal;
}

.metric-block strong {
  display: block;
  margin: 3px 0 1px;
  color: var(--text);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}

.buy-tone strong {
  color: var(--green);
}

.sell-tone strong {
  color: var(--coral);
}

.net-tone strong {
  color: var(--cyan);
}

.neutral-tone strong {
  color: var(--text);
}

.data-notice {
  display: none;
  margin-top: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(242, 191, 91, 0.32);
  border-radius: 3px;
  background: rgba(242, 191, 91, 0.07);
  color: var(--amber);
  font-size: 9px;
  line-height: 1.45;
}

.data-notice.is-visible {
  display: block;
}

/* Charts */
.visual-caption,
.timeline-caption {
  color: var(--muted-2);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.signal-visual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.recent-flow-reading {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(0, 2.2fr);
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.recent-flow-heading,
.recent-flow-metrics,
.recent-flow-detail {
  min-width: 0;
  padding: 11px;
  background: var(--surface-2);
}

.recent-flow-heading {
  display: grid;
  align-content: center;
  gap: 4px;
}

.recent-flow-heading .eyebrow {
  margin: 0;
  color: var(--muted-2);
  font-size: 8px;
}

.recent-flow-heading strong {
  color: var(--on-surface);
  font-size: 12px;
}

.recent-flow-heading span,
.recent-flow-detail {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.recent-flow-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  padding: 0;
  background: var(--line);
}

.recent-flow-metrics > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px;
  background: var(--surface-2);
}

.recent-flow-metrics span {
  color: var(--muted-2);
  font-size: 8px;
}

.recent-flow-metrics strong {
  overflow: hidden;
  color: var(--on-surface);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-flow-detail {
  grid-column: 1 / -1;
  margin: 0;
  border-top: 1px solid var(--line);
}

.recent-flow-reading.is-divergent #recent-flow-alignment {
  color: var(--amber);
}

.recent-flow-reading.is-aligned #recent-flow-alignment {
  color: var(--cyan);
}

.signal-chart-section {
  min-width: 0;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.signal-chart-section:nth-child(2) {
  border-right: 0;
}

.signal-chart-section-wide {
  grid-column: 1 / -1;
  border-right: 0;
  border-bottom: 0;
}

.signal-chart-title {
  min-height: 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.signal-chart-title strong {
  font-size: 10px;
}

.signal-chart-title span {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-chart-guidance {
  margin: -1px 0 8px;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.45;
}

.signal-chart {
  width: 100%;
  min-height: 250px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
}

.visual-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.visual-grid-line {
  stroke: #262b37;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.visual-zero-line {
  stroke: #51596a;
  stroke-dasharray: 4 5;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.visual-line {
  stroke-width: 1.8;
}

.visual-line.buy {
  stroke: var(--green);
}

.visual-line.sell {
  stroke: var(--coral);
}

.visual-line.net {
  stroke: var(--cyan);
}

.visual-line.price {
  stroke: var(--text);
}

.visual-price-area {
  fill: rgba(140, 123, 255, 0.1);
}

.density-bar.buy,
.legend-swatch.buy,
.pattern-time-marker.buy,
.exposure-bar.buy {
  fill: var(--green);
}

.density-bar.sell,
.legend-swatch.sell,
.pattern-time-marker.sell,
.exposure-bar.sell {
  fill: var(--coral);
}

.density-bar.unknown,
.legend-swatch.unknown,
.pattern-time-marker.unknown {
  fill: var(--amber);
}

.density-bar {
  opacity: 0.82;
}

.legend-swatch.net {
  fill: var(--cyan);
}

.legend-swatch.price {
  fill: var(--text);
}

.legend-swatch.current {
  fill: var(--cyan);
}

.exposure-bar {
  opacity: 0.84;
}

.exposure-zero-line {
  stroke: #4b5262;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.exposure-current-line {
  stroke: var(--cyan);
  stroke-dasharray: 4 4;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.exposure-current-label {
  fill: var(--cyan);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.exposure-price-label {
  fill: var(--text);
}

.pattern-time-marker {
  opacity: 0.86;
  stroke: var(--surface);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.visual-axis-label,
.visual-legend-label,
.visual-empty-label {
  fill: var(--muted-2);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.visual-empty-label {
  fill: var(--muted);
}

/* Trade stream */
.trade-header {
  align-items: flex-start;
  flex-wrap: wrap;
}

.trade-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}

.trade-controls label {
  display: grid;
  gap: 3px;
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 700;
}

.trade-controls select {
  min-width: 135px;
  padding: 0 24px 0 7px;
}

.trade-controls input {
  width: 100px;
  padding: 0 6px;
}

.trade-controls button {
  padding: 0 8px;
  color: var(--cyan);
  font-weight: 750;
}

.trade-controls button:hover {
  border-color: rgba(53, 194, 229, 0.45);
  background: rgba(53, 194, 229, 0.07);
}

.trade-meta {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 9px;
}

.trade-meta strong {
  color: var(--text);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.trade-scroll {
  max-height: 360px;
}

.trade-table {
  min-width: 650px;
}

.trade-table td:first-child {
  color: var(--muted);
  font-size: 10px;
}

/* State timeline */
.timeline-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline-item {
  position: relative;
  min-height: 82px;
  padding: 12px 12px 12px 34px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.timeline-item:nth-child(3n) {
  border-right: 0;
}

.timeline-dot {
  position: absolute;
  top: 16px;
  left: 14px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 2px rgba(53, 194, 229, 0.15);
}

.timeline-dot.buy {
  background: var(--green);
}

.timeline-dot.sell {
  background: var(--coral);
}

.timeline-dot.warning {
  background: var(--amber);
}

.timeline-time {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-2);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.timeline-item strong {
  display: block;
  margin-bottom: 3px;
  font-size: 10px;
}

.timeline-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

/* Login: a product entry point, not a floating form card. */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.login-shell {
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr);
}

.login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.login-logo-link {
  display: inline-flex;
  align-items: center;
}

.login-brand-logo {
  width: 166px;
  height: auto;
  display: block;
  object-fit: contain;
}

.login-center {
  width: 100%;
  max-width: 730px;
  align-self: center;
  justify-self: center;
  padding: 48px 0;
}

.login-tagline {
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  margin: 0;
  padding-bottom: 9px;
  color: var(--amber);
  font-size: var(--fs-label);
  font-weight: 800;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.login-access {
  width: 100%;
  padding: 48px 0 36px;
  border-top: 2px solid var(--amber);
  border-bottom: 1px solid var(--line);
}

.login-access .eyebrow {
  color: var(--amber);
}

.login-access h2 {
  margin: 9px 0 16px;
  color: var(--text);
  font-size: var(--fs-page-title);
  letter-spacing: -0.035em;
}
.pattern-panel .panel-kicker,
.pattern-panel .eyebrow {
  font-size: 9px;
  line-height: 1.15;
}

.pattern-panel .section-heading h2,
.pattern-panel .heading-with-help h2 {
  font-size: 14px;
  line-height: 1.2;
}

.theme-toggle {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.theme-toggle-icon {
  color: var(--amber);
  font-size: 14px;
  line-height: 1;
}

.login-copy {
  margin: 0 0 24px;
  color: var(--muted-2);
  font-size: var(--fs-body);
}

.login-error {
  margin: 0 0 15px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 102, 120, 0.34);
  border-radius: 3px;
  background: rgba(255, 102, 120, 0.07);
  color: var(--text);
  font-size: var(--fs-meta);
  line-height: 1.45;
}

.google-login {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid #d6d9df;
  border-radius: 3px;
  background: #ffffff;
  color: #202124;
  font-size: var(--fs-control);
  font-weight: 700;
  text-decoration: none;
}

.google-login:hover {
  background: #f3f5f7;
}

.google-g {
  color: #4285f4;
  font-size: var(--fs-section-title);
  font-weight: 800;
}

.login-access-note {
  margin: 14px 0 0;
  color: var(--muted-2);
  font-size: var(--fs-meta);
  line-height: 1.55;
}

@media (max-width: 760px) {
  .login-shell {
    width: min(100% - 36px, 560px);
    grid-template-rows: 64px minmax(0, 1fr);
  }

  .login-access {
    padding: 38px 0 30px;
  }

  .login-tagline {
    padding-bottom: 8px;
    font-size: var(--fs-micro);
    letter-spacing: 0.1em;
  }

  .login-center {
    padding: 38px 0;
  }
}

/* Flow Research is a separate read-only workspace. Unavailable research
   layers remain visible so that missing data cannot be mistaken for zero. */
.flow-research-panel {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 0 32px 70px;
  background: var(--bg);
}

.flow-research-panel[hidden] { display: none; }

.research-header {
  align-items: center;
  padding: 24px 0 18px;
  border-bottom: 1px solid var(--line);
}

.research-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--amber) 55%, var(--line));
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .01em;
}

.research-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr);
  gap: 44px;
  padding: 42px 0;
  border-bottom: 1px solid var(--line);
}

.research-intro h3 {
  max-width: 760px;
  margin: 8px 0 12px;
  color: var(--on-surface);
  font-size: clamp(23px, 3vw, 34px);
  letter-spacing: -.04em;
  line-height: 1.24;
}

.research-intro p {
  max-width: 780px;
  margin: 0;
  color: var(--muted-2);
  font-size: 14px;
  line-height: 1.75;
}

.research-decision-clock {
  display: grid;
  align-content: start;
  margin: 0;
  border-top: 1px solid var(--line);
}

.research-decision-clock div {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.research-decision-clock dt {
  color: var(--text);
  font-size: 11px;
}

.research-decision-clock dd {
  margin: 0;
  color: var(--on-surface);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

.research-unavailable { color: var(--amber) !important; }

.research-sensor-grid,
.research-evidence-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.research-sensor-card,
.research-evidence-card {
  min-width: 0;
  padding: 22px 20px 24px 0;
  border-right: 1px solid var(--line);
}

.research-sensor-card:not(:first-child),
.research-evidence-card:not(:first-child) { padding-left: 20px; }
.research-sensor-card:last-child,
.research-evidence-card:last-child { border-right: 0; }

.research-card-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 11px;
}

.research-card-heading span,
.research-layer-label {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}

.research-sensor-card.is-pending .research-card-heading span,
.research-evidence-card:not(.is-live) .research-layer-label { color: var(--amber); }

.research-sensor-card > b,
.research-evidence-card > strong {
  display: block;
  margin-top: 26px;
  color: var(--on-surface);
  font-size: 18px;
  letter-spacing: -.03em;
  line-height: 1.15;
}

.research-sensor-card > p,
.research-evidence-card p {
  min-height: 58px;
  margin: 10px 0 12px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.55;
}

.research-sensor-card small,
.research-evidence-card small {
  display: block;
  color: var(--text);
  font-size: 10px;
  line-height: 1.4;
}

.research-section { padding: 44px 0 0; }

.research-section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.research-section-header h3 {
  margin: 5px 0 0;
  color: var(--on-surface);
  font-size: 20px;
  letter-spacing: -.025em;
}

.research-section-header > span {
  max-width: 330px;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.5;
  text-align: right;
}

.research-pipeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.research-pipeline li {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  padding: 20px;
  border-right: 1px solid var(--line);
}

.research-pipeline li:first-child { padding-left: 0; }
.research-pipeline li:last-child { border-right: 0; }
.research-pipeline b { color: var(--text); font-size: 11px; }
.research-pipeline strong,
.research-pipeline span,
.research-pipeline em { display: block; }
.research-pipeline strong { color: var(--on-surface); font-size: 13px; }
.research-pipeline span { margin-top: 7px; color: var(--muted-2); font-size: 11px; line-height: 1.5; }
.research-pipeline em { grid-column: 2; margin-top: 12px; color: var(--text); font-size: 10px; font-style: normal; }
.research-pipeline .is-current { background: color-mix(in srgb, var(--cyan) 9%, transparent); }
.research-pipeline .is-current b,
.research-pipeline .is-current em { color: var(--cyan); }

.research-evidence-card h4 {
  margin: 10px 0 0;
  color: var(--on-surface);
  font-size: 14px;
  letter-spacing: -.02em;
}

.research-evidence-card > strong { margin-top: 24px; font-size: 17px; }
.research-evidence-card:not(.is-live) > strong { color: var(--amber); }

.research-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 42px;
  padding: 22px 0 0;
  border-top: 1px solid var(--line);
}

.research-footer p {
  max-width: 770px;
  margin: 0;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.6;
}

.research-footer p strong { color: var(--on-surface); }
.research-footer > div { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 1050px) {
  .research-sensor-grid,
  .research-evidence-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .research-sensor-card:nth-child(3),
  .research-evidence-card:nth-child(3) { border-right: 0; }
  .research-sensor-card:nth-child(n + 4),
  .research-evidence-card:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .research-pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .research-pipeline li:nth-child(3) { border-right: 0; }
  .research-pipeline li:nth-child(n + 4) { border-top: 1px solid var(--line); }
}

@media (max-width: 760px) {
  .flow-research-panel { padding: 0 18px 48px; }
  .research-header,
  .research-section-header,
  .research-footer { align-items: flex-start; flex-direction: column; }
  .research-intro { grid-template-columns: 1fr; gap: 28px; padding: 30px 0; }
  .research-sensor-grid,
  .research-evidence-grid,
  .research-pipeline { grid-template-columns: 1fr; }
  .research-sensor-card,
  .research-evidence-card,
  .research-pipeline li { padding: 18px 0; border-right: 0; border-top: 1px solid var(--line); }
  .research-sensor-card:first-child,
  .research-evidence-card:first-child,
  .research-pipeline li:first-child { border-top: 0; }
  .research-sensor-card:not(:first-child),
  .research-evidence-card:not(:first-child) { padding-left: 0; }
  .research-sensor-card > p { min-height: 0; }
  .research-section-header > span { text-align: left; }
  .research-pipeline li:first-child { padding-left: 0; }
}

/* Mobile navigation is intentionally absent from desktop. */
#mobile-flow-nav {
  display: none;
}

@media (max-width: 1100px) {
  .flow-app {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-sidebar {
    position: relative;
    z-index: 27;
    width: 100%;
    height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .flow-sidebar .brand-block,
  .sidebar-brand,
  .flow-brand {
    min-width: 188px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .flow-nav,
  .sidebar-nav,
  .flow-sidebar nav {
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 3px;
    overflow: auto hidden;
    padding: 7px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    scrollbar-width: none;
  }

  .flow-nav a,
  .flow-nav button,
  .flow-nav-item,
  .sidebar-nav a,
  .sidebar-nav button,
  .flow-sidebar nav a,
  .flow-sidebar nav button {
    flex: 0 0 auto;
  }

  .flow-sidebar .ranking-panel {
    max-height: 230px;
    border-left: 0;
  }

  .sidebar-watchlist {
    display: none;
  }

  .flow-sidebar .ranking-table {
    min-width: 420px;
    table-layout: auto;
  }

  .flow-sidebar .ranking-table th:nth-child(2),
  .flow-sidebar .ranking-table td:nth-child(2),
  .flow-sidebar .ranking-table th:nth-child(4),
  .flow-sidebar .ranking-table td:nth-child(4) {
    display: table-cell;
  }

  .flow-sidebar .ranking-panel .panel-header,
  .flow-sidebar .ranking-panel .sort-tabs,
  .flow-sidebar .ranking-panel .ranking-controls,
  .flow-sidebar .ranking-panel .panel-footer {
    display: none;
  }

  .flow-sidebar-footer,
  .sidebar-footer,
  .sidebar-alerts {
    display: none;
  }

  .flow-stage {
    padding-inline: 12px;
  }

  .workspace-grid,
  .flow-stage .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ranking-panel {
    position: static;
  }

  .signal-visual-grid,
  .metric-grid,
  .timeline-list {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .market-context-card:nth-child(3) {
    border-right: 0;
  }

  .market-context-card:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }

  .market-context-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .signal-chart-section,
  .signal-chart-section:nth-child(2),
  .signal-chart-section-wide {
    grid-column: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .signal-chart-section-wide:last-child {
    border-bottom: 0;
  }

  .recent-flow-reading,
  .recent-flow-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .recent-flow-detail {
    grid-column: auto;
  }

  .metric-grid {
    gap: 1px;
  }

  .timeline-item,
  .timeline-item:nth-child(3n) {
    border-right: 0;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 62px;
  }

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

  .market-context-card:nth-child(3) {
    border-right: 1px solid var(--line);
  }

  .market-context-card:nth-child(even) {
    border-right: 0;
  }

  .market-context-card:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .market-context-card:last-child {
    grid-column: 1 / -1;
  }

  .market-context-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .market-context-footer > p {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .market-context-footer > p span {
    overflow: visible;
    white-space: normal;
  }

  .context-projection-status {
    flex-wrap: wrap;
  }

  .app-shell,
  .flow-stage {
    padding-right: 8px;
    padding-left: 8px;
  }

  .app-shell {
    padding-bottom: 18px;
  }

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

  .flow-sidebar .brand-block,
  .sidebar-brand,
  .flow-brand {
    min-width: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .flow-nav,
  .sidebar-nav,
  .flow-sidebar nav {
    display: none;
  }

  .flow-sidebar .ranking-panel {
    max-height: 170px;
  }

  .topbar {
    min-height: 50px;
    align-items: center;
    padding: 5px 0;
    flex-wrap: wrap;
  }

  .topbar > .brand-block {
    min-width: 0;
  }

  .topbar-status {
    gap: 5px;
  }

  .auth-user,
  .market-clock {
    font-size: 9px;
  }

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

  .flow-status-banner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-card {
    min-height: 61px;
  }

  .flow-commandbar {
    top: 50px;
    overflow: visible;
  }

  .flow-commandbar-main {
    overflow: auto hidden;
    scrollbar-width: none;
  }

  .flow-commandbar-main::-webkit-scrollbar {
    display: none;
  }

  .flow-commandbar .command-group,
  .command-group {
    flex: 0 0 auto;
  }

  .flow-commandbar .command-spacer,
  .command-spacer {
    display: none;
  }

  .flow-commandbar button,
  .flow-commandbar input,
  .flow-commandbar select,
  .command-button,
  .sort-tab,
  .side-filter,
  .pattern-state-filter,
  .signal-filter,
  .alert-filter,
  .pattern-pagination button,
  .trade-controls select,
  .trade-controls input,
  .trade-controls button,
  .ranking-search input,
  .ranking-alert-toggle,
  #flow-column-panel label,
  .column-option {
    min-height: 40px;
  }

  #flow-filter-panel {
    grid-template-columns: minmax(0, 1fr);
    max-height: 52vh;
    overflow: auto;
  }

  #flow-filter-panel .side-filters,
  #flow-filter-panel .state-filters,
  #flow-filter-panel .signal-filters,
  #flow-filter-panel .alert-filters,
  .pattern-filter-bar .side-filters,
  .pattern-filter-bar .state-filters,
  .pattern-filter-bar .signal-filters,
  .pattern-filter-bar .alert-filters {
    width: 100%;
    overflow: auto hidden;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  #flow-column-panel {
    top: auto;
    right: 8px;
    bottom: 68px;
    left: 8px;
    width: auto;
    max-height: 52vh;
  }

  .panel-header,
  .pattern-header,
  .trade-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .pattern-filter-bar,
  .trade-controls {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow: auto hidden;
    scrollbar-width: none;
  }

  .instrument-heading {
    flex-direction: column;
  }

  .pattern-scroll,
  .flow-stage .pattern-scroll {
    min-height: 58vh;
    max-height: 68vh;
  }

  .pattern-table {
    min-width: 610px;
  }

  .pattern-table .col-optional:not(.is-mobile-visible),
  .pattern-table [data-priority="optional"]:not(.is-mobile-visible),
  .pattern-table [data-mobile="hide"]:not(.is-mobile-visible),
  .pattern-table [data-column="evidence"]:not(.is-mobile-visible),
  .pattern-table [data-column="interval"]:not(.is-mobile-visible),
  .pattern-table [data-column="price"]:not(.is-mobile-visible),
  .pattern-table [data-column="state"]:not(.is-mobile-visible),
  .pattern-table [data-column="reason"]:not(.is-mobile-visible) {
    display: none !important;
  }

  th,
  td {
    padding-right: 7px;
    padding-left: 7px;
  }

  .signal-chart {
    min-height: 210px;
  }

  .trade-controls label {
    flex: 0 0 auto;
  }

  .trade-controls select {
    min-width: 155px;
  }

  #mobile-flow-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 120;
    min-height: 58px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(64px, 1fr);
    align-items: stretch;
    overflow: auto hidden;
    padding: 4px max(6px, env(safe-area-inset-right))
      max(4px, env(safe-area-inset-bottom))
      max(6px, env(safe-area-inset-left));
    border-top: 1px solid var(--border-strong);
    background: rgba(9, 9, 11, 0.98);
    scrollbar-width: none;
  }

  #mobile-flow-nav::-webkit-scrollbar {
    display: none;
  }

  #mobile-flow-nav a,
  #mobile-flow-nav button {
    min-width: 64px;
    min-height: 44px;
    display: grid;
    place-items: center;
    padding: 3px 7px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
  }

  #mobile-flow-nav a.is-active,
  #mobile-flow-nav button.is-active,
  #mobile-flow-nav [aria-current="page"] {
    background: var(--surface-2);
    color: var(--brand-orange);
  }

  .mobile-flow-icon {
    width: 18px;
    height: 18px;
    display: block;
    margin-bottom: 1px;
    opacity: 0.9;
  }
}

/* Landing v2: editorial market-data aesthetic inspired by modern financial terminals. */
.landing-page { background: #0b0d12; }
.landing-shell { width: min(1240px, calc(100% - 72px)); }
.landing-header { height: 74px; padding: 0; border-bottom: 1px solid #262b35; }
.landing-header img { width: 166px; }
.landing-nav { display: flex; align-items: center; gap: 30px; }
.landing-nav a { color: #aab2bf; font-size: 13px; text-decoration: none; }
.landing-nav a:hover { color: #fff; }
.landing-nav a:last-child { padding: 10px 17px; color: #0b0d12; background: #fda821; border-radius: 3px; font-weight: 800; }
.landing-ticker { display: flex; gap: 34px; min-height: 38px; align-items: center; overflow: hidden; border-bottom: 1px solid #262b35; color: #aab2bf; font-size: 12px; white-space: nowrap; }
.landing-ticker span { display: inline-flex; gap: 7px; }
.landing-ticker b { color: #46d3a3; font-weight: 700; }
.landing-hero { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(390px, .94fr); gap: 72px; align-items: center; max-width: none; padding: 112px 0 126px; }
.landing-hero h1 { margin: 16px 0 24px; color: #f5f7fa; font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 6vw, 82px); font-weight: 500; letter-spacing: -0.065em; line-height: .98; }
.landing-hero h1 em { color: #fda821; }
.landing-copy { max-width: 560px; color: #aab2bf; font-size: 17px; line-height: 1.7; }
.landing-actions { display: flex; align-items: center; gap: 22px; margin-top: 32px; }
.landing-primary-cta { padding: 13px 17px; border-radius: 3px; font-size: 14px; }
.landing-secondary-cta { color: #f5f7fa; font-size: 14px; text-decoration: none; }
.landing-terminal { padding: 18px; border: 1px solid #303642; border-radius: 5px; background: #11141b; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.terminal-top { display: flex; gap: 8px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid #2a303a; color: #fda821; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.terminal-top span:last-child { margin-left: auto; color: #7f8997; font-size: 10px; font-weight: 500; letter-spacing: 0; }
.terminal-live { width: 7px; height: 7px; border-radius: 50%; background: #46d3a3; }
.terminal-title { display: flex; align-items: baseline; gap: 8px; padding: 20px 0 18px; color: #fff; font-size: 21px; font-weight: 800; }
.terminal-title small { color: #7f8997; font-size: 11px; font-weight: 500; }
.terminal-title b { margin-left: auto; color: #46d3a3; font-size: 11px; }
.terminal-row { display: grid; grid-template-columns: 1.2fr .65fr 1fr .45fr; align-items: center; padding: 13px 0; border-bottom: 1px solid #252b35; color: #cbd5e1; font-size: 12px; }
.terminal-head { padding: 0 0 8px; color: #7f8997; font-size: 9px; letter-spacing: .1em; }
.terminal-row strong.buy { color: #46d3a3; }.terminal-row strong.sell { color: #ff6678; }.terminal-row .score { color: #fda821; text-align: right; }
.terminal-foot { padding-top: 16px; color: #7f8997; font-size: 11px; }
.preview-tabs { display: flex; gap: 26px; padding: 0 0 12px; border-bottom: 1px solid #252b35; color: #7f8997; font-size: 11px; }
.preview-tabs b { color: #fda821; }
.landing-points { border-color: #262b35; }
.landing-points article { padding: 26px 24px; border-color: #262b35; }
.landing-points strong { color: #fff; font-size: 16px; }.landing-points span { color: #8e98a7; font-size: 13px; }
.landing-proof { display: grid; grid-template-columns: .8fr 1.4fr 1fr; gap: 30px; align-items: start; padding: 80px 0 86px; }
.landing-proof > span { color: #fda821; font-size: 10px; font-weight: 800; letter-spacing: .14em; }.landing-proof strong { color: #fff; font-family: Georgia, "Times New Roman", serif; font-size: 28px; font-weight: 500; line-height: 1.2; }.landing-proof p { margin: 0; color: #8e98a7; font-size: 13px; }
.landing-footer { border-top: 1px solid #262b35; color: #687282; }
@media (max-width: 820px) { .landing-shell { width: min(100% - 32px, 620px); }.landing-nav a:not(:last-child) { display: none; }.landing-hero { grid-template-columns: 1fr; gap: 48px; padding: 76px 0 82px; }.landing-terminal { max-width: 560px; }.landing-proof { grid-template-columns: 1fr; gap: 16px; padding: 60px 0; } }

/* Keep landing v2 above the legacy landing defaults. */
.landing-page { background: #0b0d12; }
.landing-shell { width: min(1240px, calc(100% - 72px)); }
.landing-header { height: 74px; padding: 0; }
.landing-header img { width: 166px; }
.landing-nav { display: flex; gap: 30px; align-items: center; }
.landing-nav a { color: #aab2bf; font-size: 13px; text-decoration: none; }
.landing-nav a:last-child { padding: 10px 17px; color: #0b0d12; background: #fda821; border-radius: 3px; font-weight: 800; }
.landing-ticker { display: flex; gap: 34px; min-height: 38px; align-items: center; overflow: hidden; border-bottom: 1px solid #262b35; color: #aab2bf; font-size: 12px; white-space: nowrap; }
.landing-ticker span { display: inline-flex; gap: 7px; }.landing-ticker b { color: #46d3a3; }
.landing-hero { display: grid; grid-template-columns: minmax(0,1.06fr) minmax(390px,.94fr); gap: 72px; max-width: none; padding: 112px 0 126px; }
.landing-hero h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px,6vw,82px); font-weight: 500; line-height: .98; }.landing-copy { color: #aab2bf; font-size: 17px; }.landing-actions { display: flex; gap: 22px; align-items: center; margin-top: 32px; }.landing-secondary-cta { color: #f5f7fa; font-size: 14px; text-decoration: none; }
.landing-terminal { padding: 18px; border: 1px solid #303642; border-radius: 5px; background: #11141b; box-shadow: 0 24px 70px rgba(0,0,0,.35); }.terminal-top { display: flex; gap: 8px; padding-bottom: 16px; color: #fda821; font-size: 10px; }.terminal-title { display: flex; gap: 8px; padding: 20px 0 18px; color: #fff; font-size: 21px; font-weight: 800; }.terminal-title small { color: #7f8997; font-size: 11px; }.terminal-title b { margin-left: auto; color: #46d3a3; font-size: 11px; }.terminal-row { display: grid; grid-template-columns: 1.2fr .65fr 1fr .45fr; padding: 13px 0; border-bottom: 1px solid #252b35; color: #cbd5e1; font-size: 12px; }.terminal-head { padding: 0 0 8px; color: #7f8997; font-size: 9px; }.terminal-row strong.buy { color: #46d3a3; }.terminal-row strong.sell { color: #ff6678; }.terminal-row .score { color: #fda821; text-align: right; }.terminal-foot { padding-top: 16px; color: #7f8997; font-size: 11px; }
.landing-points article { padding: 26px 24px; }.landing-points strong { color: #fff; font-size: 16px; }.landing-points span { color: #8e98a7; font-size: 13px; }.landing-proof { display: grid; grid-template-columns: .8fr 1.4fr 1fr; gap: 30px; padding: 80px 0 86px; }.landing-proof strong { color: #fff; font-family: Georgia, "Times New Roman", serif; font-size: 28px; font-weight: 500; }.landing-proof p { color: #8e98a7; font-size: 13px; }
@media (max-width: 820px) { .landing-shell { width: min(100% - 32px, 620px); }.landing-nav a:not(:last-child) { display: none; }.landing-hero { grid-template-columns: 1fr; gap: 48px; padding: 76px 0 82px; }.landing-proof { grid-template-columns: 1fr; gap: 16px; padding: 60px 0; } }
.live-flow-preview .preview-tabs { display: flex; gap: 26px; padding: 0 0 12px; border-bottom: 1px solid #252b35; color: #7f8997; font-size: 11px; }
.live-flow-preview .preview-tabs b { color: #fda821; }
.live-flow-preview { min-width: 0; overflow: hidden; }
.live-flow-preview .terminal-row { grid-template-columns: 68px 1.45fr 48px 58px 45px 45px 82px 42px 46px 42px; min-width: 620px; gap: 7px; padding: 11px 0; font-size: 10px; }
.live-flow-preview .terminal-head { font-size: 8px; padding-bottom: 8px; }
.live-flow-preview .terminal-row strong { white-space: nowrap; }
.live-flow-preview .terminal-row strong small { color: #7f8997; font-size: 8px; font-weight: 500; }
.live-flow-preview .terminal-row .active,
.live-flow-preview .terminal-row .candidate { color: #46d3a3; }
.live-flow-preview .terminal-row .weakening { color: #fda821; }
.live-flow-preview .score-muted { color: #fda821 !important; }
.landing-hero { grid-template-columns: minmax(0,.82fr) minmax(0,1.18fr); gap: 52px; }
.live-flow-preview { width: 100%; padding: 22px 0 0; border: 0; border-top: 1px solid #303642; border-bottom: 1px solid #303642; border-radius: 0; background: transparent; box-shadow: none; }
.live-flow-preview .terminal-top { padding: 0 0 15px; }
.live-flow-preview .terminal-title { padding: 18px 0 15px; }
.landing-chart { margin-top: 20px; padding-top: 14px; border-top: 1px solid #252b35; }
.chart-label { display: flex; justify-content: space-between; color: #7f8997; font-size: 9px; letter-spacing: .12em; }
.chart-label b { color: #fda821; font-size: 10px; font-weight: 500; letter-spacing: 0; }
.landing-chart svg { display: block; width: 100%; height: 120px; margin-top: 8px; }
.chart-grid { fill: none; stroke: #252b35; stroke-width: 1; }
.chart-area { fill: rgba(253,168,33,.09); stroke: none; }
.chart-line { fill: none; stroke: #fda821; stroke-width: 2; vector-effect: non-scaling-stroke; }
.live-flow-preview .terminal-foot { padding: 13px 0 16px; }
.landing-page .landing-hero { grid-template-columns: minmax(0,.82fr) minmax(0,1.18fr); gap: 52px; }
.landing-page .landing-hero { grid-template-columns: minmax(340px,.68fr) minmax(680px,1.32fr); gap: 42px; }
@media (max-width: 1100px) { .landing-page .landing-hero { grid-template-columns: minmax(0,.72fr) minmax(0,1.28fr); gap: 30px; } }
.landing-page .live-flow-preview { width: 100%; padding: 22px 0 0; border: 0; border-top: 1px solid #303642; border-bottom: 1px solid #303642; border-radius: 0; background: transparent; box-shadow: none; }
.landing-page .live-flow-preview { margin-left: 18px; width: calc(100% - 18px); }
.landing-page .live-flow-preview .terminal-top { border-bottom: 0; }
@media (max-width: 1100px) { .landing-page .live-flow-preview { margin-left: 0; width: 100%; } }
@media (max-width: 820px) {
  .landing-page .landing-hero { display: flex; flex-direction: column; align-items: stretch; }
  .landing-page .landing-hero-copy { order: 1; }
  .landing-page .live-flow-preview { order: 2; margin-left: 0; width: 100%; overflow-x: auto; }
  .landing-page .live-flow-preview .terminal-row { min-width: 620px; }
}
.landing-page .live-flow-preview .terminal-top { border-bottom: 0; }
.landing-page .live-flow-preview .terminal-top { position: relative; padding-right: 150px; white-space: nowrap; }
.landing-page .live-flow-preview .terminal-top > span:last-child { position: absolute; top: 0; right: 0; margin-left: 0; text-align: right; white-space: nowrap; }
.landing-page .landing-chart { margin-top: 20px; padding-top: 14px; border-top: 1px solid #252b35; }
.landing-page .chart-label { display: flex; justify-content: space-between; color: #7f8997; font-size: 9px; letter-spacing: .12em; }
.landing-page .chart-label b { color: #fda821; font-size: 10px; font-weight: 500; letter-spacing: 0; }
.landing-page .landing-chart svg { display: block; width: 100%; height: 120px; margin-top: 8px; }
.landing-page .chart-grid { fill: none; stroke: #252b35; stroke-width: 1; }.landing-page .chart-area { fill: rgba(253,168,33,.09); stroke: none; }.landing-page .chart-line { fill: none; stroke: #fda821; stroke-width: 2; vector-effect: non-scaling-stroke; }
.docs-panel { background: #09090b; }
.docs-header, .docs-hero { background: transparent; }
.docs-hero { padding: 30px 4px 34px; }
.docs-grid, .site-map-grid { gap: 0; border-top: 1px solid var(--line); background: transparent; }
.docs-card, .site-map-card { min-height: 150px; padding: 22px 20px 24px 0; border: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: transparent; }
.docs-card:not(:nth-child(4n)), .site-map-card:not(:nth-child(3n)) { padding-right: 24px; }
.docs-card:not(:nth-child(4n)), .site-map-card:not(:nth-child(3n)) { margin-right: 20px; }
.docs-card-key { padding: 0; border: 0; color: var(--cyan); font-size: 10px; }
.docs-card h3, .site-map-card h3, .docs-section h3 { font-size: 17px; }
.docs-card p, .site-map-card p, .site-map-card li { font-size: 13px; line-height: 1.6; }
.docs-section { padding: 28px 4px; background: transparent; }
.docs-steps, .docs-terms { gap: 0; border-top: 1px solid var(--line); }
.docs-steps li, .docs-terms > div { padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.data-flow-map { gap: 0; border-top: 1px solid var(--line); }
.data-flow-map > div { min-height: 100px; padding: 16px 18px 16px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.data-flow-map > div:not(:last-child)::after { padding-right: 14px; }
.topbar .connection-pill { font-size: var(--fs-micro); }
.flow-table-note { font-size: 10px; }
.market-session-banner { display: flex; align-items: center; gap: 12px; min-height: 30px; margin: 6px 0; padding: 5px 10px; border-bottom: 1px solid var(--line); color: var(--muted-2); font-size: var(--fs-meta); }
.market-session-banner strong { color: var(--green); font-size: var(--fs-control); }
.market-session-banner[data-session="closed"] strong,
.market-session-banner[data-session="preopen"] strong { color: var(--amber); }
.market-session-banner[data-session="closed"] { background: rgba(253,168,33,.06); }

@media (max-width: 430px) {
  .summary-card {
    padding-right: 8px;
    padding-left: 8px;
  }

  .summary-card strong {
    font-size: 16px;
  }

  .simulation-badge {
    display: none;
  }

  .login-panel {
    padding: 22px;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: #566071;
    --line-soft: #424b5b;
    --border-strong: #7b8799;
    --muted: #c0c8d4;
    --muted-2: #aab4c2;
  }

  .panel,
  .summary-strip,
  .flow-commandbar,
  #flow-filter-panel,
  table,
  .signal-chart {
    border-width: 2px;
  }

  .capture-count,
  .pattern-side,
  .state-pill,
  .signal-pill,
  .alert-badge,
  .quality-chip,
  .connection-pill,
  .simulation-badge {
    border-width: 2px;
  }
}

@media (forced-colors: active) {
  :root {
    --bg: Canvas;
    --background: Canvas;
    --sidebar: Canvas;
    --surface: Canvas;
    --surface-2: Canvas;
    --surface-3: Canvas;
    --line: CanvasText;
    --line-soft: CanvasText;
    --border: CanvasText;
    --border-strong: CanvasText;
    --text: CanvasText;
    --muted: CanvasText;
    --muted-2: CanvasText;
    --cyan: Highlight;
    --blue: Highlight;
    --green: CanvasText;
    --mint: CanvasText;
    --coral: CanvasText;
    --red: CanvasText;
    --amber: CanvasText;
    --violet: CanvasText;
  }

  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  a:focus-visible,
  [tabindex]:focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }
}

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

/* UW-style density pass: text-first live flow with minimal chrome. */
.flow-app {
  grid-template-columns: 166px minmax(0, 1fr);
}

.topbar {
  min-height: 40px;
  height: 40px;
}

.flow-brand {
  min-height: 40px;
}

.flow-status-banner {
  height: 36px;
  margin: 6px 0;
}

.flow-status-item {
  min-height: 34px;
  height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 7px;
  padding: 3px 8px;
}

.flow-status-item .summary-label-row {
  min-width: 0;
}

.flow-status-item strong {
  margin: 0;
  font-size: 14px;
  line-height: 1;
}

.flow-status-item small {
  display: none;
}

.flow-commandbar {
  min-height: 34px;
  margin-bottom: 6px;
  padding: 2px 5px;
}

.flow-commandbar-main {
  min-height: 28px;
}

.flow-commandbar button,
.flow-command-button {
  min-height: 26px;
  height: 26px;
  padding-inline: 8px;
}

.panel-header {
  min-height: 34px;
  padding: 4px 9px;
}

.pattern-header {
  min-height: 34px;
}

.flow-content {
  gap: 7px;
}

.pattern-table {
  min-width: 1164px;
  table-layout: fixed;
}

.pattern-table th,
.pattern-table td {
  height: 32px;
  padding: 4px 8px;
}

.pattern-table td {
  font-size: 13px;
}

.pattern-table th {
  height: 28px;
  font-size: 9px;
}

.pattern-table [data-column="time"] {
  width: 76px;
}

.pattern-table [data-column="ticker"] {
  width: 142px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pattern-table [data-column="side"] {
  width: 50px;
}

.pattern-table [data-column="quantity"] {
  width: 72px;
}

.pattern-table [data-column="evidence"] {
  width: 50px;
}

.pattern-table [data-column="interval"] {
  width: 62px;
}

.pattern-table [data-column="price"] {
  width: 82px;
}

.pattern-table [data-column="score"] {
  width: 94px;
}

.pattern-table [data-column="state"] {
  width: 58px;
}

.pattern-table [data-column="alert"] {
  width: 92px;
}

.pattern-table [data-column="verification"] {
  width: 126px;
}

.pattern-table [data-column="reason"] {
  width: 260px;
  max-width: 260px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.pattern-table [data-column="ticker"] .stock-name,
.pattern-table [data-column="ticker"] .stock-code {
  display: inline;
  max-width: none;
  margin: 0;
  font-size: inherit;
  line-height: inherit;
}

.pattern-table [data-column="ticker"] .stock-code {
  margin-left: 6px;
  color: var(--muted-2);
  font-size: 10px;
}

.pattern-table .pattern-side,
.pattern-table .state-pill,
.pattern-table .alert-badge {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.2;
}

.pattern-table .pattern-side.buy,
.pattern-table .pattern-side.sell,
.pattern-table .pattern-side.unknown,
.pattern-table .state-pill.active,
.pattern-table .state-pill.weakening,
.pattern-table .state-pill.degraded,
.pattern-table .alert-badge.eligible {
  border: 0;
  background: transparent;
}

.pattern-table .flow-reason {
  width: 100%;
  max-width: 100%;
  display: block;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pattern-table .flow-tags {
  display: none;
}

/* Statuses read as text; color carries meaning without capsule chrome. */
.simulation-badge,
.connection-pill,
.quality-chip,
.ticker-code,
.panel-count,
.status-chip,
.flow-tag,
.capture-count,
.signal-pill {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.2;
}

.simulation-badge,
.connection-pill,
.status-chip,
.panel-count,
.capture-count {
  font-size: 10px;
}

.connection-pill.is-disconnected,
.connection-pill.is-stale,
.connection-pill.is-reconnecting,
.connection-pill.is-restored,
.status-chip.is-stale,
.status-chip.is-reconnecting,
.status-chip.is-restored,
.capture-count.has-alert,
.capture-count.is-empty {
  border: 0;
  background: transparent;
}

@media (max-width: 1100px) {
  .flow-app {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-brand {
    min-height: 40px;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 40px;
    height: auto;
  }

  .flow-status-banner {
    height: auto;
  }

  .flow-status-item {
    min-height: 36px;
  }

  .flow-commandbar button,
  .flow-command-button,
  .sort-tab,
  .side-filter,
  .pattern-state-filter,
  .signal-filter,
  .alert-filter,
  .pattern-pagination button,
  .trade-controls select,
  .trade-controls input,
  .trade-controls button,
  .ranking-search input,
  .ranking-alert-toggle,
  #flow-column-panel label,
  .column-option {
    min-height: 40px;
    height: auto;
  }

  .pattern-table {
    min-width: 600px;
  }

  .pattern-table [data-column="ticker"] {
    width: 136px;
  }
}

/* Final UW palette and live-flow table contract. */
:root {
  --bg: #09090b;
  --sidebar: #09090b;
  --surface: #121217;
  --surface-2: #19191f;
  --surface-3: #202026;
  --line: #2b2b33;
  --line-soft: rgba(43, 43, 51, 0.72);
  --border-strong: #3a3a44;
  --text: #f4f4f5;
  --muted: var(--text);
  --muted-2: var(--text);
}

.pattern-panel,
.pattern-panel .detail-view,
.pattern-panel .pattern-scroll,
.pattern-panel .pattern-table,
.pattern-panel .pattern-pagination {
  background: #09090b;
}

.pattern-table tbody tr:nth-child(odd) {
  background: #19191f;
}

.pattern-table tbody tr:nth-child(even) {
  background: #121217;
}

.pattern-table tbody tr:hover {
  background: rgba(53, 194, 229, 0.09);
}

.pattern-table tbody tr.is-selected,
.pattern-table tbody tr[aria-selected="true"] {
  background: rgba(53, 194, 229, 0.13);
}

.score-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
}

.score-cell > strong {
  display: none;
}

.score-meter {
  width: 80px;
  height: 20px;
  display: block;
  flex: 0 0 80px;
  overflow: hidden;
  border-radius: 0;
}

.score-meter-view {
  width: 80px;
  height: 20px;
  display: block;
  overflow: hidden;
}

.score-meter-track {
  fill: #202026;
  stroke: #303038;
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

.score-meter-fill {
  fill: var(--cyan);
}

.score-meter-fill.strong {
  fill: #33b890;
}

.score-meter-fill.watch {
  fill: var(--amber);
}

.score-meter-fill.weak {
  fill: var(--violet);
}

.score-meter-boundary {
  fill: #f4f4f5;
}

.score-meter-value {
  fill: #ffffff;
  font-size: 10px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

/* On-demand instrument inspector. */
.flow-detail-trigger {
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.flow-detail-trigger:hover .flow-ticker-name,
.flow-detail-trigger:focus-visible .flow-ticker-name {
  color: var(--cyan);
}

.flow-detail-trigger .flow-ticker-name,
.flow-detail-trigger .stock-code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-detail-open {
  overflow: hidden;
}

.instrument-detail-dialog {
  position: fixed;
  inset: 12px 12px auto 178px;
  width: auto;
  height: auto;
  max-width: none;
  max-height: calc(100vh - 24px);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--overlay-surface);
  color: var(--text);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.58);
}

.instrument-detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.76);
}

.instrument-detail-shell {
  width: 100%;
  height: auto;
  max-height: inherit;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--overlay-surface);
}

.instrument-detail-toolbar {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto 48px;
  align-items: center;
  gap: 16px;
  padding: 7px 10px 7px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--overlay-surface);
}

.instrument-detail-heading {
  min-width: 0;
}

.instrument-detail-heading .eyebrow {
  margin-bottom: 1px;
}

.instrument-detail-heading h2 {
  overflow: hidden;
  margin: 0;
  color: var(--on-surface);
  font-size: 17px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instrument-detail-heading h2:focus {
  outline: 0;
  box-shadow: none;
}

.instrument-detail-heading > p:last-child {
  overflow: hidden;
  margin: 2px 0 0;
  color: var(--text);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instrument-detail-nav {
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.instrument-detail-nav::-webkit-scrollbar {
  display: none;
}

.instrument-detail-nav-button {
  position: relative;
  min-width: max-content;
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  font-weight: 750;
}

.instrument-detail-nav-button:hover,
.instrument-detail-nav-button.is-active {
  border-bottom-color: var(--cyan);
  color: var(--on-surface);
}

.instrument-detail-close {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--on-surface);
  font-size: 10px;
  font-weight: 750;
}

.instrument-detail-close:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.instrument-detail-body {
  min-height: 0;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 8px;
  padding: 8px;
  overflow: auto;
  max-height: calc(100vh - 86px);
  overscroll-behavior: contain;
  background: var(--overlay-surface);
  scrollbar-color: var(--border-strong) var(--overlay-surface);
  scrollbar-width: thin;
}

/* Summary is a compact inspector; only analytical tabs need a viewport-sized shell. */
.instrument-detail-dialog[data-detail-tab="summary"] {
  height: auto !important;
}

.instrument-detail-dialog[data-detail-tab="summary"] .instrument-detail-shell {
  height: auto;
}

.instrument-detail-dialog[data-detail-tab="summary"] .instrument-detail-body {
  max-height: none;
  overflow: visible;
}

.instrument-detail-body > .panel {
  width: 100%;
  scroll-margin-top: 8px;
}

.instrument-detail-body .trade-scroll {
  max-height: 390px;
}

@media (max-width: 1100px) {
  .instrument-detail-dialog {
    inset: 8px 8px auto;
    max-height: calc(100vh - 16px);
  }
}

@media (max-width: 720px) {
  body.is-detail-open {
    padding-bottom: 0;
  }

  body.is-detail-open #mobile-flow-nav {
    display: none;
  }

  .instrument-detail-dialog {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .instrument-detail-toolbar {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 6px 10px;
    padding: max(6px, env(safe-area-inset-top)) 8px 0;
  }

  .instrument-detail-heading h2 {
    font-size: 15px;
  }

  .instrument-detail-heading > p:last-child {
    font-size: 9px;
  }

  .instrument-detail-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 40px;
    gap: 18px;
    padding: 0 2px;
  }

  .instrument-detail-nav-button {
    min-height: 40px;
  }

  .instrument-detail-close {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  .instrument-detail-body {
    gap: 6px;
    padding: 6px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }

  .instrument-detail-body .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .instrument-detail-body .instrument-heading {
    flex-direction: column;
  }

  .instrument-detail-body .signal-visual-grid,
  .instrument-detail-body .timeline-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .instrument-detail-body .signal-chart-section,
  .instrument-detail-body .signal-chart-section:nth-child(2),
  .instrument-detail-body .timeline-item,
  .instrument-detail-body .timeline-item:nth-child(3n) {
    border-right: 0;
  }

  .instrument-detail-body .signal-chart-section-wide {
    grid-column: auto;
  }
}

.docs-panel {
  min-height: calc(100vh - 62px);
  background: #09090b;
}

.docs-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.docs-route-link {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  font-size: 10px;
  font-weight: 750;
}

.docs-route-link:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: #ffffff;
}

.docs-panel[hidden] {
  display: none !important;
}

.docs-header {
  background: #121217;
}

.docs-caption {
  color: var(--text);
  font-size: 10px;
  font-weight: 650;
}

.docs-hero {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.docs-hero h3 {
  max-width: 980px;
  margin: 0;
  color: var(--on-surface);
  font-size: clamp(20px, 2.4vw, 34px);
  line-height: 1.16;
}

.docs-hero p {
  max-width: 920px;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.docs-grid,
.site-map-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

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

.docs-card,
.site-map-card {
  min-height: 160px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 15px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.docs-card:nth-child(4n),
.site-map-card:nth-child(3n) {
  border-right: 0;
}

.docs-card-key {
  width: max-content;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--cyan);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.docs-card h3,
.site-map-card h3,
.docs-section h3 {
  margin: 0;
  color: var(--on-surface);
  font-size: 15px;
  line-height: 1.25;
}

.docs-card p,
.site-map-card p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.site-map-card code {
  color: var(--cyan);
  font: 700 11px/1.4 var(--mono);
}

.site-map-card ul {
  display: grid;
  gap: 6px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.site-map-card li {
  color: var(--text);
  font-size: 11px;
  line-height: 1.45;
}

.site-map-card li::before {
  content: "· ";
  color: var(--cyan);
  font-weight: 900;
}

.docs-section {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}

.docs-steps,
.docs-terms {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
}

.docs-steps {
  list-style: none;
  counter-reset: docs-step;
}

.docs-steps li,
.docs-terms > div {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.docs-steps li {
  counter-increment: docs-step;
}

.docs-steps li strong::before {
  content: counter(docs-step, decimal-leading-zero) " ";
  color: var(--cyan);
}

.docs-steps strong,
.docs-terms dt {
  color: var(--on-surface);
  font-size: 12px;
  font-weight: 800;
}

.docs-steps span,
.docs-terms dd {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.data-flow-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
}

.data-flow-map > div {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.data-flow-map > div:not(:last-child)::after {
  content: "→";
  justify-self: end;
  color: var(--cyan);
  font-weight: 900;
}

.data-flow-map strong {
  color: var(--on-surface);
  font-size: 13px;
}

.data-flow-map span {
  color: var(--text);
  font-size: 11px;
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .docs-grid,
  .site-map-grid,
  .data-flow-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .docs-card:nth-child(4n),
  .site-map-card:nth-child(3n) {
    border-right: 1px solid var(--line);
  }

  .docs-card:nth-child(2n),
  .site-map-card:nth-child(2n) {
    border-right: 0;
  }
}

@media (max-width: 720px) {
  .docs-panel {
    min-height: calc(100dvh - 104px);
  }

  .docs-hero,
  .docs-section {
    padding: 13px;
  }

  .docs-grid,
  .site-map-grid,
  .data-flow-map,
  .docs-steps li,
  .docs-terms > div {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs-card,
  .site-map-card,
  .docs-card:nth-child(2n),
  .site-map-card:nth-child(2n) {
    border-right: 0;
  }

  .docs-caption {
    font-size: 9px;
  }

  .docs-header-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* Watch universe: full route for large instrument lists. */
.universe-panel {
  position: static;
  min-height: calc(100vh - 62px);
  display: flex;
  flex-direction: column;
}

.quality-detail-panel {
  min-height: calc(100vh - 62px);
}

.quality-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line);
}

.quality-detail-card {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.quality-detail-card:last-child {
  border-right: 0;
}

.quality-detail-card span,
.quality-detail-card small {
  color: var(--text);
  font-size: 11px;
}

.quality-detail-card strong {
  color: var(--on-surface);
  font-size: 21px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.quality-detail-card small {
  color: var(--muted);
  font-size: 10px;
}

.quality-detail-note {
  margin: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .quality-detail-panel {
    min-height: calc(100dvh - 104px);
  }

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

  .quality-detail-card:nth-child(2n) {
    border-right: 0;
  }
}

.universe-panel[hidden] {
  display: none !important;
}

.universe-panel .ranking-header {
  flex: 0 0 auto;
}

.universe-panel .ranking-scroll {
  flex: 1 1 auto;
  max-height: none;
  border-top: 1px solid var(--line);
}

.universe-panel .ranking-table {
  min-width: 720px;
  table-layout: fixed;
}

.universe-panel .ranking-table th:nth-child(1),
.universe-panel .ranking-table td:nth-child(1) {
  width: 30%;
}

.universe-panel .ranking-table th:nth-child(2),
.universe-panel .ranking-table td:nth-child(2) {
  width: 20%;
}

.universe-panel .ranking-table th:nth-child(3),
.universe-panel .ranking-table td:nth-child(3) {
  width: 20%;
}

.universe-panel .ranking-table th:nth-child(4),
.universe-panel .ranking-table td:nth-child(4) {
  width: 18%;
}

.universe-panel .ranking-table th:nth-child(5),
.universe-panel .ranking-table td:nth-child(5) {
  width: 12%;
}

/* Instrument summary: turn the first tab into an actionable reading path. */
.summary-insight-panel,
.summary-tab-preview,
.summary-patterns,
.signal-trust-panel {
  margin-top: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.summary-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.summary-section-heading h3 {
  margin: 0;
  color: var(--on-surface);
  font-size: 12px;
  line-height: 1.25;
}

.summary-section-heading .eyebrow {
  margin-bottom: 2px;
}

.summary-section-meta {
  color: var(--text);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.summary-insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  gap: 1px;
  background: var(--line);
}

.signal-trust-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.signal-trust-card {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  background: var(--surface-2);
}

.signal-trust-card > span,
.signal-trust-card small,
.signal-trust-detail {
  color: var(--text);
  font-size: 9px;
  line-height: 1.4;
}

.signal-trust-card strong {
  overflow: hidden;
  color: var(--on-surface);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-trust-detail {
  margin: 8px 0 0;
  color: var(--muted);
}

.pressure-summary,
.summary-readout {
  min-width: 0;
  padding: 11px;
  background: var(--surface-2);
}

.summary-inline-label,
.pressure-legend,
.summary-tab-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.summary-inline-label span,
.summary-readout-label {
  color: var(--text);
  font-size: 10px;
  font-weight: 750;
}

.summary-inline-label strong {
  color: var(--on-surface);
  font-size: 13px;
}

.pressure-meter {
  height: 12px;
  display: flex;
  overflow: hidden;
  margin: 13px 0 7px;
  border: 1px solid var(--line);
  background: var(--surface-contrast);
}

.pressure-meter span {
  display: block;
  min-width: 0;
  height: 100%;
  transition: width 180ms ease;
}

.pressure-meter-buy {
  background: var(--green);
}

.pressure-meter-sell {
  background: var(--coral);
}

.pressure-legend {
  color: var(--text);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.summary-readout {
  display: grid;
  align-content: center;
  gap: 3px;
}

.summary-readout strong {
  color: var(--on-surface);
  font-size: 15px;
  line-height: 1.2;
}

.summary-readout p {
  margin: 1px 0 0;
  color: var(--text);
  font-size: 10px;
  line-height: 1.45;
}

.summary-tab-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.summary-tab-preview-button {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  border: 0;
  border-radius: 0;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
}

.summary-tab-preview-button:hover,
.summary-tab-preview-button:focus-visible {
  background: var(--surface-contrast);
  color: var(--on-surface);
}

.summary-tab-preview-top strong {
  color: var(--on-surface);
  font-size: 11px;
}

.summary-tab-preview-top span {
  color: var(--cyan);
  font-size: 14px;
  line-height: 1;
}

.summary-tab-preview-button > strong {
  color: var(--on-surface);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.summary-tab-preview-button small {
  overflow: hidden;
  color: var(--text);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-pattern-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.summary-pattern-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 68px minmax(150px, 1.2fr) 58px minmax(155px, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
}

.summary-pattern-row:hover,
.summary-pattern-row:focus-visible,
.summary-pattern-row.is-selected {
  background: var(--surface-contrast);
  color: var(--on-surface);
}

.summary-pattern-time,
.summary-pattern-score,
.summary-pattern-state,
.summary-pattern-main small {
  color: var(--text);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.summary-pattern-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.summary-pattern-main strong {
  overflow: hidden;
  color: var(--on-surface);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-pattern-score {
  color: var(--cyan);
  font-weight: 800;
  text-align: right;
}

.summary-pattern-state {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-empty {
  margin: 0;
  padding: 12px 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 10px;
}

/* The richer summary stays compact when it fits and scrolls only when needed. */
.instrument-detail-dialog[data-detail-tab="summary"] .instrument-detail-body {
  max-height: calc(100vh - 86px);
  overflow: auto;
}

@media (max-width: 720px) {
  .universe-panel {
    min-height: calc(100dvh - 104px);
  }

  .universe-panel .ranking-controls {
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .universe-panel .ranking-alert-toggle > span {
    display: none;
  }

  .summary-insight-grid,
  .summary-tab-grid,
  .signal-trust-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-pattern-row {
    grid-template-columns: 54px minmax(0, 1fr) 48px;
    gap: 7px;
  }

  .instrument-detail-dialog[data-detail-tab="summary"] .instrument-detail-body {
    max-height: calc(100dvh - 104px);
  }

  .summary-pattern-state {
    grid-column: 2 / -1;
  }
}

/* Timeline: explain state transitions before showing the event log. */
.timeline-purpose {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
  gap: 1px;
  margin-bottom: 10px;
  background: var(--line);
}

.timeline-purpose-copy,
.timeline-stage-guide,
.timeline-summary-grid > div {
  background: var(--surface-2);
}

.timeline-purpose-copy {
  padding: 12px;
}

.timeline-purpose-copy h3 {
  margin: 0 0 5px;
  color: var(--on-surface);
  font-size: 13px;
}

.timeline-purpose-copy p:last-child {
  max-width: 560px;
  margin: 0;
  color: var(--text);
  font-size: 10px;
  line-height: 1.5;
}

.timeline-stage-guide {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
}

.timeline-stage-guide span {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
  padding: 10px;
  background: var(--surface);
}

.timeline-stage-guide b {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 10px;
}

.timeline-stage-guide strong {
  color: var(--on-surface);
  font-size: 10px;
}

.timeline-stage-guide small {
  color: var(--text);
  font-size: 9px;
  white-space: nowrap;
}

.timeline-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 10px;
  background: var(--line);
}

.timeline-summary-grid > div {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
}

.timeline-summary-grid span,
.timeline-summary-grid small {
  color: var(--text);
  font-size: 9px;
}

.timeline-summary-grid strong {
  overflow: hidden;
  color: var(--on-surface);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-meta {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--surface);
  color: var(--text);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.timeline-meta strong {
  color: var(--cyan);
  font-size: 10px;
}

.timeline-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.75fr);
  gap: 1px;
  background: var(--line);
}

.timeline-scroll {
  min-height: 300px;
  max-height: calc(100vh - 420px);
  border: 1px solid var(--line);
  border-right: 0;
  background: var(--overlay-surface);
}

.timeline-table {
  min-width: 700px;
  table-layout: fixed;
}

.timeline-table th,
.timeline-table td {
  height: 34px;
  padding: 5px 9px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
  white-space: nowrap;
}

.timeline-table th {
  height: 29px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 9px;
  font-weight: 800;
}

.timeline-table [data-column="time"] {
  width: 104px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.timeline-table [data-column="side"] {
  width: 64px;
}

.timeline-table [data-column="stage"] {
  width: 92px;
}

.timeline-table [data-column="change"] {
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-list {
  display: table-row-group;
  background: var(--overlay-surface);
}

.timeline-item {
  display: table-row;
  min-height: 0;
  cursor: default;
  padding: 0;
  border: 0;
  background: var(--surface);
}

.timeline-item:nth-child(odd) {
  background: var(--surface-raised);
}

.timeline-item:hover {
  background: rgba(53, 194, 229, 0.09);
}

.timeline-item td {
  vertical-align: middle;
}

.timeline-time {
  color: var(--text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.timeline-side,
.timeline-stage-label {
  font-size: 11px;
  font-weight: 800;
}

.timeline-stage-label.timeline-stage-candidate,
.timeline-stage-label.timeline-stage-evidence {
  color: var(--violet);
}

.timeline-stage-label.timeline-stage-active {
  color: var(--green);
}

.timeline-stage-label.timeline-stage-weakening,
.timeline-stage-label.timeline-stage-resolved {
  color: var(--amber);
}

.timeline-stage-label.timeline-stage-warning {
  color: var(--coral);
}

.timeline-item strong,
.timeline-reason {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-change {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.timeline-event-meta {
  color: var(--text);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline-item strong {
  color: var(--on-surface);
  font-size: 12px;
  font-weight: 700;
}

.timeline-reason {
  margin-top: 2px;
  color: var(--text);
  font-size: 10px;
}

.timeline-insight {
  min-width: 0;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
}

.timeline-insight h3 {
  margin: -3px 0 0;
  color: var(--on-surface);
  font-size: 14px;
}

.timeline-insight-facts {
  display: grid;
  gap: 1px;
  margin: 0;
  background: var(--line);
}

.timeline-insight-facts > div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 9px;
  background: var(--surface);
}

.timeline-insight-facts dt {
  color: var(--text);
  font-size: 10px;
}

.timeline-insight-facts dd {
  overflow: hidden;
  margin: 0;
  color: var(--on-surface);
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-insight > p {
  margin: 0;
  color: var(--on-surface);
  font-size: 11px;
  line-height: 1.55;
}

.timeline-insight > small {
  margin-top: auto;
  color: var(--text);
  font-size: 10px;
  line-height: 1.45;
}

.timeline-empty {
  margin: 0;
  padding: 18px 12px;
  border: 1px solid var(--line);
  border-top: 0;
  color: var(--text);
  font-size: 10px;
}

@media (max-width: 720px) {
  .timeline-purpose,
  .timeline-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .timeline-stage-guide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .timeline-scroll {
    max-height: calc(100vh - 500px);
    border-right: 1px solid var(--line);
  }

  .timeline-insight {
    min-height: 0;
  }

  .timeline-table {
    min-width: 560px;
  }

  .timeline-table [data-column="time"] {
    width: 86px;
  }

  .timeline-table [data-column="side"] {
    width: 56px;
  }

  .timeline-table [data-column="stage"] {
    width: 76px;
  }
}

/* Final readability overrides. */
body { font-size: var(--fs-body); }
button, input, select, textarea { font-size: var(--fs-control); }
.flow-sidebar, .sidebar-nav, .watchlist-panel, .alerts-drawer-panel { font-size: var(--fs-table); }
.flow-table th, .pattern-table th, .timeline-table th,
.flow-table td, .pattern-table td, .timeline-table td { font-size: var(--fs-table); }
.flow-table th, .pattern-table th, .timeline-table th,
.eyebrow, .panel-kicker, .section-kicker { font-size: var(--fs-label); }
.flow-reason, .flow-time, .stock-code, .alerts-storage-note,
.timeline-event-meta { font-size: var(--fs-meta); }

.flow-status-banner { height: 44px; min-height: 44px; }
.flow-status-item { height: 42px; min-height: 42px; padding: 4px 10px; display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 8px; white-space: nowrap; }
.flow-status-item .summary-label-row,
.flow-status-item .summary-label-row > span { font-size: var(--fs-meta); }
.flow-status-item strong { margin: 0; font-size: var(--fs-metric); line-height: 1; }
.flow-status-item small { display: block; min-width: 0; font-size: var(--fs-micro); text-overflow: ellipsis; }
.pattern-pagination { min-height: 46px; font-size: var(--fs-control); gap: 12px; }
.pattern-pagination button { min-width: 64px; height: 34px; font-size: var(--fs-control); }
.watchlist-empty { padding: 10px; font-size: var(--fs-meta); line-height: 1.45; }
.watchlist-empty strong { font-size: var(--fs-table); }
.watchlist-empty span { font-size: var(--fs-label); }
.watchlist-preview-label { font-size: var(--fs-micro); }

.landing-page { min-height: 100vh; background: #09090b; color: #f5f7fa; }
.landing-shell { width: min(1120px, calc(100% - 64px)); margin: 0 auto; }
.landing-header { display: flex; align-items: center; justify-content: space-between; padding: 28px 0; border-bottom: 1px solid #2b2b33; }
.landing-header img { width: 180px; height: auto; display: block; }
.landing-login-link { color: #fda821; font-size: 14px; font-weight: 700; text-decoration: none; }
.landing-hero { max-width: 760px; padding: clamp(88px, 14vh, 160px) 0 96px; }
.landing-hero h1 { margin: 14px 0 22px; font-size: clamp(42px, 6vw, 76px); line-height: 1.08; letter-spacing: -0.06em; }
.landing-hero h1 em { color: #fda821; font-style: normal; }
.landing-copy { max-width: 600px; margin: 0 0 32px; color: #cbd5e1; font-size: 18px; line-height: 1.7; }
.landing-primary-cta { display: inline-flex; align-items: center; gap: 22px; padding: 14px 20px; color: #09090b; background: #fda821; border-radius: 4px; font-size: 15px; font-weight: 800; text-decoration: none; }
.landing-primary-cta span { font-size: 22px; line-height: 1; }
.landing-points { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid #2b2b33; border-bottom: 1px solid #2b2b33; }
.landing-points article { display: grid; gap: 8px; padding: 24px 22px; border-right: 1px solid #2b2b33; }
.landing-points article:last-child { border-right: 0; }
.landing-points strong { font-size: 17px; }
.landing-points span { color: #cbd5e1; font-size: 13px; line-height: 1.5; }
.landing-footer { padding: 24px 0 36px; color: #94a3b8; font-size: 12px; }
@media (max-width: 720px) {
  .landing-shell { width: min(100% - 32px, 560px); }
  .landing-header { padding: 20px 0; }
  .landing-header img { width: 150px; }
  .landing-hero { padding: 72px 0 64px; }
  .landing-copy { font-size: 16px; }
  .landing-points { grid-template-columns: 1fr; }
  .landing-points article { border-right: 0; border-bottom: 1px solid #2b2b33; }
  .landing-points article:last-child { border-bottom: 0; }
}
.watchlist-preview-label { font-size: 12px; }
.watchlist-select { padding: 8px 10px; gap: 2px; }
.watchlist-select strong { font-size: 13px; }
.watchlist-select span { font-size: 10px; }
.watchlist-preview-row .watchlist-pin { font-size: 10px; }

/* Instrument detail tabs: keep the same readable scale as the main workspace. */
.instrument-detail-heading .eyebrow { font-size: 12px; }
.instrument-detail-heading h2 { font-size: 22px; }
.instrument-detail-heading > p:last-child { font-size: 13px; }
.instrument-detail-dialog .detail-tabs button,
.instrument-detail-dialog [role="tab"] { font-size: 14px; }
.instrument-detail-dialog .panel-header h3,
.instrument-detail-dialog .section-heading h3 { font-size: 17px; }
.instrument-detail-dialog .instrument-heading h3 { font-size: 18px; }
.instrument-detail-dialog .metric-grid strong,
.instrument-detail-dialog .summary-readout strong { font-size: 19px; }
.instrument-detail-dialog .metric-grid span,
.instrument-detail-dialog .metric-grid small,
.instrument-detail-dialog .summary-readout-label,
.instrument-detail-dialog .summary-readout p { font-size: 12px; }
.instrument-detail-dialog .trade-table th,
.instrument-detail-dialog .trade-table td { font-size: 13px; }
.instrument-detail-dialog .trade-table td:first-child { font-size: 12px; }
.instrument-detail-dialog .timeline-purpose-copy h3 { font-size: 17px; }
.instrument-detail-dialog .timeline-purpose-copy p:last-child,
.instrument-detail-dialog .timeline-stage-guide strong,
.instrument-detail-dialog .timeline-stage-guide small { font-size: 12px; }
.instrument-detail-dialog .timeline-summary-grid strong { font-size: 19px; }
.instrument-detail-dialog .timeline-summary-grid span,
.instrument-detail-dialog .timeline-summary-grid small { font-size: 12px; }
.instrument-detail-dialog .timeline-table th,
.instrument-detail-dialog .timeline-table td { font-size: 13px; }
.instrument-detail-dialog .timeline-table th { font-size: 12px; }
.instrument-detail-dialog .timeline-time,
.instrument-detail-dialog .timeline-side,
.instrument-detail-dialog .timeline-stage-label { font-size: 13px; }
.instrument-detail-dialog .timeline-item strong,
.instrument-detail-dialog .timeline-reason { font-size: 13px; }
.instrument-detail-dialog .timeline-event-meta { font-size: 12px; }
.instrument-detail-dialog .timeline-insight h3 { font-size: 17px; }
.instrument-detail-dialog .timeline-insight-facts dt,
.instrument-detail-dialog .timeline-insight > small { font-size: 12px; }
.instrument-detail-dialog .timeline-insight-facts dd,
.instrument-detail-dialog .timeline-insight > p { font-size: 13px; }

/* Documentation pages: editorial line-based layout, no card boxes. */
.docs-panel .docs-header,
.docs-panel .docs-hero,
.docs-panel .docs-card,
.docs-panel .site-map-card,
.docs-panel .docs-section,
.docs-panel .data-flow-map > div { background: transparent; }
.docs-panel .docs-hero { padding: 30px 4px 34px; }
.docs-panel .docs-grid,
.docs-panel .site-map-grid,
.docs-panel .docs-steps,
.docs-panel .docs-terms,
.docs-panel .data-flow-map { border-top: 1px solid var(--line); }
.docs-panel .docs-card,
.docs-panel .site-map-card { min-height: 150px; padding: 22px 20px 24px 0; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.docs-panel .docs-card-key { padding: 0; border: 0; font-size: 10px; }
.docs-panel .docs-card h3,
.docs-panel .site-map-card h3,
.docs-panel .docs-section h3 { font-size: 17px; }
.docs-panel .docs-card p,
.docs-panel .site-map-card p,
.docs-panel .site-map-card li { font-size: 13px; line-height: 1.6; }
.docs-panel .docs-section { padding: 28px 4px; }
.docs-panel .docs-steps li,
.docs-panel .docs-terms > div { padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.docs-panel .data-flow-map { gap: 0; }
.docs-panel .data-flow-map > div { min-height: 100px; padding: 16px 18px 16px 0; border: 0; border-bottom: 1px solid var(--line); }

.docs-panel,
.docs-panel .panel-header,
.docs-panel .docs-header,
.docs-panel .docs-hero,
.docs-panel .docs-card,
.docs-panel .site-map-card,
.docs-panel .docs-section { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
.docs-panel .docs-card,
.docs-panel .site-map-card { border-bottom: 1px solid var(--line) !important; }
.docs-panel .docs-card:not(:last-child),
.docs-panel .site-map-card:not(:last-child) { border-right: 1px solid var(--line) !important; }

.docs-panel .docs-grid .docs-card,
.docs-panel .site-map-grid .site-map-card { border-right: 0 !important; }
.docs-panel .docs-grid .docs-card:nth-child(odd) { border-right: 1px solid var(--line) !important; }
.docs-panel .site-map-grid .site-map-card:nth-child(3n+1),
.docs-panel .site-map-grid .site-map-card:nth-child(3n+2) { border-right: 1px solid var(--line) !important; }
.site-map-panel .site-map-grid .site-map-card { border-right: 0 !important; }
.site-map-panel .site-map-grid .site-map-card:nth-child(4n+1),
.site-map-panel .site-map-grid .site-map-card:nth-child(4n+2),
.site-map-panel .site-map-grid .site-map-card:nth-child(4n+3) { border-right: 1px solid var(--line) !important; }
.docs-panel .docs-grid .docs-card:nth-child(n+3),
.docs-panel .site-map-grid .site-map-card:nth-child(n+4) { border-top: 0; }

/* Guide/Site Map editorial treatment. */
.docs-panel { max-width: 1180px; margin: 0 auto; padding: 0 32px 70px; }
.docs-panel .docs-header { padding: 24px 0 18px; border-bottom: 1px solid var(--line) !important; }
.docs-panel .docs-header h2 { font-size: 24px; letter-spacing: -0.03em; }
.docs-panel .docs-caption { color: var(--muted-2); font-size: 11px; }
.docs-panel .docs-hero { max-width: 820px; padding: 76px 0 70px; }
.docs-panel .docs-hero h3 { font-size: clamp(28px, 4vw, 48px); font-weight: 500; letter-spacing: -0.05em; line-height: 1.08; }
.docs-panel .docs-hero p { color: var(--muted-2); font-size: 15px; line-height: 1.75; }
.docs-panel .docs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.docs-panel .site-map-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.site-map-panel.docs-panel { max-width: 1480px; width: min(100%, 1480px); }

/* Research-note treatment: an editorial document, deliberately distinct from
   the operational dashboard and from real-time status cards. */
.flow-research-panel {
  width: min(100%, 980px);
  padding-bottom: 96px;
}

.research-note-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 40px;
  padding: 52px 0 30px;
  border-bottom: 1px solid var(--line);
}

.research-note-header h2 {
  margin: 7px 0 10px;
  color: var(--on-surface);
  font-size: clamp(29px, 4vw, 43px);
  letter-spacing: -.045em;
  line-height: 1.16;
}

.research-note-subtitle {
  max-width: 700px;
  margin: 0;
  color: var(--muted-2);
  font-size: 14px;
  line-height: 1.65;
}

.research-note-meta {
  align-content: start;
  display: grid;
  margin: 0;
  border-top: 1px solid var(--line);
}

.research-note-meta div {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.research-note-meta dt {
  color: var(--text);
  font-size: 10px;
  letter-spacing: .04em;
}

.research-note-meta dd {
  margin: 3px 0 0;
  color: var(--on-surface);
  font-size: 12px;
  font-weight: 750;
}

.research-abstract,
.research-note-section {
  max-width: 820px;
  padding: 42px 0 0;
}

.research-abstract h3,
.research-note-section h3 {
  margin: 6px 0 16px;
  color: var(--on-surface);
  font-size: 23px;
  letter-spacing: -.035em;
  line-height: 1.3;
}

.research-abstract > p,
.research-note-section > p {
  margin: 0 0 14px;
  color: var(--muted-2);
  font-size: 15px;
  line-height: 1.82;
}

.research-note-caution {
  margin-top: 24px !important;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--on-surface) !important;
}

.research-note-caution strong { color: var(--amber); }

.research-questions {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.research-questions li {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.research-questions b {
  color: var(--cyan);
  font-size: 11px;
  letter-spacing: .08em;
}

.research-questions strong,
.research-questions span { display: block; }
.research-questions strong { color: var(--on-surface); font-size: 14px; }
.research-questions span { margin-top: 5px; color: var(--muted-2); font-size: 13px; line-height: 1.6; }

.research-finding {
  margin-top: 25px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.research-finding strong { color: var(--cyan); font-size: 11px; letter-spacing: .08em; }
.research-finding p { margin: 8px 0 0; color: var(--on-surface); font-size: 14px; line-height: 1.7; }

.research-build-table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.research-build-table { width: 100%; min-width: 740px; border-collapse: collapse; }
.research-build-table th,
.research-build-table td { padding: 15px 14px 15px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.research-build-table thead th { color: var(--text); font-size: 10px; letter-spacing: .05em; }
.research-build-table tbody th { width: 100px; color: var(--on-surface); font-size: 12px; }
.research-build-table td { color: var(--muted-2); font-size: 12px; line-height: 1.6; }
.research-build-table td:last-child { color: var(--cyan); }

.research-validation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.research-validation-grid > div + div { padding-left: 36px; }
.research-validation-grid strong { color: var(--on-surface); font-size: 14px; }
.research-validation-grid ul { margin: 12px 0 0; padding-left: 17px; color: var(--muted-2); }
.research-validation-grid li { margin: 7px 0; font-size: 13px; line-height: 1.55; }

.research-note-footer {
  max-width: 820px;
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.research-note-footer p { margin: 0; color: var(--text); font-size: 12px; line-height: 1.65; }

@media (max-width: 760px) {
  .research-note-header { grid-template-columns: 1fr; gap: 26px; padding-top: 36px; }
  .research-note-meta { max-width: none; }
  .research-abstract,
  .research-note-section { padding-top: 32px; }
  .research-abstract > p,
  .research-note-section > p { font-size: 14px; }
  .research-validation-grid { grid-template-columns: 1fr; gap: 24px; }
  .research-validation-grid > div + div { padding: 24px 0 0; border-top: 1px solid var(--line); box-shadow: none; }
}

/* Implementation plan: intentionally plain, source-like documentation for
   deliberate AI follow-on work rather than a product dashboard. */
.implementation-plan-panel {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 0 32px 96px;
  background: var(--bg);
}

.implementation-plan-panel[hidden] { display: none; }

.plan-note-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 40px;
  padding: 52px 0 30px;
  border-bottom: 1px solid var(--line);
}

.plan-note-header h2 {
  margin: 7px 0 10px;
  color: var(--on-surface);
  font-size: clamp(29px, 4vw, 43px);
  letter-spacing: -.045em;
  line-height: 1.16;
}

.plan-note-header > div > p:last-child {
  max-width: 680px;
  margin: 0;
  color: var(--muted-2);
  font-size: 14px;
  line-height: 1.65;
}

.plan-note-meta {
  display: grid;
  align-content: start;
  margin: 0;
  border-top: 1px solid var(--line);
}

.plan-note-meta div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.plan-note-meta dt { color: var(--text); font-size: 10px; letter-spacing: .04em; }
.plan-note-meta dd { margin: 3px 0 0; color: var(--on-surface); font-size: 12px; font-weight: 750; line-height: 1.4; }

.plan-note-section {
  max-width: 850px;
  padding: 42px 0 0;
}

.plan-note-section h3 {
  margin: 6px 0 16px;
  color: var(--on-surface);
  font-size: 23px;
  letter-spacing: -.035em;
  line-height: 1.3;
}

.plan-principles,
.plan-stop-list {
  margin: 0;
  padding: 0 0 0 20px;
  color: var(--muted-2);
  border-top: 1px solid var(--line);
}

.plan-principles li,
.plan-stop-list li {
  padding: 11px 0 11px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.65;
}

.plan-status-list {
  border-top: 1px solid var(--line);
}

.plan-status-list > div {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.plan-status-list b {
  color: var(--text);
  font-size: 11px;
  letter-spacing: .05em;
}

.plan-status-list strong,
.plan-status-list span,
.plan-status-list em { display: block; }
.plan-status-list strong { color: var(--on-surface); font-size: 14px; }
.plan-status-list span { margin-top: 5px; color: var(--muted-2); font-size: 13px; line-height: 1.6; }
.plan-status-list em { color: var(--text); font-size: 10px; font-style: normal; white-space: nowrap; }
.plan-status-list .is-done b,
.plan-status-list .is-done em { color: var(--green); }
.plan-status-list .is-next b,
.plan-status-list .is-next em { color: var(--cyan); }

.plan-work-packages {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.plan-work-packages li {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.plan-work-packages b {
  color: var(--on-surface);
  font-size: 14px;
}

.plan-work-packages p {
  margin: 8px 0;
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.7;
}

.plan-work-packages small {
  display: block;
  color: var(--cyan);
  font-size: 11px;
  line-height: 1.55;
}

.plan-execution-steps {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.plan-execution-steps li {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.plan-execution-steps b { color: var(--on-surface); font-size: 13px; }
.plan-execution-steps span { color: var(--muted-2); font-size: 13px; line-height: 1.6; }

.plan-note-footer {
  max-width: 850px;
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.plan-note-footer p { margin: 0; color: var(--text); font-size: 12px; line-height: 1.65; }

@media (max-width: 760px) {
  .implementation-plan-panel { padding: 0 18px 48px; }
  .plan-note-header { grid-template-columns: 1fr; gap: 26px; padding-top: 36px; }
  .plan-note-section { padding-top: 32px; }
  .plan-status-list > div { grid-template-columns: 66px minmax(0, 1fr); }
  .plan-status-list em { grid-column: 2; }
  .plan-execution-steps li { grid-template-columns: 1fr; gap: 5px; }
}

/* Research and implementation notes are authored as Markdown files in
   apps/web/content/. Keep the renderer deliberately document-like so changing
   a heading, table, list, quote, or code block needs no HTML edit. */
.research-library-header {
  max-width: 760px;
  padding: 52px 0 32px;
}

.research-library-header h2 {
  margin: 7px 0 12px;
  color: var(--on-surface);
  font-size: clamp(29px, 4vw, 43px);
  letter-spacing: -.045em;
  line-height: 1.16;
}

.research-library-header > p:last-child {
  margin: 0;
  color: var(--muted-2);
  font-size: 14px;
  line-height: 1.7;
}

.research-note-index-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.research-note-index {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.research-note-index th,
.research-note-index td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.research-note-index th:first-child,
.research-note-index td:first-child { padding-left: 0; }
.research-note-index th:last-child,
.research-note-index td:last-child { padding-right: 0; }

.research-note-index th {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.research-note-index td {
  color: var(--muted-2);
  font-size: 12px;
}

.research-note-index tbody tr {
  cursor: pointer;
  transition: background-color 150ms ease;
}

.research-note-index tbody tr:hover,
.research-note-index tbody tr:focus-within {
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
}

.research-note-index tbody tr.is-active {
  background: color-mix(in srgb, var(--cyan) 7%, transparent);
}

.research-note-index tbody tr.is-active .research-note-select { color: var(--cyan); }

.research-note-select {
  width: 100%;
  padding: 8px 12px 8px 14px;
  border: 0;
  background: transparent;
  color: var(--on-surface);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.research-note-select:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 2px;
}

.research-note-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.research-note-status.is-implemented {
  border-color: color-mix(in srgb, var(--cyan) 48%, var(--line));
  color: var(--cyan);
}

.research-note-status.is-plan {
  border-color: color-mix(in srgb, var(--amber) 48%, var(--line));
  color: var(--amber);
}

.research-note-reader {
  margin-top: 54px;
  scroll-margin-top: 24px;
}

.research-note-reader-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.research-note-reader-header h3 {
  margin: 6px 0 0;
  color: var(--on-surface);
  font-size: 18px;
  letter-spacing: -.025em;
}

.research-note-reader-header > p {
  max-width: 360px;
  margin: 0;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.55;
  text-align: right;
}

.research-note-reader .markdown-document { padding-top: 38px; }

.markdown-document {
  max-width: 850px;
  padding-top: 52px;
  color: var(--muted-2);
  font-size: 15px;
  line-height: 1.82;
}

.markdown-document h1,
.markdown-document h2,
.markdown-document h3 {
  color: var(--on-surface);
  letter-spacing: -.04em;
}

.markdown-document h1 {
  margin: 0 0 10px;
  font-size: clamp(29px, 4vw, 43px);
  line-height: 1.16;
}

.markdown-document h2 {
  margin: 52px 0 16px;
  padding-top: 42px;
  border-top: 1px solid var(--line);
  font-size: 23px;
  line-height: 1.3;
}

.markdown-document h3 {
  margin: 30px 0 10px;
  font-size: 16px;
  line-height: 1.4;
}

.markdown-document p { margin: 0 0 16px; }
.markdown-document h1 + p { margin-bottom: 26px; color: var(--text); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.markdown-document strong { color: var(--on-surface); }
.markdown-document em { color: var(--text); }
.markdown-document a { color: var(--cyan); }
.markdown-document code {
  padding: 1px 4px;
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--on-surface);
  font: 0.9em/1.3 var(--mono);
}

.markdown-document blockquote {
  margin: 24px 0;
  padding: 15px 18px;
  border-top: 2px solid var(--cyan);
  background: var(--surface-2);
  color: var(--text);
}

.markdown-document blockquote p { margin: 0; }
.markdown-document ul,
.markdown-document ol { margin: 18px 0 26px; padding-left: 22px; }
.markdown-document li { margin: 8px 0; }
.markdown-document hr { margin: 42px 0; border: 0; border-top: 1px solid var(--line); }

.markdown-table-wrap { margin: 24px 0 30px; overflow-x: auto; border-top: 1px solid var(--line); }
.markdown-document table { width: 100%; min-width: 680px; border-collapse: collapse; }
.markdown-document th,
.markdown-document td { padding: 14px 14px 14px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.markdown-document th { color: var(--text); font-size: 10px; letter-spacing: .05em; }
.markdown-document td { font-size: 12px; line-height: 1.6; }
.markdown-document td:last-child { color: var(--cyan); }
.markdown-document pre { margin: 22px 0; padding: 16px; overflow: auto; background: var(--surface-2); border: 1px solid var(--line); }
.markdown-document pre code { padding: 0; background: transparent; }
.markdown-document-error { color: var(--amber); }

@media (max-width: 760px) {
  .research-library-header { padding-top: 36px; }
  .research-note-reader { margin-top: 42px; }
  .research-note-reader-header { align-items: start; flex-direction: column; gap: 8px; }
  .research-note-reader-header > p { max-width: none; text-align: left; }
  .markdown-document { padding-top: 36px; font-size: 14px; }
  .markdown-document h2 { margin-top: 40px; padding-top: 32px; }
}

/* Optional white workspace theme. Brand orange and signal colors stay intact;
   only the canvas, surfaces, borders and readable text contrast change. */
html[data-theme="light"] {
  color-scheme: light;
  --canvas: #f5f7fa;
  --overlay-surface: #ffffff;
  --surface-raised: #f8fafc;
  --surface-contrast: #e4e9f0;
  --on-surface: #172033;
  --bg: #f5f7fa;
  --background: #f5f7fa;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --surface-3: #e4e9f0;
  --line: #d7dee8;
  --line-soft: rgba(148, 163, 184, 0.3);
  --border: #d7dee8;
  --border-strong: #b7c2d0;
  --text: #172033;
  --muted: #334155;
  --muted-2: #64748b;
  --brand-slate: #475569;
  --shadow-popover: 0 14px 34px rgba(15, 23, 42, 0.14);
}

html[data-theme="light"],
html[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}

html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.96);
}

html[data-theme="light"] .flow-brand:hover {
  background: transparent;
}

html[data-theme="light"] .flow-sidebar nav a:hover,
html[data-theme="light"] .flow-sidebar nav button:hover {
  background: #edf3f9;
}

html[data-theme="light"] button,
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] a {
  color: var(--text);
}

html[data-theme="light"] .panel,
html[data-theme="light"] .panel-header,
html[data-theme="light"] .flow-commandbar,
html[data-theme="light"] .flow-status-banner,
html[data-theme="light"] .flow-tabs,
html[data-theme="light"] .connection-detail-popover,
html[data-theme="light"] .alerts-drawer-panel,
html[data-theme="light"] .browser-notification-card,
html[data-theme="light"] .quality-detail-card,
html[data-theme="light"] .watchlist-row,
html[data-theme="light"] .watchlist-empty {
  background: var(--surface);
  color: var(--text);
}

html[data-theme="light"] .pattern-table tbody tr:nth-child(odd),
html[data-theme="light"] .ranking-table tbody tr:nth-child(odd),
html[data-theme="light"] .timeline-table tbody tr:nth-child(odd) {
  background: #f8fafc;
}

html[data-theme="light"] .pattern-table tbody tr:nth-child(even),
html[data-theme="light"] .ranking-table tbody tr:nth-child(even),
html[data-theme="light"] .timeline-table tbody tr:nth-child(even) {
  background: #ffffff;
}

html[data-theme="light"] .pattern-table tbody tr:hover,
html[data-theme="light"] .ranking-table tbody tr:hover,
html[data-theme="light"] .timeline-table tbody tr:hover {
  background: #edf3f9;
}

html[data-theme="light"] .pattern-table td,
html[data-theme="light"] .ranking-table td,
html[data-theme="light"] .timeline-table td,
html[data-theme="light"] .flow-table td,
html[data-theme="light"] .pattern-table th,
html[data-theme="light"] .ranking-table th,
html[data-theme="light"] .timeline-table th,
html[data-theme="light"] .flow-table th {
  color: var(--text);
}

html[data-theme="light"] .stock-code,
html[data-theme="light"] .flow-time,
html[data-theme="light"] .flow-reason,
html[data-theme="light"] .visual-caption,
html[data-theme="light"] .flow-table-note,
html[data-theme="light"] .alerts-storage-note {
  color: var(--muted-2);
}

html[data-theme="light"] .score-meter-track {
  fill: #e2e8f0;
  stroke: #cbd5e1;
}

/* Some dense Flow and detail areas intentionally force dark surfaces in the
   default theme. Reset those component-level overrides explicitly for light. */
html[data-theme="light"] .sidebar-watchlist,
html[data-theme="light"] .pattern-panel,
html[data-theme="light"] .pattern-panel .detail-view,
html[data-theme="light"] .pattern-panel .pattern-scroll,
html[data-theme="light"] .pattern-panel .pattern-table,
html[data-theme="light"] .pattern-panel .pattern-pagination {
  background: var(--surface);
  color: var(--text);
}

html[data-theme="light"] .sidebar-watchlist h2,
html[data-theme="light"] .watchlist-empty strong,
html[data-theme="light"] .pattern-panel h1,
html[data-theme="light"] .pattern-panel h2,
html[data-theme="light"] .pattern-panel h3 {
  color: var(--text);
}

html[data-theme="light"] .instrument-hero {
  --bg: #f5f7fa;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --surface-3: #e4e9f0;
  --line: #d7dee8;
  --line-soft: rgba(148, 163, 184, 0.3);
  --border-strong: #b7c2d0;
  --text: #172033;
  --muted: #334155;
  --muted-2: #64748b;
}
.pattern-table tbody tr:nth-child(odd) { background: #19191f; }
.pattern-table tbody tr:nth-child(even) { background: #121217; }
.pattern-table tbody tr.is-selected,
.pattern-table tbody tr[aria-selected="true"] { background: rgba(53, 194, 229, 0.13); }
.score-meter { width: 80px; height: 20px; display: block; overflow: hidden; border-radius: 0; }
.score-meter-track { fill: #202026; stroke: #303038; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.score-meter-fill { fill: var(--cyan); }
.score-meter-fill.strong { fill: #33b890; }
.score-meter-fill.watch { fill: var(--amber); }
.score-meter-fill.weak { fill: var(--violet); }
.pattern-table tbody tr:nth-child(odd) { background: #19191f; }
.pattern-table tbody tr:nth-child(even) { background: #121217; }
.pattern-table tbody tr.is-selected,
.pattern-table tbody tr[aria-selected="true"] { background: rgba(53, 194, 229, 0.13); }
.score-meter { width: 80px; height: 20px; display: block; overflow: hidden; border-radius: 0; }
.score-meter-track { fill: #202026; stroke: #303038; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.score-meter-fill { fill: var(--cyan); }
.score-meter-fill.strong { fill: #33b890; }
.score-meter-fill.watch { fill: var(--amber); }
.score-meter-fill.weak { fill: var(--violet); }
.site-map-panel .site-map-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.site-map-panel .site-map-card h3 { display: flex; align-items: center; gap: 10px; }
.site-map-icon { width: 19px; height: 19px; object-fit: contain; opacity: .9; }
.docs-panel .docs-card,
.docs-panel .site-map-card { min-height: 190px; padding: 24px 28px 28px 0; }
.docs-panel .docs-card-key { color: var(--amber); font-size: 11px; letter-spacing: .1em; }
.docs-panel .docs-card h3,
.docs-panel .site-map-card h3 { font-size: 19px; letter-spacing: -0.02em; }
.docs-panel .docs-card p,
.docs-panel .site-map-card p,
.docs-panel .site-map-card li { color: var(--muted-2); font-size: 13px; line-height: 1.7; }
.docs-panel .docs-section { padding: 54px 0 0; }
.docs-panel .docs-section > h3 { margin-bottom: 14px; font-size: 22px; }
.docs-panel .docs-steps li,
.docs-panel .docs-terms > div { grid-template-columns: 220px minmax(0, 1fr); padding: 18px 0; }
.docs-panel .data-flow-map { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .docs-panel { padding: 0 18px 48px; }
  .docs-panel .docs-hero { padding: 48px 0; }
  .docs-panel .docs-grid, .docs-panel .site-map-grid, .docs-panel .data-flow-map { grid-template-columns: 1fr; }
  .docs-panel .docs-card, .docs-panel .site-map-card { min-height: 0; padding: 20px 0; border-right: 0 !important; }
  .docs-panel .docs-steps li, .docs-panel .docs-terms > div { grid-template-columns: 1fr; gap: 7px; }
}

/* Typography contract: one scale shared by the workspace, detail views, and docs.
   Never assign a one-off font size before choosing one of these roles. */
:root {
  --bg: #09090b;
  --sidebar: #09090b;
  --surface: #121217;
  --surface-2: #19191f;
  --text: #f4f4f5;
  --muted: var(--text);
  --muted-2: var(--text);
  --fs-display: clamp(32px, 4vw, 48px);
  --fs-page-title: 24px;
  --fs-workspace-title: 20px;
  --fs-section-title: 17px;
  --fs-subsection-title: 15px;
  --fs-metric: 16px;
  --fs-body: 14px;
  --fs-table: 13px;
  --fs-control: 13px;
  --fs-meta: 12px;
  --fs-label: 11px;
  --fs-micro: 10px;
}
/* Final visual contract selectors kept adjacent to the token contract for QA. */
.pattern-table tbody tr:nth-child(odd) { background: #19191f; }
.pattern-table tbody tr:nth-child(even) { background: #121217; }
.pattern-table tbody tr.is-selected,
.pattern-table tbody tr[aria-selected="true"] { background: rgba(53, 194, 229, 0.13); }
.score-meter { width: 80px; height: 20px; display: block; overflow: hidden; border-radius: 0; }
.score-meter-track { fill: #202026; stroke: #303038; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.score-meter-fill { fill: var(--cyan); }
.score-meter-fill.strong { fill: #33b890; }
.score-meter-fill.watch { fill: var(--amber); }
.score-meter-fill.weak { fill: var(--violet); }
.score-meter-boundary { fill: #f4f4f5; }
.score-meter-value { fill: #ffffff; font-size: var(--fs-micro); font-weight: 800; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
body { font-size: var(--fs-body); line-height: 1.5; }
button, input, select, textarea { font-size: var(--fs-control); }
.flow-table td, .flow-table th, .pattern-table td, .pattern-table th,
.timeline-table td, .timeline-table th, .trade-table td, .trade-table th { font-size: var(--fs-table); }
.eyebrow, .panel-kicker, .section-kicker, .docs-card-key,
.flow-table th, .pattern-table th, .timeline-table th { font-size: var(--fs-label); }
.flow-time, .flow-reason, .stock-code, .timeline-event-meta,
.docs-caption, .alerts-storage-note { font-size: var(--fs-meta); }
.flow-nav-section-label, .watchlist-preview-label, .flow-status-item small { font-size: var(--fs-micro); }
.flow-page-title h1 { font-size: var(--fs-workspace-title); line-height: 1.2; }
.instrument-detail-heading h2 { font-size: var(--fs-page-title); line-height: 1.2; }
.panel-header h2, .docs-header h2 { font-size: var(--fs-section-title); line-height: 1.25; }
.section-heading h3, .docs-section > h3, .site-map-card h3, .docs-card h3 { font-size: var(--fs-subsection-title); line-height: 1.3; }
.landing-hero h1 { font-size: var(--fs-display); }
.topbar .eyebrow { font-size: var(--fs-micro); margin-bottom: 2px; }
.topbar .simulation-badge, .topbar .connection-pill { font-size: var(--fs-micro); }
.flow-status-item .summary-label-row, .flow-status-item .summary-label-row > span { font-size: var(--fs-meta); }
.flow-status-item strong { font-size: var(--fs-metric); }
.flow-status-item small { font-size: var(--fs-micro); }
.pattern-panel .panel-kicker, .pattern-panel .eyebrow { font-size: var(--fs-micro); }
.pattern-panel .section-heading h2, .pattern-panel .heading-with-help h2 { font-size: var(--fs-subsection-title); }
.site-map-panel.docs-panel { max-width: 1480px; width: min(100%, 1480px); }
