/* AOM local console — standard CSS only, no external fonts or assets. */

:root {
  color-scheme: dark;
  --bg: #080b10;
  --bg-soft: #0c1118;
  --panel: rgba(16, 22, 30, 0.84);
  --panel-solid: #10161e;
  --panel-2: #141c26;
  --line: rgba(148, 163, 184, 0.12);
  --line-strong: rgba(148, 163, 184, 0.22);
  --text: #edf2f7;
  --text-soft: #c1ccd9;
  --muted: #7f8ea3;
  --muted-2: #5c6b7e;
  --mint: #72f1b8;
  --mint-dim: rgba(114, 241, 184, 0.12);
  --blue: #7db7ff;
  --blue-dim: rgba(125, 183, 255, 0.12);
  --amber: #f6c76a;
  --amber-dim: rgba(246, 199, 106, 0.12);
  --rose: #ff8b9b;
  --rose-dim: rgba(255, 139, 155, 0.12);
  --red: #ff5d6c;
  --red-deep: #d93e50;
  --red-dim: rgba(255, 93, 108, 0.12);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --radius: 16px;
  --radius-sm: 10px;
  --font-sans: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
               "Hiragino Sans GB", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono",
               Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 78% -10%, rgba(52, 211, 153, 0.07), transparent 60%),
    radial-gradient(900px 520px at 0% 20%, rgba(59, 130, 246, 0.07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.022) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 78%);
  z-index: 0;
}

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: .6;
}
.ambient-a { width: 360px; height: 360px; background: rgba(114, 241, 184, .06); top: 80px; right: 8%; }
.ambient-b { width: 300px; height: 300px; background: rgba(125, 183, 255, .05); bottom: 5%; left: 2%; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
code {
  font-family: var(--font-mono);
  font-size: .88em;
  color: var(--text-soft);
  background: rgba(148, 163, 184, .09);
  border: 1px solid rgba(148, 163, 184, .10);
  padding: 1px 5px;
  border-radius: 5px;
  word-break: break-all;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 28px;
}

/* ============================== top bar ============================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 82px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 16, .82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 208px; }
.brand-mark {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #1b2a25, #0f171f);
  border: 1px solid rgba(114, 241, 184, .28);
  color: var(--mint);
  font: 700 17px/1 var(--font-mono);
  letter-spacing: -1px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 8px 24px rgba(0,0,0,.3);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(114, 241, 184, .12);
  border-radius: 8px;
}
.brand-mark span { color: var(--text-soft); }
.brand-copy h1 { margin: 0; font-size: 16px; letter-spacing: .02em; line-height: 1.35; font-weight: 650; }
.brand-copy h1 span { color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .12em; margin-left: 4px; }
.brand-copy p { margin: 2px 0 0; color: var(--muted); font-size: 11px; letter-spacing: .03em; }

.status-strip {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.status-chip {
  min-width: 84px;
  padding: 7px 12px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
}
.status-chip.wide { min-width: 132px; }
.chip-label {
  font-size: 9.5px;
  color: var(--muted-2);
  letter-spacing: .11em;
  text-transform: uppercase;
  font-weight: 600;
}
.utc-tag { font-size: 8px; padding: 1px 3px; border-radius: 3px; background: rgba(148,163,184,.09); color: var(--muted); letter-spacing: .04em; }
.chip-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mode-value { color: var(--mint); }
#daily-loss.neg { color: var(--rose); }
#daily-loss.pos { color: var(--mint); }
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 3px rgba(148,163,184,.06);
}
.dot.live { background: var(--mint); box-shadow: 0 0 0 3px rgba(114,241,184,.10); animation: pulse 1.8s infinite; }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(246,199,106,.10); }
.dot.error { background: var(--red); box-shadow: 0 0 0 3px rgba(255,93,108,.10); }
.dot.done { background: var(--blue); box-shadow: 0 0 0 3px rgba(125,183,255,.10); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.server-clock { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  cursor: pointer;
  transition: .18s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255,255,255,.045); }
.icon-btn.spinning .icon { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================== kill banner ============================== */
.kill-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 0;
  padding: 12px 16px;
  border: 1px solid rgba(255, 93, 108, .32);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(255,93,108,.14), rgba(255,93,108,.045));
  color: #ffc9ce;
  font-size: 12.5px;
}
.kill-banner .icon { color: var(--red); width: 18px; height: 18px; }
.kill-banner strong { margin-right: 8px; color: #ffe2e5; }
.kill-banner > div { display: flex; flex-wrap: wrap; gap: 4px 10px; flex: 1; }
.banner-link { color: #ffd6da; font-size: 12px; text-decoration: none; border-bottom: 1px dashed rgba(255,214,218,.4); }

/* ============================== tabs ============================== */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 6px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 14px 12px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  transition: color .18s ease;
}
.tab .icon { width: 15px; height: 15px; opacity: .85; }
.tab:hover { color: var(--text-soft); }
.tab.is-active { color: var(--text); }
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--mint), rgba(114,241,184,.2));
  box-shadow: 0 0 16px rgba(114,241,184,.25);
}

.content { padding: 28px 0 52px; }

/* ============================== pages ============================== */
.view { display: none; animation: rise .24s ease; }
.view.is-active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 20px;
}
.eyebrow {
  margin: 0 0 7px;
  color: var(--mint);
  font: 600 10px/1.2 var(--font-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .78;
}
.page-head h2 { margin: 0; font-size: clamp(22px, 2.2vw, 29px); line-height: 1.25; font-weight: 650; letter-spacing: -.02em; }
.page-sub { margin: 7px 0 0; color: var(--muted); font-size: 12.5px; max-width: 760px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.data-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.02);
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}
.data-badge .icon { width: 13px; height: 13px; }
.danger-badge { color: var(--rose); border-color: rgba(255,139,155,.2); background: var(--red-dim); }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 16px;
  padding: 12px 15px;
  border: 1px solid rgba(246,199,106,.20);
  border-radius: 12px;
  background: rgba(246,199,106,.07);
  color: #f8dca2;
  font-size: 12.5px;
}
.alert .icon { margin-top: 2px; color: var(--amber); width: 17px; height: 17px; }
.alert > div { display: flex; flex-direction: column; gap: 2px; }
.alert strong { color: #ffe8b9; }
.alert span { color: rgba(248,220,162,.78); }
#kill-alert { border-color: rgba(255,93,108,.24); background: var(--red-dim); color: #ffc9ce; }
#kill-alert .icon { color: var(--red); }
#kill-alert strong { color: #ffe2e5; }

/* ============================== panels ============================== */
.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(21, 29, 39, .9), rgba(13, 19, 26, .84));
  box-shadow: 0 1px 0 rgba(255,255,255,.025), 0 16px 44px rgba(0,0,0,.16);
  padding: 19px;
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute;
  top: 0; left: 22px; right: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.10), transparent);
  pointer-events: none;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.panel-kicker { margin: 0 0 3px; color: var(--muted-2); font: 600 9px/1.2 var(--font-mono); letter-spacing: .14em; }
.panel h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.soft-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(148,163,184,.07);
  border: 1px solid rgba(148,163,184,.10);
  color: var(--muted);
  font: 600 9px/1.4 var(--font-mono);
  letter-spacing: .08em;
  white-space: nowrap;
}
.text-link { color: var(--mint); text-decoration: none; font-size: 11.5px; white-space: nowrap; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .9fr); gap: 16px; margin-bottom: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

