:root {
  color-scheme: dark;
  --bg: #181d20;
  --surface: #20272b;
  --surface-muted: #293237;
  --surface-sunken: #1b2125;
  --ink: #e8edea;
  --ink-soft: #c7d1cb;
  --muted: #a9b6ae;
  --line: #303a3f;
  --line-strong: #46524a;
  --green: #adcbb7;
  --green-dark: #b8d6c2;
  --green-soft: #adcbb712;
  --red: #dea3a1;
  --red-soft: #dea3a112;
  --amber: #d6bb8c;
  --amber-soft: #d6bb8c12;
  --blue: #adcbb7;
  --blue-dark: #b8d6c2;
  --blue-soft: #adcbb712;
  --sidebar: #14191c;
  --sidebar-active: #adcbb712;
  --primary-ink: #19281f;
  --shadow: 0 20px 55px #0004;
  --sidebar-width: 198px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #fff;
  --surface-muted: #edf1ee;
  --surface-sunken: #f7f9f8;
  --ink: #24352c;
  --ink-soft: #405c4d;
  --muted: #63746a;
  --line: #e0e6e2;
  --line-strong: #c8d2cc;
  --green: #386a4b;
  --green-dark: #386a4b;
  --green-soft: #386a4b0d;
  --red: #a3464b;
  --red-soft: #a3464b0d;
  --amber: #856325;
  --amber-soft: #8563250d;
  --blue: #39684b;
  --blue-dark: #39684b;
  --blue-soft: #39684b0d;
  --sidebar: #f9faf9;
  --sidebar-active: #39684b0d;
  --primary-ink: #fff;
  --shadow: 0 20px 55px #1939231c;
}
* { box-sizing: border-box; }
* { letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 12px; line-height: 1.45; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-panel {
  width: min(100%, 460px);
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel h1 { margin: 0 0 22px; font-size: 28px; line-height: 1.1; }
.auth-copy { margin: -10px 0 20px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; margin: -8px 0 18px; padding: 6px 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.auth-back svg { width: 16px; height: 16px; }
.auth-loading { display: flex; min-height: 190px; align-items: center; justify-content: center; gap: 9px; color: var(--muted); font-size: 13px; }
.auth-loading svg { width: 19px; height: 19px; animation: spin 1s linear infinite; }
.authenticator-setup { display: grid; grid-template-columns: 164px minmax(0, 1fr); align-items: center; gap: 18px; margin-bottom: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-muted); }
.authenticator-setup img { width: 164px; height: 164px; background: white; }
.authenticator-setup strong { font-size: 13px; }
.authenticator-setup p { margin: 7px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.authenticator-setup code { display: block; overflow-wrap: anywhere; color: var(--blue-dark); font-size: 12px; line-height: 1.5; }
.recovery-code-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 18px 0; }
.recovery-code-list code { padding: 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-muted); font-size: 12px; text-align: center; }
#recovery-codes .button + .button { margin-top: 9px; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand-lockup { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.brand-lockup small { display: block; font-size: 10px; font-weight: 400; color: var(--muted); margin-top: 3px; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 34px; border-radius: 6px; background: var(--surface); color: var(--blue); border: 1px solid var(--line); font-size: 14px; }
.brand-mark svg { width: 16px; height: 16px; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-sunken);
  color: var(--ink);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
textarea { min-height: 210px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; }

.button, .icon-button, .primary-nav button, .mobile-nav button {
  border: 0;
  background: transparent;
  color: inherit;
}
.button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 7px; padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; font-size: 12px; font-weight: 550; text-decoration: none; }
.button svg { width: 17px; height: 17px; }
.button.primary { border-color: var(--blue); background: var(--blue); color: var(--primary-ink); }
.button.primary:hover { filter: brightness(1.12); }
.button.danger { border-color: #6e2731; color: var(--red); }
.button.full { width: 100%; }
.button:disabled { cursor: not-allowed; opacity: 0.48; }
.icon-button:disabled { cursor: not-allowed; opacity: 0.38; }
.icon-button { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 3px; }
.icon-button:hover { background: var(--surface-muted); }
.icon-button svg { width: 18px; height: 18px; }

.app-shell { min-height: 100dvh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 22px 11px 12px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  color: var(--ink);
}
.sidebar > .brand-lockup { padding: 0 4px 34px; }
.primary-nav { display: grid; gap: 5px; }
.primary-nav button { position: relative; display: flex; min-height: 42px; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 6px; color: var(--muted); text-align: left; font-size: 12.5px; font-weight: 500; }
.primary-nav button:hover { background: var(--surface-muted); color: var(--ink); }
.primary-nav button.active { background: var(--sidebar-active); color: var(--blue-dark); }
.primary-nav button.active::before { position: absolute; inset: 12px auto 12px 0; width: 2px; background: var(--blue); content: ""; }
.primary-nav svg { width: 18px; height: 18px; }
.sidebar-account { display: grid; grid-template-columns: 34px minmax(0, 1fr) 36px; align-items: center; gap: 9px; margin-top: auto; padding: 14px 6px 0; border-top: 1px solid var(--line); }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--blue-dark); font-weight: 800; }
.sidebar-account strong, .sidebar-account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account strong { font-size: 13px; }
.sidebar-account small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.truncate { min-width: 0; }

.workspace { min-height: 100dvh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 27px; border-bottom: 1px solid var(--line); background: var(--bg); }
.eyebrow { margin: 0 0 1px; color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 650; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.4; }
.topbar-actions { display: flex; align-items: end; gap: 10px; }
.instance-picker { display: grid; min-width: 220px; gap: 2px; color: var(--muted); font-size: 10px; }
.instance-picker select { min-height: 32px; padding-block: 4px; color: var(--ink); font-size: 12px; font-weight: 650; text-transform: none; }
.content { width: min(100%, 1680px); margin: 0 auto; padding: 24px 27px 40px; }
.content:focus { outline: none; }
.mobile-nav { display: none; }

