/* Titan v2 — Strategy Lab
   Same design system as dashboard.css (see :root there). Reuses tokens by
   re-declaring the palette here so lab.html can be a standalone document. */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg-0:       #05080c;
  --bg-1:       #090d12;
  --bg-2:       #0d1219;
  --bg-3:       #121820;
  --bg-4:       #161d28;
  --bg-hover:   rgba(255,255,255,0.025);

  --bd-0:   rgba(255,255,255,0.04);
  --bd-1:   rgba(255,255,255,0.08);
  --bd-2:   rgba(255,255,255,0.14);

  --t-0:    #dde3ec;
  --t-1:    #8b96a6;
  --t-2:    #4c5669;
  --t-3:    #2e3848;

  --ok:       #22c55e;
  --ok-dim:   rgba(34, 197, 94, 0.10);
  --ok-glow:  rgba(34, 197, 94, 0.22);

  --warn:     #f59e0b;
  --warn-dim: rgba(245, 158, 11, 0.10);
  --warn-glow:rgba(245, 158, 11, 0.22);

  --err:      #f43f5e;
  --err-dim:  rgba(244, 63, 94, 0.10);
  --err-glow: rgba(244, 63, 94, 0.28);

  --profit:   #10b981;
  --profit-d: rgba(16, 185, 129, 0.10);
  --loss:     #f43f5e;
  --loss-d:   rgba(244, 63, 94, 0.10);

  --accent:   #3b82f6;
  --accent-d: rgba(59, 130, 246, 0.10);

  --kill:     #dc2626;
  --kill-h:   #b91c1c;
  --kill-g:   rgba(220, 38, 38, 0.30);

  --f-data: 'IBM Plex Mono', 'Courier New', monospace;
  --f-ui:   'DM Sans', system-ui, sans-serif;

  --r:   3px;
  --r2:  6px;
  --r3:  10px;

  --tx: 140ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 13px; }
body {
  font-family: var(--f-ui);
  background: var(--bg-0);
  color: var(--t-0);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; outline: none; background: none; color: inherit; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--bd-1); border-radius: 2px; }

.tr    { text-align: right; }
.mono  { font-family: var(--f-data); }
.hidden{ display: none !important; }

/* ══ TOP BAR ══════════════════════════════════════════════════════════ */
.lab-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 46px;
  padding: 0 20px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--bd-1);
}
.lab-topbar__left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.wordmark {
  font-family: var(--f-data);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t-1);
  flex-shrink: 0;
  text-decoration: none;
}
.wordmark em { color: var(--accent); font-style: normal; }
.lab-crumb {
  font-family: var(--f-data);
  font-size: 11px;
  color: var(--t-2);
}
.lab-crumb strong { color: var(--t-0); font-weight: 600; }
.nav-link {
  font-family: var(--f-data);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--t-2);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: var(--r);
  border: 1px solid var(--bd-1);
  transition: color var(--tx), border-color var(--tx);
}
.nav-link:hover { color: var(--t-0); border-color: var(--bd-2); }

/* ══ LAYOUT: collapsible left column + full-width backtest main ═══════ */
.lab-body {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 46px);
}
.rail-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 360px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--bd-0);
  transition: width 220ms ease, opacity 180ms ease, border-color 220ms ease;
}
.rail-left.collapsed {
  width: 0;
  opacity: 0;
  border-color: transparent;
  pointer-events: none;
}
.center-col { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }

/* collapse toggle — slim edge handle sitting on the column boundary */
.rail-collapse-btn {
  flex-shrink: 0;
  align-self: stretch;
  width: 14px;
  background: var(--bg-2);
  border: none;
  border-right: 1px solid var(--bd-0);
  color: var(--t-2);
  font-size: 12px;
  transition: color var(--tx), background var(--tx);
}
.rail-collapse-btn:hover { color: var(--t-0); background: var(--bg-3); }
.rail-collapse-btn[aria-expanded="false"] { transform: scaleX(-1); }

