@font-face { font-family: "HarmonyOS Sans"; src: url("/static/fonts/HarmonyOS-Sans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "HarmonyOS Sans"; src: url("/static/fonts/HarmonyOS-Sans-Medium.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "HarmonyOS Sans"; src: url("/static/fonts/HarmonyOS-Sans-Bold.woff2") format("woff2"); font-weight: 700 900; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f8f9fa;
  --panel: #fff;
  --panel-soft: #f3f5f6;
  --ink: #2b2f32;
  --ink-strong: #212529;
  --muted: #6c757d;
  --nav: #596169;
  --subtle: #8b959f;
  --line: #e2e6e9;
  --chip: #e9ecef;
  --input-line: #ced4da;
  --accent: #1fad9c;
  --accent-text: #087b6d;
  --accent-soft: #edfdfb;
  --brand-50: #edfdfb;
  --brand-100: #d4f7f3;
  --button-bg: #108577;
  --button-hover: #0d7165;
  --button-ink: #fff;
  --good: #168345;
  --good-soft: #edfaf1;
  --bad: #cf3542;
  --bad-soft: #fff0f1;
  --chart-bg: #fff;
  --shadow: 0 6px 24px #12141712;
  --tooltip-bg: #2b2f32;
  --avatar: #2b2f32;
  --avatar-ink: #fff;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1012;
  --panel: #16191d;
  --panel-soft: #1d2126;
  --ink: #e9ecef;
  --ink-strong: #e9ecef;
  --muted: #9aa3ac;
  --nav: #9aa3ac;
  --subtle: #8b959f;
  --line: #2b3036;
  --chip: #1d2126;
  --input-line: #414850;
  --accent: #40bfb0;
  --accent-text: #66ccc0;
  --accent-soft: #122e2a;
  --brand-50: #0c1d1b;
  --brand-100: #0a2925;
  --button-bg: #40bfb0;
  --button-hover: #66ccc0;
  --button-ink: #092824;
  --good: #5dcb8a;
  --good-soft: #162d21;
  --bad: #f98981;
  --bad-soft: #321d22;
  --chart-bg: #16191d;
  --shadow: 0 6px 24px #0005;
  --tooltip-bg: #343a40;
  --avatar: #dee2e6;
  --avatar-ink: #000;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-family: "HarmonyOS Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; font-size: 13px; line-height: 1.5; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: var(--accent-text); }
button, input, select { transition: border-color 120ms, background-color 120ms, color 120ms; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input, select { width: 100%; min-width: 0; height: 34px; padding: 5px 9px; border: 1px solid var(--input-line); border-radius: 4px; background: var(--panel); color: var(--ink); font-size: 13px; }
input:hover, select:hover { border-color: var(--accent); }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input:disabled { color: var(--muted); background: var(--panel-soft); cursor: not-allowed; }
input::placeholder { color: var(--subtle); }
input[type="checkbox"] { width: 14px; height: 14px; padding: 0; margin: 0; accent-color: var(--button-bg); flex: 0 0 auto; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; min-width: 0; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); }
.ui-icon { flex-shrink: 0; vertical-align: middle; }
.hidden { display: none !important; }
.muted, .field-help, .indicator-empty { color: var(--muted); }
.field-help { font-size: 11px; line-height: 1.6; margin: 6px 0 0; }
.eyebrow { color: var(--accent-text); margin: 0 0 5px; font-size: 11px; font-weight: 500; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; background: var(--panel); padding: 10px; }
.skip-link:focus { top: 8px; }
#main-content { outline: none; }
.shell { min-height: 100vh; padding-bottom: 30px; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; padding: 0 16px; position: sticky; top: 0; z-index: 40; background: var(--panel); border-bottom: 1px solid var(--chip); }
.header-left { display: flex; align-self: stretch; align-items: center; gap: 30px; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 0; padding: 0; white-space: nowrap; color: var(--ink-strong); }
.brand-mark { display: block; width: 30px; height: 30px; flex-shrink: 0; object-fit: contain; }
.app-header .brand-mark { width: 40px; height: 40px; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -.5px; }
.app-header .brand-name { font-size: 22px; letter-spacing: 0; line-height: normal; }
.brand-name > span { font-weight: 400; }
.brand-pro { font-size: 9px; letter-spacing: .7px; font-weight: 700; background: var(--accent-soft); color: var(--accent-text); padding: 2px 5px; border-radius: 3px; }
.header-divider { height: 20px; width: 1px; background: var(--input-line); flex-shrink: 0; }
.view-tabs { display: flex; align-self: stretch; align-items: stretch; gap: 24px; }
.view-tabs button { display: flex; gap: 8px; align-items: center; position: relative; padding: 0; border: 0; background: transparent; color: var(--nav); font-size: 14px; font-weight: 500; line-height: 24px; white-space: nowrap; }
.view-tabs button:hover { color: var(--accent); background: transparent; }
.view-tabs button.selected { color: var(--accent); }
.view-tabs button.selected::after { content: ""; height: 2px; position: absolute; bottom: -1px; left: 0; right: 0; background: var(--accent); border-radius: 1px; }
.header-actions { display: flex; gap: 16px; align-items: center; margin-left: auto; flex-shrink: 0; }
.header-prefs { display: flex; gap: 24px; align-items: center; }
.language-switch { display: inline-flex; flex-shrink: 0; align-items: center; height: 28px; padding: 2px; border: 0; border-radius: 4px; background: var(--chip); }
.language-switch button { min-width: 0; height: 100%; padding: 0 16px; border: 0; border-radius: 2px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 20px; }
.language-switch button:hover { color: var(--accent); background: transparent; }
.language-switch button[aria-pressed="true"] { background: var(--panel); color: var(--accent); }
.language-switch button:focus-visible { position: relative; z-index: 1; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: 0; background: transparent; color: var(--nav); position: relative; }
.theme-toggle::before { content: ""; position: absolute; inset: -6px; }
.theme-toggle:hover { color: var(--accent); background: transparent; }
.header-asset { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 44px; padding: 0 12px; border-radius: 8px; background: var(--chip); color: var(--ink-strong); font-size: 14px; font-weight: 500; line-height: 14px; }
.header-asset img { display: block; width: 16px; height: 16px; }
.avatar-button { display: flex; align-items: center; justify-content: center; position: relative; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: var(--avatar); color: var(--avatar-ink); transition: background-color 0.2s ease; }
.avatar-button.is-logged-in, .avatar-button.is-pro { background: var(--avatar); }
.avatar-button:hover { background: var(--accent); }
.avatar-button.is-pro > .ui-icon { transform: translateY(-4px); }
.avatar-status-dot { position: absolute; right: 0; bottom: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1.5px var(--panel); pointer-events: none; }
.asset-badge { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; padding: 3px 7px; border-radius: 3px; background: var(--panel-soft); color: var(--ink); font-size: 11px; font-weight: 600; line-height: 1.4; }
.asset-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #f7931a; }
.asset-badge[aria-label="Asset ETH"]::before { background: #879bf0; }
.status-bar { display: flex; justify-content: space-between; align-items: center; position: fixed; inset: auto 0 0; height: 28px; padding: 0 16px; border-top: 1px solid var(--line); background: var(--panel); z-index: 40; font-size: 10px; color: var(--muted); }
.health { display: flex; gap: 22px; align-items: center; }
.health > span { display: inline-flex; gap: 7px; align-items: center; }
.health strong { color: var(--muted); font-weight: 400; }
.health .ok { color: var(--accent-text); }
.health .bad { color: var(--bad); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: currentColor; flex-shrink: 0; }
.status-separator { margin: 0 9px; color: var(--line); }

/* Strategy workspace */
.workspace-view { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; padding: 20px 24px 28px; max-width: 1800px; margin: auto; align-items: start; }
.workspace-titlebar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 2px; }
.breadcrumb { font-size: 11px; color: var(--muted); margin-bottom: 7px; }
.breadcrumb span { color: var(--subtle); margin: 0 8px; }
.workspace-titlebar h1 { margin: 0; font-size: 23px; font-weight: 500; letter-spacing: -.4px; }
.workspace-titlebar p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.coverage-note { display: flex; gap: 10px; align-items: center; color: var(--accent-text); padding: 9px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
.coverage-note > div { display: grid; gap: 2px; }
.coverage-note div > span { font-size: 10px; color: var(--muted); }
.coverage-note strong { color: var(--ink); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.coverage-note strong span { margin: 0 6px; color: var(--subtle); }
.workbench { min-width: 0; }
.form { display: grid; gap: 12px; }
.builder-section, .summary-panel, .history-panel { border: 1px solid var(--line); border-radius: 4px; background: var(--panel); min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; min-height: 45px; padding: 8px 14px; gap: 8px; border-bottom: 1px solid var(--line); }
.panel-heading > div { display: flex; gap: 9px; align-items: center; min-width: 0; }
.panel-heading h2 { font-size: 13px; font-weight: 600; margin: 0; }
.panel-heading > div > .ui-icon { color: var(--muted); }
.section-number { font-size: 10px; font-variant-numeric: tabular-nums; color: var(--accent-text); width: 21px; height: 21px; display: grid; place-items: center; border-radius: 3px; background: var(--accent-soft); }
.panel-meta { color: var(--muted); font-size: 11px; }
.panel-body { padding: 16px; }
.field-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr .9fr; gap: 14px; }
.session-field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; min-width: 0; }
.session-time { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 3px; }
.session-time select { padding-inline: 3px; }
.schedule-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 16px; }
.field-caption { color: var(--muted); font-size: 12px; display: block; margin-bottom: 6px; }
.weekday-row { display: flex; gap: 5px; flex-wrap: wrap; }
.setup-fields { align-items: start; }
.start-date-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.start-date-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.start-date-heading > label { white-space: nowrap; }
.date-shortcuts { display: flex; flex-shrink: 0; gap: 3px; align-items: center; }
.date-shortcuts button { height: 18px; font-size: 10px; line-height: 1; padding: 0 5px; white-space: nowrap; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); color: var(--muted); }
.date-shortcuts button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.control-grid { display: grid; grid-template-columns: 1.15fr 1fr 1.05fr; gap: 20px; align-items: start; }
.control-grid > section { min-width: 0; }
.section-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12px; font-weight: 500; }
.control-grid .section-line { font-weight: 400; color: var(--muted); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 4px; padding: 2px; gap: 2px; background: var(--panel-soft); }
.segmented button { border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 3px; min-height: 28px; padding: 3px 8px; white-space: nowrap; font-size: 11px; }
.segmented button.selected { background: var(--panel); border-color: var(--line); color: var(--accent-text); font-weight: 500; }
.segmented button:hover { color: var(--accent-text); }
.segmented[data-name="hedge"] { display: flex; flex-wrap: wrap; align-items: center; width: fit-content; max-width: 100%; padding: 3px; gap: 0; border: 0; border-radius: 4px; background: var(--chip); }
.segmented[data-name="mode"],
.segmented[data-name="numeraire"] { width: 100%; max-width: none; padding: 3px; gap: 0; border: 0; border-radius: 4px; background: var(--chip); }
.segmented[data-name="mode"] { grid-template-columns: 1fr 1fr; grid-auto-flow: row; }
.segmented[data-name="numeraire"] { grid-auto-flow: column; grid-auto-columns: 1fr; }
.segmented[data-name="hedge"] > button,
.segmented[data-name="mode"] > button,
.segmented[data-name="numeraire"] > button { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 4px 12px; border: 0; border-radius: 4px; background: transparent; color: var(--nav); font-size: 11px; font-weight: 400; line-height: 1.5; white-space: nowrap; }
.segmented[data-name="mode"] > button,
.segmented[data-name="numeraire"] > button { width: 100%; }
.segmented[data-name="hedge"] > button.selected,
.segmented[data-name="mode"] > button.selected,
.segmented[data-name="numeraire"] > button.selected { background: var(--panel); border-color: transparent; color: var(--accent); font-weight: 500; }
.segmented[data-name="hedge"] > button:hover,
.segmented[data-name="mode"] > button:hover,
.segmented[data-name="numeraire"] > button:hover { color: var(--accent); background: transparent; }
.segmented[data-name="hedge"] > button.selected:hover,
.segmented[data-name="mode"] > button.selected:hover,
.segmented[data-name="numeraire"] > button.selected:hover { background: var(--panel); color: var(--accent); }
.hedge-divider { flex: 0 0 auto; align-self: center; width: 1px; height: 14px; background: var(--input-line); }
.hedge-hourly.is-selected:hover { background: var(--panel); }
.hedge-hourly { display: inline-flex; align-items: center; gap: 2px; min-height: 28px; padding-right: 12px; border-radius: 4px; color: var(--nav); font-size: 11px; font-weight: 400; line-height: 1.5; }
.hedge-hourly.is-selected { background: var(--panel); color: var(--accent); font-weight: 500; }
.segmented[data-name="hedge"] .hedge-hourly > button { display: inline-flex; align-items: center; gap: 2px; min-height: 0; margin: 0; padding: 4px 0 4px 12px; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; line-height: inherit; white-space: nowrap; }
.segmented[data-name="hedge"] .hedge-hourly > button.selected,
.segmented[data-name="hedge"] .hedge-hourly > button:hover { background: transparent; border-color: transparent; color: inherit; }
.segmented[data-name="hedge"] .hedge-hourly > button.pro-locked,
.segmented[data-name="hedge"] .hedge-hourly > button.pro-locked:hover { opacity: 1; color: #b5bcc3; cursor: default; }
:root[data-theme="dark"] .segmented[data-name="hedge"] .hedge-hourly > button.pro-locked,
:root[data-theme="dark"] .segmented[data-name="hedge"] .hedge-hourly > button.pro-locked:hover { color: #6d767e; }
.hedge-pro-badge { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; padding: 2px 4px; border-radius: 2px; color: #fff; background: linear-gradient(90deg, #03d7d6 27.885%, #4aa8ff 107.41%); }
.hedge-hourly .pro-info { margin-left: 0; }
.hedge-hourly > .hourly-pro-tip { display: flex; align-items: center; line-height: 0; }
.hedge-hourly .pro-info-trigger { display: inline-flex; align-items: center; justify-content: center; width: 12px; height: 12px; min-height: 12px; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: pointer; }
.hedge-hourly .pro-info-trigger:hover { background: transparent; border-color: transparent; }
.hedge-tip { position: relative; }
.hedge-tip-popup {
  display: none;
  position: absolute;
  z-index: 60;
  top: 100%;
  left: 50%;
  width: max-content;
  max-width: min(280px, calc(100vw - 48px));
  padding-top: 8px;
  transform: translateX(-50%);
}
.hedge-tip.is-open .hedge-tip-popup,
.hedge-tip:focus-within .hedge-tip-popup { display: block; }
.hedge-tip-body {
  display: block;
  position: relative;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--tooltip-bg);
  box-shadow: 0 14px 34px rgba(19, 33, 30, 0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
}
.hedge-tip-body::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 8px;
  height: 8px;
  background: var(--tooltip-bg);
  transform: translateX(-50%) rotate(45deg);
}
.segmented[data-name="mode"] > button { white-space: normal; line-height: 1.3; }
.asset-switch { display: flex; padding: 0; background: var(--panel-soft); border: 0; gap: 3px; }
.asset-switch button { min-width: 46px; min-height: 25px; padding: 2px 8px; font-size: 11px; }
.asset-switch button.selected { background: var(--accent-soft); border-color: var(--accent); }
.ddh-setting { margin-top: 10px; }
.transaction-cost-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.transaction-cost-fields label { display: grid; gap: 5px; min-width: 0; font-size: 11px; }
.transaction-cost-fields input { width: 100%; height: 28px; }
.annual-return-row { display: grid; gap: 8px; margin-top: 10px; }
.inline-check { display: inline-flex; gap: 7px; align-items: center; }
.inline-check.is-locked, .inline-check.is-locked input { cursor: not-allowed; }
.annual-principal { grid-template-columns: auto minmax(60px, 1fr); align-items: center; gap: 8px; font-size: 11px; }
.annual-principal input { height: 28px; }
.legs-section-line { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.equity-sizing-control { margin-bottom: 12px; }
.wheel-assignment-control { display: grid; gap: 6px; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.wheel-assignment-control .segmented button { white-space: normal; }
.count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 18px; padding: 0 5px; background: var(--panel-soft); color: var(--muted); font-size: 10px; border-radius: 3px; margin-left: 4px; }
.legs-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; }
.legs-table-head, .leg-row { display: grid; grid-template-columns: 22px 1fr 1fr 1fr 1fr 1fr 28px 28px; gap: 10px; align-items: center; padding: 7px 10px; min-width: 570px; }
.legs-table-head.with-close-dte, .leg-row.with-close-dte { grid-template-columns: 22px 1fr 1fr 1fr 1fr 1fr 1fr 28px 28px; min-width: 670px; }
.legs-table-head { font-size: 11px; color: var(--muted); background: var(--panel-soft); }
.leg-row { border-top: 1px solid var(--line); }
.leg-row:hover { background: var(--panel-soft); }
.leg-row label { font-size: 0; gap: 0; }
.leg-row input, .leg-row select { height: 30px; font-size: 12px; }
.leg-row .leg-side { color: var(--good); background: var(--good-soft); border-color: transparent; }
.leg-row.short .leg-side { color: var(--bad); background: var(--bad-soft); }
.leg-number { color: var(--subtle); font-size: 10px; font-variant-numeric: tabular-nums; }
.indicator-list { display: grid; gap: 8px; }
.indicator-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 30px; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 4px; align-items: end; }
.indicator-row > .delete-indicator { grid-column: 4; grid-row: 1; }
.signal-indicator-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.indicator-empty { margin: 0 0 15px; font-size: 12px; }
.signal-panel { display: grid; gap: 12px; }
.exposure-band-formulas { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-soft); min-width: 0; }
.exposure-band-formulas > strong { font-size: 12px; font-weight: 600; }
.exposure-band-formula-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.exposure-band-formula-grid > div { display: grid; gap: 5px; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); }
.exposure-band-formula-grid span { color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.exposure-band-formula-grid code { overflow-wrap: anywhere; color: var(--ink); font-size: 11px; line-height: 1.55; white-space: normal; }
.exposure-band-formulas p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.wheel-rules { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-soft); min-width: 0; }
.wheel-rules > strong { font-size: 12px; font-weight: 600; }
.wheel-rules ul { display: grid; gap: 6px; margin: 0; padding-left: 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.signal-condition-group { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 4px; min-width: 0; }
.signal-condition-group legend { padding: 0 6px; font-weight: 600; }
.signal-condition { display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, .8fr) minmax(0, 1fr) 26px; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; align-items: start; }
.rule-operand { display: grid; gap: 8px; min-width: 0; }
.rule-family-label { grid-column: 1 / 4; }
.signal-condition > .delete-condition { grid-column: 4; grid-row: 1; }
.signal-condition label, .signal-condition-group .section-line > label { min-width: 0; }
.signal-condition select, .signal-condition input { min-width: 0; width: 100%; }
.signal-condition-group .section-line { flex-wrap: wrap; gap: 10px; }
.delete-condition { margin-top: 20px; }
@media (max-width: 600px) {
  .exposure-band-formula-grid { grid-template-columns: 1fr; }
  .signal-condition { grid-template-columns: minmax(0, 1fr) 26px; }
  .signal-condition > .rule-operand, .signal-condition > .rule-operator-label { grid-column: 1; }
  .signal-condition > .rule-family-label { grid-column: 1; }
  .signal-condition > .delete-condition { grid-column: 2; grid-row: 1; }
}
.signal-rule-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.bi-wheel-side { color: var(--good); font-weight: 600; }
.legs-scroll + section { margin-top: 18px; }
.output-customization { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
.output-customization-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.output-customization-heading h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; font-weight: 500; }
.output-selection-count { flex: 0 0 auto; font-size: 11px; color: var(--muted); }
.chips { display: grid; gap: 14px; padding-top: 16px; }
.detail-csv-option { display: grid; gap: 6px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail-csv-line { display: flex; align-items: center; gap: 6px; min-height: 24px; }
.detail-csv-option .inline-check { justify-self: start; gap: 10px; min-height: 24px; color: var(--ink); font-size: 12px; }
.detail-csv-option.is-locked .inline-check,
.detail-csv-option.is-locked .muted { color: var(--subtle); }
.detail-csv-option.is-locked .inline-check { cursor: not-allowed; }
.detail-csv-option.is-locked input[type="checkbox"]:disabled { background: transparent; accent-color: var(--input-line); opacity: 1; cursor: not-allowed; }
.detail-csv-option .muted { margin: 0 0 0 24px; font-size: 11px; line-height: 1.6; }
.pro-badge { position: relative; display: inline-block; flex: 0 0 auto; box-sizing: border-box; width: 68px; height: 24px; overflow: hidden; border-radius: 4px; background: linear-gradient(90deg, #03d7d6 31.757%, #2481f5 107.41%); container-type: size; vertical-align: middle; }
.pro-badge-art { position: absolute; left: 50%; top: 50%; display: flex; align-items: center; box-sizing: border-box; width: 68px; height: 24px; padding: 4px 6px; gap: 4px; transform: translate(-50%, -50%) scale(min(calc(100cqw / 68px), calc(100cqh / 24px))); }
.pro-badge-icon { display: block; flex: 0 0 auto; width: 16px; height: 16px; aspect-ratio: 1; object-fit: contain; }
.pro-badge-word { position: relative; flex: 0 0 36px; width: 36px; height: 15px; }
.pro-badge-word img { position: absolute; left: 1.29px; top: 1.49px; display: block; width: 33.5996px; height: 12.015px; aspect-ratio: 33.5996 / 12.015; object-fit: contain; -webkit-mask-image: url("/static/images/pro-badge-mask.svg"); mask-image: url("/static/images/pro-badge-mask.svg"); -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: -1.285px -1.484px; mask-position: -1.285px -1.484px; -webkit-mask-size: 36px 15px; mask-size: 36px 15px; }
.chip-group { display: grid; gap: 7px; }
.chip-group-title { font-size: 11px; font-weight: 500; color: var(--muted); }
.chips-row { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); color: var(--muted); cursor: pointer; font-size: 11px; }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip.disabled { opacity: .5; cursor: not-allowed; }
.chip-group > p { margin: 0; font-size: 11px; line-height: 1.6; }
.weekday-chip { padding: 4px 9px; position: relative; min-height: 28px; }
.weekday-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.weekday-chip:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.run-actionbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; bottom: 28px; z-index: 15; border: 1px solid var(--line); border-radius: 4px; padding: 10px 14px; background: var(--panel); }
.run-actionbar > span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.run-button, .download { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 4px; padding: 8px 18px; min-height: 34px; background: var(--button-bg); color: var(--button-ink); font-size: 12px; font-weight: 500; text-decoration: none; }
.run-button:hover, .download:hover { background: var(--button-hover); }
.icon-button, .ghost-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--input-line); border-radius: 4px; background: var(--panel); color: var(--ink); min-height: 30px; }
.icon-button { width: 28px; height: 28px; min-height: 28px; flex-shrink: 0; padding: 0; color: var(--muted); border-color: transparent; }
.ghost-button { padding: 5px 11px; font-size: 12px; }
.ghost-button.full { width: 100%; margin-top: 12px; }
.icon-button:hover, .ghost-button:hover { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent); }
.small-button { min-height: 26px; font-size: 11px; padding: 3px 8px; }
.delete-leg:hover, .delete-indicator:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }

/* Overview and run history */
.workspace-sidebar { display: grid; gap: 14px; position: sticky; top: 74px; min-width: 0; }
.draft-badge { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; }
.summary-heading { display: flex; gap: 8px; align-items: center; padding-bottom: 14px; }
.summary-heading strong { font-size: 13px; overflow-wrap: anywhere; }
.summary-facts { display: grid; gap: 10px; margin: 0; }
.summary-facts > div { display: flex; justify-content: space-between; gap: 14px; }
.summary-facts dt { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.summary-facts dd { margin: 0; font-size: 11px; text-align: right; }
.summary-legs { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 10px; display: grid; gap: 8px; }
.summary-legs > div { display: flex; align-items: center; gap: 7px; font-size: 10px; }
.summary-legs > div > span:nth-last-child(2) { color: var(--muted); margin-left: auto; }
.side-label { font-size: 10px; padding: 1px 4px; border-radius: 3px; }
.side-label.long { color: var(--good); background: var(--good-soft); }
.side-label.short { color: var(--bad); background: var(--bad-soft); }
.summary-output { display: flex; gap: 7px; align-items: center; margin-top: 16px; font-size: 11px; color: var(--muted); }
.history-body { padding: 12px; max-height: 410px; overflow: auto; }
.history-list { display: grid; gap: 6px; }
.history-item { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 4px; padding: 10px 6px 10px 10px; }
.history-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.history-item:hover { border-color: var(--accent); }
.history-select { display: flex; flex: 1; min-width: 0; justify-content: space-between; gap: 6px; padding: 0; border: 0; background: transparent; text-align: left; align-items: center; }
.history-select > span { min-width: 0; }
.history-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.history-title-row strong { font-size: 12px; overflow-wrap: anywhere; }
.history-title-row .asset-badge { font-size: 9px; padding: 1px 4px; }
.history-item small { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; }
.task-id { display: block; color: var(--subtle); font-size: 10px; overflow-wrap: anywhere; }
.history-item .task-id { display: none; }
em.completed, em.failed, em.queued, em.running { font-size: 9px; font-style: normal; text-transform: capitalize; }
em.completed { color: var(--good); }
em.failed { color: var(--bad); }
em.queued, em.running { color: var(--accent-text); }
.history-delete, .history-rename { display: grid; place-items: center; width: 22px; height: 24px; flex-shrink: 0; border: 0; background: transparent; color: var(--muted); }
.history-rename:hover { color: var(--accent-text); }
.history-delete:hover { color: var(--bad); }
.rename-report-form { display: flex; flex: 1; min-width: 0; align-items: center; flex-wrap: wrap; gap: 4px; }
.rename-report-input { min-width: 0; flex: 1; height: 30px; }
.rename-report-error { flex-basis: 100%; color: var(--bad); font-size: 10px; }
.history-rename-form .rename-report-input { height: 28px; font-size: 12px; }
.history-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 6px; color: var(--muted); }
.history-empty > .ui-icon { color: var(--subtle); margin-bottom: 12px; }
.history-empty strong { color: var(--ink); font-size: 12px; font-weight: 500; }
.history-empty p { font-size: 11px; max-width: 220px; margin: 7px 0 0; }
.history-footer { border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); padding: 10px 12px; }
.run-state { padding: 14px; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 4px; margin-bottom: 12px; }
.run-state h3 { font-size: 14px; margin: 4px 0; overflow-wrap: anywhere; }
.run-state p { font-size: 11px; color: var(--muted); margin: 4px 0; overflow-wrap: anywhere; }
.run-state .eyebrow { color: var(--accent-text); }
.run-state.failed { border-color: var(--bad); }
.run-state.failed h3 { color: var(--bad); }
.task-title-row, .report-label-row, .run-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.report-label-row { justify-content: flex-start; }
.run-head strong { font-size: 23px; font-weight: 500; color: var(--accent-text); }
.progress { height: 5px; margin-top: 14px; background: var(--line); overflow: hidden; border-radius: 3px; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width 220ms ease; }