/* ============================== performance ============================== */
.performance-panel { min-height: 364px; padding: 22px; background: linear-gradient(155deg, rgba(20, 34, 31, .92), rgba(12, 18, 24, .88) 58%); }
.big-number { margin: 10px 0 16px; font: 500 clamp(34px, 4vw, 48px)/1.05 var(--font-mono); letter-spacing: -.045em; color: var(--text); }
.big-number span { color: var(--muted); font-size: 12px; letter-spacing: .04em; margin-left: 4px; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.metric { padding: 10px 12px; border-radius: 9px; background: rgba(255,255,255,.022); border: 1px solid rgba(255,255,255,.045); }
.metric-label { display: block; color: var(--muted-2); font-size: 9.5px; letter-spacing: .04em; margin-bottom: 3px; }
.metric strong { font: 600 14px/1.2 var(--font-mono); }
.curve-wrap { position: relative; margin-top: 8px; }
.curve { display: block; width: 100%; height: 136px; overflow: visible; }
.curve-line { fill: none; stroke: var(--mint); stroke-width: 2; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 8px rgba(114,241,184,.25)); }
.curve-area { fill: url(#curve-fill); stroke: none; }
.curve-empty { position: absolute; inset: 28px 0 30px; display: grid; place-items: center; color: var(--muted-2); font-size: 11.5px; border: 1px dashed rgba(148,163,184,.12); border-radius: 8px; }
.curve-axis { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 9px; margin-top: 8px; letter-spacing: .04em; }

/* ============================== engine ============================== */
.engine-panel { display: flex; flex-direction: column; }
.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(148,163,184,.05);
  font: 600 9.5px/1.3 var(--font-mono);
  white-space: nowrap;
}
.state-pill.live { color: var(--mint); background: var(--mint-dim); border-color: rgba(114,241,184,.22); }
.state-pill.warn { color: var(--amber); background: var(--amber-dim); border-color: rgba(246,199,106,.22); }
.state-pill.error { color: var(--rose); background: var(--rose-dim); border-color: rgba(255,139,155,.22); }
.state-pill.done { color: var(--blue); background: var(--blue-dim); border-color: rgba(125,183,255,.22); }

.engine-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 13px; }
.engine-meta > div { padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.022); border: 1px solid rgba(255,255,255,.04); }
.engine-meta span { display: block; color: var(--muted-2); font-size: 9.5px; margin-bottom: 2px; }
.engine-meta strong { font-size: 11.5px; color: var(--text-soft); font-weight: 600; word-break: break-word; }
.engine-reason { margin: 0 0 12px; padding: 9px 11px; border: 1px solid rgba(246,199,106,.18); border-radius: 8px; background: var(--amber-dim); color: #f8dca2; font-size: 11.5px; }
.field.compact { margin-bottom: 11px; }
.field.compact input { padding: 8px 10px; font-size: 11px; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.engine-panel .button-row { margin-top: auto; }
.hint { margin: 10px 0 0; color: var(--muted-2); font-size: 10.5px; line-height: 1.6; }

/* ============================== buttons / fields ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 35px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  color: var(--text-soft);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .12s ease;
}
.btn .icon { width: 14px; height: 14px; }
.btn:hover:not(:disabled) { background: rgba(255,255,255,.065); border-color: rgba(148,163,184,.34); color: var(--text); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn-primary {
  color: #062318;
  border-color: transparent;
  background: linear-gradient(180deg, #8ff8c8, #67dfa7);
  box-shadow: 0 8px 22px rgba(72, 224, 160, .13), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #a7ffda, #7aefb9); color: #041b12; border-color: transparent; }
.btn-quiet { background: transparent; color: var(--muted); }
.btn-danger { color: #2b060a; border-color: transparent; background: linear-gradient(180deg, #ff8d98, #ff5d6c); box-shadow: 0 8px 24px rgba(255,93,108,.16); }
.btn-danger:hover:not(:disabled) { background: linear-gradient(180deg, #ffa8b1, #ff7080); color: #260408; border-color: transparent; }
.btn-block { width: 100%; margin-top: 14px; }
.btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.is-loading::after { content: ""; position: absolute; width: 13px; height: 13px; border: 2px solid rgba(0,0,0,.22); border-top-color: rgba(0,0,0,.65); border-radius: 50%; animation: spin .7s linear infinite; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { color: var(--text-soft); font-size: 11px; font-weight: 600; }
.optional { color: var(--muted-2); font-size: 9.5px; font-weight: 400; margin-left: 3px; }
.field-hint { color: var(--muted-2); font-size: 9.5px; line-height: 1.45; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select {
  width: 100%;
  min-height: 37px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(4, 8, 12, .34);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  outline: none;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
input::placeholder { color: var(--muted-2); opacity: .72; }
input:focus, select:focus { border-color: rgba(114,241,184,.45); background: rgba(4,8,12,.5); box-shadow: 0 0 0 3px rgba(114,241,184,.07); }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
.readonly-field { min-height: 37px; display: flex; align-items: center; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 11px; background: rgba(255,255,255,.015); }

/* ============================== stats ============================== */
.stat-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 11px;
  row-gap: 3px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  min-height: 96px;
}
.stat-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; grid-row: span 2; align-self: center; }
.stat-icon .icon { width: 15px; height: 15px; }
.stat-icon.mint { color: var(--mint); background: var(--mint-dim); }
.stat-icon.blue { color: var(--blue); background: var(--blue-dim); }
.stat-icon.amber { color: var(--amber); background: var(--amber-dim); }
.stat-icon.rose { color: var(--rose); background: var(--rose-dim); }
.stat-label { color: var(--muted); font-size: 9.5px; letter-spacing: .02em; }
.stat-card strong { font: 600 18px/1.15 var(--font-mono); letter-spacing: -.025em; color: var(--text); }
.stat-card strong em { color: var(--muted-2); font-size: 11px; font-style: normal; font-weight: 500; }
.stat-foot { grid-column: 2; color: var(--muted-2); font-size: 9px; line-height: 1.35; }
.stat-card strong.neg { color: var(--rose); }
.stat-card strong.pos { color: var(--mint); }

/* ============================== tables ============================== */
.table-panel { padding: 0; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.data-table th {
  padding: 11px 13px;
  text-align: left;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .06em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.015);
}
.data-table td { padding: 11px 13px; border-bottom: 1px solid rgba(148,163,184,.065); color: var(--text-soft); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: rgba(255,255,255,.017); }
.data-table .empty-cell { padding: 34px 16px; text-align: center; color: var(--muted-2); font-size: 11px; }
.compact-table td, .compact-table th { padding: 9px 12px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 9.5px; }
.table-foot span:first-child { color: var(--muted); font-family: var(--font-mono); }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
  white-space: nowrap;
}
.tag.long { color: var(--mint); border-color: rgba(114,241,184,.22); background: var(--mint-dim); }
.tag.short { color: var(--rose); border-color: rgba(255,139,155,.22); background: var(--rose-dim); }
.tag.blue { color: var(--blue); border-color: rgba(125,183,255,.22); background: var(--blue-dim); }
.tag.amber { color: var(--amber); border-color: rgba(246,199,106,.22); background: var(--amber-dim); }
.tag.red { color: var(--rose); border-color: rgba(255,139,155,.22); background: var(--rose-dim); }
.tag.muted { color: var(--muted-2); }
.pnl-pos { color: var(--mint) !important; font-family: var(--font-mono); }
.pnl-neg { color: var(--rose) !important; font-family: var(--font-mono); }
.pnl-flat { color: var(--muted) !important; font-family: var(--font-mono); }
.cell-time { white-space: nowrap; font: 10.5px/1.4 var(--font-mono); color: var(--muted); }
.muted-cell { color: var(--muted) !important; }
.unit { color: var(--muted-2); font-size: .82em; margin-left: 1px; }

/* ============================== positions preview ============================== */
.position-list { display: flex; flex-direction: column; gap: 7px; }
.position-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(148,163,184,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.018);
}
.position-row .pos-main { display: flex; flex-direction: column; gap: 1px; }
.position-row .pos-main strong { color: var(--text-soft); font-size: 11px; font-weight: 600; }
.position-row .pos-main span { color: var(--muted-2); font-size: 9px; }
.position-row .pos-pnl { text-align: right; font: 600 12px/1.2 var(--font-mono); }
.empty-block { padding: 30px 16px; text-align: center; color: var(--muted-2); font-size: 11px; border: 1px dashed rgba(148,163,184,.10); border-radius: 9px; }

/* ============================== risk summary ============================== */
.risk-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; padding: 0; }
.risk-summary-item { padding: 15px 18px; border-right: 1px solid var(--line); }
.risk-summary-item:last-child { border-right: 0; }
.risk-summary-item span { display: block; color: var(--muted-2); font-size: 9.5px; margin-bottom: 4px; }
.risk-summary-item strong { font-size: 12px; color: var(--text-soft); font-weight: 600; }

