:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #f0f3f4;
  --ink: #172023;
  --muted: #647176;
  --line: #dce3e5;
  --line-strong: #c7d0d3;
  --green: #087e62;
  --green-dark: #05634e;
  --green-soft: #e5f5f0;
  --red: #b7333f;
  --red-soft: #fae9eb;
  --amber: #9b650b;
  --amber-soft: #fff3d5;
  --blue: #24679d;
  --shadow: 0 10px 30px rgba(24, 42, 47, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--bg); 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: #eef2f3;
}

.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(--green-dark); font-size: 11px; 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: 11px; 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: 17px; font-weight: 750; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--ink); color: white; font-size: 14px; }
.brand-mark svg { width: 16px; height: 16px; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #465156; font-size: 13px; 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);
  color: var(--ink);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(8, 126, 98, 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: 40px; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); font-weight: 700; text-decoration: none; }
.button svg { width: 17px; height: 17px; }
.button.primary { border-color: var(--green); background: var(--green); color: white; }
.button.primary:hover { background: var(--green-dark); }
.button.danger { border-color: #e3b7bc; 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: 36px; height: 36px; place-items: center; border-radius: 6px; }
.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: 232px;
  flex-direction: column;
  padding: 24px 14px 16px;
  border-right: 1px solid var(--line);
  background: #fbfcfc;
}
.sidebar > .brand-lockup { padding: 0 10px 23px; }
.primary-nav { display: grid; gap: 4px; }
.primary-nav button { display: flex; min-height: 42px; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 6px; color: #4c595e; text-align: left; font-weight: 650; }
.primary-nav button:hover { background: var(--surface-muted); color: var(--ink); }
.primary-nav button.active { background: #e8eeec; color: var(--green-dark); }
.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: 13px 6px 0; border-top: 1px solid var(--line); }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #dfe7e5; color: var(--green-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: 11px; }
.truncate { min-width: 0; }

.workspace { min-height: 100dvh; margin-left: 232px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 30px; border-bottom: 1px solid var(--line); background: rgba(245, 247, 248, 0.96); backdrop-filter: blur(12px); }
.eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.topbar-actions { display: flex; align-items: end; gap: 10px; }
.instance-picker { display: grid; min-width: 190px; gap: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.instance-picker select { min-height: 40px; padding-block: 6px; color: var(--ink); font-size: 13px; font-weight: 650; text-transform: none; }
.content { width: min(100%, 1240px); margin: 0 auto; padding: 25px 30px 48px; }
.content:focus { outline: none; }
.mobile-nav { display: none; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.metric span { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.metric strong { display: block; margin-top: 9px; font-size: 24px; line-height: 1; }
.metric small { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
.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: 11px; }
.cell-label { display: none; }
.status { display: inline-flex; width: max-content; align-items: center; gap: 6px; padding: 4px 7px; border-radius: 5px; background: var(--surface-muted); color: #4b595e; font-size: 11px; font-weight: 750; }
.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: 11px; }

.strategy-page-tools, .desk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}
.strategy-page-tools h2, .desk-toolbar h2 { margin: 0; font-size: 15px; }
.strategy-page-tools p, .desk-toolbar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.manifest-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.manifest-actions input { min-height: 38px; padding: 6px; font-family: inherit; font-size: 12px; }
.manifest-actions a { flex: none; color: var(--green-dark); 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: 6px; background: #fafbfb; }
.advanced-settings summary { cursor: pointer; padding: 11px 12px; color: #465156; font-size: 13px; 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: #465156; font-size: 12px; font-weight: 650; }

.strategy-workspace {
  display: grid;
  min-height: 650px;
  grid-template-columns: 224px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.strategy-rail { min-width: 0; border-right: 1px solid var(--line); background: #fafbfb; }
.strategy-rail-header { display: flex; min-height: 53px; align-items: center; justify-content: space-between; padding: 8px 10px 8px 15px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.strategy-rail-list { display: grid; padding: 7px; gap: 3px; }
.strategy-rail-item { display: grid; width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 11px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--ink); text-align: left; }
.strategy-rail-item:hover { background: var(--surface-muted); }
.strategy-rail-item.selected { background: #e7eeec; box-shadow: inset 3px 0 0 var(--green); }
.strategy-rail-item strong, .strategy-rail-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strategy-rail-item strong { font-size: 12px; }
.strategy-rail-item small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.strategy-rail-state { width: 7px; height: 7px; overflow: hidden; border-radius: 50%; background: var(--amber); color: transparent; }
.strategy-rail-state.active, .strategy-rail-state.staged_for_session { background: var(--green); }
.strategy-rail-state.retiring, .strategy-rail-state.rejected { background: var(--red); }
.strategy-detail { min-width: 0; }
.strategy-detail-header { display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 20px; }
.strategy-detail-header h2 { margin: 0; overflow-wrap: anywhere; font-size: 22px; }
.strategy-detail-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.strategy-header-actions { display: flex; flex: none; gap: 5px; }
.strategy-tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 20px; border: 1px solid var(--line); border-radius: 6px; }
.strategy-tabs button { position: relative; min-height: 40px; border: 0; border-right: 1px solid var(--line); background: #fbfcfc; color: #435055; font-weight: 650; }
.strategy-tabs button:first-child { border-radius: 5px 0 0 5px; }
.strategy-tabs button:last-child { border-right: 0; border-radius: 0 5px 5px 0; }
.strategy-tabs button.active { background: var(--surface); color: var(--green-dark); }
.strategy-tabs button.active::after { position: absolute; inset: -1px 0 auto; height: 2px; background: var(--green); content: ""; }
.strategy-tab-panel { padding: 14px 20px 20px; }

.strategy-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.strategy-section-heading h3, .run-workspace h3, .historical-welcome h3, .daily-results h3, .historical-summary h3 { margin: 0; font-size: 15px; }
.strategy-section-heading p, .run-intro p, .historical-welcome p, .daily-results header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.strategy-definition, .run-checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.strategy-definition > div, .run-checklist > div { min-width: 0; padding: 16px 0; border-bottom: 1px solid var(--line); }
.strategy-definition > div:nth-child(odd), .run-checklist > div:nth-child(odd) { padding-right: 20px; }
.strategy-definition > div:nth-child(even), .run-checklist > div:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--line); }
.strategy-definition dt, .run-checklist dt { color: var(--muted); font-size: 11px; font-weight: 650; }
.strategy-definition dd, .run-checklist dd { margin: 6px 0 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 750; }
.strategy-build-footer { display: flex; justify-content: flex-end; padding-top: 16px; }

.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: 6px; background: #fafbfb; }
.historical-controls label { min-width: 0; font-size: 11px; }
.historical-date-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.historical-date-field legend { margin-bottom: 7px; padding: 0; color: #465156; font-size: 11px; 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: 11px; }
.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: #edf5fa; color: #31586e; font-size: 11px; 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 #b8ddd3; border-radius: 6px; background: var(--green-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: 11px; line-height: 1.45; }
.qualification-spinner { display: grid; width: 30px; height: 30px; place-items: center; color: var(--green-dark); }
.qualification-spinner svg { width: 19px; height: 19px; animation: spin 1s linear infinite; }
.qualification-message.failed, .qualification-message.rejected { border-color: #e3b7bc; 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(--green); }
.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: 10px; 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); }
.historical-body { display: grid; grid-template-columns: minmax(0, 1fr) 210px; align-items: start; gap: 12px; margin-top: 12px; }
.historical-main { min-width: 0; }
.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: 11px; }
.equity-figure header span { display: inline-flex; align-items: center; gap: 7px; }
.equity-figure header svg { width: 15px; height: 15px; color: var(--green); }
#qualification-chart { display: block; width: 100%; height: 270px; margin-top: 6px; }
.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: 11px; }
.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: 10px; 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: 9px; }
.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: 10px; }
.historical-summary p strong { color: var(--ink); font-size: 11px; }
.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: 11px; }
.qualification-complete small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.strategy-action-bar { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fafbfb; }
.strategy-action-bar > span { display: inline-flex; min-width: 0; flex: 1; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.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: 6px; background: #fafbfb; }
.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(--green-dark); font-size: 11px; font-weight: 750; }
.run-posture svg { width: 17px; height: 17px; }
.run-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; }

