:root {
  --bg: #0f1419;
  --panel: #1a1f2e;
  --panel-2: #141a27;
  --panel-3: #20283a;
  --text: #e7e9ea;
  --muted: #9ba7b7;
  --muted-2: #738094;
  --green: #00d395;
  --red: #f6465d;
  --yellow: #f0b90b;
  --blue: #7aa7ff;
  --line: #2d3748;
  --line-strong: #475569;
  --shadow: 0 18px 46px rgba(0, 0, 0, .24);
  --shadow-soft: 0 8px 20px rgba(0, 0, 0, .18);
  --radius: 10px;
  --radius-sm: 6px;
  --focus: 0 0 0 3px rgba(0, 138, 100, .18);
  --stage-s0: rgba(122, 167, 255, .13);
  --stage-s1: rgba(0, 211, 149, .12);
  --stage-s2: rgba(240, 185, 11, .12);
  --stage-s3: rgba(179, 136, 255, .14);
  --stage-s4: rgba(61, 205, 255, .12);
  --stage-s5: rgba(255, 143, 184, .12);
  --stage-s6: rgba(255, 170, 76, .12);
  --stage-s0-line: #7aa7ff;
  --stage-s1-line: #00d395;
  --stage-s2-line: #f0b90b;
  --stage-s3-line: #b388ff;
  --stage-s4-line: #3dcdff;
  --stage-s5-line: #ff8fb8;
  --stage-s6-line: #ffaa4c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, "PingFang SC", "Hiragino Sans GB", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body:not([data-role="admin"]) #users-nav,
body:not([data-role="admin"]) .bulk-actions,
body:not([data-role="admin"]) .manual-tools,
body:not([data-role="admin"]) #new-ledger,
body:not([data-role="admin"]) [data-ledger],
body:not([data-role="admin"]) .config-actions,
body:not([data-role="admin"]) #refresh-regime,
body:not([data-role="admin"]) #record-card {
  display: none;
}

a {
  color: var(--green);
  text-decoration: none;
}

a:hover {
  color: #006b50;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  transform: translateY(-160%);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  min-width: max-content;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 138, 100, .12);
}