/* ============================== settings ============================== */
.form-section { margin-bottom: 14px; padding: 21px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 17px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.section-head > div { display: flex; align-items: center; gap: 10px; }
.section-head h3 { font-size: 14px; }
.section-head p { margin: 1px 0 0; max-width: 380px; text-align: right; color: var(--muted-2); font-size: 10.5px; }
.section-no { display: inline-grid; place-items: center; width: 25px; height: 25px; border-radius: 6px; border: 1px solid var(--line); background: rgba(255,255,255,.025); color: var(--mint); font: 600 9px/1 var(--font-mono); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.trade-mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 17px; }
.mode-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.018);
  color: var(--text-soft);
  font-family: var(--font-sans);
  cursor: default;
}
.mode-card.is-selected { border-color: rgba(114,241,184,.25); background: rgba(114,241,184,.055); }
.mode-card.is-disabled { opacity: .57; }
.mode-card > div { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.mode-card strong { font-size: 11.5px; font-weight: 600; }
.mode-card small { color: var(--muted-2); font-size: 9px; line-height: 1.4; }
.mode-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); flex: none; }
.mode-card.is-selected .mode-dot { background: var(--mint); box-shadow: 0 0 0 3px rgba(114,241,184,.10); }
.mode-tag { font: 600 8px/1.4 var(--font-mono); color: var(--muted-2); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; white-space: nowrap; }
.mode-card.is-selected .mode-tag { color: var(--mint); border-color: rgba(114,241,184,.2); }
.toggle-list { margin-top: 17px; border-top: 1px solid var(--line); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px solid rgba(148,163,184,.06); cursor: pointer; }
.toggle-row:last-child { border-bottom: none; }
.toggle-row > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.toggle-row strong { font-size: 11.5px; font-weight: 600; }
.toggle-row small { color: var(--muted-2); font-size: 9.5px; }
.toggle-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch { position: relative; width: 34px; height: 19px; border-radius: 20px; background: rgba(148,163,184,.16); border: 1px solid rgba(148,163,184,.14); flex: none; transition: .18s ease; }
.switch::after { content: ""; position: absolute; width: 13px; height: 13px; top: 2px; left: 2px; border-radius: 50%; background: #8794a7; transition: .18s ease; }
.toggle-row input:checked + .switch { background: rgba(114,241,184,.25); border-color: rgba(114,241,184,.3); }
.toggle-row input:checked + .switch::after { left: 17px; background: var(--mint); box-shadow: 0 0 8px rgba(114,241,184,.35); }
.toggle-row.is-disabled { opacity: .48; cursor: not-allowed; }
.save-bar {
  position: sticky;
  bottom: 12px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(12, 17, 24, .92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 16px 40px rgba(0,0,0,.4);
}
.save-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10.5px; }
.save-note .icon { color: var(--mint); width: 14px; height: 14px; }
.save-note.dirty { color: var(--amber); }
.save-note.dirty .icon { color: var(--amber); }
.footnote { color: var(--muted-2); font-size: 10px; line-height: 1.7; margin: 16px 4px 0; }

/* ============================== secrets ============================== */
.security-banner {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(114,241,184,.16);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(114,241,184,.07), rgba(114,241,184,.02));
}
.security-banner .icon { width: 21px; height: 21px; color: var(--mint); margin-top: 1px; }
.security-banner > div { display: flex; flex-direction: column; gap: 3px; }
.security-banner strong { font-size: 12.5px; color: #d7ffee; }
.security-banner span { color: #a8c9ba; font-size: 11px; line-height: 1.65; max-width: 980px; }
.secrets-layout { grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); align-items: start; }
.env-select { display: inline-flex; padding: 3px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(0,0,0,.18); }
.env-btn { border: 0; border-radius: 6px; padding: 7px 13px; background: transparent; color: var(--muted); font-family: var(--font-sans); font-size: 11px; font-weight: 600; cursor: pointer; }
.env-btn.is-active { background: rgba(255,255,255,.07); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }
.env-btn[data-env="live"].is-active { background: rgba(255,139,155,.10); color: #ffc4cc; }
#secrets-form { margin-top: 14px; display: flex; flex-direction: column; gap: 13px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 55px; }
.reveal-btn { position: absolute; right: 4px; top: 4px; bottom: 4px; padding: 0 9px; border: 0; border-radius: 5px; background: rgba(255,255,255,.04); color: var(--muted); font-size: 9.5px; cursor: pointer; }
.reveal-btn:hover { background: rgba(255,255,255,.07); color: var(--text-soft); }
.stored-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--line); }
.stored-strip > div { background: #0e141b; padding: 9px 10px; min-width: 0; }
.stored-strip span { display: block; color: var(--muted-2); font-size: 8.5px; margin-bottom: 3px; }
.stored-strip strong { font-size: 10.5px; color: var(--text-soft); font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-result { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(0,0,0,.18); font-size: 11px; }
.test-result.is-ok { border-color: rgba(114,241,184,.20); background: var(--mint-dim); color: #c5f5df; }
.test-result.is-fail { border-color: rgba(255,139,155,.20); background: var(--rose-dim); color: #ffd0d6; }
.test-result.is-warn { border-color: rgba(246,199,106,.20); background: var(--amber-dim); color: #f8dca2; }
.test-line { display: flex; align-items: flex-start; gap: 8px; padding: 3px 0; }
.test-line .icon { width: 13px; height: 13px; margin-top: 2px; }
.test-line strong { font-weight: 600; }
.test-meta { margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(255,255,255,.07); color: var(--muted); font-size: 9.5px; font-family: var(--font-mono); }
.security-panel { position: sticky; top: 108px; }
.security-panel h3 { margin-bottom: 13px; }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.check-list li { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.check-list .icon { color: var(--mint); width: 13px; height: 13px; margin-top: 2px; flex: none; }
.check-list .danger-item .icon { color: var(--rose); }
.api-note { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.api-note span { color: var(--text-soft); font-size: 10.5px; font-weight: 600; }
.api-note p { margin: 4px 0 0; color: var(--muted-2); font-size: 10px; line-height: 1.65; }

/* ============================== filters / summaries ============================== */
.filter-select { width: auto; min-width: 118px; min-height: 34px; font-size: 11px; padding-top: 6px; padding-bottom: 6px; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0,0,0,.18); }
.segment { border: 0; border-radius: 5px; padding: 5px 11px; background: transparent; color: var(--muted); font-family: var(--font-sans); font-size: 10.5px; cursor: pointer; }
.segment.is-active { background: rgba(255,255,255,.07); color: var(--text); }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--line); }
.mini-stats > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; background: #0e141b; }
.mini-stats span { color: var(--muted-2); font-size: 9.5px; }
.mini-stats strong { font: 600 14px/1.2 var(--font-mono); color: var(--text-soft); }

/* ============================== logs ============================== */
.log-panel { padding: 0; background: #090d12; }
.log-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--muted-2); font: 9.5px/1.3 var(--font-mono); }
.log-head span:nth-child(2) { flex: 1; }
.terminal-dots { display: inline-flex; gap: 4px; }
.terminal-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(148,163,184,.18); }
.terminal-dots i:first-child { background: rgba(255,139,155,.4); }
.terminal-dots i:nth-child(2) { background: rgba(246,199,106,.35); }
.terminal-dots i:nth-child(3) { background: rgba(114,241,184,.35); }
.log-list { min-height: 210px; max-height: 610px; overflow-y: auto; padding: 7px 0; }
.log-row { display: grid; grid-template-columns: 148px 64px 1fr; gap: 10px; padding: 6px 15px; font: 10.5px/1.6 var(--font-mono); border-left: 2px solid transparent; }
.log-row:hover { background: rgba(255,255,255,.018); }
.log-ts { color: var(--muted-2); white-space: nowrap; }
.log-level { font-size: 9px; font-weight: 700; letter-spacing: .04em; padding-top: 1px; }
.log-level.INFO { color: var(--blue); }
.log-level.WARN { color: var(--amber); }
.log-level.ERROR, .log-level.CRITICAL { color: var(--rose); }
.log-msg { color: var(--text-soft); word-break: break-word; white-space: pre-wrap; }
.log-row.level-ERROR, .log-row.level-CRITICAL { background: rgba(255,93,108,.035); border-left-color: rgba(255,93,108,.34); }
.log-row.level-WARN { border-left-color: rgba(246,199,106,.22); }

/* ============================== takeover ============================== */
.takeover-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.danger-panel { border-color: rgba(255,93,108,.20); background: linear-gradient(155deg, rgba(46, 18, 24, .6), rgba(15, 18, 24, .88)); }
.danger-head { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.danger-icon { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 11px; color: var(--red); background: var(--red-dim); border: 1px solid rgba(255,93,108,.20); }
.danger-icon .icon { width: 20px; height: 20px; }
.danger-head .panel-kicker { color: rgba(255,139,155,.55); }
.danger-head h3 { font-size: 18px; }
.danger-copy { margin: 0 0 13px; color: #e7b8bd; font-size: 11.5px; line-height: 1.65; }
.plain-list { margin: 0 0 5px; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.plain-list li { position: relative; padding-left: 12px; color: var(--muted); font-size: 10px; }
.plain-list li::before { content: ""; position: absolute; left: 0; top: .6em; width: 4px; height: 4px; border-radius: 50%; background: var(--rose); }
.takeover-status { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.takeover-status > div { padding: 10px 12px; border: 1px solid rgba(148,163,184,.07); border-radius: 8px; background: rgba(255,255,255,.018); }
.takeover-status span { display: block; color: var(--muted-2); font-size: 9px; margin-bottom: 3px; }
.takeover-status strong { color: var(--text-soft); font-size: 11.5px; font-weight: 600; word-break: break-word; }
.divider { height: 1px; background: var(--line); margin: 15px 0 2px; }
.checklist-panel { padding: 21px; }
.runbook { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.runbook li { display: flex; align-items: flex-start; gap: 9px; padding: 12px; border: 1px solid rgba(148,163,184,.07); border-radius: 9px; background: rgba(255,255,255,.015); }
.runbook li > span { color: var(--mint); font: 600 10px/1.4 var(--font-mono); }
.runbook strong { display: block; color: var(--text-soft); font-size: 10.5px; font-weight: 600; margin-bottom: 2px; }
.runbook div { color: var(--muted-2); font-size: 9.5px; line-height: 1.55; }

/* ============================== footer / toast / dialog ============================== */
.footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 22px 0 28px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 9.5px; letter-spacing: .02em; }
.footer-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); opacity: .5; }

.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: min(380px, calc(100vw - 34px));
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(15, 21, 29, .96);
  color: var(--text-soft);
  box-shadow: var(--shadow);
  font-size: 11px;
  pointer-events: auto;
  animation: toast-in .2s ease;
}
.toast .icon { margin-top: 1px; width: 14px; height: 14px; color: var(--mint); }
.toast.error { border-color: rgba(255,139,155,.25); background: rgba(35, 15, 20, .97); }
.toast.error .icon { color: var(--rose); }
.toast.warn .icon { color: var(--amber); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.confirm-dialog {
  width: min(430px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(255,139,155,.22);
  border-radius: 15px;
  background: #11161e;
  color: var(--text);
  box-shadow: 0 30px 100px rgba(0,0,0,.7);
}
.confirm-dialog::backdrop { background: rgba(3, 6, 10, .72); backdrop-filter: blur(4px); }
.dialog-inner { padding: 22px; }
.dialog-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 10px; background: var(--red-dim); color: var(--rose); border: 1px solid rgba(255,139,155,.18); margin-bottom: 13px; }
.dialog-icon .icon { width: 19px; height: 19px; }
.dialog-icon.safe { background: var(--mint-dim); color: var(--mint); border-color: rgba(114,241,184,.18); }
.confirm-dialog h2 { margin: 0 0 7px; font-size: 17px; font-weight: 650; }
.confirm-dialog p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.7; white-space: pre-line; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.dialog-actions .btn { min-width: 82px; }

/* ============================== responsive ============================== */
@media (max-width: 1180px) {
  .app-shell { padding: 0 18px; }
  .topbar { grid-template-columns: auto 1fr; gap: 10px 20px; }
  .status-strip { justify-content: flex-end; grid-column: 2; }
  .topbar-actions { position: absolute; right: 0; top: 14px; }
  .server-clock { display: none; }
  .status-chip { border-left: 0; padding: 5px 8px; min-width: 0; }
  .status-strip { gap: 0; }
  .hero-grid { grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .field-grid.three { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .hero-grid, .two-col, .secrets-layout, .takeover-grid { grid-template-columns: 1fr; }
  .security-panel { position: static; }
  .risk-summary { grid-template-columns: 1fr 1fr; }
  .risk-summary-item:nth-child(2) { border-right: 0; }
  .risk-summary-item:nth-child(1), .risk-summary-item:nth-child(2) { border-bottom: 1px solid var(--line); }
  .runbook { grid-template-columns: 1fr 1fr; }
  .trade-mode-grid { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; gap: 7px; }
  .section-head p { text-align: left; }
  .topbar { position: relative; }
  .tabs { position: sticky; top: 0; z-index: 30; background: rgba(8,11,16,.92); backdrop-filter: blur(14px); }
}

@media (max-width: 720px) {
  .app-shell { padding: 0 13px; }
  .topbar { min-height: auto; padding: 13px 0 9px; grid-template-columns: 1fr auto; }
  .status-strip { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 1px; }
  .status-chip { padding: 3px 10px 3px 0; border-right: 1px solid var(--line); margin-right: 6px; }
  .status-chip:nth-child(3) { flex: 1 1 100%; border-right: 0; margin-right: 0; padding-bottom: 0; }
  .status-chip:nth-child(3) .chip-value { font-size: 11px; }
  .topbar-actions { position: static; }
  .icon-btn { width: 31px; height: 31px; }
  .brand { min-width: 0; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-copy h1 { font-size: 15px; }
  .brand-copy p { font-size: 10px; }
  .tab { padding: 11px 10px; gap: 5px; font-size: 11.5px; }
  .tab .icon { width: 14px; height: 14px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .head-actions { justify-content: flex-start; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .field-grid, .field-grid.three, .metric-row { grid-template-columns: 1fr; }
  .hero-grid { gap: 12px; }
  .performance-panel { min-height: auto; padding: 18px; }
  .panel { padding: 16px; }
  .form-section { padding: 16px; }
  .big-number { font-size: 36px; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .mini-stats > div { padding: 10px 12px; }
  .stored-strip { grid-template-columns: 1fr 1fr; }
  .save-bar { position: static; flex-direction: column; align-items: stretch; gap: 10px; }
  .save-bar .button-row { justify-content: flex-end; }
  .log-row { grid-template-columns: 86px 52px 1fr; padding: 6px 10px; font-size: 9.5px; }
  .runbook { grid-template-columns: 1fr; }
  .takeover-status { grid-template-columns: 1fr; }
  .plain-list { grid-template-columns: 1fr; }
  .risk-summary { grid-template-columns: 1fr; }
  .risk-summary-item { border-right: 0; border-bottom: 1px solid var(--line); }
  .risk-summary-item:last-child { border-bottom: 0; }
  .section-head > div { align-items: flex-start; }
  .footer { justify-content: flex-start; gap: 7px; line-height: 1.6; }
}

@media (max-width: 460px) {
  .stat-grid { grid-template-columns: 1fr; }
  .status-chip.wide { flex-basis: auto; }
  .tab span { display: none; }
  .tab { padding: 12px 13px; }
  .tab .icon { width: 17px; height: 17px; }
  .tabs { justify-content: space-between; }
  .head-actions { width: 100%; }
  .filter-select { flex: 1; }
}

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

/* ------------------------------------------------------------------ */
/* P2-B: single-user login layer + ops console                         */
/* ------------------------------------------------------------------ */
.auth-user {
  color: var(--text-soft);
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

.auth-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 7, 11, 0.78);
  backdrop-filter: blur(8px);
}

.auth-card {
  width: min(400px, 100%);
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.auth-card h2 { margin: 0; font-size: 20px; }

.auth-card .hint { margin: 0; color: var(--muted); font-size: 12px; }

.auth-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--mint-dim);
  background: var(--mint-dim);
  color: var(--mint);
}
.auth-icon .icon { width: 22px; height: 22px; }

.auth-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--red-dim);
  background: var(--red-dim);
  color: var(--rose);
  font-size: 12px;
}

body.auth-locked .content,
body.auth-locked .tabs,
body.auth-locked .status-strip { pointer-events: none; }

.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.ops-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ops-card.ops-action { border-color: rgba(255, 93, 108, 0.24); }

.ops-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.ops-card-head h3 { margin: 2px 0 0; font-size: 15px; }
.ops-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.ops-desc { margin: 0; color: var(--text-soft); font-size: 12.5px; }
.ops-meta { margin: 0; color: var(--muted); font-size: 11.5px; }

.ops-params {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.ops-param { display: grid; gap: 4px; }
.ops-param label { font-size: 11.5px; color: var(--muted); }
.ops-param input,
.ops-param select {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.ops-console-panel { margin-top: 4px; }

.ops-output {
  margin: 0;
  padding: 16px;
  min-height: 220px;
  max-height: 520px;
  overflow: auto;
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: 1px solid var(--line);
  background: #060a0f;
  color: #b9c9dd;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 720px) {
  .ops-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 20px; }
}

/* T15: 2FA second step in the login layer */
.auth-links {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 4px;
}
.auth-links .btn { flex: 1 1 120px; }
#auth-step-totp .btn-block { margin-top: 4px; }

/* ------------------------------------------------------------------ */
/* T22: collapsible sidebar shell + module routing + mobile drawer     */
/* ------------------------------------------------------------------ */
.app-shell {
  display: flex;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  gap: 0;
  align-items: stretch;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 224px;
  flex: 0 0 224px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px 14px;
  background: rgba(10, 15, 22, 0.92);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .18s ease, flex-basis .18s ease, padding .18s ease;
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 6px; }
.sidebar-brand-copy { min-width: 0; }
.sidebar-brand-copy h1 { margin: 0; font-size: 15px; font-weight: 650; line-height: 1.3; white-space: nowrap; }
.sidebar-brand-copy h1 span { color: var(--muted); font-size: 10px; letter-spacing: .1em; }
.sidebar-brand-copy p { margin: 2px 0 0; color: var(--muted); font-size: 10.5px; white-space: nowrap; }

.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; flex: 1; }
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 11px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.side-link .icon { width: 17px; height: 17px; flex: 0 0 auto; opacity: .9; }
.side-link:hover { color: var(--text-soft); background: rgba(148, 163, 184, .06); }
.side-link.is-active { color: var(--text); background: var(--mint-dim); border-color: rgba(114, 241, 184, .16); }
.side-link.is-active .icon { color: var(--mint); opacity: 1; }
.side-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 38px; }
.side-sublink {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
}
.side-sublink:hover { color: var(--text-soft); background: rgba(148, 163, 184, .05); }
.side-sublink.is-active { color: var(--mint); background: rgba(114, 241, 184, .08); }

.sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 6px 2px;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.user-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(114, 241, 184, .2), rgba(125, 183, 255, .14));
  border: 1px solid rgba(114, 241, 184, .24);
  color: var(--text);
  font-weight: 650;
  font-size: 14px;
  text-transform: uppercase;
}
.user-avatar.large { width: 52px; height: 52px; flex-basis: 52px; font-size: 20px; }
.user-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.user-meta strong { font-size: 12px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-2fa { font-size: 10.5px; color: var(--mint); }
.user-email { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-actions { display: flex; flex-direction: column; gap: 2px; }
.user-actions .icon-btn { width: 30px; height: 30px; }

body.sidebar-collapsed .sidebar { width: 64px; flex-basis: 64px; padding-left: 8px; padding-right: 8px; }
body.sidebar-collapsed .sidebar-brand-copy,
body.sidebar-collapsed .side-label,
body.sidebar-collapsed .side-sub,
body.sidebar-collapsed .user-meta,
body.sidebar-collapsed .user-actions { display: none; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
body.sidebar-collapsed .side-link { justify-content: center; padding: 0; }
body.sidebar-collapsed .sidebar-user { justify-content: center; padding-left: 0; padding-right: 0; }

.workspace { flex: 1; min-width: 0; padding: 0 28px; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  min-height: 60px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 11, 16, .96), rgba(8, 11, 16, .82));
  backdrop-filter: blur(14px);
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 168px; }
.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.top-crumb { font-size: 14px; font-weight: 650; color: var(--text); }
.top-meta { font-size: 10.5px; color: var(--muted); letter-spacing: .02em; }
.nav-toggle { flex: 0 0 auto; }
.status-strip { flex: 1 1 auto; justify-content: center; flex-wrap: wrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.content { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 24px 0 42px; }
.footer { margin-top: auto; }

.sidebar-backdrop { display: none; }
.bottom-tabs { display: none; }

/* user sheet (mobile "我的") */
.user-sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(4, 7, 11, .62);
  backdrop-filter: blur(4px);
}
.user-sheet-layer.hidden { display: none; }
.user-sheet {
  width: min(440px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 18px 18px 0 0;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  padding: 16px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-sheet .icon-btn { width: auto; padding: 0 10px; font-size: 11px; color: var(--muted); }
.user-sheet-body { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0 8px; }
.user-sheet-body strong { font-size: 15px; }
.user-sheet-backdrop { position: absolute; inset: 0; }

/* help page */
.help-grid { margin-bottom: 16px; }
.help-grid .plain-list code, #help-security code { color: var(--text-soft); }
.badge-note { color: var(--muted); font-size: 11px; }

@media (max-width: 1200px) {
  .workspace { padding: 0 18px; }
  .topbar-actions .server-clock { display: none; }
  .status-chip.wide { flex-basis: 100%; order: 9; }
}

@media (max-width: 899px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100vh;
    width: 264px;
    flex-basis: 264px;
    transform: translateX(-104%);
    transition: transform .2s ease;
    box-shadow: 24px 0 60px rgba(0, 0, 0, .4);
    z-index: 60;
  }
  .sidebar.is-open { transform: none; }
  body.sidebar-collapsed .sidebar { width: 264px; flex-basis: 264px; padding: 16px 12px 14px; }
  body.sidebar-collapsed .sidebar-brand-copy,
  body.sidebar-collapsed .side-label,
  body.sidebar-collapsed .side-sub,
  body.sidebar-collapsed .user-meta,
  body.sidebar-collapsed .user-actions { display: revert; }
  body.sidebar-collapsed .sidebar-brand { justify-content: flex-start; padding: 0 6px; }
  body.sidebar-collapsed .side-link { justify-content: flex-start; padding: 0 11px; }
  body.sidebar-collapsed .sidebar-user { justify-content: flex-start; padding-left: 6px; padding-right: 6px; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, .55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }
  body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .workspace { padding: 0 14px 82px; }
  .topbar { min-height: auto; padding: 10px 0; }
  .topbar-left { min-width: 0; flex: 1; }
  .status-strip { order: 4; flex-basis: 100%; justify-content: flex-start; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
  .status-chip.wide { flex-basis: 100%; order: 9; }
  .content { padding: 18px 0 14px; }
  .bottom-tabs {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    height: 62px;
    border-top: 1px solid var(--line);
    background: rgba(8, 11, 16, .97);
    backdrop-filter: blur(14px);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-tab {
    flex: 1;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    font-size: 10.5px;
    font-family: inherit;
    border-radius: 10px;
  }
  .bottom-tab .icon { width: 19px; height: 19px; }
  .bottom-tab.is-active { color: var(--mint); background: rgba(114, 241, 184, .06); }
  .footer { padding: 18px 0 16px; }
  .nav-toggle { width: 40px; height: 40px; }
}

@media (max-width: 460px) {
  .status-strip .status-chip.wide { display: none; }
  .topbar-title .top-meta { display: none; }
  .help-grid { grid-template-columns: 1fr; }
}

/* ==================================================================== */
/* T24: live order / protection / backtest pages (no third-party CSS)   */
/* ==================================================================== */

/* ---------------------------------- order --------------------------- */
.order-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 14px;
}
.order-view-hint { flex: 1 1 240px; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.order-check { color: var(--muted); font-size: 11px; font-family: var(--font-mono); }

.live-status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--line);
}
.live-status-grid > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: #0e141b;
}
.live-status-grid span { color: var(--muted-2); font-size: 9.5px; }
.live-status-grid strong {
  color: var(--text-soft);
  font: 600 12px/1.3 var(--font-mono);
  word-break: break-word;
}

.wizard-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.wizard-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .02);
  color: var(--muted-2);
  font-size: 10px;
  white-space: nowrap;
}
.wizard-indicator b {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(148, 163, 184, .12);
  color: var(--muted);
  font: 600 9px/1 var(--font-mono);
}
.wizard-indicator.is-done { color: var(--mint); border-color: rgba(114, 241, 184, .24); }
.wizard-indicator.is-done b { background: var(--mint-dim); color: var(--mint); }
.wizard-indicator.is-current {
  color: var(--text);
  border-color: rgba(114, 241, 184, .38);
  background: rgba(114, 241, 184, .07);
}
.wizard-indicator.is-current b { background: var(--mint); color: #05261a; }

.wizard-step { display: none; }
.wizard-step.is-active { display: block; }
.wizard-step h3 { margin: 0 0 13px; font-size: 14px; font-weight: 650; }
.wizard-tip {
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}
.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.preview-card {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .015);
}
.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--line);
}
.preview-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: #0e141b;
}
.preview-label { color: var(--muted-2); font-size: 9.5px; }
.preview-value { color: var(--text-soft); font-size: 12px; font-weight: 600; word-break: break-word; }
.preview-note { margin: 0; }
.preview-stale {
  margin: 8px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(246, 199, 106, .28);
  border-radius: 7px;
  background: var(--amber-dim);
  color: #f8dca2;
  font-size: 10.5px;
}

