:root {
  color-scheme: dark;
  --ink: #060706;
  --ink-2: #11130f;
  --panel: rgba(16, 18, 15, 0.9);
  --panel-solid: #11140f;
  --line: rgba(244, 238, 224, 0.13);
  --line-strong: rgba(244, 238, 224, 0.3);
  --text: #f6f1e7;
  --muted: #aba799;
  --faint: #747065;
  --acid: #d7b76c;
  --cyan: #80d6ff;
  --amber: #f1a85b;
  --red: #ff6868;
  --shadow: rgba(0, 0, 0, 0.34);
  --display: "Nacelle", "IBM Plex Sans", Inter, ui-sans-serif, system-ui, sans-serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--sans);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(246, 241, 231, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(246, 241, 231, 0.028) 1px, transparent 1px),
    linear-gradient(145deg, #050605 0%, #11130f 52%, #070807 100%);
  background-size: 7.5rem 7.5rem, 7.5rem 7.5rem, auto;
  color: var(--text);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

#signalCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  opacity: 0.48;
  pointer-events: none;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 7, 6, 0.82);
  backdrop-filter: blur(18px);
}

.eyebrow,
.label,
label {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.34rem;
  font-family: var(--display);
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: 0.9;
  font-weight: 700;
}

.product-line {
  max-width: 38rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.45;
}

h2 {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: 1.26rem;
  font-weight: 700;
}

h3 {
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  max-width: 38rem;
}

.topbar-meta span,
.topbar-link,
.topbar-action,
.verdict,
.status-pill {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.72rem;
  background: rgba(246, 241, 231, 0.045);
  color: var(--muted);
  font-size: 0.84rem;
}

.topbar-link {
  border-color: rgba(128, 214, 255, 0.34);
  color: var(--cyan);
  text-decoration: none;
}

.topbar-action {
  cursor: pointer;
}

.topbar-action.primary {
  border-color: rgba(215, 183, 108, 0.58);
  color: var(--acid);
}

.topbar-link:hover,
.topbar-link:focus-visible,
.topbar-action:hover,
.topbar-action:focus-visible {
  border-color: rgba(128, 214, 255, 0.72);
  background: rgba(128, 214, 255, 0.1);
  outline: none;
}

.topbar-meta span.status-good {
  border-color: rgba(215, 183, 108, 0.62);
  color: var(--acid);
}

.topbar-meta span.status-watch {
  border-color: rgba(241, 168, 91, 0.52);
  color: var(--amber);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 17.5rem minmax(0, 1fr) 23.5rem;
  gap: 0.85rem;
  padding: 0.85rem;
  min-height: calc(100vh - 6.9rem);
}

.panel,
.workspace {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1.2rem 4rem rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
}

.control-panel,
.inspector {
  padding: 1rem;
}

.workspace {
  min-width: 0;
  padding: 1rem;
}

.performance-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.62rem;
  margin-bottom: 0.85rem;
}

.performance-card {
  min-height: 6.9rem;
  border: 0;
  border-top: 2px solid var(--line);
  border-radius: 0;
  padding: 0.9rem 0.2rem 0.7rem;
  background: transparent;
}

.performance-card.proof {
  border-color: rgba(215, 183, 108, 0.34);
}

