:root {
  color-scheme: light;
  /* Shared with iOS AppTheme and LaunchTheme; see docs/brand.md. */
  --ink: #142e26;
  --ink-soft: #4f665c;
  --muted: #61796d;
  --line: #d7e4dc;
  --canvas: #f2faf5;
  --panel: #ffffff;
  --teal: #0f6b54;
  --teal-dark: #123f30;
  --teal-pale: #e7f5ed;
  --amber: #865512;
  --amber-pale: #fbf0d9;
  --red: #c24038;
  --red-pale: #fcedea;
  --positive: #299e6e;
  --green: #16714f;
  --green-pale: #e7f5ed;
  --brand-ink: #0d2d25;
  --brand-green: #0f6b54;
  --brand-gold: #e9c477;
  --brand-ivory: #faf0d5;
  --brand-mint: #b5e6cc;
  --brand-mist: #f2faf5;
  --surface-soft: #f6faf7;
  --focus-ring: rgba(15, 107, 84, .16);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); min-width: 320px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); line-height: 1.6; }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: .12em; margin: 0 0 7px; font-weight: 700; }

.auth-screen { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 48px 6vw; background: var(--canvas); }
.auth-layout { width: min(1180px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) 480px; align-items: center; gap: clamp(48px, 8vw, 120px); }
.auth-intro { min-width: 0; padding: 16px 0; }
.intro-brand { display: flex; align-items: center; gap: 14px; }
.intro-brand-copy { display: grid; gap: 7px; }
.brand-wordmark { color: var(--ink); font-size: 23px; font-weight: 750; letter-spacing: .12em; }
.intro-brand .eyebrow { font-size: 9px; letter-spacing: .16em; }
.intro-brand .eyebrow { margin: 0; }
.auth-intro h1 { display: flex; align-items: center; gap: 22px; margin: 42px 0 22px; color: var(--ink); font-size: clamp(42px, 5vw, 64px); font-weight: 650; line-height: 1.1; letter-spacing: .08em; }
.auth-brand-line { width: 44px; height: 4px; border-radius: 4px; background: var(--brand-gold); }
.auth-lede { margin: 0; color: var(--ink); font-size: clamp(20px, 2.2vw, 28px); font-weight: 600; line-height: 1.5; }
.auth-brand-description { color: var(--ink-soft); margin: 12px 0 0; font-size: 14px; line-height: 1.7; }
.intro-status-list { display: grid; gap: 22px; margin-top: 42px; max-width: 420px; }
.intro-status-list > div { display: flex; gap: 13px; align-items: flex-start; }
.intro-status-icon { width: 24px; height: 24px; display: grid; place-items: center; color: var(--teal); background: var(--teal-pale); border-radius: 50%; font-size: 11px; flex: 0 0 auto; }
.intro-status-list strong, .intro-status-list span { display: block; }
.intro-status-list strong { font-size: 14px; }
.intro-status-list span:not(.intro-status-icon) { color: var(--ink-soft); font-size: 13px; margin-top: 3px; line-height: 1.5; }
.auth-intro-footer { margin-top: 48px; color: var(--ink-soft); font-size: 9px; font-weight: 600; letter-spacing: .18em; }
.auth-panel { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 36px; box-shadow: 0 16px 48px rgba(13, 45, 37, .05); }
.auth-panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
.auth-panel-heading h2 { margin: 0; font-size: 22px; }
.auth-mode-switch { display: flex; gap: 4px; padding: 4px; margin: 0 0 18px; background: var(--surface-soft); border: 1px solid var(--line); }
.auth-mode { flex: 1; border: 0; border-radius: 3px; padding: 9px 12px; color: var(--ink-soft); background: transparent; font-weight: 700; }
.auth-mode.active { color: var(--teal-dark); background: #fff; box-shadow: 0 1px 3px rgba(20, 46, 38, .12); }
.file-mode-notice { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--surface-soft); }
.file-mode-panel { width: min(100%, 460px); background: var(--panel); border: 1px solid var(--line); padding: 40px; box-shadow: 0 18px 48px rgba(20, 46, 38, .12); }
.file-mode-panel h1 { font-size: 28px; line-height: 1.2; margin: 18px 0 10px; }
.address-hint { display: block; margin-top: 12px; padding: 10px 12px; color: var(--ink-soft); background: var(--surface-soft); font-size: 12px; overflow-wrap: anywhere; }
.brand-mark { display: block; width: 52px; height: 52px; object-fit: contain; background: var(--brand-ink); border-radius: 14px; flex: 0 0 auto; }
.brand-mark.small { width: 40px; height: 40px; border-radius: 11px; }
.boot-brand { text-align: center; }
.boot-brand .brand-mark { margin: 0 auto 18px; }
.boot-brand strong { color: var(--ink); letter-spacing: .1em; }
.boot-brand strong span { margin-left: 8px; letter-spacing: .15em; }
.boot-brand p { margin-top: 16px; font-size: 13px; }
.setup-box h3 { margin: 0; font-size: 17px; }
.auth-form { display: grid; gap: 16px; margin-top: 30px; }
#login-credentials-fields { display: grid; gap: 16px; }
label { color: var(--ink-soft); font-size: 13px; font-weight: 650; }
input, select { width: 100%; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none; }
.static-control { width: 100%; color: var(--ink-soft); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 4px; padding: 11px 12px; }
input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 107, 84, .12); }
.button { border: 1px solid transparent; border-radius: 10px; padding: 10px 14px; font-weight: 650; transition: background .15s ease, border-color .15s ease; }
.button:focus-visible, .nav-item:focus-visible, .icon-button:focus-visible, .auth-switch-link:focus-visible { outline: 3px solid var(--brand-mint); outline-offset: 3px; }
.auth-form input { min-height: 50px; }
.auth-form > .button { min-height: 50px; margin-top: 4px; }
.button.primary { background: var(--teal); color: #fff; }
.button.primary:hover { background: var(--teal-dark); }
.button.secondary { background: var(--teal-pale); color: var(--teal-dark); }
.button.ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.button.danger { background: var(--red-pale); color: var(--red); }
.full-width { width: 100%; }
.form-message { min-height: 20px; color: var(--red); font-size: 13px; margin: 0; }
.security-note { margin: 28px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.auth-switch-link { display: block; margin-top: 14px; text-align: center; color: var(--teal); font-size: 13px; font-weight: 650; text-decoration: none; }
.auth-switch-link:hover { color: var(--teal-dark); text-decoration: underline; }
.toast { position: fixed; z-index: 20; right: 22px; bottom: 22px; max-width: min(360px, calc(100vw - 32px)); padding: 12px 15px; background: var(--ink); color: #fff; border-left: 3px solid #62d9a2; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; font-size: 13px; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-left-color: #f38b8b; }
.setup-box { border: 1px solid #e8c56f; background: #fffaf0; padding: 16px; margin-top: 24px; }
.setup-result { margin-top: 16px; color: var(--ink); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.qr-layout { display: flex; align-items: center; gap: 14px; padding: 12px; background: #fff; border: 1px solid #ecdcae; }
.qr-frame { width: 128px; height: 128px; padding: 7px; background: #fff; border: 1px solid var(--line); flex: 0 0 auto; }
.qr-frame img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.qr-copy strong, .qr-copy span { display: block; }
.qr-copy strong { font-size: 13px; }
.qr-copy span { color: var(--ink-soft); margin-top: 5px; }
.secret-block { margin-top: 12px; }
.secret-block span { color: var(--ink-soft); font-size: 11px; }
.secret-block code, .uri-details code { display: block; background: #fff; border: 1px solid #ecdcae; padding: 9px; margin-top: 5px; user-select: all; }
.uri-details { margin-top: 10px; color: var(--ink-soft); }
.uri-details summary { cursor: pointer; font-size: 12px; }
.uri-details code { white-space: pre-wrap; overflow-wrap: anywhere; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; gap: 34px; padding: 28px 16px; background: var(--brand-ink); color: var(--brand-ivory); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { color: var(--brand-ivory); font-size: 15px; font-weight: 650; letter-spacing: .07em; white-space: nowrap; }
.sidebar-brand strong em { display: block; margin-top: 4px; color: var(--brand-gold); font-size: 12px; font-style: normal; font-weight: 500; letter-spacing: .2em; }
.sidebar-brand span { color: #b5c9be; font-size: 10px; margin-top: 6px; }
.main-nav { display: grid; gap: 5px; }
.nav-item { border: 0; background: transparent; color: #c4d6cb; border-radius: 10px; display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px; font-weight: 600; }
.nav-item:hover { color: var(--brand-ivory); background: #173e32; }
.nav-item.active { color: var(--brand-ivory); background: #1b493b; box-shadow: inset 3px 0 var(--brand-gold); }
.nav-icon { display: inline-grid; place-items: center; width: 20px; color: var(--brand-mint); font-size: 18px; }
.nav-item.active .nav-icon { color: var(--brand-gold); }
.sidebar-footer { margin-top: auto; display: flex; align-items: center; gap: 8px; color: #b5c9be; font-size: 12px; padding: 8px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.online { background: var(--positive); box-shadow: 0 0 0 4px rgba(41, 158, 110, .12); }
.status-dot.warning { background: var(--amber); }
.content-shell { min-width: 0; }
.topbar { min-height: 82px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 34px; }
.topbar h2 { margin: 0; font-size: 23px; letter-spacing: -.01em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.badge { display: inline-flex; align-items: center; padding: 6px 8px; border-radius: 6px; font-size: 10px; font-weight: 750; letter-spacing: .08em; }
.badge.neutral { color: var(--ink-soft); background: var(--surface-soft); }
.badge.green { color: var(--green); background: var(--green-pale); }
.badge.amber { color: var(--amber); background: var(--amber-pale); }
.badge.red { color: var(--red); background: var(--red-pale); }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); color: var(--ink-soft); background: #fff; border-radius: 4px; font-size: 20px; line-height: 1; }
.icon-button:hover { color: var(--teal); border-color: var(--teal); }
.view-root { width: min(100%, 2400px); margin: 0 auto; padding: 30px 34px 50px; }
.app-message { margin: 15px 34px 0; padding: 11px 14px; background: var(--red-pale); color: var(--red); border-left: 3px solid var(--red); font-size: 13px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-intro h3 { margin: 0; font-size: 25px; }
.page-intro p { margin: 5px 0 0; }
.page-intro > .button { flex: 0 0 auto; white-space: nowrap; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; min-height: 112px; }
.metric-link { display: block; width: 100%; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.metric-link:hover { border-color: var(--teal); box-shadow: 0 4px 12px rgba(15, 107, 84, .12); transform: translateY(-1px); }
.metric-link:focus-visible { outline: 3px solid rgba(15, 107, 84, .22); outline-offset: 2px; }
.metric-label { color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.metric-value { display: block; font-size: 25px; letter-spacing: -.02em; margin-top: 16px; }
.metric-caption { display: block; color: var(--muted); font-size: 11px; margin-top: 7px; }
.overview-summary-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: none; }
.metric-value.positive { color: var(--green); }
.metric-value.negative { color: var(--red); }
.skip-reason-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 18px; }
.skip-reason-list > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--surface-soft); color: var(--ink-soft); }
.skip-reason-list strong { color: var(--ink); }
.layout-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr); gap: 18px; align-items: start; }
/* Membership is configured from the existing user row, in one dialog. */
.admin-membership-cell { min-width: 180px; }
.admin-membership-cell .button { margin-top: 8px; }
.membership-modal-panel { width: min(780px, calc(100vw - 32px)); max-height: 88vh; overflow-y: auto; }
.membership-modal-panel .panel-header > div { min-width: 0; overflow-wrap: anywhere; }
.membership-modal-panel .compact-form input { min-width: 0; max-width: 100%; }
.membership-records table { min-width: 0; }
.membership-records th, .membership-records td { white-space: normal; overflow-wrap: anywhere; padding-inline: 10px; }
.membership-review { display: grid; gap: 6px; }
.membership-review dd { margin: 0 0 10px; overflow-wrap: anywhere; }
#membership-reviewed { width: auto; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 18px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding: 16px 18px; }
.panel-header h3 { margin: 0; font-size: 16px; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }
.holding-toolbar { display: flex; align-items: center; gap: 9px; }
.holding-toolbar label { white-space: nowrap; }
.holding-toolbar select { width: auto; min-width: 170px; padding: 8px 10px; }
.compact-field { min-width: 150px; }
.compact-field label { color: var(--muted); font-size: 11px; font-weight: 700; }
.compact-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.compact-form .wide { grid-column: 1 / -1; }
.form-field { display: grid; gap: 6px; }
.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modal-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(20, 46, 38, .42); overflow-y: auto; }
.modal-panel { width: min(920px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 70px rgba(13, 45, 37, .18); }
.modal-panel .panel-header { position: sticky; top: 0; z-index: 1; background: var(--panel); }
.totp-modal-panel { width: min(460px, 100%); }
.totp-modal-form { display: grid; gap: 10px; margin-top: 16px; }
.totp-modal-form input { letter-spacing: .18em; text-align: center; font-size: 20px; }
.settings-security-note { margin: 16px 0 0; }
.condition-parameter-grid { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 4px; }
.condition-parameter-grid label { display: grid; gap: 4px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.condition-parameter-input { display: flex; align-items: center; gap: 5px; }
.condition-parameter-input input { min-width: 0; padding: 7px 8px; font-size: 12px; }
.condition-parameter-input small { color: var(--muted); white-space: nowrap; font-size: 11px; }
.strategy-replacement-setting { display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--ink); font-size: 13px; }
.strategy-replacement-setting input { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; accent-color: var(--teal); }
.setting-toggle-copy { display: grid; gap: 4px; min-width: 0; }
.setting-toggle-copy strong { font-size: 14px; }
.setting-toggle-copy span { color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.table-wrap { overflow-x: auto; }
.backtest-daily-table-scroll {
  max-height: clamp(420px, 70vh, 760px);
  overflow: auto;
  overscroll-behavior: contain;
}
.backtest-daily-table-scroll .backtest-daily-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  box-shadow: inset 0 -1px 0 var(--line);
}
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { padding: 13px 18px; text-align: left; border-bottom: 1px solid var(--surface-soft); white-space: nowrap; font-size: 13px; }
th { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-soft); }
.condition-module-table { min-width: 980px; }
.condition-module-table th, .condition-module-table td { white-space: normal; vertical-align: top; }
.condition-module-table th:nth-child(1), .condition-module-table td:nth-child(1) { width: 20%; }
.condition-module-table th:nth-child(2), .condition-module-table td:nth-child(2) { width: 8%; }
.condition-module-table th:nth-child(3), .condition-module-table td:nth-child(3) { width: 34%; }
.condition-module-table th:nth-child(4), .condition-module-table td:nth-child(4) { width: 28%; }
.condition-module-table th:nth-child(5), .condition-module-table td:nth-child(5) { width: 10%; white-space: nowrap; }
.condition-tabs { display: flex; gap: 8px; margin: 18px 0 12px; border-bottom: 1px solid var(--line); }
.condition-tab { appearance: none; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; padding: 10px 14px; font: inherit; font-weight: 700; }
.condition-tab span { display: inline-flex; min-width: 22px; justify-content: center; margin-left: 5px; padding: 2px 6px; border-radius: 999px; background: var(--teal-pale); font-size: 11px; }
.condition-tab:hover, .condition-tab.active { color: var(--ink); border-bottom-color: var(--teal); }
.condition-hypothesis-table { min-width: 1180px; }
.condition-hypothesis-table th, .condition-hypothesis-table td { white-space: normal; vertical-align: top; }
.condition-hypothesis-table th:nth-child(1), .condition-hypothesis-table td:nth-child(1) { width: 18%; }
.condition-hypothesis-table th:nth-child(2), .condition-hypothesis-table td:nth-child(2) { width: 10%; }
.condition-hypothesis-table th:nth-child(3), .condition-hypothesis-table td:nth-child(3) { width: 25%; }
.condition-hypothesis-table th:nth-child(4), .condition-hypothesis-table td:nth-child(4) { width: 18%; }
.condition-hypothesis-table th:nth-child(5), .condition-hypothesis-table td:nth-child(5) { width: 13%; }
.condition-hypothesis-table th:nth-child(6), .condition-hypothesis-table td:nth-child(6) { width: 10%; white-space: nowrap; }
.condition-hypothesis-table th:nth-child(7), .condition-hypothesis-table td:nth-child(7) { width: 140px; min-width: 140px; }
.condition-hypothesis-table code { display: block; color: var(--ink-soft); font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; white-space: pre-wrap; }
.condition-hypothesis-metrics { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.condition-hypothesis-actions { align-items: flex-start; flex-direction: column; }
.condition-created-at { color: var(--muted); font-size: 12px; white-space: nowrap; }
.position-history-table, .backtest-history-table { min-width: 760px; table-layout: fixed; }
.position-history-table th, .position-history-table td, .backtest-history-table th, .backtest-history-table td { white-space: normal; vertical-align: top; }
.position-history-table th:nth-child(1), .position-history-table td:nth-child(1), .backtest-history-table th:nth-child(1), .backtest-history-table td:nth-child(1) { width: 25%; }
.position-history-table th:nth-child(2), .position-history-table td:nth-child(2), .position-history-table th:nth-child(3), .position-history-table td:nth-child(3), .backtest-history-table th:nth-child(2), .backtest-history-table td:nth-child(2), .backtest-history-table th:nth-child(3), .backtest-history-table td:nth-child(3) { width: 23%; }
.position-history-table th:nth-child(4), .position-history-table td:nth-child(4), .backtest-history-table th:nth-child(4), .backtest-history-table td:nth-child(4) { width: 29%; }
.history-identity, .history-trade, .history-result { min-width: 0; }
.history-strategy { line-height: 1.45; overflow-wrap: anywhere; }
.history-symbol { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 10px; }
.history-symbol strong { color: var(--ink); }
.history-info-line { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: baseline; gap: 8px; margin-bottom: 7px; }
.history-info-line:last-child { margin-bottom: 0; }
.history-info-line > span { color: var(--muted); font-size: 11px; }
.history-info-line > strong { min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.history-result .history-info-line:first-child > strong, .history-result .history-info-line:nth-child(2) > strong { font-size: 14px; }
.ai-suggestion-box { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--teal-pale); border-radius: 6px; background: var(--surface-soft); }
.ai-suggestion-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.ai-suggestion-head > span { font-size: 12px; font-weight: 700; color: var(--teal-dark); }
.ai-suggestion-reasoning { margin: 0 0 8px; font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.ai-suggestion-condition { margin-top: 6px; font-size: 12px; }
.ai-suggestion-condition > strong { color: var(--teal-dark); margin-right: 6px; }
.ai-suggestion-condition > span { color: var(--muted); }
.ai-suggestion-section { margin-top: 10px; }
.ai-suggestion-section > strong { display: block; color: var(--ink-soft); font-size: 11px; }
.ai-suggestion-hypothesis { margin-top: 7px; padding: 8px 10px; border-left: 3px solid #d99a22; background: #fffaf0; }
.ai-suggestion-hypothesis-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-suggestion-hypothesis-title strong { color: var(--ink); }
.ai-suggestion-hypothesis-meta { margin-top: 4px; color: var(--muted); font-size: 11px; }
.ai-suggestion-hypothesis code { display: block; margin-top: 5px; color: var(--ink-soft); font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-suggestion-hypothesis > span:last-child { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.ai-suggestion-section > .muted { margin: 8px 0 0; font-size: 11px; line-height: 1.45; }
.ai-hypothesis-validation { display: grid; gap: 5px; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(24, 59, 53, .12); font-size: 11px; line-height: 1.45; }
.ai-hypothesis-validation > span { color: var(--muted); }
.ai-hypothesis-metrics { display: flex; flex-wrap: wrap; gap: 5px 10px; color: var(--ink-soft); }
.ai-hypothesis-metrics span { white-space: nowrap; }
.ai-hypothesis-suggestions { margin-top: 14px; }
.ai-hypothesis-suggestions li { display: grid; gap: 4px; }
.ai-hypothesis-suggestions li > span { color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.empty { color: var(--muted); text-align: center; padding: 28px 18px; font-size: 13px; }
.side-list { display: grid; gap: 0; }
.side-list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--surface-soft); }
.side-list-row:last-child { border-bottom: 0; }
.side-list-row strong { display: block; font-size: 13px; }
.side-list-row span { display: block; color: var(--ink-soft); font-size: 12px; margin-top: 4px; }
.side-list-row .value { color: var(--ink); font-weight: 700; text-align: right; }
.side-list-row .build-id-value { max-width: 220px; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.strategy-row { cursor: pointer; }
.strategy-row.selected { background: var(--teal-pale); }
.strategy-list-table { table-layout: fixed; min-width: 1460px; }
.strategy-list-table th:first-child, .strategy-list-table td:first-child { width: 180px; max-width: 180px; }
.strategy-list-table th:last-child, .strategy-list-table td:last-child { position: sticky; right: 0; width: 170px; min-width: 170px; background: var(--panel); box-shadow: -8px 0 12px rgba(20, 46, 38, .06); z-index: 2; }
.strategy-list-table tbody tr:hover td:last-child, .strategy-list-table tbody tr.selected td:last-child { background: var(--teal-pale); }
.strategy-list-table td:first-child { overflow: hidden; text-overflow: ellipsis; white-space: normal; }
.user-strategy-table { min-width: 1180px; }
.admin-user-table { min-width: 1180px; }
.admin-settlement-table { min-width: 1080px; }
.reconciliation-table { min-width: 1080px; }
.user-allocation-control { display: flex; align-items: center; gap: 5px; min-width: 155px; }
.user-allocation-control input { min-width: 0; width: 120px; padding: 8px; }
.user-allocation-control span { color: var(--muted); font-size: 11px; }
.user-action-panel { margin-bottom: 0; }
.strategy-name { color: var(--teal-dark); font-weight: 750; }
.strategy-identity { min-width: 0; }
.strategy-core-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.strategy-core-tag { display: inline-flex; max-width: 100%; padding: 3px 5px; border: 1px solid var(--line); border-radius: 3px; color: var(--teal-dark); background: var(--teal-pale); font-size: 10px; line-height: 1.2; white-space: normal; }
.strategy-condition-meta { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.3; }
.strategy-builder-options { display: grid; gap: 8px; }
.strategy-builder-options label { color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.strategy-builder-options input { margin-right: 7px; }
.strategy-conditions { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.strategy-section-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; padding: 4px; background: var(--teal-pale); border: 1px solid var(--line); }
.strategy-section-link { border: 0; border-radius: 3px; padding: 10px 14px; color: var(--ink-soft); background: transparent; font-weight: 700; cursor: pointer; }
.strategy-section-link:hover, .strategy-section-link.active { color: var(--teal-dark); background: #fff; box-shadow: 0 1px 3px rgba(20, 46, 38, .1); }
.strategy-detail-intro { margin-bottom: 14px; }
.strategy-returns-panel .daily-returns-note { padding: 0 18px 18px; }
.simulated-history-summary { display: flex; flex-wrap: wrap; gap: 12px 24px; border-bottom: 1px solid var(--line); }
.simulated-history-tabs { display: flex; gap: 4px; padding: 12px 18px 0; border-bottom: 1px solid var(--line); }
.simulated-history-tabs button { appearance: none; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-weight: 700; padding: 10px 14px; }
.simulated-history-tabs button.active { border-bottom-color: var(--teal); color: var(--ink); }
.simulated-day-row { cursor: pointer; }
.simulated-day-row.selected td { background: var(--teal-pale); }
.table-link { border: 0; background: transparent; color: var(--teal-dark); cursor: pointer; font: inherit; font-weight: 700; padding: 0; }
.simulated-position-detail { border-top: 1px solid var(--line); }
.simulated-position-detail .empty { margin: 18px; }
.simulated-history-warning { margin: 14px 18px 18px; color: var(--amber); }
.strategy-conditions-title { display: block; font-size: 13px; }
.strategy-conditions-list { margin: 10px 0 0; padding-left: 22px; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.strategy-conditions-list li + li { margin-top: 5px; }
.strategy-exit-title { margin-top: 16px; }
.strategy-condition-note { display: block; margin-top: 10px; color: var(--teal-dark); font-size: 12px; }
.strategy-condition-editor { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; width: 100%; margin-top: 14px; }
.strategy-condition-editor label { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.strategy-condition-editor select { min-width: 0; width: 100%; }
.strategy-condition-editor .strategy-condition-note { flex-basis: 100%; }
.strategy-condition-options { display: grid; flex-basis: 100%; gap: 8px; }
.strategy-condition-options label { color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.strategy-condition-options input { margin-right: 7px; }
.condition-sequence-editor { display: grid; gap: 10px; flex-basis: 100%; margin-top: 10px; }
.condition-sequence-list { display: grid; gap: 7px; }
.condition-sequence-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto minmax(72px, 86px); align-items: center; gap: 8px; min-width: 0; padding: 9px 10px; background: var(--surface-soft); border: 1px solid var(--line); }
.condition-sequence-index { display: grid; place-items: center; width: 24px; height: 24px; color: var(--teal-dark); background: var(--teal-pale); border-radius: 50%; font-size: 12px; font-weight: 800; }
.condition-sequence-label { min-width: 0; color: var(--ink); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.condition-sequence-actions { display: flex; flex: 0 0 auto; gap: 4px; }
.condition-sequence-actions .icon-button { width: 28px; height: 28px; padding: 0; font-size: 15px; }
.condition-sequence-actions .icon-button:disabled { cursor: default; opacity: .35; }
.condition-sequence-operator { min-width: 0; width: 100%; color: var(--teal-dark); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.condition-sequence-end { color: var(--muted); font-size: 12px; text-align: center; }
.condition-sequence-available { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 3px; color: var(--ink-soft); font-size: 12px; }
.condition-sequence-available > span { font-weight: 750; }
.condition-sequence-available label { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; background: #fff; border: 1px solid var(--line); font-size: 12px; }
.condition-sequence-available input { width: auto; }
.condition-expression-editor { display: grid; gap: 10px; width: 100%; margin-top: 12px; }
.condition-expression-group { min-width: 0; border: 1px solid var(--line); background: var(--surface-soft); padding: 10px; }
.condition-expression-group:not(.expression-root) { margin: 8px 0; border-left: 3px solid var(--teal); background: #fff; }
.condition-expression-group-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.condition-expression-group-header strong { color: var(--ink); font-size: 12px; }
.condition-expression-group-header select { width: auto; min-width: 160px; max-width: 100%; padding: 6px 8px; }
.condition-expression-relation { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.condition-expression-group-header .mini { padding: 6px 8px; font-size: 11px; }
.condition-expression-group-help { flex-basis: 100%; color: var(--ink-soft); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.condition-expression-children { display: grid; gap: 7px; min-width: 0; padding-top: 8px; }
.expression-node { min-width: 0; }
.condition-sequence-row.expression-node { grid-template-columns: 24px minmax(0, 1fr) auto; }
.condition-sequence-row.expression-node select { min-width: 0; width: 100%; }
.condition-sequence-row.expression-node .condition-parameter-grid { grid-column: 2 / -1; }
.expression-preview { margin: 8px 0 4px; padding: 10px 12px; color: var(--teal-dark); background: var(--teal-pale); border: 1px solid var(--line); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.strategy-condition-editor > strong { flex-basis: 100%; margin-top: 12px; }
.strategy-condition-editor > strong:first-child { margin-top: 0; }
.strategy-condition-editor > .button { justify-self: start; }
.market-button { white-space: nowrap; padding: 7px 10px; font-size: 12px; }
.symbol-cell { display: inline-flex; align-items: center; gap: 9px; }
.market-link { color: var(--teal); font-size: 11px; font-weight: 750; text-decoration: none; }
.market-link:hover { color: var(--teal-dark); text-decoration: underline; }
.strategy-link { color: var(--teal-dark); font-weight: 700; text-decoration: none; }
.strategy-link:hover { color: var(--teal); text-decoration: underline; }
.link-button { border: 0; padding: 0; color: var(--teal-dark); background: transparent; font: inherit; font-weight: 750; cursor: pointer; text-align: left; }
.link-button:hover { color: var(--teal); text-decoration: underline; }
.row-actions { display: flex; gap: 7px; align-items: center; }
.row-actions .button { padding: 7px 10px; font-size: 12px; }
.copy-modal-panel { width: min(560px, 100%); }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.warning-text { color: var(--amber); }
.switch-line { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--surface-soft); }
.switch-line:last-child { border-bottom: 0; }
.switch-line strong { font-size: 13px; }
.switch-line span { color: var(--ink-soft); font-size: 12px; display: block; margin-top: 4px; }
.detail-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.detail-header h3 { margin: 0; font-size: 24px; }
.detail-header p { margin: 5px 0 0; }
.detail-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.inline-control { display: flex; align-items: center; gap: 8px; }
.inline-control input { width: 150px; }
.notice { background: var(--amber-pale); color: var(--amber); padding: 12px 14px; font-size: 13px; line-height: 1.5; }
.notice.error-notice { background: var(--red-pale); color: var(--red); border-left: 3px solid var(--red); overflow-wrap: anywhere; }
.scan-diagnostics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-top: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.scan-diagnostics > div { padding: 12px 10px; border-right: 1px solid var(--line); }
.scan-diagnostics > div:last-child { border-right: 0; }
.scan-diagnostics span, .scan-diagnostics strong { display: block; min-width: 0; }
.scan-diagnostics span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.scan-diagnostics strong { margin-top: 5px; font-size: 15px; }
.signal-filter-bar { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.signal-filter-bar label { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.signal-filter-bar select { min-width: 190px; }
.detail-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 0; }
.detail-summary-grid .metric { min-height: 105px; }
.detail-config-grid { grid-template-columns: 1fr; }
.strategy-settings-body { padding: 0; }
.strategy-settings-form { display: grid; gap: 0; }
.settings-section { padding: 20px 22px; border-bottom: 1px solid var(--surface-soft); }
.settings-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.settings-section-heading h4 { margin: 0; color: var(--ink); font-size: 15px; }
.settings-section-heading p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.settings-fields-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.publication-panel { margin-bottom: 20px; }
.publication-panel .panel-body { display: grid; gap: 20px; }
.publication-checklist ul { margin: 12px 0 0; padding-left: 20px; }
.publication-checklist li { margin: 8px 0; }
.publication-checklist li span { display: block; margin-top: 3px; }
.publication-ready { padding: 14px; background: var(--green-pale); color: var(--ink); }
.publication-section { border-top: 1px solid var(--line); padding-top: 20px; min-width: 0; }
.publication-form { display: grid; gap: 16px; }
.publication-form textarea { width: 100%; min-height: 100px; resize: vertical; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }
.publication-sort { max-width: 220px; }
.publication-import { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin: 16px 0 8px; }
.publication-import .form-field { flex: 1 1 280px; min-width: 0; }
.publication-import select { width: 100%; }
.publication-preview { border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-top: 16px; }
.publication-preview h4 { margin: 0 0 8px; }
.publication-preview .settings-fields-grid strong { display: block; margin-top: 5px; }
.publication-preview .button { margin-top: 16px; }
.publication-chart { color: var(--green); margin-top: 16px; }
.publication-chart svg { width: 100%; max-height: 150px; display: block; }
.settings-help { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.settings-form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 18px 22px; background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.settings-runtime { border-bottom: 0; }
.settings-runtime .switch-line { padding-top: 0; }
.settings-runtime .control-actions { margin-top: 16px; }
.control-form { display: grid; gap: 12px; }
.input-with-unit { display: flex; align-items: center; gap: 8px; }
.input-with-unit input { min-width: 0; flex: 1; }
.setting-preview { display: block; margin-top: 5px; }
.control-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.order-toolbar { display: flex; align-items: end; gap: 14px; flex-wrap: wrap; }
.order-toolbar .form-field { min-width: 180px; }
.task-detail-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.task-condition-list { margin-top: 0; }
.performance-disclosure { margin-bottom: 18px; }
.performance-summary-grid { margin: 0 0 18px; }
.performance-note { margin: 16px 0 0; line-height: 1.6; }
.performance-chart-wrap { width: 100%; overflow-x: auto; border-top: 1px solid var(--line); padding-top: 18px; }
.backtest-form { margin-top: 16px; }
.backtest-list-toolbar { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }
.all-backtests-table { min-width: 1760px; }
.all-backtests-table > thead > tr > th:nth-child(2), .all-backtests-table > tbody > tr > td:nth-child(2) { width: 300px; white-space: normal; }
.backtest-variant-cell { display: grid; gap: 5px; min-width: 230px; max-width: 320px; }
.backtest-variant-cell > strong { color: var(--ink); font-size: 12px; line-height: 1.35; }
.backtest-condition-preview { color: var(--ink-soft); font-size: 11px; line-height: 1.45; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.backtest-fingerprint { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.backtest-variant-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.backtest-variant-badges .badge { padding: 4px 6px; letter-spacing: 0; }
.backtest-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-top: 1px solid var(--line); }
.backtest-pagination .form-actions { margin: 0; }
.panel-subsection { border-top: 1px solid var(--line); }
.backtest-comparison-table { min-width: 980px; }
.backtest-daily-table { min-width: 1680px; table-layout: fixed; }
.backtest-daily-table th, .backtest-daily-table td { white-space: normal; vertical-align: top; overflow-wrap: anywhere; line-height: 1.45; }
.backtest-daily-table th:nth-child(1), .backtest-daily-table td:nth-child(1) { width: 8%; }
.backtest-daily-table th:nth-child(2), .backtest-daily-table td:nth-child(2) { width: 13%; }
.backtest-daily-table th:nth-child(3), .backtest-daily-table td:nth-child(3) { width: 11%; }
.backtest-daily-table th:nth-child(4), .backtest-daily-table td:nth-child(4) { width: 11%; }
.backtest-daily-table th:nth-child(5), .backtest-daily-table td:nth-child(5) { width: 12%; }
.backtest-daily-table th:nth-child(6), .backtest-daily-table td:nth-child(6), .backtest-daily-table th:nth-child(7), .backtest-daily-table td:nth-child(7) { width: 6%; white-space: nowrap; overflow-wrap: normal; }
.backtest-daily-table th:nth-child(8), .backtest-daily-table td:nth-child(8), .backtest-daily-table th:nth-child(9), .backtest-daily-table td:nth-child(9), .backtest-daily-table th:nth-child(10), .backtest-daily-table td:nth-child(10) { width: 8%; }
.backtest-daily-table th:nth-child(11), .backtest-daily-table td:nth-child(11) { width: 9%; }
.backtest-daily-table .history-info-line { grid-template-columns: 34px minmax(0, 1fr); gap: 6px; }
.backtest-daily-note { padding: 0 16px 16px; }
.monthly-backtest-ranking-panel { margin-top: 18px; }
.monthly-backtest-ranking-table { min-width: 980px; }
.monthly-backtest-ranking-table th, .monthly-backtest-ranking-table td { white-space: nowrap; }
.backtest-monthly-table { min-width: 1120px; }
.backtest-monthly-table th, .backtest-monthly-table td { white-space: normal; vertical-align: top; }
.backtest-monthly-table td:first-child { min-width: 145px; }
.backtest-comparison-table td:first-child strong { display: inline-block; margin-right: 8px; }
.best-comparison-row { background: color-mix(in srgb, var(--positive) 6%, var(--panel)); }
.backtest-result-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.backtest-result-actions .button { white-space: nowrap; }
.backtest-condition-snapshot .panel-body { display: grid; gap: 20px; }
.backtest-condition-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.backtest-condition-group, .backtest-ai-experiment { border: 1px solid var(--line); background: var(--surface-soft); padding: 14px; }
.backtest-condition-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.backtest-condition-group-heading h4 { margin: 0; color: var(--ink); font-size: 14px; }
.backtest-condition-list { display: grid; gap: 10px; }
.backtest-condition-row { display: grid; gap: 8px; }
.backtest-condition-item { padding: 12px; border: 1px solid var(--line); background: #fff; }
.backtest-condition-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.backtest-condition-title strong { color: var(--ink); line-height: 1.45; }
.backtest-condition-item p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.backtest-condition-parameters { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.backtest-condition-parameters span { padding: 4px 7px; background: var(--surface-soft); }
.backtest-condition-parameters strong { color: var(--ink-soft); }
.backtest-condition-operator { display: block; width: fit-content; margin: 0 auto; padding: 2px 8px; color: var(--muted); font-size: 11px; font-weight: 700; background: var(--surface-soft); }
.backtest-baseline-conditions { border-top: 1px solid var(--line); padding-top: 14px; }
.backtest-baseline-conditions summary { cursor: pointer; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.backtest-baseline-conditions .backtest-condition-group { margin-top: 12px; }
.backtest-snapshot-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.backtest-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.backtest-meta-grid span { display: grid; gap: 3px; padding: 10px; background: var(--surface-soft); }
.backtest-meta-grid em { color: var(--muted); font-size: 11px; font-style: normal; }
.backtest-meta-grid strong { color: var(--ink-soft); font-size: 13px; overflow-wrap: anywhere; }
@media (max-width: 900px) { .backtest-condition-groups, .backtest-snapshot-meta { grid-template-columns: 1fr; } }
.backtest-ai-status { max-width: 260px; line-height: 1.4; }
.backtest-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 18px; }
.backtest-disclaimer { margin: 16px 0 0; line-height: 1.6; }
.backtest-integrity { margin-top: 16px; border: 1px solid var(--line); background: var(--surface-soft); }
.backtest-integrity summary { cursor: pointer; padding: 12px 14px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.backtest-integrity-grid { display: grid; grid-template-columns: minmax(140px, 0.35fr) minmax(0, 1fr); gap: 8px 14px; padding: 0 14px 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.backtest-integrity-grid strong { color: var(--ink-soft); font-weight: 600; overflow-wrap: anywhere; }
.backtest-integrity-grid .positive { color: var(--positive); }
.backtest-integrity-grid .negative { color: var(--negative); }
.backtest-reason-value { white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
.history-status { margin-top: 10px; }
.backtest-trade-note { margin: 14px 18px 18px; line-height: 1.6; }
.backtest-ai-result { display: grid; gap: 16px; }
.backtest-ai-result .notice { margin: 0; }
.ai-analysis-summary { display: grid; gap: 8px; line-height: 1.6; }
.ai-analysis-summary p { margin: 0; white-space: pre-wrap; }
.ai-analysis-summary ul, .ai-condition-suggestions ul { margin: 0; padding-left: 20px; }
.ai-condition-suggestions { display: grid; gap: 8px; line-height: 1.6; }
.ai-condition-suggestions li { display: grid; gap: 2px; margin: 6px 0; }
.ai-condition-suggestions li span { color: var(--muted); }
.performance-chart-legend { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.performance-chart-legend span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-weight: 700; }
.chart-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; }
.chart-dot.total { background: var(--teal); }
.performance-chart { display: block; width: 100%; min-width: 560px; height: auto; overflow: visible; }
.chart-grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-total-line { fill: none; stroke: var(--teal); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-total-point { fill: #fff; stroke: var(--teal); stroke-width: 2; }
.chart-axis-label { fill: var(--muted); font-size: 10px; }

@media (max-width: 980px) {
  .auth-layout { gap: 44px; grid-template-columns: minmax(0, 1fr) 420px; }
  .auth-intro h1 { font-size: 50px; }
  .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .view-root { padding-inline: 22px; }
  .topbar { padding-inline: 22px; }
  .app-message { margin-inline: 22px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-grid { grid-template-columns: 1fr; }
  .backtest-list-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .backtest-list-toolbar { grid-template-columns: 1fr; }
  .backtest-pagination { align-items: stretch; flex-direction: column; }
  .backtest-pagination .form-actions { width: 100%; }
  .backtest-pagination .button { flex: 1; }
}

@media (max-width: 680px) {
  body { overflow-x: hidden; }
  .auth-screen { padding: 24px 16px 36px; }
  .auth-layout { grid-template-columns: 1fr; gap: 22px; align-items: start; }
  .auth-intro { padding: 8px 6px 0; }
  .auth-intro h1 { margin-top: 18px; font-size: 42px; }
  .auth-lede { font-size: 16px; }
  .intro-status-list { gap: 11px; margin-top: 26px; }
  .intro-status-list span:not(.intro-status-icon) { font-size: 12px; }
  .auth-intro-footer { margin-top: 24px; }
  .auth-panel { padding: 26px 22px; }
  .qr-layout { align-items: flex-start; }
  .qr-frame { width: 112px; height: 112px; }
  .app-shell { display: block; }
  .sidebar { padding: 12px 14px 0; gap: 12px; }
  .sidebar-brand { padding: 0 3px; }
  .main-nav { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
  .nav-item { flex: 0 0 auto; padding: 9px 11px; font-size: 13px; }
  .sidebar-footer { display: none; }
  .topbar { min-height: 72px; padding: 15px 16px; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .topbar > div:first-child { min-width: 0; flex: 1 1 150px; }
  .topbar h2 { font-size: 20px; }
  .topbar .badge { display: none; }
  .topbar-actions { min-width: 0; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .topbar-actions .button { padding: 8px 9px; font-size: 12px; }
  .view-root { padding: 20px 16px 35px; }
  .app-message { margin: 12px 16px 0; }
  .page-intro { align-items: stretch; flex-direction: column; gap: 12px; }
  .page-intro > div { min-width: 0; }
  .page-intro > .button { width: 100%; }
  .page-intro h3 { font-size: 22px; }
  .metrics-grid { gap: 9px; margin-bottom: 16px; }
  .overview-summary-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; }
  .metric { min-width: 0; min-height: 94px; padding: 13px; overflow-wrap: anywhere; }
  .metric-value { font-size: 19px; margin-top: 12px; overflow-wrap: anywhere; }
  .metric-caption { line-height: 1.45; }
  .panel-header { align-items: flex-start; flex-wrap: wrap; padding: 14px; }
  .panel-header > div { min-width: 0; flex: 1 1 220px; }
  .panel-header > .muted, .panel-header > .badge { margin-left: auto; }
  .panel-body { padding: 14px; }
  .table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
  .mobile-card-table { min-width: 0; }
  .mobile-card-table thead { display: none; }
  .mobile-card-table, .mobile-card-table tbody, .mobile-card-table tr, .mobile-card-table td { display: block; width: 100%; }
  .mobile-card-table tr { padding: 9px 0; border-bottom: 1px solid var(--line); }
  .mobile-card-table tr:last-child { border-bottom: 0; }
  .mobile-card-table td { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; min-width: 0; padding: 7px 4px; border: 0; white-space: normal; text-align: right; overflow-wrap: anywhere; }
  .mobile-card-table td::before { content: attr(data-label); flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 700; text-align: left; }
  .mobile-card-table td > :last-child { min-width: 0; }
  .mobile-card-table td .symbol-cell { justify-content: flex-end; }
  .mobile-card-table td:first-child { padding-top: 5px; }
  .mobile-card-table td:last-child { padding-bottom: 5px; }
  .user-strategy-table { min-width: 1180px; }
  .user-strategy-table th, .user-strategy-table td { padding-inline: 12px; }
  .form-actions .button { min-height: 42px; }
  .condition-expression-group-header .mini { flex: 1 1 auto; }
  .holding-toolbar { align-items: stretch; flex-wrap: wrap; justify-content: flex-end; }
  .holding-toolbar select { min-width: 0; max-width: 100%; }
  .compact-form { grid-template-columns: 1fr; }
  .compact-form .wide { grid-column: auto; }
  .signal-filter-bar { align-items: stretch; flex-direction: column; }
  .signal-filter-bar select { width: 100%; }
  .detail-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-detail-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-config-grid { grid-template-columns: 1fr; }
  .settings-fields-grid { grid-template-columns: 1fr; }
  .settings-section { padding: 18px 14px; }
  .settings-form-actions { padding: 16px 14px; }
  .scan-diagnostics, .scan-diagnostics-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scan-diagnostics > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .scan-diagnostics > div:nth-child(odd) { border-right: 1px solid var(--line); }
  .scan-diagnostics > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .detail-header { flex-direction: column; gap: 12px; }
  .detail-header-actions { width: 100%; justify-content: flex-start; }
  .inline-control { width: 100%; }
  .inline-control input { flex: 1; width: auto; }
  .condition-sequence-row { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .condition-sequence-row .condition-sequence-operator, .condition-sequence-row .condition-sequence-end { grid-column: 2 / -1; justify-self: start; }
  .condition-sequence-row .condition-sequence-operator { width: 100%; min-width: 0; }
  .condition-sequence-row .condition-sequence-operator, .condition-sequence-row select { width: 100%; min-width: 0; }
  .modal-backdrop { align-items: start; padding: 10px; }
  .modal-panel { max-height: calc(100vh - 20px); }
  .condition-parameter-grid { grid-column: 1 / -1; grid-template-columns: 1fr; }
  .order-toolbar { align-items: stretch; flex-direction: column; gap: 10px; }
  .order-toolbar .form-field, .order-toolbar select { width: 100%; min-width: 0; }
  .position-history-table, .backtest-history-table { min-width: 0; }
  .position-history-table thead, .backtest-history-table thead { display: none; }
  .position-history-table, .position-history-table tbody, .position-history-table tr, .position-history-table td, .backtest-history-table, .backtest-history-table tbody, .backtest-history-table tr, .backtest-history-table td { display: block; width: 100%; }
  .position-history-table th, .position-history-table td, .backtest-history-table th, .backtest-history-table td { width: auto !important; }
  .position-history-table tr, .backtest-history-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; padding: 10px 4px; }
  .position-history-table td, .backtest-history-table td { padding: 10px 4px; border-bottom: 0; }
  .position-history-table td:first-child, .position-history-table td:last-child, .backtest-history-table td:first-child, .backtest-history-table td:last-child { grid-column: 1 / -1; }
  .position-history-table td:first-child, .backtest-history-table td:first-child { padding-top: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .position-history-table td:last-child, .backtest-history-table td:last-child { padding-top: 12px; border-top: 1px solid var(--line); }
  .history-info-line { grid-template-columns: 34px minmax(0, 1fr); gap: 6px; }
}

@media (max-width: 390px) {
  .view-root { padding-inline: 12px; }
  .app-message { margin-inline: 12px; }
  .topbar { padding-inline: 12px; }
  .overview-summary-metrics, .detail-summary-grid, .task-detail-metrics { grid-template-columns: 1fr; }
  .metric-value { font-size: 20px; }
  .panel-header, .panel-body { padding-inline: 12px; }
}
.exchange-admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 24px; margin-top: 24px; align-items: start; }
.exchange-admin-grid .form-field { min-width: 0; }
.exchange-admin-grid textarea { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ink); }
.exchange-admin-grid textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 107, 84, .12); }
.exchange-platform-form input[type="checkbox"] { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--teal); }
.exchange-api-address { display: flex; flex-direction: column; gap: 8px; margin: 20px 0; }
.exchange-api-address code { overflow-wrap: anywhere; }
.exchange-save-status { margin: 0; overflow-wrap: anywhere; }

/* Annual accounts stay next to their immutable full-period parent report. */
.all-backtests-table > tbody > tr.backtest-annual-row > td { padding: 0 16px 20px; border-bottom: 2px solid var(--border, #dce8e1); white-space: normal; }
.backtest-annual { width: 100%; max-width: 1400px; overflow-x: auto; white-space: normal; }
.backtest-annual-table { min-width: 980px; width: 100%; table-layout: fixed; font-variant-numeric: tabular-nums; }
.backtest-annual-table caption { text-align: left; padding: 12px 10px 8px; font-weight: 600; color: #274c3f; white-space: normal; overflow-wrap: break-word; }
.backtest-annual-table caption span { display: block; margin-top: 3px; color: #6b7e75; font-size: 12px; font-weight: 400; }
.backtest-annual-table th, .backtest-annual-table td { min-width: 96px; padding: 6px 12px; text-align: right; }
.backtest-annual-table th:first-child { min-width: 120px; width: 240px; text-align: left; white-space: normal; }
.backtest-annual-table th small { display: block; font-size: 11px; font-weight: 400; }
.backtest-annual-empty { padding: 8px 10px; font-size: 12px; }

/* Historical offline evidence has its own period and cost labels. */
.research-archive-panel { margin-bottom: 24px; }
.research-archive-table { min-width: 1000px; width: 100%; }
.research-archive-table td { vertical-align: top; }
.research-archive-table small { display: inline-block; max-width: 260px; white-space: normal; }
.research-archive-table summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
.research-archive-detail { padding: 8px 0 16px; max-width: 1100px; white-space: normal; }
.research-archive-detail p, .research-archive-detail li { overflow-wrap: anywhere; }
.research-archive-detail caption { text-align: left; padding: 12px 0; }
:root .access-role-table {
  table-layout: fixed;
  width: 100%;
  min-width: 680px;
}
:root .access-role-table td { white-space: normal; overflow-wrap: anywhere; line-height: 1.7; }
:root .access-role-table th:first-child { width: 160px; }
:root .access-role-table th:last-child { width: 160px; }
:root .access-permission-table { min-width: 0; width: 100%; }
:root .access-permission-table input[type="checkbox"] { width: 18px; height: 18px; }

/* Financial comparison columns remain horizontally scrollable. */
.strategy-list-table { min-width: 1700px; }

/* Strategy sorting lives in the column headers, including amount/rate pairs. */
.strategy-list-table { table-layout: auto; }
.strategy-list-table th:first-child, .strategy-list-table td:first-child { min-width: 180px; }
.strategy-sort-button { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 3px 0; border: 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; white-space: nowrap; }
.strategy-sort-button:hover, .strategy-sort-button.active { color: var(--teal); }
.strategy-sort-button:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; border-radius: 2px; }
.strategy-sort-indicator { color: var(--ink-soft); opacity: .55; font-size: 12px; }
.strategy-sort-button.active .strategy-sort-indicator { color: var(--teal); opacity: 1; }
.strategy-sort-pair { display: flex; flex-direction: column; align-items: flex-start; }

/* Financial reference chart: three independently coloured continuous series. */
.historical-chart-heading { display:flex; justify-content:space-between; gap:20px; flex-wrap:wrap; align-items:flex-start; }
.historical-chart h4 { margin:0 0 8px; font-size:17px; }
.historical-chart-heading p { margin:0; font-size:12px; }
.historical-chart-legend { display:flex; flex-wrap:wrap; gap:18px; font-size:13px; }
.historical-chart-legend span { display:inline-flex; gap:7px; align-items:center; }
.historical-chart-legend i { width:18px; height:3px; display:inline-block; border-radius:2px; }
.historical-chart-scroll { overflow-x:auto; margin-top:18px; }
.historical-chart svg { width:100%; min-width:760px; display:block; }
.historical-chart svg text { fill:var(--muted); font-size:12px; }
.historical-chart .history-grid { stroke:var(--line); stroke-width:1; }
.historical-chart circle:focus { fill:#2563eb; outline:none; stroke:white; stroke-width:2; }
.historical-chart-note { font-size:12px; line-height:1.8; margin-bottom:0; }
.history-month-control { display:flex; align-items:center; flex-wrap:wrap; gap:12px; padding:16px 24px; }
.history-month-control select { width:auto; min-width:130px; }

.admin-language-control { display: inline-flex; align-items: center; gap: 7px; color: var(--muted, #52675c); font-size: 12px; }
.admin-language-control select { width: auto; min-width: 100px; min-height: 36px; padding: 6px 10px; border: 1px solid var(--border, #d6e1db); border-radius: 8px; background: #fff; color: inherit; }
.auth-panel > .admin-language-control { margin-bottom: 16px; }
@media (max-width: 640px) { .topbar .admin-language-control > span { display: none; } }

.operations-panel { width: min(1180px, calc(100vw - 32px)); max-width: 1180px; max-height: calc(100dvh - 48px); overflow-y: auto; }
.operations-panel .row-actions { margin: 14px 0; gap: 8px; flex-wrap: wrap; }
.operations-panel .table-wrap { max-height: 48dvh; overflow: auto; }
.operations-panel td { white-space: normal; min-width: 110px; overflow-wrap: anywhere; vertical-align: top; }
.operations-panel td p { max-width: 420px; margin: 6px 0; }
.operations-panel label { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.operations-panel input:not([type=checkbox]) { max-width: 240px; }
.operations-panel input[type=checkbox] { width: 16px; min-height: 16px; height: 16px; flex: 0 0 16px; margin: 0; }
.operations-preview { white-space: pre-wrap; overflow-wrap: anywhere; background: #f5f7fa; padding: 12px; border-radius: 8px; }
#operations-confirm { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 20px 0; }