/* Shared workspace navigation and integrated authoring surface. */
.sidebar-utilities { margin-top: auto; padding: 16px 5px; display: flex; gap: 8px; }
.sidebar-account { margin-top: 0; grid-template-columns: 28px minmax(0, 1fr) 25px; gap: 6px; }
.sidebar-account .avatar { width: 28px; height: 28px; font-size: 11px; }
.sidebar-account strong { font-size: 12px; }
.sidebar-account small { font-size: 10px; }
.sidebar-account .icon-button { width: 25px; }
.primary-nav button:last-child { margin-top: 20px; }
.registry-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 0 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.registry-summary > div { display: grid; gap: 8px; padding: 0 24px; border-left: 1px solid var(--line); }
.registry-summary > div:first-child { padding-left: 0; border-left: 0; }
.registry-summary span, .registry-summary small { color: var(--muted); font-size: 11px; }
.registry-summary strong { font-size: 30px; font-weight: 500; font-variant-numeric: tabular-nums; }
.registry-layout { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 22px; align-items: start; }
.strategy-registry { min-width: 0; }
.strategy-registry > header, .strategy-inspector > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 49px; border-bottom: 1px solid var(--line); }
.strategy-registry header h2 { font-size: 14px; font-weight: 550; margin: 0; }
.strategy-registry header > span, .strategy-inspector > header { color: var(--muted); font-size: 11px; }
.strategy-inspector > header svg { width: 15px; }
.registry-filters { display: flex; align-items: center; gap: 10px; padding: 16px 0 12px; }
.registry-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-sunken); padding: 0 10px; flex: 1; }
.registry-search input { border: 0; box-shadow: none; min-height: 35px; padding: 8px 0; font-size: 12px; }
.registry-search svg { width: 14px; color: var(--muted); }
.registry-filters select { width: 145px; min-height: 36px; padding: 8px; font-size: 11px; }
.registry-status-filters { display: flex; gap: 5px; padding-bottom: 15px; }
.registry-status-filters button { border: 1px solid transparent; background: transparent; color: var(--muted); min-height: 29px; padding: 4px 10px; border-radius: 5px; font-size: 11px; }
.registry-status-filters button.active { background: var(--surface-muted); border-color: var(--line-strong); color: var(--ink); }
.registry-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.registry-table th { background: var(--surface-sunken); padding: 11px 10px; color: var(--muted); font-weight: 400; font-size: 10.5px; text-align: left; border-block: 1px solid var(--line); }
.registry-table td { border-bottom: 1px solid var(--line); padding: 14px 10px; height: 76px; font-size: 12px; }
.registry-table tr.selected { background: var(--blue-soft); }
.registry-table tr.selected td:first-child { box-shadow: inset 2px 0 var(--blue); }
.registry-table td:first-child { width: 64%; }
.registry-table td:last-child { width: 35px; padding-inline: 4px; }
.registry-table .status { width: fit-content; max-width: 160px; }
.registry-table .status::before { flex-shrink: 0; }
.registry-run-versions { display: block; max-width: 160px; margin-top: 5px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.activity-notice { padding: 12px 0; color: var(--muted); }
.registry-name { background: transparent; border: 0; color: var(--ink); display: flex; align-items: center; gap: 11px; padding: 0; width: 100%; text-align: left; }
.registry-name > span:last-child { min-width: 0; display: grid; gap: 6px; }
.registry-name strong { font-size: 12.5px; font-weight: 550; overflow-wrap: anywhere; }
.registry-name small { font-size: 10.5px; color: var(--muted); }
.registry-symbol { width: 33px; height: 34px; flex: 0 0 33px; border: 1px solid var(--line-strong); border-radius: 6px; display: grid; place-items: center; color: var(--blue); background: var(--surface-sunken); }
.registry-symbol svg { width: 16px; }
.strategy-registry > footer { padding-top: 15px; font-size: 10.5px; color: var(--muted); }
.strategy-inspector { min-width: 0; padding-left: 20px; border-left: 1px solid var(--line); }
.registry-inspector-title { display: flex; align-items: center; gap: 12px; padding: 23px 0 17px; }
.registry-inspector-title > div { min-width: 0; }
.registry-inspector-title h2 { font-size: 15px; line-height: 1.5; font-weight: 550; margin: 0 0 5px; overflow-wrap: anywhere; }
.registry-inspector-title small { color: var(--muted); font-size: 10.5px; }
.registry-definition { display: grid; gap: 0; margin: 0 0 22px; }
.registry-definition > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.registry-definition dt { color: var(--muted); font-size: 11px; }
.registry-definition dd { margin: 0; text-align: right; max-width: 55%; overflow-wrap: anywhere; font-size: 11px; }
.inspector-actions { display: grid; gap: 8px; }
.registry-schedule { margin-top: 20px; }
.registry-schedule .run-intro { padding: 14px 0; }
.registry-schedule .run-intro h3 { font-size: 14px; }
.registry-schedule .run-checklist { grid-template-columns: 1fr; }
.registry-schedule .run-checklist > div { padding: 10px 0; }
.registry-schedule .run-action { flex-direction: column; }
.backtest-selector { display: flex; gap: 15px; align-items: end; padding-bottom: 25px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.backtest-selector > label { width: min(440px, 100%); }
.workspace-timeline { padding: 0; margin: 0; list-style: none; }
.workspace-timeline li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.workspace-timeline li strong { font-size: 12px; font-weight: 500; }
.workspace-timeline li p, .workspace-timeline time { color: var(--muted); font-size: 11px; }
.timeline-icon { color: var(--muted); }
.timeline-icon svg { width: 17px; }

#builder-host { height: calc(100dvh - 78px); min-height: 580px; }
.builder-workspace { height: 100%; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.strategy-identity { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 25px; min-height: 73px; border-bottom: 1px solid var(--line); }
.strategy-identity-main { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.strategy-title-input { padding: 5px 0; min-height: 32px; border: 0; border-radius: 0; background: transparent; font-size: 19px; font-weight: 550; width: 280px; max-width: 65%; }
.strategy-title-input:focus { box-shadow: none; border-bottom: 1px solid var(--blue); }
.draft-state { color: var(--muted); font-size: 10.5px; flex-shrink: 0; }
.draft-state.changed { color: var(--amber); }
.builder-identity-actions, .builder-tools { display: flex; align-items: center; gap: 5px; }
.segmented { display: flex; gap: 2px; padding: 3px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-sunken); }
.segmented button { display: flex; align-items: center; gap: 6px; background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 5px 9px; color: var(--muted); font-size: 11px; }
.segmented button.active { background: var(--surface-muted); color: var(--ink); border-color: var(--line-strong); }
.builder-commandbar { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 7px 25px; gap: 16px; border-bottom: 1px solid var(--line); }
.builder-steps { display: flex; align-items: center; gap: 20px; }
.builder-steps button { display: flex; align-items: center; gap: 7px; background: transparent; color: var(--muted); border: 0; padding: 7px 0; font-size: 11px; }
.builder-steps button.active { color: var(--blue); }
.builder-steps button > span { border: 1px solid var(--line-strong); border-radius: 4px; display: grid; place-items: center; width: 18px; height: 18px; font-size: 9px; }
.template-menu { position: relative; }
.template-menu .button { min-height: 30px; font-size: 11px; padding: 5px 9px; }
.editor-menu { position: absolute; z-index: 5; right: 0; top: 100%; width: 180px; margin-top: 5px; padding: 5px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: var(--shadow); }
.editor-menu button { border: 0; background: transparent; color: var(--ink); width: 100%; text-align: left; padding: 10px; font-size: 12px; }
.editor-menu button:hover { background: var(--surface-muted); }
.builder-body { display: grid; grid-template-columns: 183px minmax(0, 1fr) 300px; min-height: 0; flex: 1; overflow: hidden; }
.block-library { display: flex; flex-direction: column; border-right: 1px solid var(--line); overflow: auto; padding-bottom: 18px; }
.block-library > header, .builder-inspector > header { display: flex; align-items: center; justify-content: space-between; min-height: 45px; padding: 10px 17px; font-size: 10.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.block-search { display: flex; align-items: center; gap: 6px; margin: 15px 12px 10px; padding: 0 7px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); }
.block-search input { border: 0; box-shadow: none; background: transparent; font-size: 11px; min-height: 31px; padding: 6px 0; }
.block-library section { padding: 8px 11px; }
.block-library h3 { font-size: 10px; font-weight: 500; color: var(--muted); margin: 7px 5px 10px; }
.block-item { width: 100%; display: flex; align-items: center; gap: 9px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--ink-soft); padding: 10px 6px; font-size: 11px; text-align: left; }
.block-item > span { flex: 1; }
.block-item > svg:last-child { color: var(--muted); }
.block-item:hover { background: var(--surface-muted); }
.block-item:disabled { opacity: .5; cursor: not-allowed; }
.execution-block { width: calc(100% - 22px); margin: auto 11px 0; border-top: 1px solid var(--line); border-radius: 0; }
.flow-canvas { display: flex; flex-direction: column; align-items: center; position: relative; min-width: 0; overflow: auto; background: var(--surface-sunken); }
.flow-stack { width: calc(100% - 50px); margin: 24px auto 20px; flex: 1; }
.canvas-caption { display: flex; align-items: center; gap: 13px; justify-content: center; color: var(--muted); font-size: 10px; margin-bottom: 21px; }
.canvas-caption > span { width: 28px; height: 1px; background: var(--line-strong); }
.flow-node { border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); overflow: hidden; }
.flow-node.selected { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue-soft); }
.flow-node-main { display: flex; align-items: center; gap: 11px; padding: 17px 15px; width: 100%; text-align: left; background: transparent; border: 0; color: var(--ink); }
.flow-node-main > span:nth-child(2) { flex: 1; display: grid; gap: 7px; min-width: 0; }
.flow-node-main > svg { color: var(--muted); flex-shrink: 0; }
.flow-node-main strong { font-size: 12px; font-weight: 550; overflow-wrap: anywhere; }
.flow-node-main small { font-size: 10.5px; color: var(--muted); overflow-wrap: anywhere; line-height: 1.6; }
.flow-node-symbol { align-self: flex-start; color: var(--blue); }
.flow-node + .flow-node { margin-top: 10px; }
.flow-node + .canvas-caption { margin-top: 24px; }
.flow-branches { border-top: 1px solid var(--line); padding: 4px 14px; }
.flow-branch { display: flex; gap: 7px; align-items: center; padding: 8px 0; font-size: 10px; color: var(--muted); }
.flow-branch > span { flex: 1; overflow-wrap: anywhere; }
.flow-branch svg { flex-shrink: 0; }
.canvas-add { display: flex; margin: 20px auto 0; align-items: center; gap: 7px; color: var(--muted); border: 1px dashed var(--line-strong); background: transparent; border-radius: 5px; padding: 8px 14px; font-size: 11px; }
.canvas-controls { display: flex; align-items: center; gap: 3px; position: sticky; bottom: 10px; align-self: flex-start; flex-shrink: 0; margin: 10px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 6px; }
.canvas-controls > span { font-size: 10px; min-width: 36px; text-align: center; color: var(--muted); }
.builder-inspector { display: flex; flex-direction: column; border-left: 1px solid var(--line); overflow: hidden; background: var(--bg); }
.inspector-heading { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--line); gap: 10px; }
.inspector-heading > div { min-width: 0; }
.inspector-heading h2 { font-size: 15px; font-weight: 550; margin: 5px 0 0; overflow-wrap: anywhere; }
.inspector-heading small { font-size: 10px; color: var(--muted); }
.inspector-fields { overflow: auto; padding: 18px 20px 35px; }
.editor-fields { display: grid; gap: 13px; }
.editor-field { font-size: 11px; font-weight: 400; gap: 7px; min-width: 0; }
.editor-field input, .editor-field select { min-height: 35px; padding: 8px 9px; font-size: 11.5px; }
.editor-field input[type="time"] { min-width: 0; }
.editor-group { min-width: 0; padding-top: 15px; margin-top: 3px; border-top: 1px solid var(--line); }
.editor-group:first-child { padding-top: 0; border-top: 0; }
.editor-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-height: 26px; margin-bottom: 9px; }
.editor-group-heading h3, .editor-group-heading > strong { color: var(--ink); font-size: 11px; font-weight: 550; margin: 0; }
.editor-group-heading .icon-button { width: 24px; height: 24px; }
.editor-check { display: flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 400; }
.editor-check input { width: 15px; height: 15px; min-height: 0; accent-color: var(--blue); }
.editor-array-item + .editor-array-item { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line-strong); }
.editor-add { display: flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--blue); font-size: 11px; padding: 13px 0 0; }
.editor-add-field { margin-top: 10px; }
.editor-add-field select { color: var(--blue); border-style: dashed; }
.builder-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 68px; border-top: 1px solid var(--line); padding: 12px 24px; background: var(--surface); }
.builder-readiness { display: flex; align-items: center; gap: 10px; color: var(--blue); }
.builder-readiness > span { display: grid; gap: 5px; }
.builder-readiness strong { font-size: 11.5px; font-weight: 500; color: var(--ink); }
.builder-readiness small { font-size: 10px; color: var(--muted); }
.builder-footer-actions { display: flex; gap: 8px; }
.builder-error { display: flex; align-items: start; gap: 10px; color: var(--red); background: var(--red-soft); border-top: 1px solid var(--line); padding: 11px 22px; font-size: 11px; max-height: 110px; overflow: auto; }
.builder-error > span { flex: 1; white-space: pre-wrap; overflow-wrap: anywhere; }
.builder-error > svg { flex-shrink: 0; }
.definition-source { display: flex; flex-direction: column; min-width: 0; padding: 20px; gap: 10px; }
.definition-source textarea { flex: 1; resize: none; white-space: pre; min-height: 100px; font-size: 11px; }
.mobile-builder-tabs { display: none; }