.performance-card span {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.performance-card strong {
  display: block;
  margin-bottom: 0.38rem;
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1.12;
}

.performance-card em {
  color: var(--muted);
  font-size: 0.79rem;
  font-style: normal;
  line-height: 1.35;
}

.performance-alert {
  display: none;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(241, 168, 91, 0.34);
  border-radius: 8px;
  padding: 0.72rem 0.82rem;
  background: rgba(241, 168, 91, 0.08);
  color: var(--amber);
  font-size: 0.86rem;
  line-height: 1.35;
}

.performance-alert.visible {
  display: block;
}

.performance-alert.good {
  border-color: rgba(215, 183, 108, 0.34);
  background: rgba(215, 183, 108, 0.08);
  color: var(--acid);
}

.control-block {
  margin-bottom: 1rem;
}

.control-block.compact {
  margin-bottom: 0.65rem;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(246, 241, 231, 0.055);
  color: var(--text);
  outline: none;
}

input {
  height: 2.6rem;
  padding: 0 0.75rem;
}

textarea {
  min-height: 7.8rem;
  resize: vertical;
  padding: 0.75rem;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: rgba(215, 183, 108, 0.72);
  box-shadow: 0 0 0 3px rgba(215, 183, 108, 0.12);
}

input[type="range"] {
  height: auto;
  padding: 0;
  accent-color: var(--acid);
}

.tolerance-scale {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.38rem;
  color: var(--faint);
  font-size: 0.7rem;
  line-height: 1.25;
}

.tolerance-scale span:nth-child(2) {
  text-align: center;
}

.tolerance-scale span:last-child {
  text-align: right;
}

.segmented,
.sort-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.segmented button,
.sort-controls button {
  min-height: 2.16rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  padding: 0 0.66rem;
  color: var(--muted);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.segmented button:hover,
.sort-controls button:hover,
.market-table tbody tr:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  color: var(--text);
}

.segmented button.active,
.sort-controls button.active {
  border-color: rgba(215, 183, 108, 0.7);
  background: rgba(215, 183, 108, 0.13);
  color: var(--acid);
}

.reduction-rules {
  margin-top: 1.15rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.setup-panel {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.setup-head,
.consumer-command,
.button-row,
.command-actions,
.inspector-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.setup-head,
.consumer-command {
  justify-content: space-between;
}

.setup-state {
  min-width: 3.2rem;
  border: 1px solid rgba(241, 168, 91, 0.4);
  border-radius: 999px;
  padding: 0.34rem 0.55rem;
  color: var(--amber);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
}

.setup-state.good {
  border-color: rgba(215, 183, 108, 0.58);
  color: var(--acid);
}

.setup-list {
  display: grid;
  gap: 0.62rem;
  margin: 0.85rem 0 1rem;
  padding: 0;
  list-style: none;
}

.setup-list li {
  border-left: 2px solid rgba(241, 168, 91, 0.5);
  padding-left: 0.65rem;
}

.setup-list li.done {
  border-left-color: rgba(215, 183, 108, 0.62);
}

.setup-list strong,
.setup-list span,
.setup-note {
  display: block;
}

.setup-list strong {
  margin-bottom: 0.2rem;
  font-size: 0.84rem;
}

.setup-list span,
.setup-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.setup-note code {
  color: var(--acid);
}

.consumer-command {
  min-height: 7.2rem;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(215, 183, 108, 0.28);
  border-left: 4px solid var(--acid);
  border-radius: 8px;
  padding: 1.05rem 1rem;
  background:
    linear-gradient(90deg, rgba(215, 183, 108, 0.11), rgba(246, 241, 231, 0.035)),
    rgba(246, 241, 231, 0.025);
}

.consumer-command h2 {
  margin-bottom: 0.3rem;
  font-size: clamp(1.45rem, 2.2vw, 2.35rem);
  line-height: 0.98;
}

.consumer-command p:not(.eyebrow) {
  max-width: 52rem;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.command-actions,
.button-row,
.inspector-actions {
  flex-wrap: wrap;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  min-height: 2.35rem;
  padding: 0 0.74rem;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, background 160ms ease;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(215, 183, 108, 0.58);
  color: var(--acid);
  outline: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.reduction-rules ul,
.text-block ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.55;
}

.workspace-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.workspace-head.compact {
  margin-bottom: 0.65rem;
}

.live-review-panel {
  margin-bottom: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
  background: rgba(246, 241, 231, 0.03);
}

.live-order-list {
  display: grid;
  gap: 0.55rem;
}

.live-order {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
}

.live-order:first-child {
  border-top: none;
  padding-top: 0;
}

.live-order strong,
.live-order span {
  display: block;
}

.live-order strong {
  margin-bottom: 0.22rem;
}

.live-order span {
  color: var(--muted);
  font-size: 0.8rem;
}

.live-empty {
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
}

.action-output {
  min-height: 2.5rem;
  margin: 0.8rem 0 0;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.68rem;
  background: rgba(0, 0, 0, 0.24);
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.4;
}

.market-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.market-table {
  width: 100%;
  min-width: 48rem;
  border-collapse: collapse;
}

.market-table th,
.market-table td {
  padding: 0.9rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.market-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-solid);
  color: var(--faint);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.market-table tbody tr {
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.market-table tbody tr.active {
  background: rgba(215, 183, 108, 0.09);
  box-shadow: inset 3px 0 0 var(--acid);
}

.market-title {
  display: grid;
  gap: 0.25rem;
  min-width: 18rem;
}

.market-title strong {
  font-size: 0.96rem;
}

.market-title span,
.thin {
  color: var(--muted);
  font-size: 0.82rem;
}

.side {
  color: var(--cyan);
  font-weight: 800;
}

.side.no {
  color: var(--amber);
}

.signal-bar {
  display: grid;
  grid-template-columns: 3rem minmax(6rem, 1fr);
  align-items: center;
  gap: 0.52rem;
}

.signal-meter {
  height: 0.48rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.signal-meter span {
  display: block;
  height: 100%;
  width: var(--score);
  background: linear-gradient(90deg, var(--amber), var(--acid));
}

.gate-pass {
  color: var(--acid);
}

.gate-watch {
  color: var(--amber);
}

.inspector {
  display: flex;
  flex-direction: column;
  min-height: 0;
  animation: fadeUp 360ms ease both;
}

.inspector-head {
  position: relative;
  padding-right: 5.8rem;
}

.verdict {
  position: absolute;
  top: 0;
  right: 0;
  border-color: rgba(215, 183, 108, 0.58);
  color: var(--acid);
}

.verdict.watch {
  border-color: rgba(241, 168, 91, 0.5);
  color: var(--amber);
}

.probability-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 1rem 0;
}

.probability-grid div,
.metric-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.72rem;
  background: rgba(255, 255, 255, 0.04);
}

.probability-grid span,
.metric-list dt {
  display: block;
  margin-bottom: 0.28rem;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.probability-grid strong,
.metric-list dd {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
}

.chart-panel {
  height: 10rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.035);
}

#sparkline {
  width: 100%;
  height: 100%;
}

.metric-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin: 1rem 0;
}

.text-block {
  border-top: 1px solid var(--line);
  padding-top: 0.95rem;
  color: var(--muted);
}

.text-block p {
  margin-bottom: 1rem;
  line-height: 1.5;
}

.evidence-list {
  display: grid;
  gap: 0.55rem;
  padding-left: 0;
  list-style: none;
}

.evidence-list li {
  display: grid;
  gap: 0.25rem;
  border-left: 2px solid rgba(215, 183, 108, 0.45);
  padding-left: 0.65rem;
}

.evidence-list strong {
  color: var(--acid);
  font-size: 0.72rem;
}

.evidence-list em {
  color: var(--faint);
  font-size: 0.76rem;
  font-style: normal;
}

.empty-state {
  color: var(--muted);
}

.empty-state code {
  color: var(--acid);
}

.thesis-log {
  margin-top: auto;
  padding-top: 1rem;
}

.inspector-actions {
  margin-top: 0.8rem;
}

.inspector-actions button {
  flex: 1 1 9rem;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 16rem minmax(0, 1fr);
  }

  .performance-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inspector {
    grid-column: 1 / -1;
  }
}

@media (max-width: 780px) {
  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .topbar-meta {
    justify-content: flex-start;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding: 0.55rem;
  }

  .workspace-head {
    align-items: start;
    flex-direction: column;
  }

  .consumer-command,
  .live-order {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .control-grid,
  .performance-strip,
  .metric-list,
  .probability-grid {
    grid-template-columns: 1fr;
  }
}

/* Live-submit confirmation button (Saturday 2026-04-25) */
.live-order-actions { display: flex; gap: 8px; align-items: center; }
.live-order .live-submit {
  background: #7a1818;
  color: #fdf6dd;
  border: 1px solid #b03030;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.live-order .live-submit:hover { background: #962323; }