/* ══ STRATEGY LOV (top of left column) ══════════════════════════════════ */
.strat-lov-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bd-0);
  background: var(--bg-2);
}
.strat-lov { flex: 1 1 auto; min-width: 0; }
.strat-lov-row .panel__meta { flex-shrink: 0; white-space: nowrap; }

/* ══ PANEL (shared) ═══════════════════════════════════════════════════ */
.panel { border-bottom: 1px solid var(--bd-0); }
.panel__hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--bd-0);
  background: var(--bg-2);
  gap: 8px;
}
.panel__ttl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--t-2);
}
.panel__meta { font-family: var(--f-data); font-size: 10px; color: var(--t-2); }
.panel__body { padding: 12px 14px; }

.btn {
  font-family: var(--f-data);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: var(--r);
  border: 1px solid var(--bd-1);
  background: transparent;
  color: var(--t-1);
  transition: all var(--tx);
  white-space: nowrap;
}
.btn:hover { border-color: var(--bd-2); color: var(--t-0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-accent { border-color: var(--accent); color: var(--accent); }
.btn-accent:hover { background: var(--accent-d); }
.btn-accent-solid { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn-accent-solid:hover { opacity: 0.85; }
.btn-warn { border-color: var(--warn); color: var(--warn); }
.btn-warn:hover { background: var(--warn-dim); }
.btn-danger { border-color: rgba(244,63,94,0.4); color: var(--err); }
.btn-danger:hover { background: var(--err-dim); }
.btn-block { width: 100%; }
.btn-sm { padding: 3px 8px; font-size: 9px; }

.empty-note {
  padding: 20px 14px;
  font-size: 11px;
  color: var(--t-2);
  text-align: center;
  line-height: 1.5;
}

/* ══ CENTER: banners ══════════════════════════════════════════════════ */
.lab-banners { display: flex; flex-direction: column; }
.banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 11px;
  line-height: 1.5;
  border-bottom: 1px solid var(--bd-0);
}
.banner.warn { background: rgba(245,158,11,0.06); color: var(--warn); }
.banner.err  { background: rgba(244,63,94,0.06); color: var(--err); }
.banner .fidelity-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fidelity-badge {
  font-family: var(--f-data);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r);
  border: 1px solid currentColor;
  white-space: nowrap;
}
.fidelity-badge.bar-close     { color: var(--warn); background: var(--warn-dim); }
.fidelity-badge.intrabar-1m   { color: var(--ok);  background: var(--ok-dim); }
.hint-note {
  font-family: var(--f-data);
  font-size: 10px;
  color: var(--t-2);
  padding: 6px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--bd-0);
}

/* ══ BACKTEST TOOLBAR (compact, above chart) ════════════════════════════ */
.bt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--bd-1);
}
.field-inline { display: flex; flex-direction: column; gap: 4px; width: 118px; }
.field-inline--grow { flex: 1 1 auto; width: auto; min-width: 160px; justify-content: flex-end; }
.field-inline--acts { flex-direction: row; align-items: center; gap: 8px; width: auto; }
.bt-toolbar .bt-check { width: auto; margin-bottom: 6px; }
.bt-toolbar .coverage-line { padding-bottom: 6px; }

/* ══ CHART AREA ═══════════════════════════════════════════════════════ */
.chart-wrap { border-bottom: 1px solid var(--bd-0); background: var(--bg-1); }
.preview-banner {
  font-family: var(--f-data);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--warn);
  background: var(--warn-dim);
  border-bottom: 1px solid var(--bd-0);
  padding: 5px 14px;
}
.preview-note {
  font-family: var(--f-data);
  font-size: 10px;
  color: var(--t-2);
  padding: 5px 14px;
  border-bottom: 1px solid var(--bd-0);
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--bd-0);
  background: var(--bg-2);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--t-1);
  white-space: nowrap;
}
.legend-item--muted { color: var(--t-2); }
.legend-swatch {
  width: 9px; height: 9px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}