@media (min-width: 1061px) {
  .nav-collapsed { --sidebar-width: 70px; }
  .nav-collapsed .brand-lockup > span:last-child, .nav-collapsed .primary-nav button > span, .nav-collapsed .sidebar-account .truncate { display: none; }
  .nav-collapsed .primary-nav button { justify-content: center; padding-inline: 0; }
  .nav-collapsed .sidebar-utilities { flex-direction: column; align-items: center; }
  .nav-collapsed .sidebar-account { display: flex; flex-wrap: wrap; justify-content: center; }
}
@media (max-width: 1150px) and (min-width: 761px) {
  :root { --sidebar-width: 165px; }
  .builder-body { grid-template-columns: 145px minmax(0, 1fr) 260px; }
  .block-item { font-size: 10px; gap: 6px; }
  .block-item > svg:last-child { display: none; }
  .builder-commandbar, .strategy-identity { padding-inline: 16px; }
  .builder-steps { gap: 12px; }
  .builder-steps button > svg { display: none; }
  .registry-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; }
  .flow-stack { width: calc(100% - 28px); }
}
@media (max-width: 980px) and (min-width: 761px) {
  :root { --sidebar-width: 70px; }
  .brand-lockup > span:last-child, .primary-nav button > span, .sidebar-account .truncate { display: none; }
  .primary-nav button { justify-content: center; padding-inline: 0; }
  .sidebar-utilities { flex-direction: column; }
  .sidebar-account { display: flex; flex-wrap: wrap; justify-content: center; }
}

