:root {
  --canvas: #0b0e11;
  --surface: #1e2329;
  --surface-2: #2b3139;
  --line: #2b3139;
  --text: #eaecef;
  --white: #ffffff;
  --muted: #929aa5;
  --muted-2: #707a8a;
  --yellow: #fcd535;
  --yellow-active: #f0b90b;
  --yellow-soft: rgba(252, 213, 53, .14);
  --green: #0ecb81;
  --red: #f6465d;
  --warn: #f0b90b;
  --blue: #3b82f6;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow: 0 18px 42px rgba(0, 0, 0, .32);
  --font-body: "BinanceNova", "Noto Sans KR", "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-number: "BinancePlex", "IBM Plex Sans", "JetBrains Mono", "Consolas", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { color-scheme: dark; }
body {
  min-width: 320px;
  color: var(--text);
  background: var(--canvas);
  font: 14px/1.5 var(--font-body);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  display: none;
  pointer-events: none;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; color: var(--white); font-size: 42px; line-height: 1.08; letter-spacing: 0; }
h2 { margin-bottom: 10px; color: var(--white); font-size: 32px; line-height: 1.15; letter-spacing: 0; }
h3 { margin-bottom: 8px; color: var(--white); font-size: 20px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow { margin: 0 0 10px; color: var(--yellow); font-size: 12px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
.good { color: var(--green) !important; }
.bad { color: var(--red) !important; }
.warn-text { color: var(--warn) !important; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}
.auth-card {
  width: 450px;
  max-width: calc(100vw - 48px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.brand-lockup { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand-lockup.compact { margin-bottom: 0; }
.brand-lockup strong { display: block; color: var(--yellow); font-size: 19px; letter-spacing: 0; line-height: 1.15; }
.brand-lockup span { display: block; color: var(--muted-2); font-size: 12px; }
.brand-diamond {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--yellow);
  transform: rotate(45deg);
  box-shadow: 0 0 0 8px rgba(252,213,53,.08);
}
.brand-diamond::before,
.brand-diamond::after {
  content: "";
  position: absolute;
  background: #181a20;
  border-radius: 2px;
}
.brand-diamond::before { inset: 11px 7px; }
.brand-diamond::after { inset: 7px 11px; }
.form-stack { display: grid; gap: 10px; margin-top: 22px; }
label { color: var(--muted); font-size: 12px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  background: #12161c;
  color: var(--text);
}
textarea { min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(252,213,53,.12); }
.form-status { min-height: 20px; margin: 14px 0 0; }
.remember-row { display: flex; align-items: center; gap: 8px; min-height: 24px; margin: 2px 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.remember-row input { width: 16px; min-height: 16px; margin: 0; padding: 0; accent-color: var(--yellow); }
.auth-links { display: flex; justify-content: center; gap: 18px; margin-top: 18px; }
.link-button { border: 0; background: transparent; color: var(--yellow); padding: 0; }
.auth-policy-note {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(252,213,53,.2);
  border-radius: var(--radius-sm);
  background: rgba(252,213,53,.06);
  font-size: 13px;
  line-height: 1.55;
}

button, .secondary, .primary, .danger, .ghost {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 760;
}
.primary { background: var(--yellow); color: #181a20; }
.primary:hover { background: var(--yellow-active); }
.secondary { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.danger { background: var(--red); color: #fff; }
.full { width: 100%; }
.small { min-height: 32px; padding: 0 12px; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.app-shell { min-height: 100vh; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 260px 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 74px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 14, 17, .94);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 2px 0 var(--yellow);
}
.top-nav { display: flex; align-items: center; gap: 6px; }
.nav-item { background: transparent; color: var(--muted); border: 0; border-radius: 0; border-bottom: 3px solid transparent; }
.nav-item.active { color: var(--yellow); border-bottom-color: var(--yellow); }
.user-box { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.session-expiry {
  color: var(--muted-2);
  font-size: 12px;
  white-space: nowrap;
}
.session-expiry.warn { color: var(--yellow); }
main { max-width: 1560px; margin: 0 auto; padding: 30px 32px 70px; }
.page { animation: fadeIn .18s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-hero, .dashboard-top, .card, .kpi-card, .bot-state-card, .control-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.page-hero { padding: 28px; margin-bottom: 20px; }
.page-hero.split { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
}
.status-pill.good { background: rgba(14,203,129,.12); color: var(--green) !important; }
.status-pill.warn { background: rgba(240,185,11,.13); color: var(--warn) !important; }
.status-pill.bad { background: rgba(246,70,93,.13); color: var(--red) !important; }
.status-pill.neutral { background: var(--surface-2); color: var(--muted) !important; }
.worker-checklist { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.worker-check-item { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #151a21; }
.worker-check-item strong { display: block; margin: 8px 0 4px; color: var(--white); }
.worker-check-item p { margin: 0; color: var(--muted); font-size: 12px; }
.worker-check-item .mini-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.compact-summary-grid { margin-bottom: 18px; }
.admin-system-status-list {
  display: grid;
  gap: 10px;
  padding: 0 24px 24px;
}
.admin-system-status-item {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border: 1px solid #e7edf7;
  border-radius: 8px;
  background: #fff;
}
.admin-system-status-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.admin-system-status-item-head div {
  min-width: 0;
}
.admin-system-status-item-head span {
  display: block;
  color: #65748a;
  font-size: 11px;
  font-weight: 900;
}
.admin-system-status-item-head strong {
  display: block;
  margin-top: 3px;
  color: #1f2a44;
  font-size: 16px;
  overflow-wrap: anywhere;
}
.admin-system-status-item p {
  margin: 0;
  color: #65748a;
  line-height: 1.55;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.admin-system-status-action {
  min-width: 0;
  color: #65748a;
}
.admin-system-status-action .inline-actions {
  justify-content: flex-start;
}

#admin-system .table-wrap {
  overflow-x: visible;
}

#admin-system .data-table {
  table-layout: fixed;
}

#admin-system .data-table th,
#admin-system .data-table td {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.setup-grid { display: grid; grid-template-columns: minmax(520px, 1fr) 420px; gap: 20px; align-items: start; }
.card { padding: 24px; }
.form-card { display: grid; gap: 10px; }
.safety-card ul { margin: 14px 0 22px; padding-left: 18px; color: var(--muted); }
.mask-summary { display: grid; gap: 8px; }
.mask-summary div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 12px; border-radius: var(--radius-sm); background: #151a21; }
.alert-guidance { display: grid; gap: 6px; margin: 12px 0 2px; }
.alert-guidance div { padding: 9px 11px; border-radius: var(--radius-sm); background: rgba(240, 185, 11, 0.08); border: 1px solid rgba(240, 185, 11, 0.18); }
.alert-guidance strong { color: var(--text); }

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(380px, 28vw, 480px);
  align-items: start;
  gap: 18px;
}
.dashboard-main { min-width: 0; }
.dashboard-sidebar { min-width: 0; max-width: 100%; }
.dashboard-top {
  margin-bottom: 20px;
  border: 0;
  background: transparent;
}
.bot-state-card { min-width: 0; padding: 16px 18px; }
.control-card { padding: 18px; }
.bot-state-card h2 { margin-bottom: 4px; font-size: 28px; }
.bot-state-card > .muted { margin-bottom: 0; max-width: 920px; }
.connection-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.connection-grid div { min-width: 0; min-height: 56px; padding: 10px; border-radius: var(--radius-md); background: #151a21; overflow: hidden; }
.connection-grid span, .kpi-card span { display: block; color: var(--muted-2); font-size: 12px; font-weight: 700; }
.connection-grid strong, .kpi-card strong { display: block; margin-top: 5px; color: var(--white); font-family: var(--font-number); font-size: 18px; }
.connection-grid strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.connection-grid .inline-action { margin-top: 8px; width: 100%; min-height: 28px; }
.connection-grid .connection-alert {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 8px;
  align-items: center;
}
.connection-grid .connection-alert span,
.connection-grid .connection-alert strong { grid-column: 1; min-width: 0; }
.connection-grid .connection-alert .inline-action {
  grid-column: 2;
  grid-row: 1 / 3;
  width: auto;
  min-width: 48px;
  min-height: 28px;
  margin: 0;
  padding: 0 8px;
  font-size: 11px;
}
.control-card {
  position: sticky;
  top: 92px;
  align-self: start;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  max-width: 100%;
  max-height: none;
  overflow: visible;
}
.control-card > * { min-width: 0; max-width: 100%; }
.control-card p { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.mode-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; max-width: 100%; }
.mode-row p { margin-bottom: 0; line-height: 1.35; overflow-wrap: anywhere; }
.strategy-select { width: 100%; min-height: 40px; color: var(--white); background: #151a21; border-color: var(--line); }
.strategy-multi-select {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  min-height: auto;
}
.strategy-choice {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px 12px;
  align-items: start;
  min-height: auto;
  min-width: 0;
  max-width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #171d25, #11161d);
  overflow: visible;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.strategy-choice input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--yellow);
}
.strategy-choice strong {
  display: block;
  min-width: 0;
  color: var(--white);
  font-size: 16px;
  line-height: 1.25;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.strategy-choice span {
  display: block;
  min-width: 0;
  max-width: 100%;
}
.strategy-choice .strategy-choice-detail {
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.strategy-choice .strategy-choice-badge {
  grid-column: 2;
  align-self: start;
  justify-self: start;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: normal;
  overflow-wrap: anywhere;
}
.strategy-choice:hover {
  border-color: rgba(240, 185, 11, .35);
  transform: translateY(-1px);
}
.strategy-choice:has(input:checked) {
  border-color: rgba(240, 185, 11, .55);
  background: linear-gradient(135deg, rgba(240, 185, 11, .14), #141a22);
  box-shadow: inset 0 0 0 1px rgba(240, 185, 11, .18), 0 12px 24px rgba(0, 0, 0, .18);
}
.strategy-choice:has(input:checked) .strategy-choice-badge {
  border-color: rgba(240, 185, 11, .45);
  color: var(--yellow);
}
.strategy-selection-summary {
  min-width: 0;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px dashed rgba(240, 185, 11, .28);
  border-radius: var(--radius-sm);
  background: rgba(240, 185, 11, .06);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.strategy-allocation-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .015));
  overflow: hidden;
}
.mini-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.mini-section-head span {
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 800;
}
.mini-section-head strong {
  color: var(--yellow);
  font-size: 12px;
  text-align: right;
  white-space: normal;
  overflow-wrap: anywhere;
}
.mini-section-head strong.bad {
  color: var(--bad);
}
.strategy-allocation-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.strategy-allocation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 16px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.strategy-allocation-row > span {
  min-width: 0;
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.strategy-allocation-row input {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #11161d;
  color: var(--white);
  font-family: var(--font-number);
  font-weight: 800;
  text-align: right;
  padding: 0 8px;
}
.strategy-allocation-row input:disabled {
  cursor: not-allowed;
  opacity: 1;
  border-color: rgba(34, 201, 139, .38);
  background: rgba(34, 201, 139, .08);
}
.strategy-allocation-lock-note {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(34, 201, 139, .24);
  border-radius: 8px;
  background: rgba(34, 201, 139, .08);
  color: #157a57;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
}
.strategy-allocation-row em {
  color: var(--muted-2);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}
.strategy-allocation-portfolio-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(34, 201, 139, .22);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(34, 201, 139, .10), rgba(47, 101, 245, .08));
  overflow: hidden;
}
.portfolio-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.portfolio-card-head span {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.portfolio-card-head strong {
  color: var(--white);
  font-size: 14px;
  font-weight: 900;
  overflow-wrap: anywhere;
}
.portfolio-card-head small {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
}
.portfolio-card-head b {
  color: var(--good);
  font-family: var(--font-number);
  font-size: 20px;
  white-space: nowrap;
}
.portfolio-card-detail {
  display: grid;
  gap: 6px;
}
.portfolio-card-detail span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}
.portfolio-card-detail strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: keep-all;
}
.portfolio-card-detail em {
  color: var(--white);
  font-family: var(--font-number);
  font-style: normal;
  font-weight: 900;
  justify-self: end;
  white-space: nowrap;
}
.fixed-value { display: block; min-width: 0; max-width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #151a21; color: var(--white); font-size: 15px; overflow-wrap: anywhere; }
.fixed-strategy-row .fixed-value { display: none; }
.profile-input-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.profile-input-grid label { display: grid; gap: 5px; }
.profile-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.profile-metrics div { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #151a21; overflow: hidden; }
.profile-metrics span { display: block; color: var(--muted-2); font-size: 11px; font-weight: 800; }
.profile-metrics strong { display: block; min-width: 0; margin-top: 4px; color: var(--white); font-family: var(--font-number); font-size: 13px; overflow-wrap: anywhere; }
.entry-diagnostic-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.entry-diagnostic-box div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #151a21;
  overflow: hidden;
}
.entry-diagnostic-box span {
  display: block;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
}
.entry-diagnostic-box strong {
  display: block;
  min-width: 0;
  margin-top: 4px;
  color: var(--white);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.submitter-status-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #151a21;
  overflow: hidden;
}
.submitter-status-box > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.submitter-status-box span {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.submitter-status-box strong {
  min-width: 0;
  color: var(--white);
  font-size: 13px;
  text-align: right;
  overflow-wrap: anywhere;
}
.submitter-check-list {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.submitter-check-list:empty { display: none; }
.trading-switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border-radius: var(--radius-lg);
  font-size: 18px;
  color: var(--white);
  background: var(--surface-2);
}
.trading-switch span { min-width: 0; overflow-wrap: anywhere; }
.trading-switch b {
  flex: 0 0 54px;
  width: 54px;
  height: 30px;
  border-radius: 999px;
  background: #6b7280;
  position: relative;
}
.trading-switch b::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform .18s ease;
}
.trading-switch.on { background: rgba(14,203,129,.16); border-color: rgba(14,203,129,.45); }
.trading-switch.on b { background: var(--green); }
.trading-switch.on b::after { transform: translateX(24px); }
.trading-switch.off { background: rgba(146,154,165,.11); }

.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi-card { padding: 18px; box-shadow: inset 0 2px 0 rgba(252, 213, 53, .72); }
.kpi-card strong { font-size: 24px; }
.kpi-card em { display: block; margin-top: 4px; color: var(--muted-2); font-size: 12px; font-style: normal; }
.daily-report-card { margin-bottom: 20px; padding: 0; overflow: hidden; }
.report-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.report-metrics div { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #151a21; }
.report-metrics span { display: block; color: var(--muted-2); font-size: 11px; font-weight: 800; }
.report-metrics strong { display: block; margin-top: 6px; color: var(--white); font-family: var(--font-number); font-size: 18px; }
.report-interpretation { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-interpretation > span:not(.status-pill) { color: var(--muted); }
.report-interpretation em { color: var(--muted-2); font-style: normal; font-size: 12px; }
.report-basis-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.compact-table-wrap th, .compact-table-wrap td { padding: 12px 14px; }
.progress-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.progress-head strong { color: var(--white); font-size: 26px; }
.progress-head span { color: var(--muted); font-weight: 800; }
.progress-track.compact { height: 10px; }

.positions-card { padding: 0; overflow: hidden; }
.section-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.section-head h3 { margin-bottom: 4px; }
.sub-card { margin: 18px 22px 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,255,255,.02); overflow: hidden; }
.compact-section-head { padding: 16px 18px; align-items: center; }
.operator-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 18px 18px;
}
.operator-summary-strip div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #11161d;
}
.operator-summary-strip span {
  display: block;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
}
.operator-summary-strip strong {
  display: block;
  margin-top: 5px;
  color: var(--white);
  font-size: 13px;
}
.operator-action-list {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}
.operator-action-title {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(240, 185, 11, .07);
}
.operator-action-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #11161d;
}
.operator-action-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.operator-action-item p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.operator-command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  margin-top: 8px;
}
.operator-command-row code { margin-top: 0; }
.operator-action-item code {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(240, 185, 11, .22);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, .24);
  color: var(--white);
  font-family: var(--font-number);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}
.submitter-runbook {
  margin: 0 18px 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.submitter-runbook h4 { margin: 0 0 6px; color: var(--white); }
.submitter-runbook pre {
  margin: 10px 0;
  padding: 12px;
  overflow-x: visible;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #eef3fb;
  color: #233044;
  font-size: 12px;
  line-height: 1.55;
}
.submitter-runbook code {
  color: inherit;
  font-family: var(--font-number);
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted-2); font-size: 12px; text-align: left; font-weight: 800; white-space: nowrap; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); }
td { color: var(--text); font-family: var(--font-number); white-space: nowrap; }
.side { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-family: var(--font-body); font-weight: 800; }
.side.long { color: var(--green); background: rgba(14,203,129,.12); }
.side.short { color: var(--red); background: rgba(246,70,93,.12); }
.empty-state { margin: 22px; padding: 34px; border: 1px dashed var(--line); border-radius: var(--radius-lg); text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--white); font-size: 18px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0,0,0,.66);
}
.modal-card { width: min(460px, 100%); padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  max-width: 420px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.toast.good { border-color: rgba(14,203,129,.45); }
.toast.warn { border-color: rgba(240,185,11,.45); }
.toast.bad { border-color: rgba(246,70,93,.45); }

@media (max-width: 1180px) {
  body { min-width: 320px; }
  .app-header { grid-template-columns: 1fr; padding: 16px; gap: 12px; }
  main { padding: 20px 16px 50px; }
  .setup-grid, .dashboard-layout { grid-template-columns: 1fr; }
  .control-card { position: static; max-height: none; overflow: visible; }
  .connection-grid, .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  h1 { font-size: 34px; }
  h2 { font-size: 26px; }
  .connection-grid, .kpi-grid { grid-template-columns: 1fr; }
  .page-hero.split { display: block; }
  .strategy-multi-select { min-height: auto; }
  .strategy-choice {
    grid-template-columns: 24px minmax(0, 1fr);
    min-height: auto;
    padding: 16px;
  }
  .strategy-choice .strategy-choice-badge {
    grid-column: 2;
    justify-self: start;
  }
  .profile-metrics { grid-template-columns: 1fr; }
  .submitter-status-box > div {
    display: grid;
    justify-items: start;
  }
  .submitter-status-box strong { text-align: left; }
  .login-page {
    justify-items: start;
    padding: 20px;
  }
  .auth-card {
    width: min(350px, 100%);
    max-width: none;
    padding: 24px;
  }
  .brand-lockup { gap: 12px; }
  .brand-lockup span { overflow-wrap: anywhere; }
}

/* MVP expansion: admin + easy backtest surfaces */
.top-nav { flex-wrap: wrap; }
.compact-pill { min-height: 26px; padding: 0 9px; font-size: 11px; }
.table-search { width: 220px; min-height: 38px; }
.sub-nav { display: flex; gap: 8px; margin: 0 0 18px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.sub-nav-item { min-height: 38px; padding: 0 14px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-weight: 800; }
.sub-nav-item.active { background: var(--yellow); color: #181a20; }
.backtest-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 20px; align-items: start; margin-bottom: 20px; }
.strategy-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.strategy-card { display: grid; gap: 8px; min-height: 160px; padding: 18px; text-align: left; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #151a21; color: var(--text); }
.strategy-card strong { color: var(--white); font-size: 18px; }
.strategy-card span { color: var(--muted); font-weight: 500; }
.strategy-card em { color: var(--muted-2); font-size: 12px; font-style: normal; }
.strategy-card.selected { border-color: var(--yellow); box-shadow: inset 0 0 0 1px rgba(252,213,53,.32); }
.strategy-card.yellow.selected { background: rgba(252,213,53,.08); }
.strategy-card.green.selected { background: rgba(14,203,129,.08); }
.strategy-card.blue.selected { background: rgba(59,130,246,.08); }
.strategy-card.red.selected { background: rgba(246,70,93,.08); }
.simple-grid-form { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; }
.simple-grid-form .wide { grid-column: 1 / -1; }
.compact-form { grid-template-columns: 110px 1fr; }
.inline-check { display: flex; align-items: center; gap: 10px; color: var(--text); }
.inline-check input { width: auto; min-height: auto; }
.advanced-panel { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #151a21; }
.progress-card, .result-card { margin-top: 20px; }
.progress-track { height: 12px; border-radius: 999px; overflow: hidden; background: #151a21; }
.progress-track span { display: block; width: 0%; height: 100%; border-radius: inherit; background: var(--yellow); transition: width .2s ease; }
.summary-grid, .admin-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.result-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.mini-chart-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #151a21; }
.mini-chart-card h4 { margin: 0 0 14px; color: var(--white); }
.equity-curve { display: flex; align-items: end; gap: 6px; height: 130px; padding: 10px; border-radius: var(--radius-md); background: #0f1318; }
.equity-curve i { display: block; flex: 1; min-width: 8px; border-radius: 4px 4px 0 0; background: var(--yellow); opacity: .9; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.admin-summary-grid { margin-bottom: 20px; }
.admin-panel { display: grid; gap: 20px; }
.split-card { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.split-card select { max-width: 320px; }
.admin-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.detail-card { min-height: 260px; }
.wide-detail { grid-column: 1 / -1; }
.detail-list { display: grid; grid-template-columns: 150px 1fr; gap: 10px 14px; margin: 14px 0 0; }
.detail-list dt { color: var(--muted-2); font-weight: 800; }
.detail-list dd { margin: 0; color: var(--text); }
.admin-actions-card { display: grid; gap: 10px; align-content: start; }
.log-stack { display: grid; gap: 10px; }
.log-line { display: grid; gap: 2px; padding: 12px; border-radius: var(--radius-sm); background: #151a21; }
.log-line strong { color: var(--white); }
.log-line span { color: var(--muted); font-size: 12px; }
.filter-row { display: flex; gap: 10px; align-items: center; }
.log-filter-row { align-items: center; }
.data-table code { color: var(--muted); font-family: var(--font-number); font-size: 12px; }
.flatten-control { display: grid; gap: 12px; text-align: left; }
.flatten-position-meta { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #151a21; }
.flatten-control input { width: 100%; min-height: 42px; }
.typed-confirmation { display: grid; gap: 12px; text-align: left; }
.typed-confirmation code { display: block; padding: 10px 12px; border: 1px solid rgba(246,70,93,.38); border-radius: var(--radius-sm); background: rgba(246,70,93,.08); color: var(--white); font-family: var(--font-number); }
.typed-confirmation input { width: 100%; min-height: 42px; }
.quick-percent-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick-percent-buttons button { min-height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #151a21; color: var(--text); font-weight: 800; }
.quick-percent-buttons button:hover { border-color: var(--yellow); color: var(--yellow); }

@media (max-width: 1180px) {
  .backtest-layout, .result-grid, .settings-grid, .admin-detail-grid { grid-template-columns: 1fr; }
  .summary-grid, .admin-summary-grid, .operator-summary-strip { grid-template-columns: repeat(2, 1fr); }
  .operator-action-list { grid-template-columns: 1fr; }
  .operator-command-row { grid-template-columns: 1fr; }
  .profile-input-grid, .report-metrics { grid-template-columns: 1fr; }
  .strategy-cards { grid-template-columns: 1fr; }
  .sub-nav { overflow-x: auto; }
}

@media (max-width: 720px) {
  .summary-grid, .admin-summary-grid, .operator-summary-strip { grid-template-columns: 1fr; }
  .simple-grid-form, .compact-form, .detail-list { grid-template-columns: 1fr; }
  .split-card, .filter-row, .log-filter-row { display: grid; }
}

/* quantadesk UI skin port.  Keep existing IDs/DOM so Autobot API bindings stay intact. */
:root {
  --qd-sidebar: 246px;
  --canvas: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --line: #e6ecf5;
  --text: #233044;
  --white: #111827;
  --muted: #6b778c;
  --muted-2: #8a96a8;
  --yellow: #2f65f5;
  --yellow-active: #2457df;
  --yellow-soft: rgba(47, 101, 245, .1);
  --green: #22c98b;
  --red: #ff4d63;
  --warn: #f4b63f;
  --blue: #2f65f5;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow: 0 14px 34px rgba(28, 45, 75, .08);
  --font-body: Inter, "Noto Sans KR", "Segoe UI", Arial, sans-serif;
  --font-number: "DIN Alternate", "IBM Plex Sans", "Segoe UI", Consolas, monospace;
}

html { color-scheme: light; }
body {
  min-width: 360px;
  background: var(--canvas);
  color: var(--text);
  font: 14px/1.5 var(--font-body);
}
body::before { display: none; }
p.small, span.small, .muted.small {
  min-height: 0;
  padding: 0;
}
h1, h2, h3 { color: #1f2a44; font-weight: 800; letter-spacing: 0; }
h1 { font-size: 40px; }
h2 { font-size: 28px; }
h3 { font-size: 18px; }
.eyebrow {
  color: #6a86ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.login-page {
  min-height: 100vh;
  background: #f0f2f5 url("/static/img/quantadesk-background.svg") center / min(1100px, 90vw) no-repeat;
}
.auth-card {
  width: 480px;
  padding: 36px;
  border: 1px solid rgba(230, 236, 245, .92);
  border-radius: 20px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 28px 70px rgba(31, 55, 92, .14);
  backdrop-filter: blur(14px);
}
.brand-lockup { gap: 12px; margin-bottom: 24px; }
.brand-lockup strong { color: #2463eb; font-size: 21px; font-weight: 900; }
.brand-lockup span { color: #7f8ba0; font-size: 12px; }
.brand-diamond {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  background:
    url("/static/img/quantadesk-logo-mark.png") center / 82% no-repeat,
    linear-gradient(135deg, #2563eb 0%, #1d4ed8 58%, #14a3a8 100%);
  box-shadow: 0 8px 18px rgba(37, 99, 235, .18);
  transform: none;
}
.brand-diamond::before,
.brand-diamond::after { display: none; }
input, select, textarea {
  min-height: 42px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  color: #1f2a44;
}
input:focus, select:focus, textarea:focus {
  border-color: #2f65f5;
  box-shadow: 0 0 0 3px rgba(47, 101, 245, .12);
}
button, .secondary, .primary, .danger, .ghost {
  min-height: 38px;
  border-radius: 8px;
  font-weight: 800;
}
.primary {
  border-color: #2f65f5;
  background: linear-gradient(135deg, #2f65f5, #579dff);
  color: #fff;
  box-shadow: 0 8px 18px rgba(47, 101, 245, .22);
}
.primary:hover { background: linear-gradient(135deg, #2457df, #3b84f4); }
.secondary {
  border-color: #dbe3ef;
  background: #f7f9fd;
  color: #38506f;
}
.secondary:hover {
  border-color: rgba(47, 101, 245, .45);
  color: #2f65f5;
}
.ghost {
  border-color: #dbe3ef;
  background: #fff;
  color: #617088;
}
.danger {
  border-color: #ff4d63;
  background: #ff4d63;
  color: #fff;
  box-shadow: 0 8px 18px rgba(255, 77, 99, .22);
}
.link-button { color: #2f65f5; }

.app-shell {
  min-height: 100vh;
  padding-left: var(--qd-sidebar);
  background: var(--canvas);
}
.app-header {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: var(--qd-sidebar);
  min-height: 100vh;
  padding: 0;
  border-right: 1px solid #e7edf7;
  border-bottom: 0;
  background: #fff;
  box-shadow: 8px 0 24px rgba(31, 55, 92, .04);
  backdrop-filter: none;
}
.brand-lockup.compact {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 72px;
  margin: 0;
  padding: 0 24px;
  border-bottom: 1px solid #eef2f7;
}
.brand-lockup.compact .brand-diamond {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
}
.brand-lockup.compact strong { color: #2463eb; font-size: 22px; }
.brand-lockup.compact span { display: none; }
.top-nav {
  display: grid;
  flex: 1 1 auto;
  width: 100%;
  align-content: start;
  gap: 8px;
  padding: 22px 0;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-right: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #627085;
  font-weight: 800;
  text-align: left;
}
.sidebar-tools {
  display: flex;
  width: 100%;
  padding: 0 24px 24px;
}
.nav-item:hover {
  background: #f5f8ff;
  color: #2f65f5;
}
.nav-item.active {
  border-right-color: #2f65f5;
  background: #edf4ff;
  color: #2f65f5;
}
.user-box {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--qd-sidebar);
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid #e7edf7;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 20px rgba(31, 55, 92, .05);
  color: #617088;
  backdrop-filter: blur(10px);
}
.user-box::before {
  content: "";
  position: absolute;
  left: 28px;
  width: 20px;
  height: 14px;
  border-top: 2px solid #5d6878;
  border-bottom: 2px solid #5d6878;
  box-shadow: inset 0 5px 0 0 #5d6878;
}
.session-expiry { color: #8a96a8; }
.status-pill {
  min-height: 30px;
  border-radius: 999px;
  background: #f1f5fb;
  color: #617088;
}
.status-pill.good { background: rgba(34, 201, 139, .13); color: #18b77c !important; }
.status-pill.warn { background: rgba(244, 182, 63, .16); color: #b57908 !important; }
.status-pill.bad { background: rgba(255, 77, 99, .13); color: #ff4058 !important; }
.status-pill.neutral { background: #f1f5fb; color: #617088 !important; }

main {
  max-width: none;
  margin: 0;
  padding: 92px 32px 64px;
}
.page { animation: qdFadeIn .18s ease-out; }
@keyframes qdFadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.page-hero, .dashboard-top, .card, .kpi-card, .bot-state-card, .control-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.page-hero {
  padding: 24px 28px;
  margin-bottom: 22px;
}
.page-hero h2 { margin-bottom: 6px; }
.page-hero .muted { margin-bottom: 0; }
.setup-grid { grid-template-columns: minmax(520px, 1fr) 420px; gap: 22px; }
.card { padding: 24px; }
.safety-card ul { color: #6b778c; }
.mask-summary div,
.connection-grid div,
.profile-metrics div,
.entry-diagnostic-box div,
.submitter-status-box,
.worker-check-item,
.report-metrics div,
.mini-chart-card,
.advanced-panel,
.log-line {
  border-color: #e7edf7;
  background: #f8fbff;
}

.dashboard-layout {
  grid-template-columns: minmax(0, 1fr) clamp(360px, 27vw, 456px);
  gap: 22px;
}
.dashboard-top { margin-bottom: 22px; border: 0; background: transparent; box-shadow: none; }
.bot-state-card {
  padding: 24px 28px;
  border-radius: 18px;
}
.bot-state-card h2 { color: #1f2a44; font-size: 28px; }
.connection-grid {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
}
.connection-grid div {
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid #e8edf5;
  border-radius: 12px;
}
.connection-grid span,
.kpi-card span {
  color: #79869a;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.connection-grid strong,
.kpi-card strong {
  color: #1f2a44;
  font-family: var(--font-number);
}
.connection-grid strong { font-size: 15px; }
.kpi-grid {
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 16px;
}
.kpi-card {
  position: relative;
  min-height: 128px;
  padding: 28px 20px 18px;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.kpi-card strong { margin-top: 16px; font-size: 28px; }
.kpi-card em { color: #79869a; }
.kpi-grid .kpi-card:first-child {
  border-color: transparent;
  background: linear-gradient(135deg, #2d5fd8, #58a5ff);
  color: #fff;
}
.kpi-grid .kpi-card:first-child span,
.kpi-grid .kpi-card:first-child strong,
.kpi-grid .kpi-card:first-child em {
  color: #fff;
}
.control-card {
  top: 86px;
  padding: 22px;
  border-radius: 18px;
  background: #fff;
}
.strategy-choice {
  border-color: #e7edf7;
  border-radius: 14px;
  background: #f8fbff;
}
.strategy-choice:hover {
  border-color: rgba(47, 101, 245, .35);
  background: #f3f7ff;
}
.strategy-choice:has(input:checked) {
  border-color: #4f7bff;
  background: #edf6ff;
  box-shadow: inset 3px 0 0 #2f65f5, 0 10px 22px rgba(47, 101, 245, .08);
}
.strategy-selection-summary,
.strategy-allocation-panel {
  border-color: rgba(47, 101, 245, .18);
  background: #f4f8ff;
}
.strategy-allocation-portfolio-card {
  border-color: rgba(34, 201, 139, .25);
  background: linear-gradient(135deg, #ecfff7, #eef5ff);
}
.portfolio-card-head strong,
.portfolio-card-detail em {
  color: #1f2a44;
}
.portfolio-card-head small,
.portfolio-card-detail span {
  color: #62708a;
}
.fixed-value,
.strategy-select,
.strategy-allocation-row input {
  border-color: #dbe3ef;
  background: #fff;
  color: #1f2a44;
}
.trading-switch {
  min-height: 58px;
  border-radius: 14px;
  background: #eef2f8;
  color: #1f2a44;
}
.trading-switch.on {
  border-color: rgba(34, 201, 139, .42);
  background: rgba(34, 201, 139, .12);
}
.trading-switch.off { background: #eef2f8; }

.daily-report-card,
.positions-card {
  border-radius: 18px;
}
.daily-report-actions {
  justify-content: flex-end;
  gap: 8px;
}
.report-export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: auto;
  min-width: 118px;
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  line-height: 1;
  white-space: nowrap;
}
.report-export-button .export-icon {
  display: block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.report-export-button span {
  min-width: 0;
  line-height: 1;
}
.daily-report-actions .compact-pill {
  height: 34px;
  min-height: 34px;
}
.section-head {
  padding: 20px 24px;
  border-bottom-color: #edf1f7;
}
.section-head h3 { color: #1f2a44; }
.report-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 24px;
  border-bottom-color: #edf1f7;
}
.report-metrics div {
  border-radius: 12px;
}
.report-metrics span,
.profile-metrics span,
.entry-diagnostic-box span,
.submitter-status-box span {
  color: #8a96a8;
}
.report-metrics strong,
.profile-metrics strong,
.entry-diagnostic-box strong,
.submitter-status-box strong {
  color: #1f2a44;
}
.table-wrap { background: #fff; }
table { background: #fff; }
th {
  padding: 14px 16px;
  border-bottom: 1px solid #e7edf7;
  background: #f8fbff;
  color: #65748a;
  font-size: 12px;
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid #eef2f7;
  color: #42526b;
}
tbody tr:hover td { background: #f7fbff; }
.side.long { color: #18b77c; background: rgba(34, 201, 139, .12); }
.side.short { color: #ff4058; background: rgba(255, 77, 99, .11); }
.empty-state {
  border-color: #dbe3ef;
  border-radius: 16px;
  color: #79869a;
}
.empty-state strong { color: #1f2a44; }

.admin-panel { gap: 22px; }
.progress-track {
  background: #eef2f8;
}
.progress-track span {
  background: linear-gradient(135deg, #2f65f5, #58a5ff);
}
.backtest-layout {
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 22px;
}
.strategy-card {
  border-color: #e7edf7;
  border-radius: 16px;
  background: #f8fbff;
}
.strategy-card strong { color: #1f2a44; }
.strategy-card.selected {
  border-color: #2f65f5;
  background: #edf6ff;
  box-shadow: inset 3px 0 0 #2f65f5, 0 10px 22px rgba(47, 101, 245, .08);
}
.summary-grid,
.admin-summary-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
}
.result-grid { grid-template-columns: 380px minmax(0, 1fr); }
.equity-curve {
  background: linear-gradient(180deg, #f3f8ff, #edf3fb);
}
.equity-curve i {
  background: linear-gradient(180deg, #2f65f5, #83b5ff);
}
.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.sub-nav {
  gap: 0;
  margin-bottom: 22px;
  padding: 0;
  border: 1px solid #e7edf7;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}
.sub-nav-item {
  min-height: 48px;
  border-radius: 0;
  color: #65748a;
}
.sub-nav-item.active {
  background: transparent;
  color: #2f65f5;
  box-shadow: inset 0 -2px 0 #2f65f5;
}
.admin-detail-grid { gap: 22px; }
.modal-backdrop { background: rgba(20, 32, 52, .42); }
.modal-card {
  border-color: #e7edf7;
  background: #fff;
  box-shadow: 0 28px 70px rgba(31, 55, 92, .2);
}
.toast {
  border-color: #dbe3ef;
  border-radius: 12px;
  background: #fff;
  color: #1f2a44;
  box-shadow: 0 18px 44px rgba(31, 55, 92, .16);
}
code,
.data-table code {
  color: #42526b;
}
.submitter-runbook pre code {
  color: inherit;
}
.position-row-clickable {
  cursor: pointer;
}
.position-row-clickable:hover td {
  background: #f5f9ff;
}
.position-row-clickable:focus-visible {
  outline: 3px solid rgba(47, 101, 245, .28);
  outline-offset: -3px;
}
.position-row-clickable .mobile-action-cell {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.submitter-runbook,
.sub-card {
  border-color: #e7edf7;
  border-radius: 14px;
  background: #f8fbff;
}
.submitter-runbook pre {
  background: #111827;
  color: #e5e7eb;
}

.chart-hero {
  align-items: center;
}
.chart-toolbar {
  display: grid;
  grid-template-columns: auto minmax(260px, 420px) auto 128px auto auto;
  align-items: center;
  gap: 10px;
  min-width: min(100%, 880px);
}
.chart-toolbar label {
  color: #65748a;
  white-space: nowrap;
}
.chart-symbol-control {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(128px, .7fr);
  gap: 8px;
  min-width: 0;
}
.chart-toolbar select,
.chart-toolbar input {
  min-height: 38px;
  border-color: #dbe3ef;
  background: #fff;
  color: #1f2a44;
}
.chart-card {
  margin-bottom: 22px;
  padding: 0;
  overflow: hidden;
  border-radius: 18px;
}
.chart-canvas-wrap {
  position: relative;
  width: 100%;
  min-height: 520px;
  padding: 18px 18px 10px;
  background: #fff;
}
.trade-chart {
  display: block;
  width: 100%;
  height: 520px;
  border: 1px solid #e7edf7;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.trade-chart-tooltip {
  position: absolute;
  z-index: 4;
  min-width: 160px;
  max-width: min(260px, calc(100% - 36px));
  padding: 10px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 14px 28px rgba(31, 55, 92, .16);
  color: #1f2a44;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}
.trade-chart-tooltip strong {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-number);
  font-size: 13px;
}
.trade-chart-tooltip span {
  display: block;
  color: #65748a;
}
.chart-empty {
  margin-top: 0;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #65748a;
  font-size: 12px;
  font-weight: 800;
}
.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}
.legend-buy { background: #2f65f5; }
.legend-sell { background: #ff4058; }
.chart-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}
.strategy-guide-page {
  display: grid;
  gap: 22px;
}
.strategy-guide-grid {
  display: grid;
  gap: 22px;
}
.strategy-sleeve-section {
  display: grid;
  gap: 18px;
}
.strategy-window-grid,
.strategy-sleeve-grid {
  display: grid;
  gap: 14px;
}
.strategy-window-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.strategy-window-grid div {
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid #e7edf7;
  border-radius: 8px;
  background: #f8fbff;
}
.strategy-window-grid strong {
  display: block;
  margin-bottom: 5px;
  color: #1f2a44;
  font-weight: 900;
}
.strategy-window-grid span {
  display: block;
  color: #65748a;
  font-size: 13px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.strategy-sleeve-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.strategy-sleeve-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid #e7edf7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(31, 55, 92, .06);
}
.strategy-sleeve-card:nth-child(5) {
  grid-column: 1 / -1;
}
.strategy-sleeve-head {
  display: grid;
  gap: 4px;
}
.strategy-sleeve-head h4 {
  margin: 0;
  color: #1f2a44;
  font-size: 18px;
}
.strategy-sleeve-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.strategy-sleeve-metrics div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #edf2f8;
  border-radius: 8px;
  background: #f8fbff;
}
.strategy-sleeve-metrics dt {
  color: #79869a;
  font-size: 11px;
  font-weight: 800;
}
.strategy-sleeve-metrics dd {
  margin: 3px 0 0;
  color: #1f2a44;
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
}
.strategy-sleeve-reasons {
  display: grid;
  gap: 10px;
}
.strategy-sleeve-reasons p {
  margin: 0;
  color: #65748a;
  font-size: 13px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.strategy-sleeve-reasons strong {
  color: #1f2a44;
  font-weight: 900;
}
.strategy-guide-card {
  display: grid;
  grid-template-columns: minmax(320px, .82fr) minmax(420px, 1.18fr);
  gap: 24px;
  align-items: center;
  padding: 24px;
  overflow: hidden;
}
.strategy-guide-copy {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.strategy-guide-copy h3 {
  margin: 0;
  color: #1f2a44;
  font-size: 26px;
}
.strategy-guide-copy p {
  margin: 0;
  color: #65748a;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.strategy-guide-evidence {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid #e7edf7;
  border-bottom: 1px solid #e7edf7;
}
.strategy-guide-evidence span {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.strategy-guide-evidence strong {
  color: #1f2a44;
  font-size: 18px;
  font-weight: 900;
  overflow-wrap: anywhere;
}
.strategy-guide-evidence em {
  color: #79869a;
  font-size: 11px;
  font-style: normal;
  line-height: 1.4;
  word-break: keep-all;
}
.strategy-guide-report-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.strategy-guide-report-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  background: #fff;
  color: #2f65f5;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.strategy-guide-report-links a:hover {
  border-color: rgba(47, 101, 245, .45);
  background: #f5f8ff;
}
.strategy-explain-steps {
  display: grid;
  gap: 10px;
}
.strategy-explain-steps div,
.strategy-risk-grid div {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #e7edf7;
  border-radius: 12px;
  background: #f8fbff;
}
.strategy-explain-steps strong,
.strategy-risk-grid strong {
  display: block;
  margin-bottom: 5px;
  color: #1f2a44;
  font-weight: 900;
}
.strategy-explain-steps span,
.strategy-risk-grid span {
  display: block;
  color: #65748a;
  font-size: 13px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.strategy-guide-figure {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
}
.strategy-guide-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #e7edf7;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(31, 55, 92, .08);
}
.strategy-guide-figure figcaption {
  color: #79869a;
  font-size: 12px;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.strategy-guide-risk {
  display: grid;
  gap: 16px;
}
.strategy-guide-risk h3 {
  margin: 0;
  color: #1f2a44;
}
.strategy-risk-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.strategy-report-section {
  display: grid;
  gap: 18px;
}
.strategy-report-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}
.strategy-report-head div {
  display: grid;
  gap: 8px;
}
.strategy-report-head h3,
.strategy-report-head p {
  margin: 0;
}
.strategy-report-head h3 {
  color: #1f2a44;
  font-size: 22px;
}
.strategy-report-head p {
  max-width: 820px;
  color: #65748a;
  line-height: 1.55;
  word-break: keep-all;
}
.strategy-report-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.strategy-report-item {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
}
.strategy-report-overview {
  grid-column: 1 / -1;
}
.strategy-report-item > a {
  display: block;
  min-width: 0;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(31, 55, 92, .08);
  overflow: hidden;
}
.strategy-report-item > a:focus-visible {
  outline: 3px solid rgba(47, 101, 245, .3);
  outline-offset: 3px;
}
.strategy-report-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}
.strategy-report-item figcaption {
  display: grid;
  gap: 4px;
}
.strategy-report-item figcaption strong {
  color: #1f2a44;
  font-size: 14px;
}
.strategy-report-item figcaption span {
  color: #79869a;
  font-size: 12px;
  line-height: 1.5;
  word-break: keep-all;
}
.strategy-report-english-link {
  width: fit-content;
  color: #2f65f5;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.strategy-report-english-link:hover {
  text-decoration: underline;
}

@media (max-width: 1320px) {
  .connection-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-layout,
  .setup-grid,
  .backtest-layout,
  .result-grid,
  .settings-grid,
  .admin-detail-grid {
    grid-template-columns: 1fr;
  }
  .strategy-guide-card {
    grid-template-columns: 1fr;
  }
  .strategy-risk-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .strategy-window-grid,
  .strategy-sleeve-grid {
    grid-template-columns: 1fr;
  }
  .strategy-sleeve-card:nth-child(5) {
    grid-column: auto;
  }
  .control-card { position: static; }
}

@media (max-width: 900px) {
  :root { --qd-sidebar: 0px; }
  .app-shell { padding-left: 0; }
  .strategy-guide-evidence {
    grid-template-columns: 1fr 1fr;
  }
  .strategy-sleeve-metrics,
  .strategy-window-grid {
    grid-template-columns: 1fr;
  }
  .strategy-report-gallery,
  .strategy-risk-grid {
    grid-template-columns: 1fr;
  }
  .strategy-report-overview {
    grid-column: auto;
  }
  .strategy-report-head {
    align-items: start;
    flex-direction: column;
  }
  .app-header {
    position: sticky;
    top: 0;
    width: 100%;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid #e7edf7;
  }
  .brand-lockup.compact {
    width: auto;
    min-height: 64px;
    padding: 0 18px;
    border-bottom: 0;
  }
  .top-nav {
    display: flex;
    overflow-x: auto;
    gap: 0;
    padding: 0;
  }
  .sidebar-tools {
    padding: 0 18px 14px;
  }
  .nav-item {
    width: auto;
    min-width: max-content;
    min-height: 64px;
    padding: 0 16px;
    border-right: 0;
    border-bottom: 3px solid transparent;
  }
  .nav-item.active {
    border-bottom-color: #2f65f5;
    border-right-color: transparent;
  }
  .user-box {
    position: static;
    left: auto;
    min-height: 56px;
    justify-content: flex-start;
    padding: 0 18px;
    box-shadow: none;
  }
  .user-box::before { display: none; }
  main { padding: 24px 16px 48px; }
  .app-header { flex-wrap: wrap; }
  .connection-grid,
  .kpi-grid,
  .report-metrics,
  .summary-grid,
  .admin-summary-grid,
  .operator-summary-strip {
    grid-template-columns: 1fr;
  }
  .strategy-risk-grid {
    grid-template-columns: 1fr;
  }
  .page-hero.split,
  .section-head,
  .split-card,
  .filter-row,
  .log-filter-row {
    display: grid;
  }
  .daily-report-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }
  .daily-report-actions .report-export-button {
    width: 100%;
    min-width: 0;
  }
  .daily-report-actions .compact-pill {
    grid-column: 1 / -1;
    justify-content: center;
    width: 100%;
  }
  .chart-toolbar {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
  }
  .chart-symbol-control {
    grid-template-columns: 1fr;
    width: 100%;
  }
  .chart-toolbar label {
    align-self: end;
  }
  .chart-toolbar button,
  .chart-toolbar .status-pill {
    width: 100%;
    justify-content: center;
  }
  .chart-canvas-wrap {
    min-height: 420px;
    padding: 12px;
  }
  .trade-chart {
    height: 420px;
  }
  .dashboard-main {
    order: 0;
  }
  .dashboard-sidebar {
    order: -1;
  }
}

@media (max-width: 560px) {
  body { min-width: 320px; }
  h1 { font-size: 34px; }
  h2 { font-size: 24px; }
  .auth-card {
    width: min(360px, 100%);
    padding: 26px;
  }
  .simple-grid-form,
  .compact-form,
  .detail-list,
  .strategy-allocation-row {
    grid-template-columns: 1fr;
  }
  .portfolio-card-head,
  .portfolio-card-detail span {
    grid-template-columns: 1fr;
  }
  .portfolio-card-head b,
  .portfolio-card-detail em {
    justify-self: start;
  }
  .user-box {
    display: grid;
    gap: 8px;
    align-items: start;
    padding: 12px 18px;
  }
  .chart-toolbar {
    grid-template-columns: 1fr;
  }
  .chart-symbol-control {
    grid-template-columns: 1fr;
  }
  .chart-canvas-wrap {
    min-height: 360px;
  }
  .trade-chart {
    height: 360px;
  }
}

@media (max-width: 900px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }
  .app-shell,
  .app-header,
  main,
  .page,
  .page-hero,
  .card,
  .dashboard-layout,
  .dashboard-main,
  .dashboard-sidebar {
    min-width: 0;
    max-width: 100%;
  }
  .app-header {
    width: 100%;
    overflow: hidden;
  }
  .brand-lockup.compact > div:last-child {
    min-width: 0;
  }
  .user-box {
    min-width: 0;
  }
  .top-nav {
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .nav-item {
    white-space: nowrap;
  }
  .page-hero.split,
  .chart-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
  .chart-toolbar {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .chart-symbol-control {
    width: 100%;
  }
  .chart-toolbar label {
    align-self: end;
  }
  .chart-toolbar .status-pill {
    min-width: 0;
  }
  .chart-canvas-wrap {
    width: 100%;
    overflow: hidden;
  }
}

@media (max-width: 720px) {
  .positions-card {
    overflow: hidden;
  }
  .positions-card .section-head,
  #order-history-card .section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .table-wrap.mobile-card-wrap {
    margin: 0;
    padding: 0 12px 14px;
    overflow: visible;
  }
  .mobile-card-wrap .mobile-card-table,
  .mobile-card-wrap .mobile-card-table.data-table,
  .mobile-card-wrap.compact-table-wrap .mobile-card-table.data-table {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }
  .mobile-card-table thead {
    display: none;
  }
  .mobile-card-table tbody {
    display: grid;
    gap: 10px;
    width: 100%;
  }
  .mobile-card-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 14px;
    border: 1px solid #e7edf7;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(31, 55, 92, .08);
  }
  .mobile-card-table tr::before {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e7edf7;
    color: #1f2a44;
    content: attr(data-symbol) " · " attr(data-side);
    font-family: var(--font-number);
    font-size: 15px;
    font-weight: 900;
    overflow-wrap: anywhere;
  }
  .order-event-table tr::before {
    content: attr(data-symbol) " · " attr(data-side) " · " attr(data-status);
  }
  .position-table tr::before {
    content: attr(data-symbol) " · " attr(data-side) " · " attr(data-status);
  }
  .mobile-card-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    color: #42526b;
    font-family: var(--font-number);
    font-size: 13px;
    line-height: 1.35;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .mobile-card-table td[data-mobile-hide="true"] {
    display: none;
  }
  .mobile-card-table td::before {
    flex: 0 0 auto;
    max-width: 42%;
    color: #65748a;
    content: attr(data-label);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 800;
    text-align: left;
    white-space: normal;
  }
  .mobile-card-table td > * {
    min-width: 0;
  }
  .mobile-card-table td strong,
  .mobile-card-table td code,
  .mobile-card-table td .status-pill {
    max-width: 58%;
    text-align: right;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .mobile-card-table .side,
  .mobile-card-table .status-pill {
    justify-content: center;
  }
  .mobile-card-table .mobile-action-cell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 6px;
  }
  .mobile-card-table .mobile-action-cell::before {
    display: none;
  }
  .mobile-card-table .mobile-action-cell button {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .table-wrap.mobile-card-wrap {
    padding-right: 10px;
    padding-left: 10px;
  }
  .mobile-card-table tr {
    padding: 12px;
  }
  .mobile-card-table td {
    gap: 10px;
    font-size: 12px;
  }
  .mobile-card-table td::before {
    font-size: 11px;
  }
  .chart-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .positions-card .section-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  #order-history-card .section-head > button,
  .positions-card .section-head .button-row button {
    width: 100%;
  }
  .table-wrap.mobile-card-wrap {
    margin: 0;
    padding: 0 12px 14px;
    overflow: visible;
    border-radius: 0;
  }
  .mobile-card-wrap .mobile-card-table {
    display: block;
    width: 100%;
    min-width: 0 !important;
    border-collapse: separate;
  }
  .mobile-card-table thead {
    display: none;
  }
  .mobile-card-table tbody {
    display: grid;
    gap: 10px;
    width: 100%;
  }
  .mobile-card-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
  }
  .mobile-card-table tr::before {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    color: var(--white);
    content: attr(data-symbol) " · " attr(data-side);
    font-family: var(--font-number);
    font-size: 15px;
    font-weight: 900;
    overflow-wrap: anywhere;
  }
  .order-event-table tr::before {
    content: attr(data-symbol) " · " attr(data-side) " · " attr(data-status);
  }
  .position-table tr::before {
    content: attr(data-symbol) " · " attr(data-side) " · " attr(data-status);
  }
  .mobile-card-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    color: var(--text);
    font-family: var(--font-number);
    font-size: 13px;
    line-height: 1.35;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .mobile-card-table td[data-mobile-hide="true"] {
    display: none;
  }
  .mobile-card-table td::before {
    flex: 0 0 auto;
    color: var(--muted-2);
    content: attr(data-label);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 800;
    text-align: left;
    white-space: nowrap;
  }
  .mobile-card-table td > * {
    min-width: 0;
  }
  .mobile-card-table td strong,
  .mobile-card-table td code,
  .mobile-card-table td .status-pill {
    max-width: 64%;
    text-align: right;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .mobile-card-table td code {
    display: inline-block;
    color: var(--muted);
    font-size: 11px;
  }
  .mobile-card-table .side,
  .mobile-card-table .status-pill {
    justify-content: center;
  }
  .mobile-card-table .mobile-action-cell {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 6px;
  }
  .mobile-card-table .mobile-action-cell::before {
    display: none;
  }
  .mobile-card-table .mobile-action-cell button {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .table-wrap.mobile-card-wrap {
    padding-right: 10px;
    padding-left: 10px;
  }
  .mobile-card-table tr {
    padding: 12px;
    border-radius: 14px;
  }
  .mobile-card-table td {
    gap: 10px;
    font-size: 12px;
  }
  .mobile-card-table td::before {
    font-size: 11px;
  }
}

@media (max-width: 900px) {
  .app-header {
    display: grid;
    grid-template-areas:
      "brand user tools"
      "nav nav nav";
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0;
    padding: 0;
    background: #fff;
  }
  .brand-lockup.compact {
    grid-area: brand;
    min-width: 0;
    min-height: 56px;
    padding: 0 12px;
  }
  .brand-lockup.compact .brand-diamond {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 7px;
  }
  .brand-lockup.compact strong {
    overflow: hidden;
    color: #2463eb;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .top-nav {
    grid-area: nav;
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    border-top: 1px solid #eef2f7;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidebar-tools {
    grid-area: tools;
    width: auto;
    padding: 0 12px 0 4px;
  }
  .top-nav::-webkit-scrollbar { display: none; }
  .nav-item {
    flex: 0 0 auto;
    min-height: 46px;
    padding: 0 14px;
    font-size: 13px;
  }
  .user-box {
    grid-area: user;
    display: flex;
    min-width: 0;
    max-width: 45vw;
    min-height: 56px;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 12px;
  }
  #session-user {
    max-width: 18vw;
    overflow: hidden;
    color: #1f2a44;
    font-size: 13px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #session-role,
  .session-expiry {
    display: none;
  }
  #auth-logout {
    min-height: 32px;
    padding: 0 10px;
  }
  main {
    padding: 16px 12px 40px;
  }
  .page-hero,
  .card,
  .control-card,
  .bot-state-card {
    border-radius: 12px;
  }
  .page-hero {
    padding: 16px;
    margin-bottom: 14px;
  }
  .card { padding: 16px; }
  .chart-card { padding: 0; }
  .section-head {
    gap: 10px;
    padding: 14px 16px;
  }
  .daily-report-actions {
    gap: 8px;
  }
  .section-head h3 { font-size: 17px; }
  .bot-state-card { padding: 16px; }
  .bot-state-card h2 { font-size: 22px; }
  .connection-grid div,
  .report-metrics div {
    min-height: auto;
    padding: 10px 12px;
  }
  .kpi-card {
    min-height: auto;
    padding: 16px;
    border-radius: 12px;
  }
  .kpi-card strong {
    margin-top: 8px;
    font-size: 22px;
  }
  .button-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .button-row button { width: 100%; }
  .sub-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sub-nav::-webkit-scrollbar { display: none; }
  .sub-nav-item {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .table-wrap {
    margin: 0 -16px;
    border-radius: 0;
  }
  .data-table { min-width: 760px; }
  .compact-table-wrap .data-table { min-width: 680px; }
}

@media (max-width: 560px) {
  .login-page {
    place-items: start center;
    padding: 24px 14px;
  }
  .auth-card {
    width: 100%;
    max-width: 360px;
    padding: 22px;
  }
  .brand-lockup.compact span { display: none; }
  .brand-lockup.compact strong { font-size: 17px; }
  .brand-lockup.compact .brand-diamond {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }
  .user-box {
    max-width: 52vw;
    gap: 6px;
  }
  #session-user {
    max-width: 24vw;
    font-size: 12px;
  }
  #auth-logout {
    min-width: 0;
    padding: 0 8px;
    font-size: 12px;
  }
  .nav-item {
    min-height: 42px;
    padding: 0 12px;
    font-size: 12px;
  }
  main { padding: 12px 10px 36px; }
  .page-hero { padding: 14px; }
  .card { padding: 14px; }
  .chart-card { padding: 0; }
  .section-head { padding: 12px 14px; }
  .report-export-button {
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }
  .report-export-button .export-icon {
    width: 15px;
    height: 15px;
    flex-basis: 15px;
  }
  .chart-toolbar select,
  .chart-toolbar input,
  .chart-toolbar button {
    min-height: 40px;
  }
  .chart-toolbar label { font-size: 11px; }
  .chart-canvas-wrap {
    min-height: 320px;
    padding: 8px;
  }
  .trade-chart {
    height: 320px;
    border-radius: 10px;
  }
  .chart-legend {
    flex-wrap: wrap;
    gap: 10px;
  }
  .report-metrics { padding: 12px 14px; }
  .toast {
    right: 10px;
    bottom: 12px;
    left: 10px;
  }
}

@media (max-width: 720px) {
  .table-wrap.mobile-card-wrap {
    margin: 0;
    padding: 0 12px 14px;
    overflow: visible;
  }
  .mobile-card-wrap .mobile-card-table,
  .mobile-card-wrap .mobile-card-table.data-table,
  .mobile-card-wrap.compact-table-wrap .mobile-card-table.data-table {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }
  .mobile-card-table tbody,
  .mobile-card-table tr,
  .mobile-card-table td {
    min-width: 0;
    max-width: 100%;
  }
  .mobile-card-table td {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  margin-left: 0;
  padding: 0;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #f7f9fd;
  color: #617088;
}
.theme-toggle:hover {
  border-color: rgba(47, 101, 245, .45);
  background: #edf4ff;
  color: #2f65f5;
}
.theme-icon {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-icon-sun { display: none; }

html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #111315;
  --surface: #191c20;
  --surface-2: #23272d;
  --line: #303640;
  --text: #e6e9ee;
  --white: #f8fafc;
  --muted: #a3abb7;
  --muted-2: #7e8795;
  --yellow: #80a7ff;
  --yellow-active: #9bbcff;
  --yellow-soft: rgba(128, 167, 255, .14);
  --green: #2bd69a;
  --red: #ff6678;
  --warn: #f5bf55;
  --blue: #80a7ff;
  --shadow: 0 18px 40px rgba(0, 0, 0, .32);
}
html[data-theme="dark"] body {
  background: var(--canvas);
  color: var(--text);
}
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] .bot-state-card h2,
html[data-theme="dark"] .section-head h3,
html[data-theme="dark"] .strategy-guide-copy h3,
html[data-theme="dark"] .strategy-guide-risk h3,
html[data-theme="dark"] .strategy-guide-evidence strong,
html[data-theme="dark"] .strategy-window-grid strong,
html[data-theme="dark"] .strategy-sleeve-head h4,
html[data-theme="dark"] .strategy-sleeve-metrics dd,
html[data-theme="dark"] .strategy-sleeve-reasons strong,
html[data-theme="dark"] .strategy-report-head h3,
html[data-theme="dark"] .strategy-report-item figcaption strong,
html[data-theme="dark"] .strategy-explain-steps strong,
html[data-theme="dark"] .strategy-risk-grid strong,
html[data-theme="dark"] .connection-grid strong,
html[data-theme="dark"] .admin-system-status-item-head strong,
html[data-theme="dark"] .kpi-card strong,
html[data-theme="dark"] .portfolio-card-head strong,
html[data-theme="dark"] .portfolio-card-detail em,
html[data-theme="dark"] .report-metrics strong,
html[data-theme="dark"] .profile-metrics strong,
html[data-theme="dark"] .entry-diagnostic-box strong,
html[data-theme="dark"] .submitter-status-box strong,
html[data-theme="dark"] .empty-state strong,
html[data-theme="dark"] .strategy-card strong {
  color: var(--white);
}
html[data-theme="dark"] .muted,
html[data-theme="dark"] .session-expiry,
html[data-theme="dark"] .brand-lockup span,
html[data-theme="dark"] .connection-grid span,
html[data-theme="dark"] .admin-system-status-item-head span,
html[data-theme="dark"] .admin-system-status-item p,
html[data-theme="dark"] .admin-system-status-action,
html[data-theme="dark"] .kpi-card span,
html[data-theme="dark"] .kpi-card em,
html[data-theme="dark"] .report-metrics span,
html[data-theme="dark"] .profile-metrics span,
html[data-theme="dark"] .entry-diagnostic-box span,
html[data-theme="dark"] .submitter-status-box span,
html[data-theme="dark"] .chart-toolbar label,
html[data-theme="dark"] .chart-legend,
html[data-theme="dark"] .strategy-guide-copy p,
html[data-theme="dark"] .strategy-guide-evidence em,
html[data-theme="dark"] .strategy-window-grid span,
html[data-theme="dark"] .strategy-sleeve-metrics dt,
html[data-theme="dark"] .strategy-sleeve-reasons p,
html[data-theme="dark"] .strategy-report-head p,
html[data-theme="dark"] .strategy-report-item figcaption span,
html[data-theme="dark"] .strategy-explain-steps span,
html[data-theme="dark"] .strategy-risk-grid span,
html[data-theme="dark"] .strategy-guide-figure figcaption,
html[data-theme="dark"] th,
html[data-theme="dark"] td,
html[data-theme="dark"] .empty-state {
  color: var(--muted);
}
html[data-theme="dark"] .login-page {
  background: #111315;
}
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .app-header,
html[data-theme="dark"] .user-box,
html[data-theme="dark"] .page-hero,
html[data-theme="dark"] .card,
html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .bot-state-card,
html[data-theme="dark"] .control-card,
html[data-theme="dark"] .sub-nav,
html[data-theme="dark"] .modal-card {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}
html[data-theme="dark"] .brand-lockup.compact,
html[data-theme="dark"] .user-box,
html[data-theme="dark"] .section-head,
html[data-theme="dark"] th,
html[data-theme="dark"] td {
  border-color: var(--line);
}
html[data-theme="dark"] .brand-lockup strong,
html[data-theme="dark"] .brand-lockup.compact strong,
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .link-button {
  color: var(--yellow);
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .fixed-value,
html[data-theme="dark"] .strategy-select,
html[data-theme="dark"] .strategy-allocation-row input,
html[data-theme="dark"] .chart-toolbar input,
html[data-theme="dark"] .chart-toolbar select {
  border-color: var(--line);
  background: #121519;
  color: var(--text);
}
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(128, 167, 255, .14);
}
html[data-theme="dark"] .secondary,
html[data-theme="dark"] .ghost,
html[data-theme="dark"] .theme-toggle {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
}
html[data-theme="dark"] .secondary:hover,
html[data-theme="dark"] .ghost:hover,
html[data-theme="dark"] .theme-toggle:hover {
  border-color: rgba(128, 167, 255, .55);
  color: var(--yellow);
}
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
html[data-theme="dark"] .nav-item {
  color: #aab2bf;
}
html[data-theme="dark"] .nav-item:hover {
  background: #20242a;
  color: var(--yellow);
}
html[data-theme="dark"] .nav-item.active {
  border-right-color: var(--yellow);
  background: #242a33;
  color: var(--yellow);
}
html[data-theme="dark"] .user-box::before {
  border-top-color: #aab2bf;
  border-bottom-color: #aab2bf;
  box-shadow: inset 0 5px 0 0 #aab2bf;
}
html[data-theme="dark"] .status-pill,
html[data-theme="dark"] .status-pill.neutral {
  background: #252a31;
  color: #aab2bf !important;
}
html[data-theme="dark"] .status-pill.good {
  background: rgba(43, 214, 154, .16);
  color: var(--green) !important;
}
html[data-theme="dark"] .status-pill.warn {
  background: rgba(245, 191, 85, .16);
  color: var(--warn) !important;
}
html[data-theme="dark"] .status-pill.bad {
  background: rgba(255, 102, 120, .16);
  color: var(--red) !important;
}
html[data-theme="dark"] .mask-summary div,
html[data-theme="dark"] .connection-grid div,
html[data-theme="dark"] .admin-system-status-item,
html[data-theme="dark"] .profile-metrics div,
html[data-theme="dark"] .entry-diagnostic-box div,
html[data-theme="dark"] .submitter-status-box,
html[data-theme="dark"] .worker-check-item,
html[data-theme="dark"] .strategy-window-grid div,
html[data-theme="dark"] .strategy-sleeve-card,
html[data-theme="dark"] .strategy-sleeve-metrics div,
html[data-theme="dark"] .strategy-explain-steps div,
html[data-theme="dark"] .strategy-risk-grid div,
html[data-theme="dark"] .report-metrics div,
html[data-theme="dark"] .mini-chart-card,
html[data-theme="dark"] .advanced-panel,
html[data-theme="dark"] .log-line,
html[data-theme="dark"] .strategy-choice,
html[data-theme="dark"] .strategy-card,
html[data-theme="dark"] .strategy-selection-summary,
html[data-theme="dark"] .strategy-allocation-panel,
html[data-theme="dark"] .strategy-allocation-portfolio-card,
html[data-theme="dark"] .sub-card,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .flatten-position-meta {
  border-color: var(--line);
  background: var(--surface-2);
}
html[data-theme="dark"] .dashboard-top {
  background: transparent;
  box-shadow: none;
}
html[data-theme="dark"] .strategy-choice:hover,
html[data-theme="dark"] .strategy-card:hover {
  border-color: rgba(128, 167, 255, .4);
  background: #262c35;
}
html[data-theme="dark"] .strategy-guide-figure img {
  border-color: var(--line);
  background: var(--surface-2);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .18);
}
html[data-theme="dark"] .strategy-guide-evidence {
  border-color: var(--line);
}
html[data-theme="dark"] .strategy-report-item > a {
  border-color: var(--line);
  background: var(--surface-2);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .18);
}
html[data-theme="dark"] .strategy-guide-report-links a {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--yellow);
}
html[data-theme="dark"] .strategy-guide-report-links a:hover {
  border-color: rgba(128, 167, 255, .55);
  background: #262c35;
}
html[data-theme="dark"] .strategy-report-english-link {
  color: var(--yellow);
}
html[data-theme="dark"] .strategy-choice:has(input:checked),
html[data-theme="dark"] .strategy-card.selected {
  border-color: var(--yellow);
  background: #273244;
  box-shadow: inset 3px 0 0 var(--yellow), 0 12px 26px rgba(0, 0, 0, .22);
}
html[data-theme="dark"] .strategy-allocation-lock-note {
  color: #75d9b3;
}
html[data-theme="dark"] .trading-switch {
  background: #262c35;
  color: var(--white);
}
html[data-theme="dark"] .trading-switch.off {
  background: #262c35;
}
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] table,
html[data-theme="dark"] .chart-canvas-wrap,
html[data-theme="dark"] .trade-chart {
  background: #15181d;
}
html[data-theme="dark"] .trade-chart-tooltip {
  border-color: var(--line);
  background: rgba(25, 28, 32, .96);
  color: var(--white);
  box-shadow: 0 14px 28px rgba(0, 0, 0, .28);
}
html[data-theme="dark"] .trade-chart-tooltip span {
  color: var(--muted);
}
html[data-theme="dark"] th {
  background: #20242a;
}
html[data-theme="dark"] tbody tr:hover td {
  background: #20242a;
}
html[data-theme="dark"] .sub-nav-item {
  color: #aab2bf;
}
html[data-theme="dark"] .sub-nav-item.active {
  color: var(--yellow);
  box-shadow: inset 0 -2px 0 var(--yellow);
}
html[data-theme="dark"] .progress-track,
html[data-theme="dark"] .equity-curve {
  background: #252a31;
}
html[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, .58);
}
html[data-theme="dark"] .typed-confirmation code,
html[data-theme="dark"] .submitter-runbook pre {
  background: #0c0e11;
  color: #e6e9ee;
}
html[data-theme="dark"] .submitter-runbook {
  background: #11161d;
}
html[data-theme="dark"] .submitter-runbook pre code {
  color: inherit;
}
html[data-theme="dark"] .mobile-card-table tr {
  border-color: var(--line);
  background: var(--surface-2);
}

.goal-progress-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.goal-progress-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface-2);
}

.goal-progress-item h4 {
  margin: 10px 0 6px;
}

.goal-progress-item p {
  margin: 0;
  color: var(--muted);
}

.progress-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin: 14px 0;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width .25s ease;
}

html[data-theme="dark"] .progress-track {
  background: #252a31;
}