.legend-swatch--muted { border-radius: 50%; opacity: 0.75; }
.legend-toggle {
  margin-left: auto;
  gap: 6px;
}
#candle-chart { width: 100%; height: 380px; }
.equity-wrap { border-bottom: 1px solid var(--bd-0); background: var(--bg-1); }
.equity-lbl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--t-2);
  padding: 6px 14px 0;
}
#equity-chart { width: 100%; height: 110px; }

.chart-empty, .chart-loading {
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t-2);
  font-size: 12px;
  text-align: center;
  gap: 8px;
  flex-direction: column;
}

.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--bd-1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══ TABS ═════════════════════════════════════════════════════════════ */
.tab-bar { display: flex; border-bottom: 1px solid var(--bd-1); background: var(--bg-2); }
.tab-btn {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--t-2);
  border-bottom: 2px solid transparent;
  padding: 9px 14px;
  transition: color var(--tx), border-color var(--tx);
}
.tab-btn.active { color: var(--t-0); border-bottom-color: var(--accent); }
.tab-btn:hover { color: var(--t-1); }
.tab-pane { display: none; flex: 1; overflow: auto; }
.tab-pane.active { display: block; }

/* Data table (shared style) */
.dt { width: 100%; border-collapse: collapse; }
.dt th {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--t-2);
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--bd-1);
  background: var(--bg-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.dt td {
  font-family: var(--f-data);
  font-size: 11px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--bd-0);
  color: var(--t-1);
  white-space: nowrap;
}
.dt tr:last-child td { border-bottom: none; }
.dt tr:hover td { background: var(--bg-hover); }
.dt tr.clickable { cursor: pointer; }

/* trades tab header + fixed-height scroll container */
.trades-tab-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bd-0);
}
.trades-table-scroll {
  max-height: 340px;
  overflow-y: auto;
  overflow-x: auto;
}
.empty-row td {
  text-align: center;
  color: var(--t-2);
  padding: 24px;
  font-family: var(--f-ui);
  font-size: 11px;
}

.dir-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  border-radius: 2px;
  display: inline-block;
}
.dir-badge.long  { background: rgba(16,185,129,0.12); color: var(--profit); }
.dir-badge.short { background: rgba(244,63,94,0.12);  color: var(--loss); }

.sig-chip {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  border-radius: 2px;
  background: rgba(59,130,246,0.14);
  color: #60a5fa;
}

.pnl-num { font-weight: 600; }
.pnl-num.profit { color: var(--profit); }
.pnl-num.loss   { color: var(--loss); }
.pnl-num.zero   { color: var(--t-2); }
.na { color: var(--t-3); }

/* ══ KPI GRID ═════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1px;
  background: var(--bd-0);
}
@media (min-width: 1400px) {
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
.kpi-tile { background: var(--bg-1); padding: 12px 14px; }
.kpi-tile__lbl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--t-2);
  margin-bottom: 5px;
  white-space: nowrap;
}
.kpi-tile__val {
  font-family: var(--f-data);
  font-size: 18px;
  font-weight: 600;
  color: var(--t-0);
  line-height: 1;
}
.kpi-tile__val.profit { color: var(--profit); }
.kpi-tile__val.loss   { color: var(--loss); }

.signal-breakdown { padding: 14px; }
.signal-breakdown__ttl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--t-2);
  margin-bottom: 8px;
}

/* ══ RIGHT RAIL: editor + backtest panel ═════════════════════════════ */
.editor-quickfields {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--bd-0);
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field--full { grid-column: 1 / -1; }
.field-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--t-2);
}
.field-input, .field-select {
  font-family: var(--f-data);
  font-size: 12px;
  background: var(--bg-0);
  color: var(--t-0);
  border: 1px solid var(--bd-1);
  border-radius: var(--r);
  padding: 6px 8px;
  outline: none;
  width: 100%;
}
.field-input:focus, .field-select:focus { border-color: var(--accent); }
.field-check { display: flex; align-items: center; gap: 6px; margin-top: 18px; }
.field-check input { width: 14px; height: 14px; }
.field-check label { font-size: 11px; color: var(--t-1); }