.btn-mini { min-height: 26px; padding: 3px 8px; border-radius: 6px; font-size: 10px; }

/* ---------------------------------- switches ------------------------ */
.switch-grid { display: grid; gap: 10px; }
.switch-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .018);
}
.switch-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-copy strong { color: var(--text-soft); font-size: 12px; font-weight: 600; }
.switch-copy small { color: var(--muted-2); font-size: 10px; line-height: 1.5; }

.toggle-switch {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 22px;
  flex: none;
  cursor: pointer;
}
.toggle-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.toggle-switch .switch-track {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(148, 163, 184, .2);
  transition: background .16s ease, border-color .16s ease;
}
.toggle-switch .switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: transform .16s ease, background .16s ease;
}
.toggle-switch input:checked + .switch-track {
  background: rgba(114, 241, 184, .3);
  border-color: rgba(114, 241, 184, .5);
}
.toggle-switch input:checked + .switch-track::after { transform: translateX(18px); background: var(--mint); }
.toggle-switch input:focus-visible + .switch-track { outline: 2px solid rgba(114, 241, 184, .5); outline-offset: 2px; }
.toggle-switch input:disabled + .switch-track { opacity: .45; }

.switch-inline {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.5;
  cursor: pointer;
}
.switch-inline input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-inline .switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(148, 163, 184, .2);
  transition: background .16s ease, border-color .16s ease;
}
.switch-inline .switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: transform .16s ease, background .16s ease;
}
.switch-inline input:checked + .switch-track {
  background: rgba(114, 241, 184, .3);
  border-color: rgba(114, 241, 184, .5);
}
.switch-inline input:checked + .switch-track::after { transform: translateX(16px); background: var(--mint); }
.switch-inline input:focus-visible + .switch-track { outline: 2px solid rgba(114, 241, 184, .5); outline-offset: 2px; }