/* Results, data API, and account management */
.report-view, .docs-view { min-width: 0; max-width: 1800px; margin: auto; padding: 24px; }
.report-view > .run-state { max-width: 640px; margin: 32px auto; padding: 24px; }
.report-head, .docs-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 16px; }
.report-head h2, .docs-head h2 { font-size: 23px; font-weight: 500; letter-spacing: -.4px; margin: 3px 0 6px; overflow-wrap: anywhere; }
.report-head p, .docs-head p { font-size: 12px; color: var(--muted); margin-bottom: 0; }
.report-head .task-id { margin-top: 5px; }
.report-title-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.report-title-row h2 { min-width: 0; }
.report-rename-form { max-width: 560px; margin: 3px 0 6px; }
.report-rename-form .rename-report-input { font-size: 17px; }
.artifact-strip { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.artifact-strip .download { border-color: var(--input-line); color: var(--ink); background: var(--panel); min-height: 30px; padding: 5px 11px; }
.artifact-strip .download:hover { color: var(--accent-text); border-color: var(--accent); }
.run-context { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.run-config { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.run-config > div { padding: 12px 14px; min-width: 0; }
.run-config > div + div { border-left: 1px solid var(--line); }
.run-config span, .run-legs-grid span { display: block; font-size: 10px; color: var(--muted); }
.run-config strong, .run-legs-grid strong { display: block; font-size: 12px; font-weight: 500; margin-top: 4px; overflow-wrap: anywhere; }
.run-legs { padding: 10px 14px; border-top: 1px solid var(--line); }
.run-legs-title { font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.run-legs-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.run-signal { padding: 14px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.run-signal h3, .run-signal h4 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin: 0; font-size: 12px; font-weight: 500; }
.run-signal h3 > span, .run-signal h4 > span { color: var(--muted); font-size: 11px; font-weight: 400; }
.run-signal-stats { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 14px 0 0; }
.run-signal-stats > div { min-width: 0; }
.run-signal-stats dt, .run-signal-stats p, .run-signal-stats strong > span { color: var(--muted); font-size: 11px; font-weight: 400; }
.run-signal-stats dd { margin: 4px 0 0; }
.run-signal-stats strong { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.run-signal-stats p { margin: 4px 0 0; line-height: 1.6; }
.run-signal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.run-signal-group { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-soft); }
.run-signal-group p, .run-signal-group li { font-size: 12px; line-height: 1.6; }
.run-signal-group p { margin: 6px 0 0; }
.run-signal-group ul { margin: 8px 0 0; padding-left: 18px; }
.run-signal-group li + li { margin-top: 4px; }
.run-signal-note { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 14px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--panel); }
.kpi { padding: 15px; min-width: 0; outline: 1px solid var(--line); }
.kpi span { display: block; font-size: 11px; color: var(--muted); }
.kpi strong { display: block; font-size: 22px; font-weight: 500; margin-top: 5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; letter-spacing: -.5px; }
.kpi-costs { grid-column: span 2; }
.kpi-costs > span { margin-bottom: 6px; }
.kpi-cost-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi-cost-row { min-width: 0; }
.kpi-costs .kpi-cost-row strong { font-size: clamp(12px, 3vw, 18px); margin-top: 2px; white-space: nowrap; overflow-wrap: normal; }
.kpi.positive strong { color: var(--good); }
.kpi.negative strong { color: var(--bad); }
.report-panel, .table-panel, .endpoint-row { border: 1px solid var(--line); border-radius: 4px; background: var(--panel); padding: 16px; margin-top: 14px; min-width: 0; }
.report-summary h3 { margin: 0 0 14px; font-size: 13px; font-weight: 500; }
pre { margin: 0; max-height: 400px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; font-size: 12px; line-height: 1.7; color: var(--ink); }
.table-scroll { overflow: auto; max-height: 420px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { position: sticky; top: 0; z-index: 1; background: var(--panel-soft); color: var(--muted); font-size: 11px; font-weight: 500; }
tbody tr:hover { background: var(--accent-soft); }
.empty-state { border: 1px solid var(--line); border-radius: 4px; background: var(--panel); min-height: 400px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; }
.empty-state > .ui-icon { color: var(--accent); margin-bottom: 22px; }
.empty-state h2 { font-size: 20px; font-weight: 500; margin: 0 0 8px; }
.empty-state p { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.docs-status { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--line); background: var(--panel); border-radius: 4px; }
.docs-status > div { padding: 16px; min-width: 0; }
.docs-status span { display: block; color: var(--muted); font-size: 11px; }
.docs-status strong { display: block; margin-top: 6px; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.endpoint-list { display: grid; gap: 0; }
.endpoint-row { display: grid; gap: 12px; }
.endpoint-title { display: flex; gap: 10px; align-items: center; min-width: 0; }
.endpoint-title > span { padding: 3px 7px; border-radius: 3px; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 500; }
.endpoint-title h3 { margin: 0; font-size: 16px; font-weight: 500; overflow-wrap: anywhere; min-width: 0; }
.endpoint-row p { margin: 0; color: var(--muted); }
.columns-line { padding: 10px; background: var(--panel-soft); font-family: ui-monospace, monospace; font-size: 11px; overflow-wrap: anywhere; color: var(--muted); border-radius: 4px; }
.endpoint-row pre { padding: 14px; background: #121b1e; color: #b2e6df; border-radius: 4px; }
.admin-users { display: grid; gap: 8px; }
.admin-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.admin-toolbar label { min-width: 150px; }
.admin-toolbar .download { min-height: 36px; }
.admin-load-heading { margin-top: 26px; }
.usage-period { margin-bottom: 12px; font-size: 12px; }
.usage-summary, .usage-trends { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.usage-service { border: 1px solid var(--line); border-radius: 4px; background: var(--panel); padding: 16px; min-width: 0; }
.usage-service h3 { margin: 0 0 14px; font-size: 14px; font-weight: 500; }
.usage-service > p { margin: 12px 0 0; font-size: 11px; }
.usage-service-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.usage-card { padding: 0 18px; min-width: 0; }
.usage-card:first-child { padding-left: 0; border-right: 1px solid var(--line); }
.usage-card > span, .usage-card small { display: block; color: var(--muted); font-size: 11px; }
.usage-card strong { display: block; margin: 8px 0; font-size: 28px; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.usage-note { font-size: 12px; line-height: 1.7; margin: 12px 0 0; }
.usage-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; font-size: 11px; margin-bottom: 18px; }
.usage-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.usage-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }
.usage-backtests { background: var(--accent); }
.usage-data-api { background: #879bf0; }
.usage-chart-scroll { overflow-x: auto; }
.usage-chart { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; }
.usage-axis { display: flex; flex-direction: column; justify-content: space-between; align-items: end; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.usage-plot { height: 180px; display: flex; gap: 3px; align-items: stretch; border-bottom: 1px solid var(--line); background: linear-gradient(var(--line), var(--line)) top / 100% 1px no-repeat, linear-gradient(var(--line), var(--line)) center / 100% 1px no-repeat; }
.usage-bar { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: end; align-items: center; height: 100%; padding: 0; border: 0; border-radius: 2px 2px 0 0; background: transparent; cursor: pointer; }
.usage-bar > span { display: block; flex-shrink: 0; width: 100%; max-width: 52px; pointer-events: none; }
.usage-bar[aria-pressed="true"], .usage-bar:hover { background: var(--accent-soft); outline: 1px solid var(--accent); outline-offset: -1px; }
.usage-bar:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.usage-dates { grid-column: 2; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; padding: 2px 0; }
.usage-detail { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; margin-top: 16px; padding: 12px; border-radius: 4px; background: var(--panel-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.usage-detail > span { color: var(--muted); }
.usage-detail b { color: var(--ink); font-weight: 500; }
.usage-users-table td:first-child { min-width: 180px; max-width: 300px; white-space: normal; overflow-wrap: anywhere; }
.usage-users-table td small { display: block; color: var(--muted); margin-top: 4px; }
.account-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.account-head-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 329px; max-width: 100%; min-width: 0; }
.account-head-copy > .account-head-kicker { margin: 0; width: 100%; color: #596169; font-size: 12px; font-weight: 400; line-height: 18px; }
.account-head-copy > div { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; }
.account-head h2 { margin: 0; width: 100%; color: #121417; font-size: 24px; font-weight: 700; line-height: 36px; letter-spacing: 0; overflow-wrap: anywhere; }
.account-head-copy p { margin: 0; width: 100%; color: #343a40; font-size: 13px; font-weight: 400; line-height: 19px; }
.account-quota { display: flex; align-items: center; justify-content: space-between; padding: 16px; border: 1px solid #dee2e6; border-radius: 8px; background: #fff; overflow: hidden; }
.account-quota > div { display: flex; flex: 0 0 240px; flex-direction: column; align-items: flex-start; gap: 8px; width: 240px; height: 56px; min-width: 0; }
.account-quota span { color: #343a40; font-size: 12px; font-weight: 400; line-height: 18px; white-space: nowrap; }
.account-quota strong { margin: 0; color: #212529; font-size: 15px; font-weight: 700; line-height: 22px; white-space: nowrap; }
.account-api-card { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; padding: 16px; border: 1px solid #e1e3ea; border-radius: 8px; background: #fff; min-width: 0; }
.account-api-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 46px; }
.account-api-intro { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.account-api-intro h3 { margin: 0; color: #343a40; font-size: 14px; font-weight: 500; line-height: 20px; }
.account-api-intro p, .account-api-empty { margin: 0; color: #596169; font-size: 13px; font-weight: 400; line-height: 19px; }
.account-api-create { flex-shrink: 0; border: 1px solid #1fad9c; border-radius: 8px; padding: 10px 28px; background: #1fad9c; color: #fff; font-size: 14px; font-weight: 700; line-height: 20px; white-space: nowrap; }
.account-api-create:hover { background: #0f8a7b; border-color: #0f8a7b; }
.account-key-list { display: flex; flex-direction: column; gap: 8px; }
.account-key-row { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-radius: 8px; background: #f8f9fa; min-width: 0; }
.account-key-field { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; flex: 0 0 auto; }
.account-key-field.is-status { min-width: 52px; }
.account-key-field > span { color: #0f8a7b; font-size: 12px; font-weight: 400; line-height: 18px; white-space: nowrap; }
.account-key-field > strong { color: #212529; font-size: 12px; font-weight: 500; line-height: 16px; white-space: nowrap; }
:lang(en) .account-key-field.is-status > strong { text-transform: capitalize; }
.account-key-field.is-status > strong.is-active { color: #00b42a; }
.account-key-field.is-status > strong.is-revoked { color: #f53f3f; }
.account-key-actions { display: flex; flex: 0 0 auto; gap: 6px; align-items: center; }
.account-key-actions button { width: 92px; padding: 4px 18px; border: 1px solid #dee2e6; border-radius: 8px; background: #fff; color: #121417; font-size: 16px; font-weight: 500; line-height: 24px; }
.account-key-actions button:hover:not(:disabled) { border-color: #1fad9c; color: #0f8a7b; }
.admin-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.admin-user-row, .admin-user-header { display: grid; grid-template-columns: minmax(180px, 1.4fr) 80px 90px repeat(3, minmax(100px, 1fr)) 64px; gap: 8px; padding: 10px; align-items: center; }
.admin-user-row, .admin-key-row { border: 1px solid var(--line); border-radius: 4px; background: var(--panel-soft); }
.admin-user-header { font-size: 11px; color: var(--muted); }
.admin-key-row { display: grid; grid-template-columns: 1fr 1.5fr 1fr 1fr 70px 70px; gap: 10px; padding: 12px; align-items: center; overflow-wrap: anywhere; }
:root[data-theme="dark"] .account-head-copy > .account-head-kicker { color: var(--nav); }
:root[data-theme="dark"] .account-head h2 { color: var(--ink-strong); }
:root[data-theme="dark"] .account-head-copy p { color: var(--ink); }
:root[data-theme="dark"] .account-quota { border-color: var(--line); background: var(--panel); }
:root[data-theme="dark"] .account-quota span { color: var(--ink); }
:root[data-theme="dark"] .account-quota strong { color: var(--ink-strong); }
:root[data-theme="dark"] .account-api-card { border-color: var(--line); background: var(--panel); }
:root[data-theme="dark"] .account-api-intro h3,
:root[data-theme="dark"] .account-key-field > strong,
:root[data-theme="dark"] .account-key-actions button { color: var(--ink-strong); }
:root[data-theme="dark"] .account-api-intro p,
:root[data-theme="dark"] .account-api-empty { color: var(--nav); }
:root[data-theme="dark"] .account-api-create { border-color: var(--accent); background: var(--accent); color: #092824; }
:root[data-theme="dark"] .account-key-row { background: var(--panel-soft); }
:root[data-theme="dark"] .account-key-field > span { color: var(--accent-text); }
:root[data-theme="dark"] .account-key-actions button { border-color: var(--line); background: var(--panel); }

/* Sign in */
.auth-layout { min-height: 100vh; display: flex; flex-direction: column; background: var(--panel); }
.auth-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 36px; }
.auth-shell { flex: 1; display: grid; grid-template-columns: 1fr 390px; align-items: center; gap: 100px; width: min(1050px, calc(100% - 64px)); margin: 30px auto 70px; }
.auth-kicker { font-size: 10px; letter-spacing: 1.6px; color: var(--accent-text); }
.auth-intro h1 { font-size: 45px; line-height: 1.18; letter-spacing: -1.3px; font-weight: 500; margin: 18px 0; }
.auth-intro > p { color: var(--muted); font-size: 14px; line-height: 1.8; max-width: 380px; }
.auth-diagram { margin: 38px 0 24px; }
.auth-diagram svg { width: 100%; height: auto; }
.diagram-grid { stroke: var(--line); stroke-dasharray: 3 5; }
.diagram-primary { stroke: var(--accent); stroke-width: 2.5; }
.diagram-secondary { stroke: var(--subtle); stroke-width: 1.5; stroke-dasharray: 5 5; }
.auth-diagram > div { display: flex; justify-content: space-between; margin-top: 14px; color: var(--muted); font-size: 10px; }
.auth-intro-foot { color: var(--subtle); font-size: 11px; }
.auth-panel { display: grid; gap: 18px; padding: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); box-shadow: var(--shadow); }
.auth-panel h2 { font-size: 21px; font-weight: 500; margin: 0; letter-spacing: -.3px; }
.auth-panel h1 { margin: 0; font-size: 22px; }
.auth-panel input { height: 40px; }
.auth-copy { font-size: 12px; color: var(--muted); margin: -8px 0 0; }
.auth-text-link { display: inline; justify-self: start; padding: 0; border: 0; background: transparent; color: var(--accent-text); font-size: 12px; }
.auth-text-link:hover { text-decoration: underline; }
.auth-panel label { position: relative; }
.optional-label { position: absolute; right: 0; top: 0; color: var(--subtle); font-size: 11px; }
.auth-panel .run-button { min-height: 40px; }
.auth-error { color: var(--bad); background: var(--bad-soft); border-radius: 4px; padding: 10px; font-size: 12px; margin: 0; }
.auth-register { text-align: center; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }
.auth-register button { margin-left: 3px; font-size: 11px; }
.auth-footer { display: flex; justify-content: space-between; padding: 20px 36px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); }

/* Help tooltips */
.label-with-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.info-dot {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--accent);
  cursor: help;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
}

.info-dot:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.2);
  outline-offset: 2px;
}

.has-tooltip {
  position: relative;
}

.has-tooltip::before,
.has-tooltip::after {
  position: absolute;
  left: 50%;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.has-tooltip::before {
  content: "";
  bottom: calc(100% + 5px);
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(17, 24, 39, 0.14);
  border-bottom: 1px solid rgba(17, 24, 39, 0.14);
  background: var(--tooltip-bg);
  transform: translate(-50%, 5px) rotate(45deg);
}

.has-tooltip::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 10px);
  width: max-content;
  max-width: min(310px, calc(100vw - 44px));
  padding: 10px 12px;
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 8px;
  background: var(--tooltip-bg);
  box-shadow: 0 14px 34px rgba(19, 33, 30, 0.18);
  color: #ffffff;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  transform: translate(-50%, 7px);
}

.has-tooltip:hover::before,
.has-tooltip:hover::after,
.has-tooltip:focus-visible::before,
.has-tooltip:focus-visible::after {
  opacity: 1;
}

.has-tooltip:hover::before,
.has-tooltip:focus-visible::before {
  transform: translate(-50%, 0) rotate(45deg);
}

.has-tooltip:hover::after,
.has-tooltip:focus-visible::after {
  transform: translate(-50%, 0);
}

.info-dot.has-tooltip::before {
  left: 9px;
}

.info-dot.has-tooltip::after {
  left: 0;
  transform: translate(0, 7px);
}

.info-dot.has-tooltip:hover::after,
.info-dot.has-tooltip:focus-visible::after {
  transform: translate(0, 0);
}

.segmented[data-name="mode"] .has-tooltip:nth-child(odd)::before {
  left: 22px;
}

.segmented[data-name="mode"] .has-tooltip:nth-child(odd)::after {
  left: 0;
  transform: translate(0, 7px);
}

.segmented[data-name="mode"] .has-tooltip:nth-child(odd):hover::after,
.segmented[data-name="mode"] .has-tooltip:nth-child(odd):focus-visible::after {
  transform: translate(0, 0);
}

.segmented[data-name="mode"] .has-tooltip:nth-child(even)::before {
  right: 22px;
  left: auto;
  transform: translate(50%, 5px) rotate(45deg);
}

.segmented[data-name="mode"] .has-tooltip:nth-child(even)::after {
  right: 0;
  left: auto;
  transform: translate(0, 7px);
}

.segmented[data-name="mode"] .has-tooltip:nth-child(even):hover::after,
.segmented[data-name="mode"] .has-tooltip:nth-child(even):focus-visible::after {
  transform: translate(0, 0);
}

.segmented[data-name="mode"] .has-tooltip:nth-child(even):hover::before,
.segmented[data-name="mode"] .has-tooltip:nth-child(even):focus-visible::before {
  transform: translate(50%, 0) rotate(45deg);
}

/* Interactive charts */
.interactive-chart-root {
  position: relative;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: none;
}

.chart-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding-right: 146px;
  margin-bottom: 10px;
}

.chart-toolbar h3 {
  margin: 2px 0 0;
  font-size: 14px;
}

.chart-axis-mode {
  grid-template-columns: repeat(2, minmax(58px, 1fr));
}

.chart-menu {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 30;
}

.chart-menu > summary {
  list-style: none;
}

.chart-menu > summary::-webkit-details-marker {
  display: none;
}

.chart-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.chart-menu-button:hover {
  color: var(--accent-text);
  border-color: var(--accent);
}

.chart-menu[open] .chart-menu-button {
  border-color: rgba(15, 118, 110, 0.38);
  background: var(--accent-soft);
}

.chart-menu.stable .chart-menu-popover {
  animation: none;
}

.chart-menu-icon {
  position: relative;
  flex: 0 0 auto;
  width: 15px;
  height: 12px;
}

.chart-menu-icon,
.chart-menu-icon::before,
.chart-menu-icon::after,
.chart-menu-icon span {
  display: block;
}

.chart-menu-icon::before,
.chart-menu-icon::after,
.chart-menu-icon span {
  position: absolute;
  left: 0;
  width: 15px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.chart-menu-icon::before {
  top: 0;
}

.chart-menu-icon span {
  top: 5px;
}

.chart-menu-icon::after {
  bottom: 0;
}

.chart-menu-count {
  padding-left: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.chart-menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  width: min(560px, calc(100vw - 32px));
  max-height: min(72vh, 680px);
  gap: 12px;
  padding: 13px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.18);
  transform-origin: top right;
  animation: chart-menu-in 130ms ease-out;
}

.chart-menu-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chart-menu-head div {
  display: grid;
  gap: 3px;
}

.chart-menu-head strong,
.chart-menu-section-title span:first-child {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.chart-menu-head span,
.chart-menu-section-title span:last-child,
.chart-control-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.chart-control-note {
  margin: 0;
  font-weight: 400;
}

.chart-menu-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chart-menu-actions .chart-axis-mode {
  min-width: 150px;
}

.chart-menu-actions .ghost-button {
  flex: 0 0 auto;
}

.chart-menu-section {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.chart-menu-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chart-toggle-grid,
.series-toggle-list {
  display: grid;
  gap: 8px;
}

.chart-toggle-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.series-toggle-group {
  display: grid;
  gap: 7px;
}

.series-toggle-group > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.series-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-toggle,
.series-toggle {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.chart-toggle {
  width: 100%;
}

.chart-toggle input,
.series-toggle input {
  flex: 0 0 auto;
  width: auto;
}

.series-toggle i {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.chart-toggle.active,
.series-toggle.active {
  border-color: rgba(15, 118, 110, 0.42);
  background: var(--accent-soft);
  color: var(--ink);
}

@keyframes chart-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chart-canvas-wrap {
  position: relative;
  overflow-x: auto;
}

.frequency-chart-section {
  margin-top: 12px;
}

.native-chart {
  display: block;
  min-width: 760px;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--chart-bg);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.native-chart text {
  user-select: none !important;
  -webkit-user-select: none !important;
}

.chart-interval-summary {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow-x: auto;
}

.chart-interval-summary p {
  margin: 6px 0;
  font-size: 12px;
  color: var(--muted);
}

.chart-interval-summary table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.chart-interval-summary th,
.chart-interval-summary td {
  padding: 6px 10px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.chart-interval-summary th:first-child {
  text-align: left;
}

.chart-title {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.chart-y-label,
.chart-axis-text,
.chart-legend {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 2 4;
  opacity: 0.75;
}

.chart-zero {
  stroke: var(--subtle);
  stroke-width: 1;
  stroke-dasharray: 5 4;
  opacity: 0.8;
}

.chart-crosshair {
  stroke: var(--accent);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.chart-brush-track {
  fill: var(--line);
}

.chart-brush-window {
  fill: rgba(15, 118, 110, 0.22);
  stroke: rgba(15, 118, 110, 0.55);
  cursor: grab;
}

.chart-brush-handle {
  cursor: ew-resize;
}

.chart-brush-handle-hit {
  fill: transparent;
  pointer-events: all;
}

.chart-brush-handle-face {
  fill: var(--panel);
  stroke: var(--subtle);
  stroke-width: 1.5;
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.2));
}

.chart-brush-grip {
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 230px;
  max-width: 300px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
  color: var(--ink);
  pointer-events: none;
}

.chart-tooltip p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.chart-tooltip div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 12px;
  line-height: 1.5;
}

.chart-tooltip strong {
  font-variant-numeric: tabular-nums;
}

.chart-loading,
.chart-empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}
.chart-interaction-hint { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.chart-grid { stroke-dasharray: none; opacity: .55; }
.chart-menu-button { min-height: 30px; font-size: 12px; }
.chart-brush-window { fill: var(--accent-soft); stroke: var(--accent); }
.chart-menu[open] .chart-menu-button, .chart-toggle.active, .series-toggle.active { border-color: var(--accent); }
.chart-tooltip { border-color: var(--line); }
.chart-interval-summary { padding: 10px; }
.has-tooltip::after { max-width: min(340px, calc(100vw - 48px)); font-weight: 400; }
.has-tooltip::before, .has-tooltip::after { display: none; }
.has-tooltip:hover::before, .has-tooltip:hover::after,
.has-tooltip:focus-visible::before, .has-tooltip:focus-visible::after { display: block; }

/* Responsive workspace keeps data tables scrollable within their panels. */
@media (min-width: 1550px) {
  .workspace-view { grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; }
  .control-grid { grid-template-columns: 1.1fr 1fr 1fr; gap: 28px; }
}
@media (max-width: 1190px) {
  .app-header { gap: 14px; }
  .header-left { gap: 16px; }
  .workspace-view { grid-template-columns: minmax(0, 1fr) 290px; padding: 18px 16px; gap: 12px; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .control-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .control-grid > section:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; align-items: start; }
  .control-grid > section:last-child > .section-line { grid-column: 1 / -1; margin: 0; }
  .annual-return-row { margin-top: 0; }
  .account-key-row { flex-wrap: wrap; justify-content: flex-start; gap: 16px 24px; }
  .account-key-field > strong { white-space: normal; overflow-wrap: anywhere; }
  .admin-user-row, .admin-user-header { grid-template-columns: minmax(160px, 1.4fr) 65px 90px repeat(3, minmax(60px, 1fr)) 54px; }
}
@media (max-width: 960px) {
  .app-header { height: 98px; flex-wrap: wrap; gap: 0; align-content: start; }
  .header-left { display: contents; }
  .app-header .brand, .app-header .header-actions { height: 54px; }
  .view-tabs { order: 3; width: 100%; height: 44px; overflow-x: auto; }
  .view-tabs button { flex: 1; justify-content: center; }
  .view-tabs button.selected::after { bottom: 0; }
  .usage-trends { grid-template-columns: 1fr; gap: 0; }
  .header-divider { display: none; }
  .view-tabs button > .ui-icon { display: none; }
  .workspace-view { grid-template-columns: 1fr; }
  .workspace-sidebar { position: static; grid-template-columns: 1fr 1fr; align-items: start; }
  .control-grid { grid-template-columns: 1.1fr 1fr 1fr; }
  .control-grid > section:last-child { display: block; grid-column: auto; }
  .control-grid > section:last-child > .section-line { margin-bottom: 9px; }
  .annual-return-row { margin-top: 10px; }
  .history-body { max-height: 340px; }
  .run-config, .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .run-legs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-shell { gap: 36px; grid-template-columns: 1fr 360px; }
  .auth-intro h1 { font-size: 34px; }
  .admin-user-row, .admin-key-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-user-header { display: none; }
}
@media (max-width: 700px) {
  .admin-toolbar { width: 100%; }
  .admin-toolbar label { flex: 1; }
  .usage-summary { grid-template-columns: 1fr; }
  .has-tooltip::after, .info-dot.has-tooltip::after,
  .segmented[data-name="mode"] .has-tooltip:nth-child(n)::after {
    position: fixed; left: 16px; right: 16px; top: auto; bottom: 96px;
    width: auto; max-width: none; transform: none !important; text-align: left;
  }
  .has-tooltip::before { display: none !important; }
  .app-header { height: 98px; flex-wrap: wrap; gap: 0; padding: 0 14px; align-content: start; }
  .header-left { display: contents; }
  .app-header .brand { height: 54px; }
  .app-header .brand-name { font-size: 16px; line-height: 1.2; text-align: left; }
  .app-header .brand-mark { width: 27px; height: 27px; }
  .header-actions { height: 54px; gap: 9px; }
  .header-prefs { gap: 12px; }
  .header-asset { display: none; }
  .view-tabs { order: 3; width: 100%; height: 44px; overflow-x: auto; }
  .view-tabs button { flex: 1; justify-content: center; padding: 0 12px; font-size: 12px; }
  .view-tabs button.selected::after { left: 10px; right: 10px; }
  .workspace-view, .report-view, .docs-view { padding: 16px 12px 24px; }
  .workspace-titlebar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .workspace-titlebar h1 { font-size: 21px; }
  .coverage-note { padding: 7px 10px; width: 100%; }
  .coverage-note > div { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
  .coverage-note strong { font-size: 11px; }
  .panel-heading { padding: 9px 12px; }
  .panel-body { padding: 12px; }
  .panel-meta { font-size: 10px; }
  .field-grid { gap: 12px; }
  .setup-fields .wide-field { grid-column: 1 / -1; }
  .setup-fields > .session-field { grid-column: 1 / -1; }
  .schedule-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .weekday-chip { padding: 6px 8px; min-height: 32px; }
  .control-grid { grid-template-columns: 1fr; gap: 16px; }
  .control-grid > section:last-child { display: block; }
  .segmented button { min-height: 32px; padding: 4px; }
  .segmented[data-name="hedge"] > button,
  .segmented[data-name="hedge"] .hedge-hourly,
  .segmented[data-name="mode"] > button,
  .segmented[data-name="numeraire"] > button { min-height: 32px; }
  .annual-return-row { grid-template-columns: 1fr 1fr; align-items: center; }
  .annual-principal { display: grid; grid-template-columns: 1fr; }
  .annual-principal input { height: 32px; }
  .workspace-sidebar { grid-template-columns: 1fr; }
  .summary-panel { display: none; }
  .run-actionbar { padding: 10px; }
  .run-actionbar > span { font-size: 10px; max-width: 140px; }
  .run-actionbar .run-button { min-height: 38px; padding: 8px 13px; }
  .indicator-row { grid-template-columns: 1fr 1fr; position: relative; padding-right: 40px; }
  .indicator-row > label:first-child { grid-column: 1 / -1; }
  .indicator-row > .delete-indicator { position: absolute; right: 5px; top: 10px; }
  .signal-rule-grid { grid-template-columns: 1fr 1fr; }
  .output-customization-heading { align-items: flex-start; }
  .output-customization-heading h3 { font-size: 11px; }
  .status-bar { padding: 0 10px; }
  .health { gap: 14px; font-size: 9px; }
  .status-caption, .ticker-status { display: none !important; }
  .report-head, .docs-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .report-head h2, .docs-head h2 { font-size: 21px; }
  .artifact-strip { justify-content: flex-start; }
  .run-config { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-config > div { padding: 10px; }
  .run-config > div:nth-child(odd) { border-left: 0; }
  .run-legs-grid { grid-template-columns: 1fr; }
  .run-signal-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 12px; }
  .kpi strong { font-size: 20px; }
  .docs-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-status > div { padding: 12px; }
  .account-head { align-items: flex-start; flex-direction: column; }
  .account-head-copy { width: auto; }
  .account-quota { flex-wrap: wrap; justify-content: flex-start; gap: 16px 24px; }
  .account-quota > div { flex: 1 1 200px; width: auto; height: auto; }
  .account-api-header { align-items: flex-start; flex-direction: column; }
  .account-key-row, .admin-form, .admin-user-row, .admin-key-row { grid-template-columns: 1fr 1fr; }
  .account-key-row { display: grid; }
  .account-key-field.is-key, .account-key-actions { grid-column: 1 / -1; }
  .admin-user-row > strong { grid-column: 1 / -1; }
  .chart-toolbar { padding-right: 100px; }
  .chart-interaction-hint { font-size: 10px; }
  .chart-menu { top: 12px; right: 12px; }
  .chart-menu-button { padding: 0 8px; gap: 5px; }
  .chart-menu-count { display: none; }
  .chart-menu-popover { max-width: calc(100vw - 52px); max-height: 65vh; }
  .chart-toggle-grid { grid-template-columns: 1fr; }
  .interactive-chart-root { padding: 10px; }
  .auth-header { padding: 20px; flex-wrap: wrap; gap: 16px; }
  .auth-shell { display: block; width: min(410px, calc(100% - 32px)); margin: 24px auto 40px; }
  .auth-intro { display: none; }
  .auth-panel { padding: 24px; }
  .auth-footer { padding: 18px 20px; font-size: 10px; }
  .empty-state { min-height: 330px; padding: 22px; }
  .empty-state h2 { font-size: 18px; }
}
@media (max-width: 420px) {
  .app-header { padding: 0 10px; }
  .header-actions { gap: 6px; }
  .start-date-heading { gap: 4px; }
  .date-shortcuts { gap: 2px; }
  .date-shortcuts button { padding-inline: 1px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.pro-label { display: inline-block; padding: 1px 5px; border-radius: 4px; background: linear-gradient(135deg, #4d3cc8, #9b55d1); color: white; font-size: 10px; font-weight: 700; line-height: 1.5; vertical-align: middle; }
.avatar-pro { position: absolute; left: 50%; bottom: -3px; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; width: 32px; height: 12px; margin: 0; padding: 0; border-radius: 2px; color: var(--avatar-ink); background: linear-gradient(90deg, #03d7d6 25.96%, #4aa8ff 100%); pointer-events: none; }
.avatar-pro-mark { display: block; }
.segmented .pro-locked { color: var(--muted); opacity: .62; }
.pro-info { display: inline-flex; position: relative; align-items: center; margin-left: 5px; vertical-align: middle; }
.pro-delta-heading { display: flex; align-items: center; margin-bottom: 5px; }
.pro-delta-heading label { color: var(--muted); font-size: 12px; }
.delta-model { position: relative; width: 100%; min-width: 0; }
.delta-model-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; height: 34px; padding: 5px 9px; border: 1px solid var(--input-line); border-radius: 4px; background: var(--panel); color: var(--ink); font-size: 13px; line-height: 1.5; text-align: left; }
.delta-model-trigger:hover { border-color: var(--accent); }
.delta-model-trigger:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.delta-model-trigger > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.delta-model-trigger::after { content: ""; flex: 0 0 auto; width: 7px; height: 7px; margin-right: 2px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-2px) rotate(45deg); }
.delta-model-trigger[aria-expanded="true"]::after { transform: translateY(1px) rotate(225deg); }
.delta-model-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 8px; border: 1px solid #dee2e6; border-radius: 8px; background: #f8f9fa; box-shadow: 0 9px 28px 8px rgba(0, 0, 0, 0.05), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12); }
.delta-model-menu[hidden] { display: none; }
.delta-model-group { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.delta-model-caption { margin: 0; color: #8b959f; font-size: 12px; font-weight: 400; line-height: 16px; white-space: nowrap; }
.delta-model-pro-caption { display: flex; align-items: center; gap: 2px; }
.delta-model-pro-caption > .delta-model-help,
.detail-csv-line > .detail-csv-tip { display: flex; align-items: center; line-height: 0; }
.delta-model-group:has(.delta-model-help) { position: relative; }
.delta-model-help { --delta-tip-bg: #dee2e6; --delta-tip-ink: #495057; --delta-tip-title: #343a40; --tip-gap: 8px; }
.delta-model-help.hedge-tip { position: static; }
.delta-model-help .pro-info-trigger { display: inline-flex; align-items: center; justify-content: center; width: 12px; height: 12px; min-height: 12px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.delta-model-help .pro-info-trigger:hover { background: transparent; }
.delta-model-help img { display: block; }
.delta-model-help .hedge-tip-popup {
  display: block;
  top: var(--popup-top, 22px);
  left: 0;
  right: 0;
  z-index: 6;
  width: auto;
  max-width: none;
  padding: var(--tip-gap) 0 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--delta-tip-ink);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.8);
  transform-origin: var(--arrow-x, 50%) var(--tip-gap);
  transition: opacity 0.2s cubic-bezier(0.08, 0.82, 0.17, 1), transform 0.2s cubic-bezier(0.08, 0.82, 0.17, 1), visibility 0s linear 0.2s;
}
.delta-model-help.is-open .hedge-tip-popup,
.delta-model-help:focus-within .hedge-tip-popup {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
  transition: opacity 0.2s cubic-bezier(0.08, 0.82, 0.17, 1), transform 0.2s cubic-bezier(0.08, 0.82, 0.17, 1), visibility 0s linear 0s;
}
.delta-model-tip-arrow {
  position: absolute;
  z-index: 1;
  top: var(--tip-gap);
  left: var(--arrow-x, 50%);
  width: 16px;
  height: 16px;
  overflow: hidden;
  pointer-events: none;
  transform: translate(-50%, calc(-100% + 1px));
}
.delta-model-tip-arrow::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 16px;
  height: 8px;
  background: var(--delta-tip-bg);
  clip-path: path("M 0 8 A 4 4 0 0 0 2.82842712474619 6.82842712474619 L 6.585786437626905 3.0710678118654755 A 2 2 0 0 1 9.414213562373096 3.0710678118654755 L 13.17157287525381 6.82842712474619 A 4 4 0 0 0 16 8 Z");
}
.delta-model-tip-card { position: relative; z-index: 1; display: block; padding: 12px; border-radius: 4px; background: var(--delta-tip-bg); }
.delta-model-tip strong { display: block; margin: 0 0 8px; color: var(--delta-tip-title); font-size: 12px; font-weight: 500; line-height: 16px; }
.delta-model-tip .delta-model-tip-more,
.delta-model-tip .delta-model-tip-more:hover { display: inline-flex; align-items: center; gap: 2px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: #1fad9c; font-size: 12px; font-weight: 400; line-height: 16px; vertical-align: baseline; white-space: nowrap; }
.delta-model-tip-more-label { text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 2px; }
.delta-model-tip-more svg { display: block; flex: 0 0 auto; }
:root[data-theme="dark"] .delta-model-help,
:root[data-theme="dark"] .detail-csv-tip,
:root[data-theme="dark"] .hourly-pro-tip { --delta-tip-bg: #343a40; --delta-tip-ink: #dee2e6; --delta-tip-title: #f8f9fa; }
.detail-csv-tip,
.hourly-pro-tip { --delta-tip-bg: #dee2e6; --delta-tip-ink: #495057; --delta-tip-title: #343a40; --tip-gap: 8px; position: relative; flex: 0 0 auto; }
.detail-csv-tip .pro-info-trigger,
.hourly-pro-tip .pro-info-trigger { display: inline-flex; align-items: center; justify-content: center; width: 12px; height: 12px; min-height: 12px; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: pointer; }
.detail-csv-tip .pro-info-trigger:hover,
.hourly-pro-tip .pro-info-trigger:hover { background: transparent; border-color: transparent; }
.detail-csv-tip .pro-info-trigger img,
.hourly-pro-tip .pro-info-trigger img { display: block; }
.detail-csv-tip .hedge-tip-popup,
.hourly-pro-tip .hedge-tip-popup {
  display: block;
  top: 100%;
  left: 50%;
  z-index: 40;
  width: 244px;
  max-width: min(244px, calc(100vw - 48px));
  padding: var(--tip-gap) 0 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--delta-tip-ink);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) scale(0.8);
  transform-origin: center var(--tip-gap);
  transition: opacity 0.2s cubic-bezier(0.08, 0.82, 0.17, 1), transform 0.2s cubic-bezier(0.08, 0.82, 0.17, 1), visibility 0s linear 0.2s;
}
.detail-csv-tip.is-open .hedge-tip-popup,
.detail-csv-tip:focus-within .hedge-tip-popup,
.hourly-pro-tip.is-open .hedge-tip-popup,
.hourly-pro-tip:focus-within .hedge-tip-popup {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
  transition: opacity 0.2s cubic-bezier(0.08, 0.82, 0.17, 1), transform 0.2s cubic-bezier(0.08, 0.82, 0.17, 1), visibility 0s linear 0s;
}
.delta-model-options { display: flex; flex-direction: column; gap: 8px; }
.delta-model-option { position: relative; display: flex; align-items: center; width: 100%; height: 32px; padding: 0 12px; border: 0; border-radius: 4px; background: #fff; color: #212529; font-size: 12px; font-weight: 500; line-height: 16px; text-align: left; }
.delta-model-option > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.delta-model-option.is-basic::before { content: ""; position: absolute; left: 0; top: 9px; width: 2px; height: 14px; border-radius: 2px; background: #8b959f; }
.delta-model-option.is-pro { padding-right: 52px; }
.delta-model-option.is-locked,
.delta-model-option.is-locked:hover { color: #8b959f; background: #fff; cursor: default; }
.delta-model-option:hover:not(.is-locked) { background: var(--brand-50); }
.delta-model-accent { position: absolute; left: 0; top: 9px; width: 2px; height: 14px; border-radius: 2px; object-fit: cover; pointer-events: none; }
.delta-model-pro-mark { position: absolute; right: 2px; bottom: 2px; width: 46px; height: 16px; pointer-events: none; }
:root[data-theme="dark"] .delta-model-menu { border-color: var(--line); background: var(--panel-soft); }
:root[data-theme="dark"] .delta-model-option,
:root[data-theme="dark"] .delta-model-option.is-locked,
:root[data-theme="dark"] .delta-model-option.is-locked:hover { background: var(--panel); }
:root[data-theme="dark"] .delta-model-option.is-basic,
:root[data-theme="dark"] .delta-model-option.is-pro:not(.is-locked) { color: var(--ink-strong); }
:root[data-theme="dark"] .delta-model-option:hover:not(.is-locked) { background: var(--brand-50); }
.pro-info-trigger { width: 19px; height: 19px; border: 1px solid var(--input-line); border-radius: 50%; background: var(--panel); color: var(--accent-text); font-size: 12px; line-height: 1; }
.pro-popover { display: none; position: absolute; z-index: 50; top: calc(100% + 7px); right: 0; width: min(280px, 80vw); padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); color: var(--ink); }
.pro-popover strong, .pro-popover span { display: block; margin-bottom: 6px; }
.pro-popover button { border: 0; padding: 0; background: transparent; color: var(--accent-text); }
.pro-info:hover .pro-popover, .pro-info:focus-within .pro-popover { display: block; }

/* Size Delta hedging to its tabs, and give up width from Backtest mode, once the row can hold that without crowding the other columns. */
.builder-section:has(.control-grid) > .panel-body {
  container-type: inline-size;
  container-name: strategy-config;
}
@container strategy-config (min-width: 940px) {
  .control-grid { grid-template-columns: minmax(0, 1fr) max-content minmax(0, 1.05fr); }
  .control-grid > section:nth-child(2) { display: flex; flex-direction: column; align-items: flex-start; width: max-content; min-width: max-content; }
  .control-grid > section:nth-child(2) > :not([data-name="hedge"]) { align-self: stretch; width: 0; min-width: 100%; }
  /* Wheel replaces the hedge control, which otherwise sets this column's width. */
  .control-grid > section:nth-child(2) > .wheel-ddh-note { width: 280px; min-width: 280px; }
  .segmented[data-name="hedge"] { flex-wrap: nowrap; width: max-content; max-width: none; }
}
.pro-status-card { margin-top: 16px; }
.admin-pro-state { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; }
.pro-status-card.is-active,
.pro-status-card.is-inactive { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; overflow: hidden; padding: 16px; border: 1.5px solid #dee2e6; border-radius: 8px; background: #fff; }
.pro-status-texture { position: absolute; inset: 0; width: 346px; height: 100px; opacity: .6; pointer-events: none; background-color: transparent; background-image: linear-gradient(45deg, var(--brand-100) 25%, transparent 25%, transparent 75%, var(--brand-100) 75%), linear-gradient(45deg, var(--brand-100) 25%, var(--brand-50) 25%, var(--brand-50) 75%, var(--brand-100) 75%); background-size: 32px 32px; background-position: 0 0, 16px 16px; -webkit-mask-image: linear-gradient(135deg, #000 0%, rgb(0 0 0 / .6) 30%, transparent 90%); mask-image: linear-gradient(135deg, #000 0%, rgb(0 0 0 / .6) 30%, transparent 90%); }
.pro-status-copy { position: relative; z-index: 1; display: flex; flex: 1 1 auto; flex-direction: column; gap: 12px; align-items: flex-start; justify-content: center; min-width: 0; }
.pro-status-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pro-status-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pro-status-name h3 { margin: 0; color: #121417; font-size: 24px; font-weight: 700; line-height: 36px; text-transform: capitalize; white-space: nowrap; }
.pro-status-pill { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 4px; height: 24px; padding: 4px 14px; overflow: hidden; border: 1px solid #b2e6df; border-radius: 8px; background: #d4f7f3; color: #1fad9c; font-size: 12px; font-weight: 700; line-height: 16px; text-transform: uppercase; white-space: nowrap; }
.pro-status-pill.is-inactive { background: #e9ecef; border-color: #dee2e6; color: #596169; }
.pro-status-dot { flex: 0 0 10px; width: 10px; height: 10px; background: radial-gradient(circle, #1fad9c 4px, transparent 4px); }
.pro-status-pill.is-inactive .pro-status-dot { background: radial-gradient(circle, #596169 4px, transparent 4px); }
.pro-status-expiry { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; color: #121417; font-size: 14px; line-height: 20px; text-transform: capitalize; white-space: nowrap; }
.pro-status-expiry > span { color: #343a40; font-weight: 400; }
.pro-status-expiry strong { font-weight: 500; }
.pro-status-expiry strong span { color: #8b959f; font-weight: 400; }
.pro-status-watermark { position: absolute; top: 27px; right: 3px; z-index: 0; display: block; pointer-events: none; }
.pro-status-card.is-compact .pro-status-watermark { top: 50%; transform: translateY(-50%); }
.pro-status-details { position: relative; z-index: 1; display: inline-flex; flex: 0 0 156px; align-items: center; justify-content: center; width: 156px; padding: 10px 28px; border: 1px solid #1fad9c; border-radius: 8px; background: #1fad9c; color: #fff; font-size: 14px; font-weight: 700; line-height: 20px; white-space: nowrap; }
.pro-status-details:hover { background: #189e8e; border-color: #189e8e; }
:root[data-theme="dark"] .pro-status-card.is-active,
:root[data-theme="dark"] .pro-status-card.is-inactive { background: var(--panel); border-color: var(--line); }
:root[data-theme="dark"] .pro-status-name h3,
:root[data-theme="dark"] .pro-status-expiry { color: var(--ink-strong); }
:root[data-theme="dark"] .pro-status-expiry > span { color: var(--ink); }
:root[data-theme="dark"] .pro-status-card.is-active .pro-status-pill { background: #12332f; border-color: #1d5c54; color: #40bfb0; }
:root[data-theme="dark"] .pro-status-pill.is-inactive { background: #212529; border-color: #343a40; color: #adb5bd; }
:root[data-theme="dark"] .pro-status-pill.is-inactive .pro-status-dot { background: radial-gradient(circle, #adb5bd 4px, transparent 4px); }
:root[data-theme="dark"] .pro-status-details { background: var(--accent); border-color: var(--accent); color: var(--button-ink); }
:root[data-theme="dark"] .pro-status-details:hover { background: var(--button-hover); border-color: var(--button-hover); }
@media (max-width: 560px) {
  .pro-status-card.is-active,
  .pro-status-card.is-inactive { align-items: stretch; flex-wrap: wrap; }
  .pro-status-details { flex-basis: 100%; width: 100%; }
  .pro-status-expiry, .pro-status-name h3 { white-space: normal; }
}
.pro-modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; overflow: auto; padding: 20px; background: #111a24aa; }
.pro-modal { position: relative; display: flex; flex-direction: column; align-items: center; width: min(640px, 100%); overflow: hidden; border: 0; border-radius: 8px; background: #fff; }
.pro-modal-glow { position: absolute; top: 0; left: 0; width: 100%; height: 156px; border-radius: 8px 8px 0 0; background: linear-gradient(to bottom, #d4f7f3, rgb(212 247 243 / 0)); pointer-events: none; }
.pro-modal-wave { position: absolute; top: 31px; left: -14px; z-index: 1; pointer-events: none; }
.pro-modal-header, .pro-modal-body, .pro-modal-actions { position: relative; z-index: 2; width: 100%; }
.pro-modal-header-content { display: flex; flex-direction: column; gap: 16px; height: 154px; padding: 24px 24px 0; }
.pro-modal-brand { display: flex; align-items: center; gap: 8px; }
.pro-modal-brand span { color: #000; font-size: 24px; font-weight: 500; line-height: 48px; letter-spacing: .28px; white-space: nowrap; }
.pro-modal h2 { margin: 0; width: 100%; color: #000; font-size: 22px; font-weight: 700; line-height: 36px; text-align: center; }
.pro-modal-close { position: absolute; top: 16px; right: 16px; display: flex; align-items: center; justify-content: center; padding: 10px; border: 0; border-radius: 8px; background: transparent; }
.pro-modal-body { display: flex; flex-direction: column; gap: 24px; padding: 0 24px 16px; }
.pro-modal-copy { display: flex; flex-direction: column; gap: 12px; }
.pro-modal p { margin: 0; color: #596169; font-size: 14px; font-weight: 400; line-height: 20px; }
.pro-package { position: relative; display: flex; flex-direction: column; justify-content: center; height: 80px; margin: 0; padding: 16px; overflow: hidden; border: 1.5px solid #d4f7f3; border-radius: 8px; background: transparent; color: #121417; }
.pro-package strong { position: relative; z-index: 1; color: #121417; font-size: 24px; font-weight: 700; line-height: 36px; text-transform: capitalize; }
.pro-package-mark { position: absolute; top: 8.5px; right: 4.5px; z-index: 0; pointer-events: none; }
.pro-modal-actions { display: flex; gap: 12px; margin: 0; padding: 24px; background: #fff; }
.pro-modal-cancel, .pro-modal-activate { display: flex; flex: 1 1 0; align-items: center; justify-content: center; min-width: 0; padding: 10px 28px; border-radius: 8px; font-size: 14px; font-weight: 700; line-height: 20px; white-space: nowrap; }
.pro-modal-cancel { border: 1px solid transparent; background: #e9ecef; color: #212529; }
.pro-modal-cancel:hover { background: #dee2e6; }
.pro-modal-activate { border: 1px solid #1fad9c; background: #1fad9c; color: #fff; }
.pro-modal-activate:hover { border-color: #189e8e; background: #189e8e; }
:root[data-theme="dark"] .pro-modal,
:root[data-theme="dark"] .pro-modal-actions { background: var(--panel); }
:root[data-theme="dark"] .pro-modal-glow { background: linear-gradient(to bottom, #0a2925, rgb(10 41 37 / 0)); }
:root[data-theme="dark"] .pro-modal-brand span,
:root[data-theme="dark"] .pro-modal h2,
:root[data-theme="dark"] .pro-package,
:root[data-theme="dark"] .pro-package strong { color: var(--ink-strong); }
:root[data-theme="dark"] .pro-modal p { color: var(--muted); }
:root[data-theme="dark"] .pro-package { border-color: #1d5c54; }
:root[data-theme="dark"] .pro-modal-cancel { background: #212529; color: var(--ink); }
:root[data-theme="dark"] .pro-modal-cancel:hover { background: #343a40; }
:root[data-theme="dark"] .pro-modal-activate { border-color: var(--accent); background: var(--accent); color: var(--button-ink); }
:root[data-theme="dark"] .pro-modal-activate:hover { border-color: var(--button-hover); background: var(--button-hover); }