nav {
  display: flex;
  gap: 4px;
  font-size: 14px;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

nav::-webkit-scrollbar {
  display: none;
}

nav a {
  color: var(--muted);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background-color .16s ease, color .16s ease;
}

nav a.active {
  color: var(--text);
  background: #e9f3ef;
  font-weight: 700;
}

nav a:hover {
  color: var(--text);
  background: var(--panel-2);
}

.top-market {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.top-market strong {
  color: var(--text);
}

main {
  padding: 0 16px 16px;
}

.subbar {
  position: sticky;
  top: 56px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  margin: 0 -16px 16px;
  padding: 10px 16px;
  background: rgba(248, 250, 252, .96);
  backdrop-filter: blur(12px);
}

.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.subbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.refresh-timeline {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  margin: -6px 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.refresh-timeline-title {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 7px;
  align-items: center;
  min-width: 92px;
  color: var(--muted);
  font-size: 11px;
}

.refresh-timeline-title strong {
  color: var(--text);
  font-size: 13px;
}

.refresh-pulse {
  grid-row: span 2;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 138, 100, .12);
}

.refresh-timeline-items {
  display: flex;
  flex: 1;
  gap: 0;
  margin: 0;
  min-width: 0;
}

.refresh-timeline-items div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 0 16px;
  border-left: 1px solid var(--line);
}

.refresh-timeline-items dt {
  color: var(--muted);
  font-size: 11px;
}

.refresh-timeline-items dd {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.refresh-timeline time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pipe-node {
  min-height: 36px;
  min-width: 78px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  color: var(--text);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease, background-color .14s ease;
}

.pipe-node:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 8px 22px rgba(20, 28, 37, .08);
}

.pipe-node strong {
  display: block;
  font-size: 13px;
}

.pipe-count {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.pipe-label {
  color: var(--text);
  font-size: 12px;
  margin-top: 2px;
}

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

.ok { background: var(--green); }
.idle { background: var(--yellow); }
.error { background: var(--red); }

.market-summary {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.market-strip {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius);
  color: var(--muted);
}

.btn {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  line-height: 1.2;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .12s ease, opacity .16s ease;
}

.btn:hover {
  border-color: var(--line-strong);
  background: #fbfcfe;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}

.btn.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  font-weight: 700;
}

.btn.danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn.ghost {
  background: var(--panel-2);
}

.btn.primary:hover {
  background: #007556;
  border-color: #007556;
}

.btn.compact {
  padding: 5px 8px;
  font-size: 12px;
}

.mock-chip {
  color: var(--yellow);
  font-weight: 700;
  white-space: nowrap;
}

.mock-chip.real {
  color: var(--green);
}

.layout {
  display: grid;
  grid-template-columns: minmax(380px, .9fr) minmax(560px, 1.45fr);
  gap: 12px;
  align-items: start;
}

.page {
  display: grid;
  gap: 18px;
}

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

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

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

.stage-card {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 12px;
}

.stage-card p,
.readiness-row p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

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

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

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

.check-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

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

h1, h2, h3 {
  margin: 0 0 12px;
  line-height: 1.25;
}

h1 {
  font-size: 24px;
  letter-spacing: 0;
}
h2 { font-size: 15px; }
h3 { font-size: 14px; }

.section-title {
  margin: 34px 0 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .04em;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 120px 120px;
  gap: 8px;
  margin-bottom: 12px;
}

.bulk-actions {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.manual-tools {
  display: grid;
  gap: 8px;
  padding: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.manual-actions,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.manual-output {
  display: grid;
  gap: 8px;
}

.json-preview {
  max-height: 180px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  white-space: pre-wrap;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th, td {
  padding: 9px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: var(--panel);
}

tbody tr:hover {
  background: #fbfcfe;
}

.table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.source-chip, .status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  background: #fff;
}

button.source-chip {
  cursor: pointer;
  font: inherit;
}

button.source-chip:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.status-ok { color: var(--green); border-color: rgba(0, 138, 100, .28); background: rgba(0, 138, 100, .07); }
.status-error { color: var(--red); border-color: rgba(217, 45, 32, .28); background: rgba(217, 45, 32, .07); }
.status-idle { color: var(--yellow); border-color: rgba(183, 121, 31, .28); background: rgba(183, 121, 31, .08); }
.status-ready_readonly { color: var(--green); border-color: rgba(0, 138, 100, .28); background: rgba(0, 138, 100, .07); }
.status-no_qualified_opportunity, .status-degraded { color: var(--yellow); border-color: rgba(183, 121, 31, .28); background: rgba(183, 121, 31, .08); }
.status-blocked { color: var(--red); border-color: rgba(217, 45, 32, .28); background: rgba(217, 45, 32, .07); }

.status-igniting { color: var(--green); border-color: rgba(0, 138, 100, .28); background: rgba(0, 138, 100, .07); }
.status-dead { color: var(--red); border-color: rgba(217, 45, 32, .28); background: rgba(217, 45, 32, .07); }
.status-watching { color: var(--yellow); border-color: rgba(183, 121, 31, .28); background: rgba(183, 121, 31, .08); }

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(420px, 100%);
  padding: 28px;
}

.auth-panel h1 {
  margin: 26px 0 8px;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  background: var(--panel-2);
  font: inherit;
}

.form-error {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
}

.user-create-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.user-create-form input,
.user-create-form select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  color: var(--text);
  background: var(--panel-2);
  font: inherit;
}

@media (max-width: 760px) {
  .user-create-form {
    grid-template-columns: 1fr;
  }
}

.stack {
  display: grid;
  gap: 8px;
}

.mini-card {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 1px 0 rgba(20, 28, 37, .02);
}

.mini-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.empty-state,
.loading-state {
  display: grid;
  gap: 4px;
  border: 1px dashed var(--line-strong);
  background: #fbfcfe;
  color: var(--muted);
}

.page-skeleton { display: grid; gap: 10px; min-height: 320px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.page-skeleton span { height: 44px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--panel-2), rgba(151, 161, 175, .18), var(--panel-2)); background-size: 240% 100%; animation: page-skeleton-shimmer 1.25s ease-in-out infinite; }
.page-skeleton span:first-child { height: 92px; }
.page-skeleton span:last-child { height: 124px; }
@keyframes page-skeleton-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

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

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

.metric {
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 6px;
}

.metric strong {
  font-size: 18px;
}

.guide {
  line-height: 1.6;
  color: var(--text);
}

.strategy-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .75fr);
  gap: 14px;
  align-items: start;
}