/* ------------------------------- positions -------------------------- */
.table-panel > .panel-head { padding: 16px 16px 0; }
.positions-table td { white-space: nowrap; }
.positions-table tr.row-external td { background: rgba(246, 199, 106, .05); }
.positions-table tr.row-external:hover td { background: rgba(246, 199, 106, .08); }
.cell-locked { color: var(--muted-2) !important; cursor: help; }
.tag.badge-warn {
  color: #2a1700;
  border-color: transparent;
  background: linear-gradient(180deg, #ffd98d, #f3c15f);
  font-weight: 650;
}

/* --------------------------------- backtest ------------------------- */
.backtest-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 16px;
  margin-bottom: 16px;
}
.backtest-grid > .panel { margin-bottom: 0; }
.backtest-stats { grid-template-columns: repeat(2, 1fr); margin-bottom: 10px; }
.backtest-stats strong { font-size: 13px; }
.equity-svg { display: block; width: 100%; height: 170px; overflow: visible; }
.equity-grid { stroke: rgba(148, 163, 184, .12); stroke-width: 1; stroke-dasharray: 3 5; }
.equity-line {
  fill: none;
  stroke: var(--mint);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 8px rgba(114, 241, 184, .25));
}
.equity-area { fill: url(#bt-curve-fill); stroke: none; }
.equity-dot { fill: var(--mint); }

/* --------------------------------- dialogs -------------------------- */
.stop-dialog { border-color: rgba(246, 199, 106, .26); }
.stop-dialog .dialog-icon {
  background: var(--amber-dim);
  color: var(--amber);
  border-color: rgba(246, 199, 106, .22);
}
.stop-dialog .field { margin: 14px 0 4px; }
.stop-dialog .hint { margin: 0 0 10px; }
.stop-dialog .hint:last-of-type { margin-bottom: 0; }

/* ------------------------- manual positions / adopt ----------------- */
.manual-panel .table-foot span:first-child { font-family: var(--font-mono); }
.manual-positions-table td { white-space: nowrap; }
.age-warn { color: var(--rose) !important; font-family: var(--font-mono); }

.adopt-dialog { width: min(680px, calc(100vw - 28px)); }
.adopt-dialog .dialog-icon {
  background: var(--amber-dim);
  color: var(--amber);
  border-color: rgba(246, 199, 106, .22);
}
.adopt-inner { max-height: min(86vh, 900px); overflow-y: auto; }
.adopt-block {
  margin: 0 0 13px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .014);
}
.adopt-label {
  display: block;
  margin-bottom: 9px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
}
.adopt-section { margin-top: 10px; }
.adopt-candidates { display: grid; gap: 6px; max-height: 190px; overflow-y: auto; }
.candidate-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .018);
  cursor: pointer;
}
.candidate-row:hover { border-color: var(--line-strong); }
.candidate-row input { margin-top: 3px; accent-color: var(--mint); }
.candidate-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.candidate-copy strong { color: var(--text-soft); font-size: 11.5px; }
.candidate-copy small { color: var(--muted-2); font-size: 10px; line-height: 1.5; }
.adopt-legs { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.adopt-legs .switch-inline { margin: 0; }
.adopt-conflict { display: grid; gap: 7px; }
.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
  cursor: pointer;
}
.radio-row input { margin-top: 2px; accent-color: var(--amber); }
.warn-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 0;
  padding: 9px 11px;
  border: 1px solid rgba(255, 139, 155, .28);
  border-radius: 8px;
  background: var(--red-dim);
  color: #ffc4cb;
  font-size: 10.5px;
  line-height: 1.5;
  cursor: pointer;
}
.warn-check.hidden { display: none !important; }
.warn-check input { margin-top: 2px; accent-color: var(--red); }
.adopt-dialog .preview-grid { grid-template-columns: repeat(2, 1fr); }
.adopt-dialog .preview-card { margin: 0; }