.section { margin-top: 24px; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.section-header h2 { margin: 0; font-size: 15px; }
.section-header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.data-list { overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.data-row { display: grid; min-height: 66px; grid-template-columns: minmax(0, 1.5fr) minmax(120px, 0.8fr) minmax(110px, 0.7fr) auto; align-items: center; gap: 14px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.data-row:last-child { border-bottom: 0; }
.data-row h3 { margin: 0; overflow-wrap: anywhere; font-size: 14px; }
.data-row p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.cell-label { display: none; }
.status { display: inline-flex; width: max-content; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 3px; background: var(--surface-muted); color: var(--muted); font-size: 10px; font-weight: 700; }
.status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status.active, .status.running { background: var(--green-soft); color: var(--green-dark); }
.status.staged_for_session, .status.retiring { background: var(--amber-soft); color: var(--amber); }
.status.rejected, .status.suspended { background: var(--red-soft); color: var(--red); }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.danger-icon { color: var(--red); }
.access-ticket p { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.access-ticket strong { color: var(--ink); }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 7px; }
.copy-field input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.inline-fields { display: flex; gap: 7px; }
.inline-fields > * { min-width: 0; }
.inline-fields.wrap { flex-wrap: wrap; }
.inline-fields.wrap > * { flex: 1 1 140px; }
.advanced-settings { border: 1px solid var(--line); border-radius: 3px; background: var(--surface-sunken); }
.advanced-settings summary { cursor: pointer; padding: 11px 12px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.advanced-settings[open] summary { border-bottom: 1px solid var(--line); }
.advanced-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 13px; }
.advanced-grid .span-2 { grid-column: 1 / -1; }
.check-label { display: flex; min-height: 42px; align-items: center; gap: 8px; }
.check-label input { width: 17px; min-height: 17px; }
.field-heading { display: block; margin-bottom: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 650; }

.run-workspace h3, .historical-welcome h3, .daily-results h3, .historical-summary h3 { margin: 0; font-size: 15px; }
.run-intro p, .historical-welcome p, .daily-results header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.run-checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.run-checklist > div { min-width: 0; padding: 16px 0; border-bottom: 1px solid var(--line); }
.run-checklist > div:nth-child(odd) { padding-right: 20px; }
.run-checklist > div:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--line); }
.run-checklist dt { color: var(--muted); font-size: 12px; font-weight: 650; }
.run-checklist dd { margin: 6px 0 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 750; }

.historical-controls { display: grid; grid-template-columns: minmax(290px, 1.4fr) minmax(180px, 0.75fr) auto; align-items: end; gap: 15px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface-sunken); }
.historical-controls label { min-width: 0; font-size: 12px; }
.historical-date-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.historical-date-field legend { margin-bottom: 7px; padding: 0; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.date-range { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.date-range span { color: var(--muted); font-size: 12px; }
.money-input { position: relative; }
.money-input span { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: var(--muted); font-weight: 750; }
.money-input input { padding-left: 48px; }
.historical-run { min-width: 210px; white-space: nowrap; }
.historical-history { display: grid; grid-template-columns: auto minmax(220px, 1fr); align-items: center; gap: 12px; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.historical-history select { min-height: 38px; }
.qualification-version-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--blue); background: var(--blue-soft); color: var(--blue-dark); font-size: 12px; line-height: 1.45; }
.qualification-version-note svg { flex: none; width: 16px; height: 16px; }
.qualification-progress, .qualification-message { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 10px; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--blue-soft); }
.qualification-progress strong, .qualification-message strong { font-size: 12px; }
.qualification-progress p, .qualification-message p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.qualification-spinner { display: grid; width: 30px; height: 30px; place-items: center; color: var(--blue); }
.qualification-spinner svg { width: 19px; height: 19px; animation: spin 1s linear infinite; }
.qualification-message.failed, .qualification-message.rejected { border-color: #6e2731; background: var(--red-soft); color: var(--red); }
.qualification-message.cancelled { border-color: var(--line); background: var(--surface-muted); }
.qualification-message svg { width: 19px; height: 19px; }
.historical-welcome { display: grid; min-height: 330px; place-items: center; align-content: center; padding: 40px 20px; text-align: center; }
.historical-welcome svg { width: 30px; height: 30px; color: var(--blue); }
.historical-welcome h3 { margin-top: 14px; }
.historical-welcome p { max-width: 470px; }
.historical-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 12px; border: 1px solid var(--line); border-radius: 6px; }
.historical-metric { min-width: 0; padding: 14px; border-right: 1px solid var(--line); }
.historical-metric:last-child { border-right: 0; }
.historical-metric span, .historical-metric small { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.historical-metric strong { display: block; margin: 8px 0 5px; overflow: hidden; text-overflow: ellipsis; font-size: 20px; white-space: nowrap; }
.historical-metric.positive strong, .positive { color: var(--green-dark); }
.historical-metric.negative strong, .negative { color: var(--red); }
.caution { color: var(--amber); }
.historical-body { display: grid; grid-template-columns: minmax(0, 1fr) 210px; align-items: start; gap: 12px; margin-top: 12px; }
.historical-main { min-width: 0; }
.pnl-chart { padding: 15px; }
.pnl-chart svg { display: block; width: 100%; height: auto; min-height: 180px; }
.pnl-chart-scale, .pnl-chart-dates { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font: 11px var(--mono); }
.pnl-zero { stroke: var(--line); stroke-dasharray: 4 4; }
.pnl-series { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linejoin: round; }
.pnl-point { fill: var(--green); }
.protocol-terms { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.appearance-field { width: min(280px, 100%); }
.equity-figure, .daily-results, .historical-summary { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.equity-figure { padding: 12px 14px 6px; }
.equity-figure header { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.equity-figure header span { display: inline-flex; align-items: center; gap: 7px; }
.equity-figure header svg { width: 15px; height: 15px; color: var(--blue); }
.daily-results { margin-top: 12px; overflow: hidden; }
.daily-results > header { display: flex; min-height: 55px; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 13px; border-bottom: 1px solid var(--line); }
.historical-day-list { font-size: 12px; }
.historical-day-head, .historical-day { display: grid; grid-template-columns: minmax(150px, 1.2fr) 90px 120px; align-items: center; gap: 12px; padding: 9px 13px; border-bottom: 1px solid var(--line); }
.historical-day-head { color: var(--muted); font-size: 12px; font-weight: 750; }
.historical-day:last-child { border-bottom: 0; }
.historical-day > :last-child, .historical-day-head > :last-child { text-align: right; }
.historical-day span strong, .historical-day span small { display: block; }
.historical-day span small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.historical-summary { overflow: hidden; }
.historical-summary > div:first-child { padding: 14px 13px; }
.historical-summary h3 { margin-bottom: 12px; }
.historical-summary p { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 9px 0; color: var(--muted); font-size: 12px; }
.historical-summary p strong { color: var(--ink); font-size: 12px; }
.historical-summary .historical-assumptions { padding: 14px 13px; border-top: 1px solid var(--line); }
.historical-summary .historical-assumptions p { display: block; margin: 7px 0; line-height: 1.45; }
.qualification-complete { display: flex; align-items: flex-start; gap: 8px; padding: 13px; border-top: 1px solid var(--line); color: var(--green-dark); }
.qualification-complete svg { flex: none; width: 17px; height: 17px; }
.qualification-complete strong, .qualification-complete small { display: block; }
.qualification-complete strong { font-size: 12px; }
.qualification-complete small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.strategy-action-bar { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface-sunken); }
.strategy-action-bar > span { display: inline-flex; min-width: 0; flex: 1; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.strategy-action-bar > span svg { flex: none; width: 16px; height: 16px; color: var(--green); }

.run-workspace { padding: 16px 0 0; }
.run-intro { padding: 28px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface-sunken); }
.run-intro h3 { margin-top: 14px; font-size: 20px; }
.run-intro p { max-width: 590px; }
.run-posture { display: inline-flex; align-items: center; gap: 7px; color: var(--blue-dark); font-size: 12px; font-weight: 750; }
.run-posture svg { width: 17px; height: 17px; }
.run-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; }

.page-tabs { display: flex; min-height: 38px; align-items: end; gap: 26px; margin: -14px -16px 12px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--surface-sunken); }
.page-tabs button { position: relative; min-height: 38px; padding: 0 2px; border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.page-tabs button:hover { color: var(--ink); }
.page-tabs button.active { color: var(--blue); }
.page-tabs button.active::after { position: absolute; inset: auto 0 -1px; height: 3px; background: var(--blue); content: ""; }

.quiet-empty { padding: 23px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 12px; text-align: center; }
.desk-table { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.desk-table-head, .desk-table-row { display: grid; align-items: center; gap: 14px; }
.desk-table-head { min-height: 34px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--surface-sunken); color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.desk-table-row { min-height: 58px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.desk-table-row:last-child { border-bottom: 0; }
.desk-table-row > * { min-width: 0; }
.desk-table-row strong, .desk-table-row small { display: block; }
.desk-table-row small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.desk-table-row > :not(:first-child), .history-row b, .historical-metric strong { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.desk-primary-cell strong { overflow: hidden; text-overflow: ellipsis; font-size: 13px; white-space: nowrap; }
.desk-strategy-grid { grid-template-columns: minmax(190px, 1.7fr) minmax(105px, 0.75fr) minmax(100px, 0.72fr) 70px 64px 116px; }
.desk-position-grid { grid-template-columns: minmax(210px, 1.65fr) minmax(84px, 0.6fr) minmax(80px, 0.55fr) minmax(80px, 0.55fr) minmax(120px, 0.85fr) minmax(120px, 0.85fr); }
.desk-order-grid { grid-template-columns: minmax(150px, 1.55fr) minmax(80px, 0.8fr) minmax(56px, 0.45fr) minmax(60px, 0.55fr) minmax(112px, 0.9fr) minmax(68px, 0.6fr); gap: 10px; }
.desk-fill-grid { grid-template-columns: minmax(150px, 1.55fr) minmax(80px, 0.8fr) minmax(64px, 0.55fr) minmax(100px, 0.8fr) minmax(110px, 0.9fr) minmax(132px, 1fr); gap: 10px; }
.desk-reconcile-grid { grid-template-columns: minmax(140px, 1.3fr) minmax(120px, 1fr) minmax(132px, 1fr) minmax(60px, 0.5fr); gap: 10px; }
.reconcile-policy-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.reconcile-policy-row > * { overflow-wrap: anywhere; }
.desk-table-row .row-actions { justify-content: flex-end; }
.desk-table-row .positive > strong, .desk-table-row > .positive strong { color: var(--green-dark); }
.desk-table-row .negative > strong, .desk-table-row > .negative strong { color: var(--red); }
.protection-cell strong { color: inherit; }
.status.in_trade, .status.active, .status.running, .status.working { background: var(--green-soft); color: var(--green-dark); }
.desk-unavailable { display: grid; min-height: 280px; place-items: center; align-content: center; padding: 28px; text-align: center; }
.desk-unavailable svg { width: 26px; height: 26px; color: var(--muted); }
.desk-unavailable h2 { margin: 12px 0 5px; font-size: 16px; }
.desk-unavailable p { max-width: 440px; margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* Live desk: one docked market workspace. Figures use a single tabular face;
   structure comes from flat regions and hairlines rather than nested cards. */
.terminal-desk { min-width: 0; }
.market-tape {
  display: grid;
  min-height: 78px;
  grid-template-columns: minmax(150px, 0.8fr) minmax(300px, 1.5fr) minmax(300px, 1.4fr) auto;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}
.session-figure, .session-facts, .market-strip, .tape-controls { min-width: 0; border-right: 1px solid var(--line); }
.session-figure { display: grid; align-content: center; padding: 9px 13px; }
.session-figure span, .tape-fact small, .market-quote small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}
.session-figure strong { overflow: hidden; margin: 1px 0; font-family: var(--mono); font-size: 24px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.session-figure small { color: var(--muted); font-size: 10px; }
.session-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tape-fact { display: grid; min-width: 0; align-content: center; padding: 8px 10px; border-right: 1px solid var(--line); }
.tape-fact:last-child { border-right: 0; }
.tape-fact b { overflow: hidden; margin-top: 4px; font-family: var(--mono); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.market-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.market-quote { display: grid; min-width: 0; align-content: center; padding: 8px 12px; border-right: 1px solid var(--line); }
.market-quote:last-child { border-right: 0; }
.market-quote b { overflow: hidden; margin: 2px 0 1px; font-family: var(--mono); font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.market-quote em { overflow: hidden; color: var(--muted); font-family: var(--mono); font-size: 9px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.market-quote.unavailable b, .market-quote.unavailable em { color: var(--muted); }
.tape-controls { display: flex; align-items: center; justify-content: flex-end; gap: 3px; padding: 7px; border-right: 0; }
.runtime-state { display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.runtime-state i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.terminal-layout {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  grid-template-areas: "chart strategies" "blotter strategies";
  gap: 10px;
  margin-top: 10px;
}
.terminal-chart-panel, .strategy-monitor, .blotter-panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.terminal-chart-panel { grid-area: chart; }
.strategy-monitor { grid-area: strategies; }
.blotter-panel { grid-area: blotter; }
.terminal-panel-head { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 11px; border-bottom: 1px solid var(--line); background: var(--surface-sunken); }
.terminal-panel-head h2 { margin: 0; font-size: 12px; }
.terminal-panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.chart-empty { display: grid; min-height: 280px; place-items: center; align-content: center; gap: 8px; color: var(--muted); font-size: 11px; text-align: center; }
.chart-empty svg { width: 22px; height: 22px; }
.strategy-monitor-list { max-height: 604px; overflow-y: auto; }
.strategy-monitor-row { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 10px; padding: 11px; border-bottom: 1px solid var(--line); }
.strategy-monitor-row:last-child { border-bottom: 0; }
.strategy-monitor-name, .strategy-monitor-value { min-width: 0; }
.strategy-monitor-name strong, .strategy-monitor-name small, .strategy-monitor-value b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strategy-monitor-name strong { font-size: 11px; }
.strategy-monitor-name small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.strategy-monitor-value { display: grid; justify-items: end; }
.strategy-monitor-value b { font-family: var(--mono); font-size: 12px; }
.strategy-monitor-value .status { margin-top: 3px; }
.strategy-monitor-row .row-actions { grid-column: 1 / -1; padding-top: 5px; border-top: 1px solid var(--line); }
.strategy-monitor-row .icon-button { width: 28px; height: 26px; }
.strategy-monitor-row .icon-button svg { width: 14px; height: 14px; }
.blotter-tabs { display: flex; min-height: 42px; align-items: stretch; border-bottom: 1px solid var(--line); background: var(--surface-sunken); }
.blotter-tabs button { position: relative; display: inline-flex; min-width: 112px; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.blotter-tabs button.active { color: var(--ink); }
.blotter-tabs button.active::after { position: absolute; inset: auto 10px -1px; height: 2px; background: var(--blue); content: ""; }
.blotter-tabs button span { color: var(--muted); font-family: var(--mono); font-size: 9px; }
.blotter-body .desk-table { margin-inline: 0; border: 0; border-radius: 0; }
.blotter-body .quiet-empty { min-height: 150px; border: 0; border-radius: 0; }

.history-workspace { display: grid; gap: 16px; }
.history-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.history-toolbar h2 { margin: 0; font-size: 16px; }
.history-toolbar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.history-toolbar label { width: min(100%, 210px); color: var(--muted); font-size: 12px; }
.history-notice { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid #6e4e15; border-radius: 3px; background: var(--amber-soft); color: var(--amber); font-size: 12px; }
.history-notice svg { flex: none; width: 17px; height: 17px; }
.history-list { overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.history-row { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }
.history-row > span { min-width: 0; }
.history-row strong, .history-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row strong { font-size: 13px; }
.history-row small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.history-row b { font-size: 13px; overflow-wrap: anywhere; }
.history-money { display: grid; gap: 4px; min-width: 0; max-width: 55%; text-align: right; }
.native-money-buckets { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 16px 0; }
.native-money-buckets b { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .history-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .history-money { max-width: 100%; text-align: left; }
  .history-row > span { max-width: 100%; }
}

.setup-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); align-items: start; gap: 24px; }
.setup-tabs { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.setup-tabs button { display: flex; min-height: 46px; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--muted); text-align: left; font-weight: 650; }
.setup-tabs button:last-child { border-bottom: 0; }
.setup-tabs button:hover { color: var(--ink); }
.setup-tabs button.active { background: var(--blue-soft); color: var(--blue-dark); box-shadow: inset 3px 0 0 var(--blue); }
.setup-tabs svg { width: 18px; height: 18px; }
.setup-panel { min-width: 0; }

.empty-state { display: grid; min-height: 260px; place-items: center; padding: 28px; border: 1px dashed var(--line-strong); border-radius: 4px; background: var(--surface-sunken); text-align: center; }
.empty-state svg { width: 26px; height: 26px; color: var(--muted); }
.empty-state h2 { margin: 12px 0 4px; font-size: 16px; }
.empty-state p { max-width: 360px; margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.modal { width: min(calc(100% - 28px), 620px); max-height: calc(100dvh - 28px); padding: 0; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 22px 80px rgba(18, 35, 39, 0.22); }
.modal::backdrop { background: rgba(25, 35, 38, 0.38); backdrop-filter: blur(2px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 17px; }
.modal-content { max-height: calc(100dvh - 170px); overflow-y: auto; padding: 18px 19px; }
.external-connect { display: grid; justify-items: center; gap: 14px; padding: 10px 0; text-align: center; }
.external-connect > svg { width: 30px; height: 30px; color: var(--blue); }
.external-connect p { max-width: 390px; margin: 0; color: var(--muted); line-height: 1.5; }
.external-connect small { color: var(--muted); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 19px; border-top: 1px solid var(--line); background: var(--surface-sunken); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-muted); }
.segmented label { display: block; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 8px; border-radius: 4px; color: var(--muted); text-align: center; }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(20, 40, 45, 0.1); }

.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; width: min(calc(100% - 36px), 380px); gap: 8px; }
.toast { padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-muted); color: var(--ink); box-shadow: var(--shadow); font-size: 12px; }
.toast.error { background: #7f252e; }

@media (max-width: 900px) {
  .data-row { grid-template-columns: minmax(0, 1.3fr) minmax(110px, 0.7fr) auto; }
  .data-row > :nth-child(3) { display: none; }
  .historical-controls { grid-template-columns: 1fr 1fr; }
  .historical-run { grid-column: 1 / -1; }
  .historical-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .historical-metric:nth-child(3) { border-right: 0; }
  .historical-metric:nth-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .historical-body { grid-template-columns: minmax(0, 1fr); }
  .terminal-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "chart" "strategies" "blotter"; }
  .strategy-monitor-list { max-height: 360px; }
}

@media (max-width: 720px) {
  .auth-shell { align-items: start; padding: 18px 14px; }
  .auth-panel { padding: 24px 20px; }
  .authenticator-setup { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .recovery-code-list { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .workspace { margin-left: 0; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .topbar { position: relative; display: grid; min-height: 64px; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 14px; }
  .topbar > div:first-child { min-width: 0; }
  .eyebrow { display: none; }
  .topbar h1 { font-size: 21px; }
  .topbar-actions { display: grid; min-width: 0; grid-column: 2; grid-template-columns: minmax(0, 1fr) 40px; align-items: end; gap: 8px; margin-top: 0; }
  .instance-picker { min-width: 0; width: 100%; }
  .instance-picker span { display: none; }
  .topbar .button span { display: none; }
  .topbar .button { width: 40px; padding: 0; }
  .content { padding: 0 14px 28px; }
  .mobile-nav { position: fixed; z-index: 30; inset: auto 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(9, 12, 18, 0.98); }
  .mobile-nav button { position: relative; display: grid; min-width: 0; min-height: 52px; place-items: center; align-content: center; gap: 3px; padding: 4px; border-radius: 5px; color: var(--muted); font-size: 12px; font-weight: 650; }
  .mobile-nav button.active { color: var(--blue); }
  .mobile-nav button.active::before { position: absolute; inset: -6px 10% auto; height: 3px; background: var(--blue); content: ""; }
  .mobile-nav svg { width: 21px; height: 21px; }
  .section { margin-top: 18px; }
  .data-list { border: 0; background: transparent; }
  .data-row { grid-template-columns: minmax(0, 1fr) auto; gap: 11px; margin-bottom: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
  .data-row > :nth-child(2) { grid-column: 1 / 2; }
  .data-row > :nth-child(3) { display: block; grid-column: 1 / 2; }
  .data-row .row-actions { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .strategy-row > :first-child { grid-column: 1 / -1; }
  .strategy-row > :nth-child(2) { grid-column: 1; }
  .strategy-row > :nth-child(3) { grid-column: 2; }
  .strategy-row .row-actions { grid-column: 1 / -1; grid-row: auto; width: 100%; }
  .strategy-row .row-actions .button { flex: 1; }
  .account-row, .team-row, .access-row { grid-template-columns: minmax(0, 1fr); }
  .account-row .row-actions, .team-row .row-actions, .access-row .row-actions { grid-column: 1; grid-row: auto; justify-content: stretch; }
  .account-row .row-actions .button, .team-row .row-actions .button { flex: 1; }
  .cell-label { display: inline; margin-right: 4px; color: var(--muted); font-size: 12px; }
  .historical-controls { grid-template-columns: 1fr; padding: 0; border: 0; background: transparent; }
  .historical-run { grid-column: auto; width: 100%; }
  .historical-history { grid-template-columns: 1fr; }
  .date-range { gap: 6px; }
  .historical-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-inline: -14px; border-width: 1px 0; border-radius: 0; }
  .historical-metric { padding: 17px 10px; text-align: center; }
  .historical-metric:nth-child(n) { display: block; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .historical-metric:nth-child(even) { border-right: 0; }
  .historical-metric:nth-child(5) { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
  .historical-metric strong { font-size: 20px; }
  .historical-body { margin-inline: -14px; gap: 0; }
  .equity-figure, .daily-results, .historical-summary { border-width: 0 0 1px; border-radius: 0; }
  .equity-figure { padding: 14px 14px 7px; }
  .historical-summary { order: 2; }
  .historical-summary > div:first-child { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
  .historical-summary h3 { grid-column: 1 / -1; }
  .daily-results { margin-top: 0; }
  .daily-results > header { align-items: flex-start; }
  .daily-results > header .button span { display: none; }
  .daily-results > header .button { width: 40px; padding: 0; }
  .historical-day-head, .historical-day { grid-template-columns: minmax(120px, 1fr) 72px 104px; padding-inline: 14px; }
  .strategy-action-bar { display: grid; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.35fr); margin: 0 -14px -20px; padding: 10px 14px; border-width: 1px 0 0; border-radius: 0; }
  .strategy-action-bar > span { display: none; }
  .strategy-action-bar .button { width: 100%; }
  .run-checklist { grid-template-columns: 1fr; }
  .run-checklist > div:nth-child(odd), .run-checklist > div:nth-child(even) { padding: 13px 0; border-left: 0; }
  .strategy-section-heading { align-items: flex-start; }
  .strategy-section-heading .button span { display: none; }
  .strategy-section-heading .button { width: 40px; padding: 0; }
  .run-intro { padding: 22px 18px; }
  .run-actions { display: grid; }
  .qualification-progress, .qualification-message { grid-template-columns: 30px minmax(0, 1fr); }
  .qualification-progress .button { grid-column: 2; justify-self: start; }
  .desk-table { margin-inline: -14px; border-width: 1px 0; border-radius: 0; }
  .desk-table-head { display: none; }
  .desk-table-row { gap: 9px 12px; padding: 12px 14px; }
  .desk-strategy-grid { grid-template-columns: minmax(0, 1fr) auto; }
  .desk-strategy-grid .desk-primary-cell { grid-column: 1; }
  .desk-strategy-grid > :nth-child(2) { grid-column: 2; justify-self: end; }
  .desk-strategy-grid > :nth-child(3), .desk-strategy-grid > :nth-child(4), .desk-strategy-grid > :nth-child(5) { grid-row: 2; }
  .desk-strategy-grid > :nth-child(3) { grid-column: 1; }
  .desk-strategy-grid > :nth-child(4) { grid-column: 1; justify-self: center; }
  .desk-strategy-grid > :nth-child(5) { grid-column: 2; }
  .desk-strategy-grid .row-actions { grid-column: 1 / -1; grid-row: 3; justify-content: flex-end; padding-top: 2px; border-top: 1px solid var(--line); }
  .desk-position-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .desk-position-grid .desk-primary-cell { display: flex; grid-column: 1 / -1; align-items: baseline; justify-content: space-between; gap: 10px; }
  .desk-position-grid .desk-primary-cell small { flex: none; margin: 0; }
  .desk-position-grid > :nth-child(5) { grid-column: 1; }
  .desk-position-grid > :nth-child(6) { grid-column: 2 / -1; }
  .desk-order-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .desk-order-grid .desk-primary-cell { grid-column: 1 / -1; }
  .desk-order-grid > :nth-child(5) { grid-column: 1 / 2; }
  .desk-order-grid > :nth-child(6) { grid-column: 2 / -1; justify-self: end; }
  .desk-fill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .desk-fill-grid .desk-primary-cell { grid-column: 1 / -1; }
  .desk-reconcile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .desk-reconcile-grid .desk-primary-cell { grid-column: 1 / -1; }
  .desk-table-row .cell-label { display: block; margin: 0 0 3px; font-size: 10px; }
  .market-tape { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-inline: -14px; border-width: 1px 0; border-radius: 0; }
  .session-figure { grid-column: 1 / -1; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .session-figure strong { font-size: 28px; }
  .market-strip { grid-column: 1 / -1; grid-row: 2; border-right: 0; border-bottom: 1px solid var(--line); }
  .market-quote { padding: 9px 14px; }
  .market-quote b { font-size: 18px; }
  .session-facts { grid-column: 1 / -1; grid-row: 3; border-right: 0; border-bottom: 1px solid var(--line); }
  .tape-fact { padding: 9px 8px; text-align: center; }
  .tape-fact b { font-size: 12px; }
  .tape-controls { grid-column: 1 / -1; grid-row: 4; justify-content: flex-end; padding: 6px 10px; }
  .terminal-layout { display: grid; gap: 10px; margin-top: 10px; }
  .terminal-chart-panel, .strategy-monitor, .blotter-panel { margin-inline: -14px; border-width: 1px 0; border-radius: 0; }
  .chart-empty { min-height: 220px; }
  .strategy-monitor-list { max-height: none; }
  .strategy-monitor-row { padding: 11px 14px; }
  .blotter-tabs button { min-width: 0; flex: 1; }
  .page-tabs { min-height: 48px; gap: 38px; margin: 0 -14px 18px; padding: 0 20px; }
  .page-tabs button { min-height: 48px; font-size: 14px; }
  .history-toolbar { align-items: end; }
  .history-toolbar label { width: 154px; }
  .setup-layout { display: block; }
  .setup-tabs { display: grid; overflow: visible; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 -14px 18px; padding: 0 5px; border-width: 0 0 1px; border-radius: 0; }
  .setup-tabs button { min-width: 0; justify-content: center; gap: 4px; padding: 8px 3px; border: 0; border-bottom: 2px solid transparent; font-size: 10px; }
  .setup-tabs svg { width: 15px; height: 15px; }
  .setup-tabs button.active { border-bottom-color: var(--blue); background: transparent; box-shadow: none; }
  .inline-fields { flex-wrap: wrap; }
  .inline-fields > * { flex: 1 1 120px; }
  .advanced-grid { grid-template-columns: 1fr; }
  .advanced-grid .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .modal { width: 100%; max-width: none; max-height: calc(100dvh - 12px); margin: auto 0 0; border-radius: 8px 8px 0 0; }
  .modal-content { max-height: calc(100dvh - 148px); }
  .toast-region { right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); width: calc(100% - 24px); }
}

@media (max-width: 390px) {
  .history-toolbar { display: grid; }
  .history-toolbar label { width: 100%; }
}

@media (max-width: 760px) {
  .workspace { margin-left: 0; }
  .topbar { min-height: 96px; padding: 12px 15px; gap: 8px; flex-wrap: wrap; }
  .topbar h1 { font-size: 18px; }
  .topbar-actions { gap: 8px; align-items: end; }
  .instance-picker { min-width: 0; width: 145px; }
  .topbar-actions .button { font-size: 11px; padding: 7px 9px; }
  .content { padding: 20px 15px 85px; }
  .mobile-nav { grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); }
  .mobile-nav button { font-size: 9px; padding: 7px 2px; min-width: 0; }
  .mobile-nav button svg { width: 17px; height: 17px; }
  .registry-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 22px; margin-bottom: 16px; }
  .registry-summary > div { padding-inline: 15px; }
  .registry-summary > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .registry-summary strong { font-size: 27px; }
  .registry-summary span, .registry-summary small { font-size: 10px; }
  .registry-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .strategy-inspector { border-left: 0; padding-left: 0; }
  .registry-symbol { width: 27px; height: 29px; flex-basis: 27px; }
  .registry-table td { padding: 13px 6px; }
  .registry-name { gap: 7px; }
  .registry-name strong { font-size: 11.5px; }
  .registry-name small { font-size: 9px; }
  .registry-table td:nth-child(2), .registry-table th:nth-child(2) { display: none; }
  .registry-table td:last-child .icon-button { width: 25px; }
  .registry-filters select { width: 125px; }
  .backtest-selector { align-items: end; gap: 10px; }
  .backtest-selector .button { width: 36px; min-width: 36px; padding: 0; font-size: 0; }
  #builder-host { height: calc(100dvh - 161px - env(safe-area-inset-bottom)); min-height: 0; margin-bottom: 70px; }
  .strategy-identity { padding: 13px 15px; min-height: 102px; flex-wrap: wrap; gap: 9px; }
  .strategy-identity-main { width: 100%; flex: auto; justify-content: space-between; gap: 8px; }
  .strategy-title-input { font-size: 17px; max-width: calc(100% - 90px); }
  .draft-state { font-size: 9px; }
  .builder-identity-actions { width: 100%; }
  .builder-identity-actions .segmented { margin-left: auto; }
  .builder-commandbar { padding: 8px 14px; gap: 6px; flex-wrap: wrap; }
  .builder-steps { width: 100%; justify-content: space-between; gap: 8px; }
  .builder-steps button { font-size: 10px; gap: 5px; }
  .builder-steps button > svg { display: none; }
  .builder-tools { width: 100%; justify-content: end; }
  .builder-tools .template-menu { margin-right: auto; }
  .mobile-builder-tabs { display: flex; padding: 6px 13px; gap: 5px; border-bottom: 1px solid var(--line); }
  .mobile-builder-tabs button { flex: 1; min-height: 30px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 11px; border-radius: 5px; }
  .mobile-builder-tabs button.active { border-color: var(--line-strong); background: var(--surface-muted); color: var(--ink); }
  .builder-body { display: flex; min-height: 120px; }
  .builder-body > * { display: none; }
  .builder-body.mobile-flow > .flow-canvas, .builder-body.mobile-definition > .definition-source, .builder-body.mobile-blocks > .block-library, .builder-body.mobile-settings > .builder-inspector { display: flex; width: 100%; flex: 1; border: 0; }
  .block-library { padding: 0 10px 15px; }
  .block-item { font-size: 12px; min-height: 43px; }
  .block-library section { padding-block: 6px; }
  .flow-stack { width: calc(100% - 28px); margin-top: 19px; }
  .flow-node-main { padding: 14px; }
  .builder-footer { padding: 10px 13px; min-height: 65px; gap: 8px; }
  .builder-readiness { gap: 7px; }
  .builder-readiness strong { font-size: 10.5px; }
  .builder-readiness small { font-size: 9px; }
  .builder-footer-actions { gap: 5px; }
  .builder-footer .button { font-size: 10.5px; padding: 8px; gap: 5px; }
  .builder-footer-actions .button:first-child { width: 30px; min-width: 30px; padding: 8px 0; font-size: 0; }
  .builder-error { padding: 9px 13px; max-height: 80px; font-size: 10px; }
  .workspace-timeline li { gap: 9px; grid-template-columns: 23px minmax(0, 1fr); }
  .workspace-timeline time { grid-column: 2; }
}