.json-editor-wrap { padding: 12px 14px; border-bottom: 1px solid var(--bd-0); }
#spec-json {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  font-family: var(--f-data);
  font-size: 11px;
  line-height: 1.6;
  background: var(--bg-0);
  color: var(--t-0);
  border: 1px solid var(--bd-1);
  border-radius: var(--r);
  padding: 10px;
  outline: none;
}
#spec-json:focus { border-color: var(--accent); }
#spec-json.invalid { border-color: var(--err); }

.editor-acts { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--bd-0); flex-wrap: wrap; }
.validate-result { margin: 0 14px 10px; font-size: 11px; line-height: 1.6; }
.validate-result.ok  { color: var(--ok); }
.validate-result.err { color: var(--err); }
.validate-result ul { margin: 4px 0 0 16px; }

.blocks-wrap { padding: 10px 14px; border-bottom: 1px solid var(--bd-0); }
.chip-group { margin-bottom: 8px; }
.chip-group__ttl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--t-2);
  margin-bottom: 5px;
}
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-family: var(--f-data);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--r);
  border: 1px solid var(--bd-1);
  color: var(--t-1);
  background: var(--bg-2);
}

/* backtest controls */
.bt-controls { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.bt-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bt-row--single { grid-template-columns: 1fr; }
.coverage-line {
  font-family: var(--f-data);
  font-size: 10px;
  color: var(--t-2);
}
.bt-check { display: flex; align-items: center; gap: 6px; }
.bt-check input { width: 14px; height: 14px; }
.bt-check label { font-size: 11px; color: var(--t-1); }
.bt-check.disabled label { color: var(--t-3); }
.bt-run-btn { width: 100%; padding: 9px; font-size: 11px; }
.bt-error {
  margin: 0 14px 10px;
  padding: 8px 10px;
  border-radius: var(--r);
  background: var(--err-dim);
  border: 1px solid rgba(244,63,94,0.22);
  color: var(--err);
  font-size: 11px;
  line-height: 1.5;
}
.bt-summary {
  margin: 0 14px 10px;
  padding: 8px 10px;
  border-radius: var(--r);
  background: var(--bg-2);
  border: 1px solid var(--bd-1);
  color: var(--t-1);
  font-family: var(--f-data);
  font-size: 10px;
  line-height: 1.6;
}

/* deploy section */
.deploy-wrap { padding: 12px 14px; border-top: 1px solid var(--bd-0); }
.deploy-note { font-size: 10px; color: var(--t-2); margin-bottom: 8px; line-height: 1.5; }

/* ══ DIALOG ═══════════════════════════════════════════════════════════ */
.dialog-bg {
  display: none;
  position: fixed; inset: 0; z-index: 300;
  background: rgba(5,8,12,0.85);
  backdrop-filter: blur(6px);
  align-items: center; justify-content: center;
}
.dialog-bg.open { display: flex; }
.dialog {
  background: var(--bg-2);
  border: 1px solid var(--bd-2);
  border-radius: var(--r2);
  width: 400px;
  padding: 26px;
  box-shadow: 0 0 80px rgba(0,0,0,0.9);
}
.dialog__ttl { font-size: 14px; font-weight: 600; color: var(--t-0); margin-bottom: 8px; }
.dialog__body { font-size: 12px; color: var(--t-1); line-height: 1.6; margin-bottom: 14px; }
.dialog__body strong { color: var(--err); }
.dialog__input {
  width: 100%;
  font-family: var(--f-data);
  font-size: 12px;
  background: var(--bg-0);
  color: var(--t-0);
  border: 1px solid var(--bd-1);
  border-radius: var(--r);
  padding: 7px 10px;
  outline: none;
  margin-bottom: 16px;
}
.dialog__input:focus { border-color: var(--accent); }
.dialog__acts { display: flex; gap: 8px; justify-content: flex-end; }

/* auth dialog reused pattern */
.auth-box {
  background: var(--bg-2);
  border: 1px solid var(--bd-2);
  border-radius: var(--r2);
  width: 340px;
  padding: 28px;
  box-shadow: 0 0 60px rgba(0,0,0,0.8);
}
.auth-ttl { font-size: 13px; font-weight: 600; color: var(--t-0); margin-bottom: 6px; }
.auth-sub { font-size: 11px; color: var(--t-1); margin-bottom: 18px; line-height: 1.5; }
.auth-field { margin-bottom: 12px; }
.auth-field label {
  display: block; font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.10em; color: var(--t-2); margin-bottom: 5px;
}
.auth-field input {
  width: 100%; font-family: var(--f-data); font-size: 12px;
  background: var(--bg-0); color: var(--t-0); border: 1px solid var(--bd-1);
  border-radius: var(--r); padding: 7px 10px; outline: none;
}
.auth-field input:focus { border-color: var(--accent); }
.auth-err { font-size: 11px; color: var(--err); margin-bottom: 12px; display: none; }
.auth-err.visible { display: block; }
.auth-submit {
  width: 100%; font-family: var(--f-data); font-size: 10px; font-weight: 700;
  letter-spacing: 0.10em; text-transform: uppercase; padding: 8px;
  border-radius: var(--r); background: var(--accent); color: #fff;
}
.auth-submit:hover { opacity: 0.85; }

/* ══ AMBIGUOUS TRADES ═════════════════════════════════════════════════ */
.ambig-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(245,158,11,0.06);
  border-bottom: 1px solid rgba(245,158,11,0.22);
  color: var(--warn);
  font-size: 11px;
  line-height: 1.5;
}
.ambig-notice span { flex: 1; }