.actionable-table th, .actionable-table td { padding: 9px 8px; font-size: 10.5px; }
.actionable-table .btn-mini { min-height: 24px; padding: 2px 7px; font-size: 9.5px; }
.detail-grid { align-items: start; }
.detail-legs { align-items: start; }
.detail-leg { align-self: start; }

/* ------------------------------ responsive -------------------------- */
@media (max-width: 900px) {
  .backtest-grid { grid-template-columns: 1fr; }
  .live-status-grid { grid-template-columns: 1fr 1fr; }
  .switch-row { grid-template-columns: auto 1fr auto; }
}

@media (max-width: 720px) {
  .order-toolbar { align-items: stretch; }
  .order-toolbar .segmented { flex: 1 1 auto; justify-content: space-between; }
  .wizard-steps { gap: 4px; }
  .wizard-indicator { padding: 4px 7px; font-size: 9px; }
  .preview-grid { grid-template-columns: 1fr 1fr; }
  .table-panel > .panel-head { padding: 14px 13px 0; }
  .equity-svg { height: 140px; }
  .switch-row { grid-template-columns: auto 1fr; }
  .switch-row .state-pill { grid-column: 2; justify-self: start; }
  .adopt-dialog .preview-grid { grid-template-columns: 1fr; }
  .candidate-row { padding: 8px; }
}

@media (max-width: 460px) {
  .preview-grid { grid-template-columns: 1fr; }
  .live-status-grid { grid-template-columns: 1fr; }
  .wizard-indicator span { display: none; }
  .wizard-indicator { padding: 4px 6px; }
  .switch-copy small { font-size: 9.5px; }
}