.strategy-forms {
  display: grid;
  gap: 14px;
}

.strategy-guide-panel {
  position: sticky;
  top: 130px;
  display: grid;
  gap: 10px;
}

.segmented-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  width: fit-content;
}

.segmented-control .btn {
  min-width: 120px;
}

.segmented-control .btn.active {
  background: #eef4f2;
  border-color: rgba(0, 138, 100, .35);
  color: var(--green);
  font-weight: 700;
}

.config-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 10px 20px;
  align-items: start;
}

.config-grid h3 {
  grid-column: 1 / -1;
  color: var(--muted);
  margin-top: 16px;
  text-transform: uppercase;
}

.config-grid label strong,
.config-grid label span {
  display: block;
}

.config-grid label span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  word-break: break-word;
}

.array-editor,
.array-items {
  display: grid;
  gap: 8px;
}

.array-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.config-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.config-preview {
  grid-column: 1 / -1;
}

.config-errors,
.config-ok {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--panel-2);
  font-size: 12px;
}

.config-errors {
  color: var(--red);
  border-color: rgba(246, 70, 93, .35);
}

.config-ok {
  color: var(--green);
  border-color: rgba(0, 211, 149, .35);
}

.config-preview-diff {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--panel-2);
}

.regime-chart {
  display: grid;
  gap: 10px;
}