.desk-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.desk-metric { min-width: 0; padding: 17px; border-right: 1px solid var(--line); }
.desk-metric:last-child { border-right: 0; }
.desk-metric span { display: block; color: var(--muted); font-size: 11px; font-weight: 650; }
.desk-metric strong { display: block; margin-top: 7px; overflow: hidden; text-overflow: ellipsis; font-size: 20px; white-space: nowrap; }
.desk-metric.positive strong { color: var(--green-dark); }
.desk-metric.negative strong { color: var(--red); }
.desk-metric.warning strong { color: var(--amber); }
.desk-toolbar { margin-top: 16px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.desk-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.desk-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.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; }
.compact-list { overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.compact-list > div { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.compact-list > div:last-child { border-bottom: 0; }
.compact-list span { min-width: 0; }
.compact-list strong, .compact-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-list strong { font-size: 12px; }
.compact-list small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.compact-list b { flex: none; font-size: 11px; }
.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; }

.empty-state { display: grid; min-height: 260px; place-items: center; padding: 28px; border: 1px dashed var(--line-strong); border-radius: 7px; background: rgba(255, 255, 255, 0.54); 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; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 19px; border-top: 1px solid var(--line); background: #fafbfb; }
.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(--ink); color: white; box-shadow: var(--shadow); font-size: 12px; }
.toast.error { background: #7f252e; }

@media (max-width: 900px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-row { grid-template-columns: minmax(0, 1.3fr) minmax(110px, 0.7fr) auto; }
  .data-row > :nth-child(3) { display: none; }
  .desk-columns { grid-template-columns: 1fr; }
  .strategy-workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .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); }
}