/* ==================================================================== */
/* T25: protection page — mode cards / diff tables / detail panels      */
/* ==================================================================== */
.mode-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.mode-card { display: flex; flex-direction: column; gap: 10px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.mode-card-live { border-color: rgba(255, 139, 155, .22); }
.mode-card-head { display: flex; align-items: center; gap: 10px; }
.mode-card-head > div { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.mode-card-head strong { font-size: 12.5px; }
.mode-card-head small { color: var(--muted-2); font-size: 9.5px; }
.mode-card-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; background: var(--blue-dim); color: var(--blue); font: 700 12px/1 var(--font-mono); }
.mode-card-icon.demo { background: var(--amber-dim); color: var(--amber); }
.mode-card-icon.live { background: var(--red-dim); color: var(--rose); }
.mode-card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0; }
.mode-card-meta > div { min-width: 0; }
.mode-card-meta dt { color: var(--muted-2); font-size: 9px; margin-bottom: 1px; }
.mode-card-meta dd { margin: 0; color: var(--text-soft); font: 600 10.5px/1.4 var(--font-mono); word-break: break-word; }
.mode-card-error { margin: 0; padding: 7px 9px; border: 1px solid rgba(255, 139, 155, .22); border-radius: 7px; background: var(--red-dim); color: #ffc4cb; font-size: 10px; line-height: 1.45; }
.sync-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line); }
.sync-grid > div { display: flex; flex-direction: column; gap: 3px; padding: 9px 11px; background: #0e141b; }
.sync-grid span { color: var(--muted-2); font-size: 9px; }
.sync-grid strong { color: var(--text-soft); font: 600 11px/1.35 var(--font-mono); word-break: break-word; }
.refresh-toggle { margin: 0; font-size: 10.5px; white-space: nowrap; }
.refresh-toggle .switch-track { width: 32px; height: 18px; }
.refresh-toggle .switch-track::after { width: 12px; height: 12px; }
.refresh-toggle input:checked + .switch-track::after { transform: translateX(14px); }
.actionable-table td { vertical-align: top; }
.expander-cell { width: 26px; padding-right: 0 !important; }
.row-expander { width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: rgba(255, 255, 255, .03); color: var(--muted); font-size: 10px; line-height: 1; cursor: pointer; }
.row-expander:hover { color: var(--text); border-color: var(--line-strong); }
.actionable-row.row-needs-link td { background: rgba(246, 199, 106, .045); }
.leg-pill { display: inline-flex; align-items: center; padding: 1px 5px; margin-right: 3px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 8.5px; white-space: nowrap; }
.leg-pill.live { color: var(--mint); border-color: rgba(114, 241, 184, .25); background: var(--mint-dim); }
.leg-pill.error { color: var(--rose); border-color: rgba(255, 139, 155, .25); background: var(--rose-dim); }
.leg-pill.warn { color: var(--amber); border-color: rgba(246, 199, 106, .25); background: var(--amber-dim); }
.leg-pill.blue { color: var(--blue); border-color: rgba(125, 183, 255, .25); background: var(--blue-dim); }
.leg-pill.muted { color: var(--muted-2); }
.position-detail-row > td { padding: 12px 14px 16px !important; border-bottom: 1px solid var(--line); background: #0b1118; }
.position-detail { display: flex; flex-direction: column; gap: 12px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 14px; }
.detail-legs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.detail-leg { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .018); }
.detail-leg-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.detail-leg-head strong { font-size: 11px; color: var(--text-soft); }
.detail-leg-price { font-size: 13px; color: var(--text); }
.detail-leg-source { color: var(--muted-2); font-size: 9px; }
.detail-side { display: grid; gap: 6px; align-content: start; }
.detail-side > div { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255, 255, 255, .014); }
.detail-side span { color: var(--muted-2); font-size: 9px; }
.detail-side strong { color: var(--text-soft); font-size: 10.5px; font-weight: 600; word-break: break-word; }
.detail-actions { margin: 0; }
.detail-timeline .timeline { list-style: none; display: grid; gap: 4px; margin: 4px 0 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 132px 52px 90px 1fr; gap: 8px; align-items: center; color: var(--muted); font-size: 10px; }
.timeline-kind { color: var(--muted-2); }
.readonly-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.readonly-grid > .panel { margin-bottom: 0; }
.protection-events { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.protection-events .empty-block { margin: 0; }
.event-row { display: grid; grid-template-columns: 132px 64px 90px 1fr; gap: 8px; align-items: center; padding: 6px 10px; border-bottom: 1px solid rgba(148, 163, 184, .05); color: var(--muted); font-size: 10px; }
.event-row:hover { background: rgba(255, 255, 255, .017); }
.event-kind { color: var(--muted-2); }
.manage-dialog .dialog-icon, .levels-dialog .dialog-icon { background: var(--mint-dim); color: var(--mint); border-color: rgba(114, 241, 184, .2); }
.manage-legs { display: grid; gap: 6px; }
.manage-leg-row { display: grid; grid-template-columns: auto 64px 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255, 255, 255, .018); color: var(--text-soft); font-size: 10.5px; }
.manage-leg-row input { accent-color: var(--mint); }
.manage-leg-price { color: var(--text); font-size: 11px; }
.manage-leg-row .tag { justify-self: end; }
.levels-rows { display: grid; gap: 8px; margin: 10px 0; }
.levels-row { display: grid; grid-template-columns: 92px 64px 1fr; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255, 255, 255, .018); }
.levels-check { display: flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 10.5px; cursor: pointer; }
.levels-check input { accent-color: var(--mint); }
.levels-input { min-height: 30px !important; padding: 4px 8px !important; font-size: 11px !important; }
.levels-tp2-mode { display: grid; gap: 5px; margin: 6px 0 10px; }

@media (max-width: 1180px) {
  .mode-cards { grid-template-columns: 1fr; }
  .sync-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .readonly-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-legs { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .sync-grid { grid-template-columns: 1fr 1fr; }
  .timeline li { grid-template-columns: 1fr 52px; }
  .event-row { grid-template-columns: 1fr 64px; }
  .detail-legs { grid-template-columns: 1fr; }
}

/* T26: repair (补单) age / red acknowledgements + position-mode hint */
.order-auto-mode-hint { margin: -6px 0 14px; color: var(--amber); }
.repair-warning { margin-top: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.018); }
.repair-warning.repair-warning-amber { border-color: rgba(246,199,106,.32); background: var(--amber-dim); }
.repair-warning.repair-warning-red { border-color: rgba(255,139,155,.35); background: var(--red-dim); }
.repair-warning-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.repair-warning-head strong { font-size: 11.5px; color: var(--text-soft); }
.repair-warning p { margin: 0 0 6px; color: var(--text-soft); font-size: 10.5px; line-height: 1.55; }
.repair-warning-amber p, .repair-warning-amber .repair-warning-list { color: #f8dca2; }
.repair-warning-red p, .repair-warning-red .repair-warning-list { color: #ffc4cb; }
.repair-warning-list { margin: 0 0 8px; padding-left: 18px; font-size: 10px; line-height: 1.55; }
.repair-warning .warn-check { margin-top: 4px; }

/* ==================================================================== */
/* T26: scoped overview + settings layers + exchange account config     */
/* ==================================================================== */
.scoped-panel { margin-bottom: 16px; }
.scoped-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 16px; margin-bottom: 12px; }
.scoped-equity { min-width: 0; }
.scoped-equity .big-number { font-size: clamp(26px, 3vw, 38px); margin: 4px 0 12px; }
.scoped-side { min-width: 0; }
.panel-head.compact { margin: 10px 0 8px; }
.scoped-events { max-height: 240px; overflow-y: auto; }

.settings-layer { margin-bottom: 18px; }
.settings-layer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.settings-layer-head h3 { margin: 2px 0 0; font-size: 15px; }
.settings-layer-head .hint { margin: 4px 0 0; max-width: 620px; }
.settings-layer-head .head-actions { display: flex; align-items: center; gap: 8px; }
.form-section .section-tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.form-section .section-tools p { margin: 0; text-align: right; }
.form-section .section-summary { display: block; width: 100%; margin-top: 6px; color: var(--muted-2); font: 10px/1.5 var(--font-mono); }
.form-section.is-collapsed .section-body { display: none; }
.form-section.is-collapsed { padding-bottom: 14px; }
.form-section.is-collapsed .section-head { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }

.mode-layer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mode-layer-card { display: flex; flex-direction: column; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.018); }
.mode-layer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mode-layer-head strong { font-size: 12.5px; }
.mode-layer-meta { display: grid; gap: 4px; margin: 0; }
.mode-layer-meta > div { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; }
.mode-layer-meta dt { color: var(--muted-2); flex: none; }
.mode-layer-meta dd { margin: 0; color: var(--text-soft); font-family: var(--font-mono); text-align: right; word-break: break-word; }
.mode-layer-card .btn { align-self: flex-start; }

