:root {
  color-scheme: dark;
  --background: #0c131e;
  --panel: #111e2d;
  --field: #0e1825;
  --line: #2c4055;
  --ink: #e8f2fc;
  --muted: #a5b9cd;
  --mint: #6be0c2;
  --gold: #ffc981;
  --pink: #f99cae;
  font: 16px/1.55 "Instrument Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); }
[hidden] { display: none !important; }
a { color: var(--mint); text-underline-offset: .24em; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); line-height: 1.15; letter-spacing: -.035em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { color: var(--muted); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 12px max(20px, calc((100vw - 1216px)/2)); border-bottom: 1px solid var(--line); background: #0f1925; }
.brand { display: inline-flex; gap: 9px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 750; }
.monogram { display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid #3c786f; border-radius: 8px; font: 720 .9rem system-ui; color: var(--mint); background: #123136; }
.back { font-size: .87rem; }
main { width: min(100% - 32px, 1216px); margin: 0 auto 36px; }
.lab-header { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin: 30px 0 20px; }
.lab-header p { margin-top: 7px; }
.capture { color: var(--muted); font-size: .84rem; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
button, input, select { font: inherit; border-radius: 7px; }
button { color: #092822; min-height: 42px; border: 1px solid var(--mint); background: var(--mint); font-weight: 700; padding: 7px 13px; cursor: pointer; }
button[disabled] { opacity: .55; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.tabs button, .secondary { color: var(--muted); border-color: var(--line); background: var(--field); }
.tabs [aria-pressed=true] { color: var(--mint); border-color: #4c9e90; background: #143038; }
.global-state { color: var(--gold); margin: 4px 0 12px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: clamp(12px, 2vw, 21px); margin-bottom: 13px; }
.panel > p, .panel > h3 + div, .panel > h3 + p { margin-top: 8px; }
.form-row { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
label { display: grid; min-width: 0; gap: 4px; color: var(--muted); font-size: .84rem; }
input, select { min-height: 42px; width: 100%; min-width: 0; padding: 7px 8px; border: 1px solid var(--line); color: var(--ink); background: var(--field); }
.contract-control { flex: 1 1 230px; }
.signal-layout { display: grid; grid-template-columns: minmax(235px, .7fr) minmax(0, 1.3fr); gap: 13px; }
.signal-list { display: grid; gap: 5px; max-height: 380px; overflow-y: auto; }
.signal-list button { color: var(--ink); border-color: var(--line); background: var(--field); display: flex; flex-direction: column; align-items: start; text-align: start; }
.signal-list button[aria-pressed=true] { border-color: #4c9e90; background: #143038; }
.signal-list small { color: var(--muted); font-weight: 400; }
.signal-list + button { margin-top: 10px; }
.decision-buy { color: var(--mint); }
.decision-sell { color: var(--pink); }
.decision-skip { color: var(--gold); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(166px, 1fr)); gap: 8px; margin: 12px 0; }
.facts div { min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 7px; }
.facts dt { color: var(--muted); font-size: .76rem; }
.facts dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: .9rem; font-variant-numeric: tabular-nums; }
.audit { color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; margin: 8px 0; }
.result { margin-top: 15px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .87rem; }
th, td { text-align: left; padding: 7px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 650; }
@media (max-width:690px) {
  .lab-header { align-items: start; flex-direction: column; margin-top:18px; }
  .signal-layout { grid-template-columns: minmax(0,1fr); gap: 0; }
  .signal-list { max-height: 225px; }
  .form-row label { flex: 1 1 140px; }
  .tabs { gap: 6px; }
  .tabs button { flex: 1 1 auto; font-size: .83rem; padding-inline: 8px; }
  .form-row button { flex: 1 0 100%; }
}