.regime-chart svg {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.chart-zero {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-btc {
  stroke: var(--yellow);
}

.chart-eth {
  stroke: var(--green);
}

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

.legend-btc {
  color: var(--yellow);
}

.legend-eth {
  color: var(--green);
}

.proposal {
  display: grid;
  gap: 10px;
}

.diff {
  display: grid;
  gap: 6px;
  font-size: 12px;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-row {
  display: grid;
  grid-template-columns: 72px 84px 1fr 140px;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

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

.history-result {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
}

.toast.error {
  border-left-color: var(--red);
}

.toast strong {
  display: block;
  margin-bottom: 2px;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: #e7edf3;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--green);
}

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  width: min(520px, 92vw);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(15, 23, 42, .28);
}

.modal-form {
  display: grid;
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.stage-modal p,
.explainer p,
.strategy-guide-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.ledger-link {
  display: grid;
  gap: 2px;
  min-width: 180px;
}

.ledger-link span {
  color: var(--muted);
  font-size: 11px;
}

.guide table {
  font-size: 13px;
}

.guide-summary {
  display: grid;
  gap: 18px;
}

.guide-summary-head {
  max-width: 720px;
}

.guide-summary-head h1 {
  margin: 4px 0 8px;
}

.guide-summary-head p,
.guide-summary-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.eyebrow,
.guide-detail-note {
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

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

.guide-summary-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.guide-summary-card h2 {
  margin: 0 0 8px;
  font-size: 15px;
}

.guide-detailed .guide-detail-note {
  margin-bottom: 14px;
}

.red-flags {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.page > table,
.guide table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

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

@media (max-width: 1100px) {
  .pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .page-grid,
  .page-grid.three,
  .stage-guide,
  .metric-grid.wide,
  .strategy-layout,
  .guide-summary-grid {
    grid-template-columns: 1fr;
  }
  .strategy-guide-panel {
    position: static;
  }
  .topbar {
    height: auto;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
  }
  nav {
    order: 3;
    width: 100%;
  }
  .top-market {
    margin-left: auto;
  }
  .filters {
    grid-template-columns: 1fr;
  }
  .bulk-actions {
    grid-template-columns: 1fr;
  }
  .history-row {
    grid-template-columns: 64px 76px 1fr;
  }
  .history-row time {
    display: none;
  }
  .array-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  main {
    padding: 0 10px 12px;
  }
  .subbar {
    top: 0;
    align-items: stretch;
    flex-direction: column;
    margin-left: -10px;
    margin-right: -10px;
  }
  .refresh-timeline,
  .refresh-timeline-items {
    align-items: stretch;
    flex-direction: column;
  }
  .refresh-timeline-items {
    gap: 8px;
  }
  .refresh-timeline-items div {
    padding: 8px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .topbar {
    position: static;
  }
  .pipeline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pipe-node {
    width: 100%;
    text-align: left;
  }
  .subbar-actions,
  .manual-actions,
  .export-actions,
  .modal-actions {
    width: 100%;
  }
  .subbar-actions .btn,
  .manual-actions .btn,
  .export-actions .btn {
    flex: 1 1 160px;
  }
  .layout {
    gap: 10px;
  }
  .panel {
    padding: 12px;
  }
  .metric-grid,
  .metric-grid.wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .config-grid {
    grid-template-columns: 1fr;
  }
  .config-actions {
    justify-content: stretch;
  }
  .config-actions .btn {
    flex: 1;
  }
  .segmented-control {
    width: 100%;
  }
  .segmented-control .btn {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 420px) {
  .brand {
    font-size: 14px;
  }
  .top-market {
    width: 100%;
    white-space: normal;
  }
  .pipeline,
  .metric-grid,
  .metric-grid.wide {
    grid-template-columns: 1fr;
  }
  .btn {
    width: 100%;
  }
  .source-chip,
  .status-chip {
    white-space: normal;
  }
}

/* Research control room shell: restrained dark instrument panel, not a trading terminal. */
body {
  background: var(--bg);
  font-family: Manrope, "PingFang SC", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: 232px;
  padding: 22px 14px 16px;
  border-right: 1px solid var(--line);
  background: #101722;
}

.app-sidebar .brand {
  padding: 0 8px 22px;
  color: var(--text);
}

.app-sidebar .brand > span:last-child {
  display: grid;
  gap: 3px;
}

.app-sidebar .brand small,
.workspace-title small,
.eyebrow {
  color: var(--muted-2);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  letter-spacing: .09em;
}

.app-sidebar nav {
  display: grid;
  width: 100%;
  gap: 3px;
  overflow: visible;
}

.app-sidebar nav a {
  padding: 10px 11px;
  color: var(--muted);
}

.app-sidebar nav a:hover,
.app-sidebar nav a.active {
  color: var(--text);
  background: rgba(122, 167, 255, .10);
}

.app-sidebar nav a.active {
  box-shadow: inset 2px 0 0 var(--green);
}

.research-only-note {
  margin-top: auto;
  padding: 12px 8px 2px;
  color: var(--muted);
  font: 10px/1.5 "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  letter-spacing: .06em;
}

.app-workspace { min-height: 100vh; margin-left: 232px; }

.topbar {
  height: 62px;
  padding: 0 26px;
  border-color: var(--line);
  background: rgba(15, 20, 25, .92);
}

.workspace-title { display: grid; gap: 2px; font-size: 14px; font-weight: 700; }
.nav-toggle { display: none; }
main { padding: 0 26px 26px; }

.subbar {
  top: 62px;
  min-height: 76px;
  margin: 0 -26px 16px;
  padding: 10px 26px;
  border-color: var(--line);
  background: rgba(15, 20, 25, .96);
}

.signal-rail { flex: 1 1 520px; flex-wrap: nowrap; min-width: 0; overflow: visible; padding-bottom: 2px; }
.pipe-node { flex: 1 1 0; min-width: 0; min-height: 48px; padding-inline: 7px; color: var(--text); background: var(--panel); border-radius: 8px; }
.subbar-actions { flex: 1 1 320px; min-width: 0; }
.pipe-node:hover, .pipe-node.active { border-color: var(--green); background: #152b2a; color: var(--text); }
.pipe-node.active { box-shadow: inset 0 0 0 1px rgba(0, 211, 149, .22); }

.refresh-timeline, .panel, .market-summary { background: var(--panel); border-color: var(--line); }
.refresh-timeline { border-left-color: var(--green); }
.metric, .mini-card, .stage-card, .market-strip { background: var(--panel-2); border-color: var(--line); }
.btn, input, select, textarea, .source-chip, .status-chip { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.btn:hover, input:hover, select:hover, textarea:hover, tbody tr:hover { background: var(--panel-3); border-color: var(--line-strong); }
.btn.primary { color: #062119; }
.btn.ghost { background: transparent; }
.json-preview, .empty-state, .loading-state { background: #111827; color: var(--muted); }
th { background: var(--panel); }
table { color: var(--text); }
a:hover { color: #59e2ba; }

.main-panel { min-width: 0; }
.dashboard-page, .stage-page { display: grid; gap: 18px; }
.dashboard-heading, .stage-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 8px 0 2px; }
.dashboard-heading h1, .stage-heading h1 { margin: 3px 0 7px; font-size: clamp(28px, 3vw, 40px); letter-spacing: -.035em; }
.dashboard-heading p:not(.eyebrow), .stage-heading p:not(.eyebrow), .muted-copy { color: var(--muted); margin: 0; line-height: 1.55; }
.dashboard-funnel { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.funnel-cell { display: grid; gap: 5px; min-height: 102px; padding: 14px; border-right: 1px solid var(--line); color: var(--muted); }
.funnel-cell:last-child { border-right: 0; }
.funnel-cell:hover { color: var(--text); background: var(--panel-3); }
.funnel-cell span { font-size: 11px; }
.funnel-cell strong { color: var(--text); font-size: 25px; font-variant-numeric: tabular-nums; }
.funnel-cell small { font: 10px "IBM Plex Mono", "SFMono-Regular", Consolas, monospace; }
.dashboard-metrics .metric strong, .stage-summary .metric strong { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.metric strong { overflow-wrap: anywhere; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.compact-stack { gap: 4px; }
.compact-stack .history-row { grid-template-columns: minmax(100px, .7fr) auto minmax(0, 1.4fr); padding: 9px 0; }
.compact-stack .blocker-row { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.blocker-row strong { min-width: 0; overflow-wrap: anywhere; }
.blocker-row span { color: var(--muted); white-space: nowrap; }
.notice { padding: 11px 13px; border: 1px solid rgba(240, 185, 11, .35); border-radius: var(--radius-sm); background: rgba(240, 185, 11, .08); color: #f7d66a; font-size: 13px; line-height: 1.5; }
.tab-row { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab-row a { padding: 9px 12px; color: var(--muted); }
.tab-row a.active { color: var(--text); border-bottom: 2px solid var(--green); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.stage-data-context { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 12px; }
.stage-data-context-label { color: var(--text); font-weight: 700; }
.stage-data-context label { display: inline-flex; align-items: center; gap: 5px; }
.stage-data-context select { min-height: 31px; padding: 4px 26px 4px 8px; font-size: 12px; }
.stage-pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.stage-pagination > div { display: flex; gap: 6px; }
.stage-table { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.stage-table td { max-width: 270px; white-space: normal; overflow-wrap: anywhere; }
.stage-table th { white-space: nowrap; }
.stage-table .stage-column-heading-row th { top: 0; z-index: 3; padding-bottom: 4px; border-bottom: 0; }
.stage-table .stage-column-filter-row th { top: 32px; z-index: 3; padding-top: 3px; padding-bottom: 8px; border-top: 0; background: var(--panel); }
.stage-table .stage-group-row th { position: static; }
.stage-sort-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; }
.stage-sort-link:hover, .stage-sort-link:focus-visible, .stage-sort-link.active { color: var(--green); outline: none; }
.stage-sort-link span { color: var(--line-strong); font-size: 10px; }
.stage-sort-link.active span { color: currentColor; }
.stage-column-filter-control { width: 100%; min-width: 76px; min-height: 29px; padding: 4px 23px 4px 7px; border-radius: 5px; font-size: 11px; }
.stage-column-filter-empty { display: inline-block; min-width: 20px; color: var(--muted-2); font-weight: 400; }
.stage-column-search { display: flex; min-width: 132px; }
.stage-column-search input { min-width: 0; width: 100%; border-radius: 5px 0 0 5px; }
.stage-column-search-submit { display: inline-grid; place-items: center; width: 30px; min-width: 30px; padding: 0; border: 1px solid var(--line); border-left: 0; border-radius: 0 5px 5px 0; background: var(--panel-2); color: var(--muted); cursor: pointer; }
.stage-column-search-submit:hover, .stage-column-search-submit:focus-visible { color: var(--green); border-color: var(--green); outline: none; }
.stage-table .stage-group-row th { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; background: rgba(0, 211, 149, .08); color: var(--muted); font-size: .76rem; letter-spacing: .05em; text-align: left; }
.stage-group-row th > span { color: var(--text); font-size: .82rem; }
.stage-group-row small { color: var(--muted); font-size: .72rem; font-weight: 500; }
.stage-history-toggle { padding: 3px 7px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; color: var(--green); font: inherit; letter-spacing: normal; cursor: pointer; }
.stage-history-toggle:hover, .stage-history-toggle:focus-visible { border-color: var(--green); background: rgba(0, 211, 149, .08); outline: none; }
.stage-history-count { color: var(--muted); font-size: .72rem; font-weight: 500; letter-spacing: normal; }
.stage-inline-detail { min-width: 132px; }
.stage-inline-detail summary { color: var(--green); cursor: pointer; white-space: nowrap; }
.evidence-loading, .stage-evidence { width: min(720px, 75vw); margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.evidence-loading { color: var(--muted); font-size: 12px; }
.stage-evidence { display: grid; gap: 12px; }
.evidence-section { display: grid; gap: 7px; }
.evidence-section + .evidence-section { padding-top: 12px; border-top: 1px solid var(--line); }
.evidence-section h3 { margin: 0; color: var(--text); font-size: 12px; }
.evidence-section dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; margin: 0; }
.evidence-section dl > div { min-width: 0; }
.evidence-section dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.evidence-section dd { margin: 3px 0 0; overflow-wrap: anywhere; color: var(--text); font-size: 12px; line-height: 1.5; }
.evidence-object { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; }
.evidence-object b { color: var(--muted); font-weight: 500; }
.evidence-object i { color: var(--line-strong); font-style: normal; }
.manual-assessment { display: grid; gap: 12px; }
.manual-assessment h2, .manual-assessment h3 { margin: 2px 0 6px; }
.manual-assessment > div > p:not(.eyebrow), .manual-assessment-result > p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.manual-assessment-form { display: grid; grid-template-columns: 140px minmax(260px, 1fr) auto; gap: 8px; }
.manual-assessment-form input, .manual-assessment-form select { min-width: 0; }
.manual-assessment-result { display: grid; gap: 9px; padding: 13px; border: 1px solid rgba(0, 211, 149, .3); border-radius: var(--radius-sm); background: rgba(0, 211, 149, .05); }
.manual-assessment-result .section-head { margin: 0; }
.manual-stage-trace { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 7px; }
.manual-stage-trace > div { display: grid; gap: 3px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); }
.manual-stage-trace b { color: var(--green); font: 11px "IBM Plex Mono", "SFMono-Regular", Consolas, monospace; }
.manual-stage-trace span { color: var(--text); font-size: 12px; overflow-wrap: anywhere; }
.manual-stage-trace small { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.classification-guide { display: grid; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--muted); font-size: 13px; line-height: 1.55; }
.classification-guide div { padding-left: 10px; border-left: 3px solid var(--stage-s3-line); }
.classification-guide div:first-child { border-left-color: var(--stage-s0-line); }
.classification-guide strong { color: var(--text); }
.classification-guide p { margin: 0; color: var(--yellow); }
.guide-tabs-page { display: grid; gap: 14px; }
.guide-search { display: grid; grid-template-columns: auto minmax(220px, 460px); gap: 10px; align-items: center; color: var(--muted); font-size: 12px; }
.guide-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.guide-tabs button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--panel-2); font: 12px Manrope, "PingFang SC", sans-serif; cursor: pointer; }
.guide-tabs button:hover, .guide-tabs button.active { color: var(--text); border-color: var(--green); background: rgba(0, 211, 149, .08); }
.guide-tab-panel { display: none; max-width: 980px; padding: clamp(14px, 2vw, 26px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-soft); line-height: 1.7; }
.guide-tab-panel.active { display: block; }
.guide-tab-panel h1, .guide-tab-panel h2, .guide-tab-panel h3 { color: var(--text); line-height: 1.3; }
.guide-tab-panel h1 { margin-top: 0; font-size: 24px; }
.guide-tab-panel h2 { margin-top: 0; font-size: 20px; }
.guide-tab-panel h3 { font-size: 16px; }
.guide-tab-panel p, .guide-tab-panel li { color: var(--muted); }
.guide-tab-panel pre { max-width: 100%; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text); font: 12px/1.55 "IBM Plex Mono", "SFMono-Regular", Consolas, monospace; }
.guide-tab-panel table { display: block; max-width: 100%; overflow-x: auto; }
.parameter-registry { display: grid; gap: 8px; }
.parameter-row { display: grid; grid-template-columns: minmax(190px, .8fr) minmax(260px, 1.3fr) minmax(250px, 1fr); gap: 16px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.parameter-row > div:first-child { display: grid; gap: 4px; }
.parameter-row > div:first-child span, .parameter-editor small { color: var(--muted); font: 11px/1.5 "IBM Plex Mono", "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; }
.parameter-row p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.parameter-row.locked { opacity: .7; background: #151a25; }
.parameter-row.locked input, .parameter-row.locked textarea { cursor: not-allowed; }
.parameter-editor { display: grid; gap: 6px; }
.parameter-reason { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.parameter-preview { display: grid; gap: 8px; padding: 12px; border: 1px solid rgba(0, 211, 149, .28); border-radius: var(--radius-sm); background: rgba(0, 211, 149, .06); color: var(--muted); font-size: 13px; }
.parameter-preview > strong { color: var(--text); }
.wallet-registry { display: grid; gap: 14px; }
.wallet-registry .metric small { display: block; margin-top: 5px; color: var(--muted); font: 11px/1.45 "IBM Plex Mono", "SFMono-Regular", Consolas, monospace; }
.wallet-registry-filters { display: grid; grid-template-columns: minmax(180px, 1fr) 125px minmax(150px, 1fr) 150px 135px 165px auto; gap: 8px; }
.evolution-flow { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--muted); font: 12px/1.5 "IBM Plex Mono", "SFMono-Regular", Consolas, monospace; }
.evolution-flow span { padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--text); background: #111827; }
.evolution-flow b { color: var(--green); }

.theme-switcher { display: inline-flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.theme-switcher button { min-height: 27px; padding: 4px 7px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font: 11px/1 Manrope, "PingFang SC", sans-serif; cursor: pointer; }
.theme-switcher button:hover { color: var(--text); background: var(--panel-3); }
.theme-switcher button[aria-pressed="true"] { color: var(--text); background: var(--panel-3); box-shadow: inset 0 0 0 1px var(--line-strong); }

.pipe-node[data-stage="S0"], .funnel-cell[data-stage="S0"] { background: var(--stage-s0); box-shadow: inset 0 3px 0 var(--stage-s0-line); }
.pipe-node[data-stage="S1"], .funnel-cell[data-stage="S1"] { background: var(--stage-s1); box-shadow: inset 0 3px 0 var(--stage-s1-line); }
.pipe-node[data-stage="S2"], .funnel-cell[data-stage="S2"] { background: var(--stage-s2); box-shadow: inset 0 3px 0 var(--stage-s2-line); }
.pipe-node[data-stage="S3"], .funnel-cell[data-stage="S3"] { background: var(--stage-s3); box-shadow: inset 0 3px 0 var(--stage-s3-line); }
.pipe-node[data-stage="S4"], .funnel-cell[data-stage="S4"] { background: var(--stage-s4); box-shadow: inset 0 3px 0 var(--stage-s4-line); }
.pipe-node[data-stage="S5"], .funnel-cell[data-stage="S5"] { background: var(--stage-s5); box-shadow: inset 0 3px 0 var(--stage-s5-line); }
.pipe-node[data-stage="S6"], .funnel-cell[data-stage="S6"] { background: var(--stage-s6); box-shadow: inset 0 3px 0 var(--stage-s6-line); }
.pipe-node[data-stage].active { color: var(--text); border-color: var(--green); box-shadow: inset 0 3px 0 var(--green), inset 0 0 0 1px rgba(0, 211, 149, .34); }
.funnel-cell[data-stage]:hover { color: var(--text); filter: saturate(1.18) brightness(1.08); }

body[data-theme="light"] {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --panel-2: #f4f7fb;
  --panel-3: #e9eef7;
  --text: #172033;
  --muted: #5f6c81;
  --muted-2: #78859a;
  --line: #d9e1ed;
  --line-strong: #b7c4d5;
  --shadow: 0 18px 46px rgba(25, 39, 64, .12);
  --shadow-soft: 0 8px 20px rgba(25, 39, 64, .08);
  --stage-s0: #ebf2ff;
  --stage-s1: #e6faf2;
  --stage-s2: #fff6dc;
  --stage-s3: #f3edff;
  --stage-s4: #e8f8ff;
  --stage-s5: #ffedf4;
  --stage-s6: #fff0e2;
}

body[data-theme="mist"] {
  --bg: #edf3f8;
  --panel: #f8fbfe;
  --panel-2: #e8f0f7;
  --panel-3: #dce8f2;
  --text: #17253b;
  --muted: #52677e;
  --muted-2: #6f8195;
  --line: #cbd9e5;
  --line-strong: #a9bfce;
  --shadow: 0 18px 46px rgba(42, 66, 92, .13);
  --shadow-soft: 0 8px 20px rgba(42, 66, 92, .09);
  --stage-s0: #e2edff;
  --stage-s1: #ddf5eb;
  --stage-s2: #fff0cf;
  --stage-s3: #ece4fb;
  --stage-s4: #dff3f8;
  --stage-s5: #fbe3ed;
  --stage-s6: #ffead9;
}

body[data-theme="light"] .app-sidebar,
body[data-theme="mist"] .app-sidebar { background: var(--panel); }
body[data-theme="light"] .topbar,
body[data-theme="light"] .subbar { background: rgba(255, 255, 255, .93); }
body[data-theme="mist"] .topbar,
body[data-theme="mist"] .subbar { background: rgba(248, 251, 254, .93); }
body[data-theme="light"] .json-preview,
body[data-theme="light"] .empty-state,
body[data-theme="light"] .loading-state,
body[data-theme="light"] .evolution-flow span,
body[data-theme="mist"] .json-preview,
body[data-theme="mist"] .empty-state,
body[data-theme="mist"] .loading-state,
body[data-theme="mist"] .evolution-flow span { background: var(--panel-2); color: var(--muted); }
body[data-theme="light"] .parameter-row.locked,
body[data-theme="mist"] .parameter-row.locked { background: var(--panel-2); }

@media (max-width: 900px) {
  .parameter-row { grid-template-columns: 1fr; gap: 9px; }
}

@media (max-width: 1100px) {
  .subbar { flex-wrap: wrap; }
  .signal-rail { flex: 1 1 100%; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: visible; }
  .pipe-node { width: auto; }
  .subbar-actions { flex: 1 1 100%; }
  .dashboard-funnel { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .funnel-cell:nth-child(4) { border-right: 0; }
  .funnel-cell:nth-child(-n + 4) { border-bottom: 1px solid var(--line); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-sidebar { transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow); }
  body.nav-open .app-sidebar { transform: translateX(0); }
  .app-workspace { margin-left: 0; }
  .nav-toggle { display: inline-flex; width: auto; padding: 6px 9px; background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius-sm); }
  .workspace-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .workspace-title small { display: none; }
  .topbar { position: sticky; top: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); justify-content: initial; height: auto; min-height: 54px; gap: 6px 10px; padding: 7px 12px; }
  .nav-toggle { grid-column: 1; grid-row: 1; }
  .workspace-title { grid-column: 2; grid-row: 1; }
  .theme-switcher { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .top-market { grid-column: 1 / -1; grid-row: 3; width: 100%; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
  main { padding: 0 12px 18px; }
  .subbar { position: static; margin: 0 -12px 12px; padding: 9px 12px; }
  .signal-rail { display: flex; flex-wrap: nowrap; width: 100%; overflow-x: auto; }
  .pipe-node { flex: 0 0 82px; }
  .subbar-actions { flex-wrap: nowrap; overflow-x: auto; width: 100%; }
  .subbar-actions .status-chip { flex: 0 0 auto; }
  .dashboard-heading, .stage-heading { align-items: start; flex-direction: column; }
  .dashboard-funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funnel-cell { min-height: 78px; border-bottom: 1px solid var(--line); }
  .funnel-cell:nth-child(even) { border-right: 0; }
  .funnel-cell:nth-last-child(-n + 1) { border-bottom: 0; }
  .stage-data-context { align-items: flex-start; }
  .stage-data-context label { flex-direction: column; align-items: flex-start; gap: 2px; }
  .wallet-registry-filters { grid-template-columns: 1fr 1fr; }
  .wallet-registry-filters input[name="q"] { grid-column: 1 / -1; }
  .manual-assessment-form { grid-template-columns: 1fr; }
  .guide-search { grid-template-columns: 1fr; }
  .evidence-section dl { grid-template-columns: 1fr; }
  .stage-pagination { align-items: start; flex-direction: column; }
  .compact-stack .history-row { grid-template-columns: 1fr auto; }
  .compact-stack .history-row span:last-child { grid-column: 1 / -1; }
}