.mode-config-dialog { width: min(680px, calc(100vw - 30px)); }
.mode-config-block { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.014); }
.mode-config-checks { display: grid; gap: 6px; }
.mode-field-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.012); font-size: 10.5px; color: var(--text-soft); }
.mode-field-row input[type="checkbox"] { accent-color: var(--mint); }
.mode-field-row input[type="number"] { min-height: 28px !important; width: 110px; padding: 3px 7px !important; font-size: 10.5px !important; }
.mode-field-name { font-family: var(--font-mono); min-width: 0; word-break: break-word; }
.source-badge { display: inline-flex; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted-2); font: 9px/1.5 var(--font-mono); }
.source-badge.mode { color: var(--mint); border-color: rgba(114,241,184,.25); background: var(--mint-dim); }
.empty-block + .mode-field-row { margin-top: 6px; }

.exchange-symbol-input { width: 120px !important; min-height: 30px !important; padding: 4px 8px !important; font-size: 11px !important; }
.exchange-grid { display: flex; flex-direction: column; gap: 10px; }
.exchange-readonly { min-height: 32px; }
#exchange-config-margin:disabled, #exchange-config-position-mode:disabled { opacity: .55; }
@media (max-width: 1180px) {
  .mode-layer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .scoped-grid { grid-template-columns: 1fr; }
  .settings-layer-head { flex-direction: column; }
  .settings-layer-head .head-actions { flex-wrap: wrap; }
}

/* ==================================================================== */
/* T27: alerts page / notification bell / order history / live-first IA */
/* ==================================================================== */
.fold-panel { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.014); }
.fold-panel > summary { cursor: pointer; padding: 12px 16px; color: var(--text-soft); font-size: 11.5px; font-weight: 600; list-style: none; }
.fold-panel > summary::-webkit-details-marker { display: none; }
.fold-panel > summary::before { content: "▸ "; color: var(--muted-2); }
.fold-panel[open] > summary::before { content: "▾ "; }
.fold-panel > .panel,
.fold-panel > .mini-stats { margin: 0 12px 12px; }
.fold-panel > .panel.table-panel { padding: 0; border: 0; background: transparent; }

.statusbar,
.protection-statusbar,
.alerts-statusbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 10px 14px; margin-bottom: 14px;
}
.statusbar-item { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted-2); white-space: nowrap; }
.statusbar-item strong { color: var(--text-soft); font: 600 11px/1.3 var(--font-mono); }
.statusbar-item > span:first-child { color: var(--muted-2); }
.statusbar-actions { margin-left: auto; gap: 8px; }
.statusbar-error { color: var(--rose); }
.statusbar-error strong { color: var(--rose); }

.live-signal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.live-signal-card { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.018); }
.live-signal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.live-signal-card .hint { margin: 0; }

/* alerts page */
.alerts-event-table .alert-event-name { color: var(--text-soft); }
.alerts-event-table tr.is-critical td { background: rgba(246,199,106,.045); }
.alerts-event-table .switch { position: relative; display: inline-flex; width: 34px; height: 19px; }
.alerts-event-table .switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.alert-channels { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 8px 0; }
.alert-channels .switch-inline { margin: 0; }
.webhook-list { display: flex; flex-direction: column; gap: 5px; margin: 6px 0; }
.webhook-row { display: flex; align-items: center; gap: 10px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.014); }
.webhook-url { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--text-soft); font-size: 10.5px; }
.quiet-hours { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.quiet-hours input { width: 74px; min-height: 30px; padding: 3px 7px; font-size: 11px; }
#alerts-webhook-input { flex: 1; min-width: 180px; }
.alert-template-placeholders { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.placeholder-chip { border: 1px solid var(--line-strong); border-radius: 999px; background: rgba(125,183,255,.08); color: var(--blue); font: 10px/1.6 var(--font-mono); padding: 2px 9px; cursor: pointer; }
.placeholder-chip:hover { background: rgba(125,183,255,.16); }
.alert-preview-body { margin: 4px 0 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0,0,0,.22); color: var(--text-soft); font-size: 10.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.alert-template-dialog .preview-card { margin: 8px 0; }
.alert-log-error { max-width: 240px; overflow-wrap: anywhere; }
.alert-bell-btn { position: relative; }
.alert-bell-badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--red); color: #fff;
  font: 700 9px/16px var(--font-mono); text-align: center;
}
.alert-bell-panel {
  position: fixed; top: 64px; right: 18px; z-index: 120; width: min(400px, calc(100vw - 24px));
  max-height: min(540px, calc(100vh - 90px)); overflow-y: auto;
  padding: 14px; border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--panel-solid); box-shadow: var(--shadow);
}
.alert-bell-panel.hidden { display: none; }
.alert-bell-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.alert-bell-head h3 { margin: 2px 0 0; font-size: 14px; }
.alert-bell-list { display: flex; flex-direction: column; gap: 4px; }
.alert-bell-item {
  display: flex; align-items: flex-start; gap: 9px; width: 100%; padding: 8px 9px;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--text-soft); text-align: left; font-family: var(--font-sans); cursor: pointer;
}
.alert-bell-item:hover { background: rgba(255,255,255,.025); border-color: var(--line); }
.alert-bell-item.is-read { opacity: .62; }
.alert-bell-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; background: var(--muted-2); flex: none; }
.alert-bell-dot.long { background: var(--mint); }
.alert-bell-dot.amber { background: var(--amber); }
.alert-bell-dot.red { background: var(--red); }
.alert-bell-dot.blue { background: var(--blue); }
.alert-bell-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.alert-bell-copy strong { font-size: 11px; color: var(--text); overflow-wrap: anywhere; }
.alert-bell-copy small { color: var(--muted-2); font-size: 9.5px; line-height: 1.5; overflow-wrap: anywhere; }
.alert-bell-panel .tag { flex: none; }
@media (max-width: 720px) {
  .alert-bell-panel { top: 56px; right: 8px; left: 8px; width: auto; }
  .statusbar, .protection-statusbar, .alerts-statusbar { gap: 8px 12px; }
  .statusbar-actions { margin-left: 0; }
  .two-col .panel#alerts-monitor-panel { margin-top: 0; }
}

/* ==================================================================== */
/* T28: unified switches + monitor / whitelist list editors             */
/* ==================================================================== */
.switch-inline.switch-mini { gap: 0; }
.switch-inline.switch-mini .switch-track { width: 30px; height: 17px; }
.switch-inline.switch-mini .switch-track::after { width: 11px; height: 11px; }
.switch-inline.switch-mini input:checked + .switch-track::after { transform: translateX(13px); }
.switch-inline input:disabled + .switch-track { opacity: .45; cursor: not-allowed; }
.switch-inline input:disabled + .switch-track + span { opacity: .6; }

.monitor-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.monitor-add-row input { flex: 1; min-width: 150px; }
.monitor-list { display: flex; flex-direction: column; gap: 5px; margin: 6px 0; max-height: 220px; overflow-y: auto; }
.monitor-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.014); }
.monitor-symbol { flex: none; min-width: 96px; color: var(--text); font-size: 11px; font-weight: 600; }
.monitor-symbol-input { flex: 0 1 150px; min-height: 28px !important; padding: 3px 7px !important; font-size: 11px !important; text-transform: uppercase; }
.monitor-note { flex: 1; min-width: 90px; min-height: 28px !important; padding: 3px 7px !important; font-size: 10.5px !important; }
.monitor-row .btn { flex: none; }
.mode-whitelist-line { margin: 6px 0; font-size: 10.5px; color: var(--muted-2); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.mode-whitelist-line .mono { color: var(--text-soft); }
.text-link { border: 0; background: none; padding: 0; color: var(--mint); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.text-link:hover { color: var(--mint-strong, var(--mint)); }
#mode-config-whitelist-block.hidden { display: none; }
#mode-config-whitelist-block .monitor-list { max-height: 160px; }
#mode-config-whitelist-block input { text-transform: uppercase; }
.statusbar-item .text-link { margin-left: 2px; font-size: 10px; }