@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(66px + env(safe-area-inset-bottom)); }
  .topbar { position: relative; min-height: auto; align-items: flex-end; padding: 17px 16px 12px; }
  .topbar-actions { gap: 7px; }
  .instance-picker { min-width: 0; width: min(140px, 38vw); }
  .instance-picker span { display: none; }
  .topbar .button span { display: none; }
  .topbar .button { width: 40px; padding: 0; }
  .content { padding: 13px 14px 28px; }
  .mobile-nav { position: fixed; z-index: 30; inset: auto 0 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(252, 253, 253, 0.98); }
  .mobile-nav button { display: grid; min-width: 0; place-items: center; gap: 2px; padding: 5px 1px; border-radius: 5px; color: var(--muted); font-size: 9px; font-weight: 700; }
  .mobile-nav button.active { color: var(--green-dark); background: var(--green-soft); }
  .mobile-nav svg { width: 18px; height: 18px; }
  .metric { padding: 14px; }
  .metric strong { font-size: 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: 10px; }
  .strategy-page-tools, .desk-toolbar { align-items: flex-start; }
  .strategy-page-tools { margin-bottom: 10px; }
  .strategy-page-tools > div p { max-width: 210px; }
  .strategy-workspace { display: block; min-height: 0; overflow: visible; border: 0; background: transparent; }
  .strategy-rail { overflow: hidden; margin: -1px -14px 10px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); }
  .strategy-rail-header { display: none; }
  .strategy-rail-list { display: flex; overflow-x: auto; padding: 8px 14px; gap: 7px; scrollbar-width: none; }
  .strategy-rail-list::-webkit-scrollbar { display: none; }
  .strategy-rail-item { width: 190px; min-width: 190px; border: 1px solid var(--line); background: var(--surface); }
  .strategy-rail-item.selected { border-color: #a5cabf; box-shadow: inset 0 -2px 0 var(--green); }
  .strategy-detail { margin: 0 -14px; background: var(--surface); }
  .strategy-detail-header { min-height: 68px; padding: 11px 18px; }
  .strategy-detail-header h2 { font-size: 21px; }
  .strategy-tabs { margin: 0 14px; }
  .strategy-tabs button { padding-inline: 5px; font-size: 12px; white-space: nowrap; }
  .strategy-tab-panel { padding: 14px 14px 20px; }
  .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; }
  #qualification-chart { height: 245px; }
  .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%; }
  .strategy-definition, .run-checklist { grid-template-columns: 1fr; }
  .strategy-definition > div:nth-child(odd), .strategy-definition > div:nth-child(even), .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-summary { grid-template-columns: 1fr 1fr; }
  .desk-metric { padding: 14px; }
  .desk-metric:nth-child(2) { border-right: 0; }
  .desk-metric:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .desk-toolbar { display: grid; }
  .desk-actions { justify-content: stretch; }
  .desk-actions .button { flex: 1 1 130px; }
  .desk-strategy-row .row-actions { display: grid; grid-template-columns: repeat(3, 36px); }
  .manifest-actions { align-items: stretch; flex-direction: column; }
  .manifest-actions a { align-self: flex-start; }
  .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) {
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric small { display: none; }
}