.dt tr.ambig-row {
  border-left: 3px solid var(--warn);
}
.dt tr.ambig-row td:first-child { border-left: none; }
.ambig-tag {
  font-family: var(--f-data);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  border-radius: 2px;
  background: var(--warn-dim);
  color: var(--warn);
  border: 1px solid rgba(245,158,11,0.3);
  margin-left: 5px;
  cursor: help;
}

/* ══ CAPITAL-RELATIVE KPI GROUP ═══════════════════════════════════════ */
.capital-relative-group { padding: 0 14px 14px; }
.capital-relative-group .signal-breakdown__ttl { padding-top: 14px; display: flex; align-items: center; gap: 8px; }
.capital-relative-group .kpi-grid { border: 1px solid var(--bd-0); border-radius: var(--r2); overflow: hidden; }

/* ══ SAVED RUNS ═══════════════════════════════════════════════════════ */
.panel__hd--clickable { cursor: pointer; }
.panel__hd--clickable:hover .panel__ttl { color: var(--t-1); }
.saved-runs-body { padding-top: 0; }
.run-actions { display: flex; gap: 4px; }
.save-run-row { padding: 0 14px 12px; }

/* ══ VIEWING SAVED RUN BANNER ═════════════════════════════════════════ */
.banner-viewing {
  padding: 8px 14px;
  background: var(--accent-d);
  border-bottom: 1px solid rgba(59,130,246,0.25);
  color: var(--accent);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.banner-viewing button {
  font-family: var(--f-data);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r);
  border: 1px solid var(--accent);
  color: var(--accent);
}
.banner-viewing button:hover { background: var(--accent-d); }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .rail-left { width: 300px; }
}
@media (max-width: 1024px) {
  .lab-body { flex-direction: column; }
  .rail-left { width: auto !important; max-height: 360px; border-right: none; border-bottom: 1px solid var(--bd-1); }
  .rail-left.collapsed { max-height: 0; border: none; }
  .rail-collapse-btn { align-self: flex-start; width: 100%; height: 14px; border-right: none; border-bottom: 1px solid var(--bd-0); }
  .rail-collapse-btn[aria-expanded="false"] { transform: scaleY(-1); }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
@media (max-width: 640px) {
  .lab-topbar { padding: 0 12px; }
  .wordmark { display: none; }
  .editor-quickfields, .bt-row { grid-template-columns: 1fr; }
  .field-inline { width: 100%; }
}
