/* QUANTUM HEDGE — Quantitative Operations & Engine Console Theme */
:root {
  --bg: #0a0d12;
  --bg-elev: #0e131b;
  --card: #121822;
  --card-hover: #171f2c;
  --border: #202a3a;
  --border-strong: #2d3b52;
  --text: #eef2f7;
  --text-dim: #9aa8bc;
  --muted: #64748b;
  --primary: #14b8a6;
  --primary-bright: #2dd4bf;
  --primary-dim: rgba(20, 184, 166, 0.14);
  --primary-border: rgba(45, 212, 191, 0.34);
  --pro-accent: #38bdf8;
  --pro-dim: rgba(56, 189, 248, 0.13);
  --ok: #10b981;
  --ok-bright: #34d399;
  --ok-dim: rgba(16, 185, 129, 0.13);
  --danger: #f43f5e;
  --danger-bright: #fb7185;
  --danger-dim: rgba(244, 63, 94, 0.13);
  --warn: #f59e0b;
  --topbar-bg: rgba(11, 15, 22, 0.92);
  --input-bg: #0b0f16;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.32), 0 8px 24px rgba(0, 0, 0, 0.22);
  --font: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
html[data-ops-theme="light"] {
  --bg: #f1f5f9;
  --bg-elev: #e8eef5;
  --card: #ffffff;
  --card-hover: #f8fafc;
  --border: #dbe3ee;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-dim: #475569;
  --muted: #64748b;
  --primary: #0d9488;
  --primary-bright: #0f766e;
  --primary-dim: rgba(13, 148, 136, 0.10);
  --primary-border: rgba(13, 148, 136, 0.32);
  --pro-accent: #0284c7;
  --pro-dim: rgba(2, 132, 199, 0.10);
  --ok: #059669;
  --ok-bright: #047857;
  --ok-dim: rgba(5, 150, 105, 0.10);
  --danger: #e11d48;
  --danger-bright: #be123c;
  --danger-dim: rgba(225, 29, 72, 0.09);
  --warn: #d97706;
  --topbar-bg: rgba(255, 255, 255, 0.94);
  --input-bg: #f8fafc;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 6px 18px rgba(15, 23, 42, 0.04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background-color: var(--bg);
  background-image: none;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.48;
  letter-spacing: -0.01em;
  font-size: 14px;
}
a { color: var(--primary-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

/* —— Top bar —— */
.topbar {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.55rem 1.35rem;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(12px);
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; white-space: nowrap; }
.brand .ver {
  font-size: 0.75rem; font-weight: 600; color: var(--primary);
  background: var(--primary-dim); padding: 0.15rem 0.45rem; border-radius: 999px; margin-left: 0.35rem;
}
.brand .sub { display: none; }
.nav-main { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; align-items: center; }
.nav-main a, .nav-main .tab {
  color: var(--text-dim); padding: 0.4rem 0.75rem; border-radius: 8px;
  border: 1px solid transparent; background: transparent; cursor: pointer; font-size: 0.9rem;
}
.nav-main a:hover, .nav-main .tab:hover, .nav-main a.active, .nav-main .tab.active {
  color: var(--text); background: var(--card); border-color: var(--border); text-decoration: none;
}
.nav-logout-form { display: inline-flex; margin: 0; }
.nav-logout-btn { font-size: 0.9rem; }
.top-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

/* —— Layout —— */
main { padding: 1.25rem; max-width: 1180px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.page-head h1, .page-head h2 { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.page-head .meta, .page-head p.muted { color: var(--muted); font-size: 0.85rem; margin: 0.25rem 0 0; }

/* —— Cards —— */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card-title {
  margin: 0 0 0.85rem; font-size: 0.8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  display: inline-flex; align-items: center; gap: 0.45rem;
}
.card-title::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(79, 140, 255, 0.65);
  flex-shrink: 0;
}

/* Summary grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
  width: 100%;
}
@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.summary-card {
  background: linear-gradient(180deg, rgba(24, 33, 45, 0.94) 0%, rgba(17, 23, 32, 0.96) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.95rem;
  min-height: 74px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 4px 14px rgba(0,0,0,0.22);
}
.summary-card .label {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-size: 0.75rem;
  color: #a8b6c8;
  font-weight: 600;
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}
.s-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background: var(--muted);
}
.s-dot.dot-primary { background: #4f8cff; box-shadow: 0 0 7px rgba(79, 140, 255, 0.65); }
.s-dot.dot-cyan { background: #38bdf8; box-shadow: 0 0 7px rgba(56, 189, 248, 0.6); }
.s-dot.dot-indigo { background: #a78bfa; box-shadow: 0 0 7px rgba(167, 139, 250, 0.6); }
.s-dot.dot-warn { background: #fbbf24; box-shadow: 0 0 7px rgba(251, 191, 36, 0.6); }
.s-dot.dot-ok { background: #34d399; box-shadow: 0 0 7px rgba(52, 211, 153, 0.65); }
.s-dot.dot-danger { background: #f87171; box-shadow: 0 0 7px rgba(248, 113, 113, 0.65); }
.s-dot.dot-muted { background: #64748b; }
.summary-card .value {
  font-size: 1.16rem; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.summary-value-stack {
  display: flex;
  flex-direction: column;
  gap: 0.16rem;
}
.summary-side-split {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem;
  font-size: 0.82rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.summary-side-split .side-split-sep {
  color: var(--text-dim);
  font-weight: 600;
}
.summary-card .hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.32rem;
  padding-top: 0.28rem;
  border-top: 1px dotted rgba(148, 163, 184, 0.16);
  display: flex;
  align-items: center;
  gap: 0.32rem;
}
.summary-card .hint::before {
  content: "·";
  color: var(--primary);
  font-weight: 800;
}
.summary-card.hero .value { font-size: 1.22rem; }
.summary-card.span-2 { grid-column: span 2; }
@media (max-width: 520px) { .summary-card.span-2 { grid-column: span 1; } }

/* Round progress in summary */
.round-progress-block { margin-top: 0.55rem; }
.progress-bar {
  height: 8px; background: #0e141c; border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border); position: relative;
}
.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 10px,
    rgba(11, 15, 20, 0.48) 10px,
    rgba(11, 15, 20, 0.48) 12px
  );
  pointer-events: none;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, #3b82f6, #34d399);
  width: 0%; transition: width 0.4s ease;
}
.round-progress-label { font-size: 0.78rem; color: var(--text-dim); margin-top: 0.4rem; }
.dot-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.52rem;
  margin: 0.12rem 0.22rem 0.12rem 0;
  background: rgba(11, 17, 25, 0.68);
  border: 1px dotted rgba(71, 85, 105, 0.65);
  border-radius: 999px;
  font-size: 0.74rem;
  color: #b4c2d4;
}
.dot-meta-chip::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}
.dot-meta-chip b { color: #eef4fb; font-weight: 600; }
.dot-meta-chip.highlight {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(16, 185, 129, 0.1);
  color: #d1fae5;
}
.dot-meta-chip.highlight::before {
  background: #34d399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.7);
}

/* Settings panel */
.settings-card {
  background: linear-gradient(120deg, #192738 0%, #161d27 58%, #1a2928 100%);
  border-color: #31465c;
}
.settings-card details { border: none; }
.settings-card summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 1rem; color: var(--text); user-select: none;
}
.settings-card summary::-webkit-details-marker { display: none; }
.settings-card summary::after {
  content: "▾"; color: var(--muted); font-size: 0.85rem; transition: transform 0.15s;
}
.settings-card details[open] summary::after { transform: rotate(180deg); }
.settings-body { margin-top: 0.55rem; padding-top: 0.85rem; border-top: 1px solid rgba(154, 168, 188, 0.16); }
.round-progress-card {
  padding: 0.95rem 1.2rem;
  background: linear-gradient(110deg, #172536 0%, #151e28 58%, #192b29 100%);
  border-color: #32485b;
}
.round-progress-details { border: none; }
.round-progress-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: block;
}
.round-progress-summary::-webkit-details-marker { display: none; }
.round-summary-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.48rem;
}
.round-summary-head .card-title { margin-right: auto; }
.round-summary-pills {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  flex-wrap: wrap;
}
.round-start-summary,
.round-target-summary {
  font-size: 0.84rem;
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(11, 17, 25, 0.72);
  border: 1px solid rgba(71, 85, 105, 0.58);
  padding: 0.16rem 0.52rem;
  border-radius: 999px;
  white-space: nowrap;
}
.round-start-summary.has-start {
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.38);
  background: rgba(59, 130, 246, 0.12);
}
.round-target-summary.has-target {
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.42);
  background: rgba(16, 185, 129, 0.12);
}
.round-chevron {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
  transition: transform 0.16s ease;
}
.round-progress-details[open] .round-chevron { transform: rotate(180deg); }
.round-progress-body {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(154, 168, 188, 0.16);
}
.round-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.85rem;
  margin-top: 0.5rem;
}
.round-meta-row { margin-top: 0; }
.round-actions { flex-shrink: 0; }
.round-progress-card .card-title {
  color: #d6e2ef; font-size: 0.96rem; text-transform: none; letter-spacing: 0; margin-bottom: 0;
}
.round-progress-card .progress-bar {
  height: 12px; background: #0b1119; border-color: #33475b;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
}
.round-progress-card .progress-fill { background: linear-gradient(90deg, #4f8cff, #27c995); }
.round-progress-label { font-size: 0.84rem; color: #c3d0df; margin-top: 0; font-variant-numeric: tabular-nums; }
.settings-tabs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem;
  border: 1px solid #27394b; border-radius: 10px; padding: 0.3rem;
  margin-bottom: 0.9rem; background: rgba(7, 12, 18, 0.72);
}
.settings-tab {
  appearance: none; border: 1px solid transparent; border-radius: 7px;
  border-bottom: 1px solid transparent; background: transparent;
  color: #9aa8bc; padding: 0.62rem 0.85rem; cursor: pointer;
  font: inherit; font-size: 0.88rem; font-weight: 600;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.settings-tab:hover { background: #1b2938; color: #dbeafe; }
.settings-tab:focus-visible { outline: 2px solid #6daaff; outline-offset: 2px; }
.settings-tab.active {
  color: #edf6ff; background: #24405b; border-color: #477ba7;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 2px 8px rgba(0,0,0,0.2);
}
.settings-panel[hidden] { display: none; }
.settings-panel {
  min-height: 7rem; padding: 1rem 1.1rem;
  background: rgba(9, 15, 22, 0.42); border: 1px solid #273647; border-radius: 10px;
}
.settings-panel .field { max-width: 42rem; }
.settings-panel .field label { color: #d4dfeb; font-size: 0.9rem; font-weight: 650; }
.cap-modes-stack { display: flex; flex-direction: column; gap: 0.55rem; max-width: 44rem; }
.cap-mode-select-label { margin-top: 0.2rem; font-weight: 600; color: #9fb3c8; }
.cap-mode-card {
  padding: 0.72rem 0.9rem; border-radius: 10px;
  background: rgba(13, 21, 31, 0.65); border: 1px solid #27384b;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}
.cap-mode-card.is-active {
  background: rgba(16, 185, 129, 0.09); border-color: rgba(52, 211, 153, 0.48);
}
.cap-mode-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem;
}
.cap-mode-btn {
  appearance: none; text-align: left; cursor: pointer; font: inherit; color: var(--text);
  padding: 0.75rem 0.88rem; border-radius: 10px;
  background: rgba(13, 21, 31, 0.78); border: 1px solid #2a3c50;
  display: flex; flex-direction: column; gap: 0.35rem;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}
.cap-mode-btn:hover { border-color: #46688a; background: rgba(23, 36, 52, 0.88); }
.cap-mode-btn.active {
  background: rgba(37, 99, 235, 0.14); border-color: #4f8cff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(79, 140, 255, 0.25);
}
.cap-mode-head { display: flex; align-items: center; justify-content: space-between; gap: 0.45rem; flex-wrap: wrap; }
.cap-mode-head strong { font-size: 0.92rem; color: #eaf3ff; }
.cap-mode-desc { font-size: 0.76rem; color: var(--muted); line-height: 1.38; }
#cap-custom-field.is-muted-mode { opacity: 0.68; }
@media (max-width: 600px) {
  .round-progress-head { flex-direction: column; }
  .settings-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-tab { padding: 0.6rem 0.35rem; }
  .cap-mode-grid { grid-template-columns: 1fr; }
  .field-row input { flex: 1 1 9.5rem; }
  .round-progress-card { padding: 1rem; }
}
.funding-status-box {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.7rem 0.9rem; border-radius: 9px;
  background: rgba(15, 23, 34, 0.85); border: 1px solid #27394b;
}
.funding-metrics {
  display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap;
}
.funding-metric {
  display: flex; flex-direction: column; gap: 0.18rem;
}
.funding-metric strong {
  font-size: 1rem; color: #e2f0ff; font-variant-numeric: tabular-nums;
}
.field label {
  display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; font-weight: 500;
}
.field-label-row {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 0.4rem;
}
.field-label-row > label { margin-bottom: 0 !important; }
.field .inline-check,
.settings-panel .field .inline-check {
  display: inline-flex; align-items: center; gap: 0.42rem; cursor: pointer; user-select: none;
  padding: 0.22rem 0.58rem; border-radius: 6px;
  background: rgba(56, 139, 253, 0.09); border: 1px solid rgba(88, 166, 255, 0.28);
  color: #cfe4ff; font-size: 0.82rem; font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.field .inline-check:hover {
  background: rgba(56, 139, 253, 0.16); border-color: rgba(88, 166, 255, 0.5);
}
.field .inline-check input[type="checkbox"] {
  width: 0.98rem; height: 0.98rem; margin: 0; padding: 0; flex: 0 0 auto;
  accent-color: #4f9cff; cursor: pointer;
}
input:disabled { opacity: 0.55; cursor: not-allowed; }
.field .help { font-size: 0.75rem; color: var(--muted); margin-top: 0.35rem; line-height: 1.4; }
.field-row { display: flex; gap: 0.5rem; align-items: stretch; flex-wrap: wrap; }
.field-row input { flex: 1 1 0; min-width: 0; width: 100%; max-width: 100%; }

input, textarea, select {
  background: #0e141c; border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 0.55rem 0.7rem; font-size: 0.95rem;
  font-family: inherit; width: 100%;
}
input:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim);
}

/* Buttons */
.btn {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 0.45rem 0.85rem; font-size: 0.875rem; font-weight: 500;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.btn:hover { background: var(--card-hover); border-color: var(--border-strong); }
.btn.primary { background: var(--primary); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger-dim); border-color: rgba(248,113,113,0.35); color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 0.25rem 0.55rem; font-size: 0.75rem; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap { gap: 0.5rem; }
.wrap { flex-wrap: wrap; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 0.32rem;
  font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.52rem;
  border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim);
  background: #0e141c;
}
.badge[hidden] { display: none !important; }
.badge.running::before, .badge.stopped::before, .badge.testnet::before, .badge.demo::before,
.badge.live::before, .badge.mainnet::before, .badge.signal-golden::before, .badge.signal-dead::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.badge.running, .badge.ok { color: var(--ok); background: var(--ok-dim); border-color: rgba(52,211,153,0.28); }
.badge.running::before { background: var(--ok); box-shadow: 0 0 7px var(--ok); }
.badge.stopped { color: var(--muted); }
.badge.stopped::before { background: #64748b; }
.badge.testnet, .badge.demo { color: #67e8f9; background: rgba(103,232,249,0.1); border-color: rgba(103,232,249,0.25); }
.badge.testnet::before, .badge.demo::before { background: #67e8f9; box-shadow: 0 0 6px rgba(103,232,249,0.65); }
.badge.live, .badge.mainnet { color: #c4b5fd; background: rgba(196,181,253,0.12); border-color: rgba(196,181,253,0.28); }
.badge.live::before, .badge.mainnet::before { background: #c4b5fd; box-shadow: 0 0 6px rgba(196,181,253,0.65); }
.badge.signal-golden { color: #34d399; background: rgba(52,211,153,0.12); border-color: rgba(52,211,153,0.3); }
.badge.signal-golden::before { background: #34d399; box-shadow: 0 0 6px #34d399; }
.badge.signal-dead { color: #f87171; background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.3); }
.badge.signal-dead::before { background: #f87171; box-shadow: 0 0 6px #f87171; }
/* Stage badge colors (dark theme contrast) */
.stage-dot-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  vertical-align: middle;
}
.stage-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(9, 14, 20, 0.72);
  border: 1px solid rgba(51, 65, 85, 0.65);
}
.stage-dots .sdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(100, 116, 139, 0.32);
  display: inline-block;
}
.stage-dots-1 .sdot.on { background: #e4e4e7; box-shadow: 0 0 5px rgba(244,244,245,0.65); }
.stage-dots-2 .sdot.on { background: #facc15; box-shadow: 0 0 6px rgba(250,204,21,0.75); }
.stage-dots-3 .sdot.on { background: #f97316; box-shadow: 0 0 6px rgba(249,115,22,0.8); }
.stage-dots-4 .sdot.on { background: #ef4444; box-shadow: 0 0 7px rgba(239,68,68,0.85); }
.badge.stage { border: 1px solid transparent; font-weight: 700; }
.badge.stage.stage-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
.badge.stage-1 { background: #e4e4e7; color: #090d14; border-color: rgba(244,244,245,0.65); box-shadow: 0 0 6px rgba(244,244,245,0.28); }
.badge.stage-2 { background: #facc15; color: #090d14; border-color: rgba(250,204,21,0.75); box-shadow: 0 0 7px rgba(250,204,21,0.35); }
.badge.stage-3 { background: #f97316; color: #ffffff; border-color: rgba(249,115,22,0.80); box-shadow: 0 0 8px rgba(249,115,22,0.40); }
.badge.stage-4 { background: #ef4444; color: #ffffff; border-color: rgba(239,68,68,0.85); box-shadow: 0 0 9px rgba(239,68,68,0.45); }
.btn-rename, #btn-rename-detail { font-size: 0.85rem; padding: 0.15rem 0.4rem; opacity: 0.75; }
.btn-rename:hover, #btn-rename-detail:hover { opacity: 1; }
.name-edit-row { display: inline-flex; align-items: center; gap: 0.35rem; }

/* Positions */
.pos-section { margin-top: 0.25rem; }
.pos-hero-pnl {
  font-size: 1.05rem; font-weight: 700; margin: 0 0 0.85rem;
  padding: 0.75rem 1rem; border-radius: var(--radius-sm);
  background: #0e141c; border: 1px solid var(--border);
}
.pos-hero-pnl.pos { color: var(--ok); border-color: rgba(52,211,153,0.25); background: var(--ok-dim); }
.pos-hero-pnl.neg { color: var(--danger); border-color: rgba(248,113,113,0.25); background: var(--danger-dim); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
  text-align: left; font-size: 0.72rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.03em;
  padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border);
}
td { padding: 0.65rem 0.6rem; border-bottom: 1px solid rgba(36,48,65,0.65); vertical-align: top; }
.pos-group-header td {
  background: #1a2330;
  border-top: 3px solid #6b7280;
  padding-top: 0.75rem; padding-bottom: 0.4rem;
  font-weight: 600;
}
.pos-group-header:first-child td { border-top: none; }
tr.pos-group-spacer td {
  height: 12px; padding: 0; border: none; background: transparent;
}
tr.pos-flip-moving td,
.pos-sym-block.pos-flip-moving,
.pos-side-card.pos-flip-moving {
  position: relative;
  will-change: transform;
}
tr.pos-flip-up td {
  z-index: 3;
  background-color: rgba(56, 189, 248, 0.10);
}
tr.pos-group-header.pos-flip-up td {
  background-color: #213044;
}
tr.pos-flip-down td {
  z-index: 1;
}
.pos-sym-block.pos-flip-up,
.pos-side-card.pos-flip-up {
  z-index: 3;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}
.pos-sym-block.pos-flip-down,
.pos-side-card.pos-flip-down {
  z-index: 1;
}
.pos-indent { padding-left: 1.1rem !important; color: var(--text-dim); }
.side-long { color: #22c55e !important; font-weight: 700; }
.side-short { color: #ef4444 !important; font-weight: 700; }
.pnl-pos { color: var(--ok); font-weight: 600; }
.pnl-neg { color: var(--danger); font-weight: 600; }
.tiny { font-size: 0.75rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Overview / accounts */
.overview-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
@media (max-width: 560px) {
  .overview-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    margin-bottom: 0.65rem;
  }
}
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.card-list { display: flex; flex-direction: column; gap: 0.6rem; }
.acct-list-card {
  padding: 0.95rem 1.1rem;
}
.acct-list-summary-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.acct-card {
  background: #0e141c; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem; cursor: pointer;
}
.acct-card:hover { border-color: var(--border-strong); background: var(--card-hover); }
.acct-fold summary.acct-fold-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}
.acct-fold summary.acct-fold-summary::-webkit-details-marker { display: none; }
.acct-fold summary.acct-fold-summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 0.8rem;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.acct-fold[open] summary.acct-fold-summary::after {
  transform: rotate(180deg);
}
.acct-fold-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.acct-fold-body {
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px dotted rgba(148, 163, 184, 0.2);
  cursor: default;
}
.form { display: flex; flex-direction: column; gap: 0.75rem; }
.form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.toggle-net { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.choice {
  flex: 1; text-align: center; padding: 0.55rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer; color: var(--text-dim);
}
.choice input { display: none; }
.choice.active-test, .choice.active-live {
  border-color: var(--primary); background: var(--primary-dim); color: var(--text);
}
.warn-live {
  display: none; margin-top: 0.5rem; padding: 0.6rem 0.75rem;
  background: var(--danger-dim); color: var(--danger); border-radius: 8px; font-size: 0.8rem;
}
.warn-live.show { display: block; }
.log {
  background: #0a0e13; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.85rem; max-height: 280px; overflow: auto; font-size: 0.75rem;
  font-family: var(--mono); color: var(--text-dim); white-space: pre-wrap;
}

/* Alerts / toast */
.alert-banner {
  background: #3f1d1d; color: #fecaca; padding: 0.65rem 1.25rem;
  display: flex; flex-wrap: wrap; gap: 0.55rem 0.75rem; align-items: center; font-size: 0.9rem;
}
.alert-banner.is-action {
  background: #3f1d1d; color: #fecaca;
  border-bottom: 1px solid rgba(248, 113, 113, 0.35);
}
.alert-banner.is-normal {
  background: #102a43; color: #bae6fd;
  border-bottom: 1px solid rgba(56, 189, 248, 0.28);
}
.alert-banner[hidden] { display: none !important; }
.alert-badge {
  background: var(--danger); color: #fff; border-radius: 999px;
  padding: 0 0.4rem; font-size: 0.7rem; margin-left: 0.2rem;
}
.alert-badge.is-normal-only {
  background: #0284c7;
}
.alert-unread { background: rgba(220,38,38,0.08); }
.alert-unread-action { background: rgba(220,38,38,0.12); }
.alert-unread-normal { background: rgba(56,189,248,0.07); }
.badge.alert-sev-action {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.45);
  font-weight: 700;
}
.badge.alert-sev-normal {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-weight: 600;
}
.alert-sev-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0.75rem;
}
.alert-auto-read-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.alert-auto-read-wrap select {
  width: auto;
  padding: 0.28rem 0.48rem;
  font-size: 0.8rem;
}
#alerts-table th, #alerts-table td { white-space: nowrap; }
#alerts-table td.alert-msg-cell { white-space: normal; min-width: 220px; }
#toast {
  position: fixed; bottom: 1.25rem; right: 1.25rem; background: var(--card);
  border: 1px solid var(--border); padding: 0.75rem 1rem; border-radius: 10px;
  opacity: 0; transition: opacity 0.2s; max-width: 360px; z-index: 50; box-shadow: var(--shadow);
}
#toast.show { opacity: 1; }

/* Auth pages */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.auth-card {
  width: min(400px, 94vw); background: var(--card); padding: 1.75rem;
  border-radius: var(--radius); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.75rem; box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 0.25rem; font-size: 1.35rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; }
.stat { background: #0e141c; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem; }
.stat .label { font-size: 0.72rem; color: var(--muted); }
.stat .value { font-size: 1.1rem; font-weight: 700; margin-top: 0.2rem; }

.round-panel { margin: 1rem 0; }
.page-head > div { min-width: 0; max-width: 100%; }
.capital-note-details {
  margin: 0.35rem 0 0;
  max-width: 100%;
}
.capital-note-details[hidden] { display: none; }
.capital-note-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  max-width: 100%;
  padding: 0.2rem 0.56rem;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.36);
  background: rgba(245, 158, 11, 0.09);
  color: var(--warn);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.3;
}
.capital-note-summary::-webkit-details-marker { display: none; }
.capital-note-summary-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.capital-note-chevron {
  flex-shrink: 0;
  font-size: 0.78rem;
  line-height: 1;
  transition: transform 0.16s ease;
}
.capital-note-details[open] .capital-note-chevron { transform: rotate(180deg); }
.capital-note-body {
  margin-top: 0.38rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.26);
  background: rgba(11, 17, 25, 0.78);
  color: var(--warn);
  font-size: 0.75rem;
  line-height: 1.45;
  max-height: 180px;
  overflow-y: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.capital-note-group + .capital-note-group {
  margin-top: 0.42rem;
  padding-top: 0.42rem;
  border-top: 1px dashed rgba(245, 158, 11, 0.22);
}
.capital-note-group-title {
  font-weight: 700;
  color: #fde68a;
  margin-bottom: 0.16rem;
}
.capital-note-group-list {
  color: #cbd5e1;
  font-size: 0.72rem;
  line-height: 1.45;
}
.section-gap { margin-top: 1.25rem; }
.section-gap h2, .section-gap h3 {
  margin: 0 0 0.75rem; font-size: 1rem; font-weight: 600;
}

/* —— Mobile position cards —— */
.pos-cards { display: none; flex-direction: column; gap: 0.85rem; }
.pos-sym-block {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: #0e141c;
}
.pos-sym-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 0.5rem; padding: 0.75rem 0.9rem;
  background: #1a2330; border-bottom: 3px solid #6b7280;
  font-weight: 600;
}
.pos-side-card {
  padding: 0.85rem 0.9rem; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem 0.75rem;
}
.pos-side-card .full { grid-column: 1 / -1; }
.pos-kv { font-size: 0.8rem; }
.pos-kv .k { color: var(--muted); display: block; font-size: 0.7rem; margin-bottom: 0.1rem; }
.pos-kv .v { font-weight: 600; font-variant-numeric: tabular-nums; }

.nav-toggle { display: none; }
.desktop-only { display: flex; gap: 0.4rem; }

@media (max-width: 768px) {
  .topbar {
    padding: 0.48rem 0.7rem; gap: 0.45rem; width: 100%; max-width: 100vw;
    justify-content: space-between;
  }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto; min-width: 38px; min-height: 36px;
    padding: 0.28rem 0.62rem; font-size: 1.05rem; line-height: 1;
    border-color: var(--border);
  }
  .nav-toggle[aria-expanded="true"] {
    background: var(--primary-dim); border-color: rgba(79, 140, 255, 0.55); color: #e2eeff;
  }
  .nav-main {
    display: none;
    flex: 0 0 100%;
    width: 100%;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.22rem;
    margin-top: 0.35rem;
    padding: 0.45rem;
    background: #0c1219;
    border: 1px solid #263547;
    border-radius: 12px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
  }
  .nav-main.open { display: flex; }
  .nav-main a,
  .nav-main .tab,
  .nav-main .nav-logout-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 40px;
    text-align: left;
    padding: 0.55rem 0.85rem;
    border-radius: 9px;
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid transparent;
    background: transparent;
  }
  .nav-main a.active,
  .nav-main .tab.active {
    background: rgba(79, 140, 255, 0.14);
    border-color: rgba(79, 140, 255, 0.35);
    color: #eef5ff;
  }
  .nav-main .nav-logout-form {
    display: block;
    width: 100%;
    margin: 0.2rem 0 0;
    padding-top: 0.28rem;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
  }
  .nav-main .nav-logout-btn { color: #fca5a5; }
  .desktop-only { display: none !important; }
  .section-gap { margin-top: 0.65rem; }
  .card + .card { margin-top: 0.65rem; }
  .card-title { margin: 0 0 0.42rem; font-size: 0.74rem; }
  .pos-table-wrap { display: none; }
  .pos-cards { display: flex; }
  table { font-size: 0.74rem; }
  th { font-size: 0.64rem; padding: 0.34rem 0.38rem; white-space: nowrap; }
  td { padding: 0.36rem 0.38rem; line-height: 1.28; }
  .btn { min-height: 36px; padding: 0.42rem 0.75rem; font-size: 0.82rem; }
  .btn.sm { min-height: 32px; padding: 0.3rem 0.58rem; font-size: 0.76rem; }
  .btn.tiny { min-height: 28px; padding: 0.22rem 0.48rem; font-size: 0.72rem; }
  input, textarea, select { min-height: 44px; font-size: 16px; } /* prevent iOS zoom */
  .page-head { gap: 0.45rem; margin-bottom: 0.55rem; }
  .page-head h1, .page-head h2 { font-size: 1.04rem; }
  .page-head .meta, .page-head p.muted { font-size: 0.74rem; margin-top: 0.14rem; }
  .capital-note-summary { font-size: 0.7rem; padding: 0.16rem 0.48rem; }
  .capital-note-body { font-size: 0.7rem; padding: 0.42rem 0.55rem; max-height: 150px; }
}

@media (max-width: 420px) {
  .pos-side-card { grid-template-columns: 1fr; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  main { padding: 1rem; max-width: 960px; }
}

/* Prevent page-level horizontal scroll without converting body into an inner scroll container */
html, body {
  overflow-x: clip;
  max-width: 100%;
  width: 100%;
  overscroll-behavior-y: contain;
}
.table-wrap { max-width: 100%; }


/* —— Overflow / responsive hardening (v1.6.18) —— */
*, *::before, *::after { box-sizing: border-box; }
section.view { overflow-x: clip; }
main, .card, .summary-card, .summary-grid, .settings-card, .pos-section,
.page-head, .field, .field-row, .pos-hero-pnl, .pos-sym-block {
  max-width: 100%; min-width: 0;
}
.summary-card .value, .summary-card .hint, .pos-hero-pnl, .meta, .help {
  overflow-wrap: anywhere; word-break: break-word;
}
.summary-card .value { font-size: clamp(0.98rem, 2.2vw, 1.16rem); }
.summary-card.hero .value { font-size: clamp(1.05rem, 2.4vw, 1.22rem); }
.field-row { width: 100%; }
.field-row .btn { flex: 0 0 auto; }
.settings-body, .settings-panel { width: 100%; min-width: 0; }

/* Desktop: table only. Phone: cards only. */
.pos-cards { display: none !important; }
.pos-table-wrap { display: block; width: 100%; overflow-x: auto; }
@media (max-width: 768px) {
  .pos-table-wrap { display: none !important; }
  .pos-cards { display: flex !important; flex-direction: column; gap: 0.5rem; width: 100%; }
  .summary-grid,
  .overview-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.45rem !important;
    margin-bottom: 0.65rem;
  }
  .summary-card,
  .summary-card.hero,
  .summary-card.span-2 {
    grid-column: span 1 !important;
    padding: 0.5rem 0.6rem;
    min-height: 0;
    border-radius: 10px;
    justify-content: flex-start;
  }
  .summary-card .label {
    font-size: 0.68rem;
    gap: 0.28rem;
    margin-bottom: 0.14rem;
    line-height: 1.24;
    flex-wrap: wrap;
  }
  .summary-card .value,
  .summary-card.hero .value {
    font-size: clamp(0.84rem, 3.6vw, 1.02rem);
    line-height: 1.22;
  }
  .summary-card .value .tiny { font-size: 0.72rem; }
  .summary-value-stack { gap: 0.12rem; }
  .summary-side-split { font-size: clamp(0.68rem, 2.9vw, 0.78rem); gap: 0.14rem; }
  .summary-card .hint {
    font-size: 0.63rem;
    margin-top: 0.2rem;
    padding-top: 0.16rem;
    line-height: 1.26;
    align-items: flex-start;
    gap: 0.2rem;
  }
  main { width: 100%; max-width: 100vw; padding: 0.55rem; }
  .card, .panel { padding: 0.65rem 0.7rem; border-radius: 12px; }
  .card.pos-section { padding: 0.6rem 0.55rem; }
  .pos-hero-pnl { font-size: 0.84rem; padding: 0.42rem 0.6rem; margin-bottom: 0.5rem; }
  .detail-account-tabs { padding: 0.34rem 0.45rem; gap: 0.32rem; margin-bottom: 0.5rem; }
  .detail-acct-tab { padding: 0.3rem 0.52rem; font-size: 0.78rem; gap: 0.3rem; }
  .settings-card summary { font-size: 0.88rem; }
  .settings-body { margin-top: 0.42rem; padding-top: 0.55rem; }
  .settings-panel { padding: 0.65rem 0.72rem; min-height: 0; }
  .round-progress-card { padding: 0.55rem 0.68rem; }
  .round-summary-head { gap: 0.32rem 0.38rem; margin-bottom: 0.35rem; }
  .round-progress-card .card-title { font-size: 0.82rem; margin-bottom: 0; }
  .round-start-summary,
  .round-target-summary { font-size: 0.72rem; padding: 0.12rem 0.42rem; }
  .round-progress-body { margin-top: 0.45rem; padding-top: 0.45rem; }
  .round-progress-head { gap: 0.4rem; margin-top: 0.38rem; }
  .round-meta-row { margin-top: 0; gap: 0.26rem; }
  #round-meta { display: flex; flex-wrap: wrap; gap: 0.22rem; }
  .dot-meta-chip { margin: 0; font-size: 0.67rem; padding: 0.12rem 0.4rem; gap: 0.22rem; }
  .round-progress-card .progress-bar { height: 9px; }
  .round-progress-label { font-size: 0.72rem; margin-top: 0; line-height: 1.32; }
  #detail-tp th, #detail-tp td,
  #detail-sym th, #detail-sym td,
  #rounds-table th, #rounds-table td { white-space: nowrap; }
  .log { padding: 0.52rem 0.6rem; max-height: 185px; font-size: 0.68rem; line-height: 1.35; }
  input, textarea, select { width: 100%; max-width: 100%; }
}
@media (max-width: 600px) {
  .round-summary-head { flex-wrap: wrap; }
  .round-summary-head .card-title { order: 1; margin-right: auto; }
  .round-summary-head .round-chevron { order: 2; }
  .round-summary-pills {
    order: 3;
    flex: 1 0 100%;
    display: flex;
    justify-content: space-between;
    gap: 0.32rem;
  }
}
@media (max-width: 420px) {
  .summary-grid,
  .overview-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.38rem !important;
  }
  .summary-card,
  .summary-card.hero,
  .summary-card.span-2 {
    padding: 0.44rem 0.5rem;
  }
}

/* Compact desktop position table & dual Long/Short layout */
#detail-pos.pos-dual-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
#detail-pos.pos-dual-table thead th {
  width: 50%;
  padding: 0.6rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #101722;
  border-bottom: 1px solid var(--border);
}
#detail-pos.pos-dual-table thead th.pos-th-long {
  color: var(--ok);
  border-top-left-radius: 8px;
  border-right: 1px solid rgba(36, 48, 65, 0.55);
}
#detail-pos.pos-dual-table thead th.pos-th-short {
  color: var(--danger);
  border-top-right-radius: 8px;
}
#detail-pos.pos-dual-table .pos-group-header td {
  background: linear-gradient(180deg, #1b2533 0%, #151e2a 100%);
  border: 1px solid #2b3b4e;
  border-bottom: 1px solid #253344;
  border-radius: 10px 10px 0 0;
  padding: 0.6rem 0.9rem;
}
.pos-group-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.pos-group-left {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.pos-sym-title {
  font-size: 0.98rem;
  color: #f1f5f9;
  letter-spacing: 0.01em;
}
.pos-live-px {
  font-size: 0.8rem;
  color: #94a3b8;
  background: rgba(15, 23, 34, 0.65);
  padding: 0.14rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(51, 65, 85, 0.55);
}
.pos-val-chip {
  font-size: 0.76rem;
  color: #cbd5e1;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(71, 85, 105, 0.5);
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
}
.pos-val-chip b { color: #f8fafc; font-weight: 700; }
.pos-group-right {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.92rem;
  font-weight: 700;
}
#detail-pos.pos-dual-table tr.pos-dual-row td.pos-dual-td {
  width: 50%;
  padding: 0.65rem;
  background: #0d131b;
  border-bottom: 1px solid #263547;
  vertical-align: stretch;
}
#detail-pos.pos-dual-table tr.pos-dual-row td.pos-dual-td-left {
  border-left: 1px solid #263547;
  border-right: 1px solid rgba(38, 53, 71, 0.65);
  border-bottom-left-radius: 10px;
}
#detail-pos.pos-dual-table tr.pos-dual-row td.pos-dual-td-right {
  border-right: 1px solid #263547;
  border-bottom-right-radius: 10px;
}
.pos-side-box {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  background: #121a24;
  border: 1px solid #223042;
}
.pos-side-box.is-long {
  border-left: 3px solid rgba(52, 211, 153, 0.65);
}
.pos-side-box.is-short {
  border-left: 3px solid rgba(248, 113, 113, 0.65);
}
.pos-side-box.is-lead {
  background: #15202d;
  border-color: #2f435a;
}
.pos-side-box.is-long.is-lead {
  border-left-color: var(--ok);
}
.pos-side-box.is-short.is-lead {
  border-left-color: var(--danger);
}
.pos-side-box.is-empty {
  background: rgba(14, 20, 28, 0.45);
  border: 1px dashed rgba(45, 60, 78, 0.65);
  opacity: 0.62;
  justify-content: center;
  min-height: 4.5rem;
}
.pos-box-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pos-box-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
}
.side-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.52rem;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.side-pill-long {
  color: #34d399;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.32);
}
.side-pill-short {
  color: #f87171;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.32);
}
.pos-box-pnl-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  background: rgba(9, 14, 20, 0.48);
  border: 1px solid rgba(38, 52, 70, 0.52);
}
.pos-pnl-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.pos-box-pnl {
  font-size: 0.94rem;
  font-weight: 700;
  white-space: nowrap;
}
.pos-box-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}
.pos-metric {
  background: rgba(9, 14, 20, 0.65);
  border: 1px solid rgba(38, 52, 70, 0.7);
  border-radius: 7px;
  padding: 0.42rem 0.55rem;
  min-width: 0;
}
.pos-metric .k {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.69rem;
  color: var(--muted);
  margin-bottom: 0.18rem;
  white-space: nowrap;
}
.pos-metric .k::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}
.pos-metric .v {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: #e2e8f0;
  overflow-wrap: anywhere;
}
.pos-dual-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  padding: 0.65rem;
}
@media (max-width: 560px) {
  .pos-dual-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.3rem;
    padding: 0.32rem;
  }
  .pos-sym-head {
    padding: 0.4rem 0.52rem;
    font-size: 0.84rem;
    border-bottom-width: 2px;
    flex-wrap: wrap;
    gap: 0.28rem;
  }
  .pos-live-px,
  .pos-val-chip {
    font-size: 0.67rem;
    padding: 0.08rem 0.34rem;
  }
  .pos-side-box {
    min-width: 0;
    padding: 0.38rem 0.42rem;
    gap: 0.26rem;
  }
  .pos-side-box.is-empty {
    min-height: 2.6rem;
  }
  .pos-box-top {
    gap: 0.25rem;
  }
  .pos-box-badges {
    gap: 0.25rem;
  }
  .pos-side-box .side-pill {
    padding: 0.12rem 0.32rem;
    font-size: 0.66rem;
    white-space: nowrap;
  }
  .pos-side-box .stage-dot-wrap {
    gap: 0.18rem;
  }
  .pos-side-box .stage-dots {
    padding: 2px 4px;
    gap: 2px;
  }
  .pos-side-box .stage-dots .sdot {
    width: 5px;
    height: 5px;
  }
  .pos-side-box .badge.stage.stage-dot {
    min-width: 17px;
    height: 17px;
    font-size: 0.66rem;
    padding: 0 4px;
  }
  .pos-box-pnl-row {
    flex-wrap: wrap;
    gap: 0.1rem 0.28rem;
    padding: 0.22rem 0.34rem;
  }
  .pos-pnl-label {
    font-size: 0.63rem;
  }
  .pos-box-pnl {
    font-size: 0.78rem;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .pos-box-metrics {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.22rem;
  }
  .pos-box-metrics > div {
    min-width: 0;
    padding: 0.22rem 0.32rem;
  }
  .pos-box-metrics .k {
    font-size: 0.6rem;
    margin-bottom: 0.06rem;
  }
  .pos-box-metrics .v {
    font-size: 0.72rem;
    line-height: 1.18;
    overflow-wrap: anywhere;
  }
}

.tp-price { font-variant-numeric: tabular-nums; }
.tp-price.tp-bad { color: #f87171; font-weight: 600; }

/* Account switcher bar inside 계정상세 (#view-detail) */
.detail-account-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
  padding: 0.5rem 0.65rem;
  background: rgba(17, 24, 39, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.detail-acct-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.42rem 0.78rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f1623;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
.detail-acct-tab:hover {
  color: var(--text);
  border-color: #334155;
}
.detail-acct-tab.active {
  background: rgba(59, 130, 246, 0.16);
  color: #e2e8f0;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.28);
}
.detail-acct-name {
  font-weight: 600;
}

/* —— Mobile Read-Only Mode & Overview Cards & QR Modal (v1.6.67) —— */
.badge.readonly-badge {
  margin-left: 0.4rem;
  color: #fde68a;
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.36);
}
.badge.readonly-badge[hidden] {
  display: none !important;
}

.btn-open-detail {
  display: none;
}
body.is-readonly .btn-open-detail {
  display: inline-flex;
}

body.is-readonly [data-view="accounts"],
body.is-readonly #view-accounts,
body.is-readonly a[href="/settings"],
body.is-readonly #btn-mobile-connect,
body.is-readonly #btn-start-all,
body.is-readonly #btn-stop-all,
body.is-readonly #btn-start-all-m,
body.is-readonly #btn-stop-all-m,
body.is-readonly #detail-start,
body.is-readonly #detail-stop,
body.is-readonly #btn-rename-detail,
body.is-readonly .btn-rename,
body.is-readonly #btn-round-reset,
body.is-readonly #view-detail .settings-card,
body.is-readonly [data-start],
body.is-readonly [data-stop],
body.is-readonly [data-test],
body.is-readonly #btn-mark-all,
body.is-readonly #btn-mark-all-global,
body.is-readonly #btn-mark-account-inline,
body.is-readonly .reorder-hint,
body.is-readonly .acct-drag-handle {
  display: none !important;
}

.overview-cards {
  display: none !important;
}
.overview-table-wrap {
  display: block;
}
@media (max-width: 768px) {
  .overview-table-wrap {
    display: none !important;
  }
  .overview-cards {
    display: flex !important;
    flex-direction: column;
    gap: 0.48rem;
    margin-top: 0.32rem;
  }
  .overview-acct-card {
    padding: 0.58rem 0.65rem;
    gap: 0.38rem;
    border-radius: 10px;
  }
  .overview-card-title {
    font-size: 0.88rem;
    gap: 0.32rem;
  }
  .overview-card-arrow {
    font-size: 0.72rem;
  }
  .overview-card-metrics {
    gap: 0.32rem;
  }
  .overview-acct-card .pos-metric {
    padding: 0.28rem 0.42rem;
  }
  .overview-acct-card .pos-metric .k {
    font-size: 0.62rem;
    margin-bottom: 0.08rem;
  }
  .overview-acct-card .pos-metric .v {
    font-size: 0.76rem;
  }
}

.overview-acct-card {
  background: #0f1621;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.overview-acct-card:hover,
.overview-acct-card:active {
  background: var(--card-hover);
  border-color: var(--border-strong);
}
.overview-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.overview-card-title {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  flex-wrap: wrap;
  font-size: 0.98rem;
}
.overview-card-arrow {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}
.overview-card-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}
.overview-card-metrics .overview-metric-wide {
  grid-column: 1 / -1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(5, 9, 14, 0.76);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-backdrop[hidden] {
  display: none !important;
}
.modal-card {
  width: min(740px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}
.mobile-access-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}
@media (max-width: 680px) {
  .mobile-access-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.mobile-access-box {
  background: #0e141c;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.mobile-qr-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 0.3rem;
}
.mobile-qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem;
  background: rgba(18, 26, 36, 0.75);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 10px;
}
.mobile-qr-img {
  width: 168px;
  height: 168px;
  border-radius: 10px;
  background: #ffffff;
  padding: 6px;
}
.mobile-url-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}
.mobile-url-code {
  font-size: 0.84rem;
  color: #dbeafe;
  background: #090e14;
  border: 1px solid var(--border);
  padding: 0.3rem 0.55rem;
  border-radius: 7px;
  word-break: break-all;
}
.mobile-step-list {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  line-height: 1.45;
}

/* —— Long-press Smooth Account Drag Reorder —— */
#account-list,
#overview-cards,
#overview-table {
  position: relative;
}
.reorder-hint {
  margin: 0.25rem 0 0.6rem;
  font-size: 0.76rem;
  opacity: 0.82;
}
.acct-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.45rem;
  padding: 0 0.18rem;
  border-radius: 6px;
  color: var(--muted);
  opacity: 0.62;
  font-size: 0.92rem;
  line-height: 1;
  letter-spacing: -0.14em;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  flex-shrink: 0;
  transition: color 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
}
.acct-card:hover .acct-drag-handle,
.overview-acct-card:hover .acct-drag-handle,
#overview-table tbody tr:hover .acct-drag-handle,
.acct-drag-handle:hover {
  opacity: 1;
  color: var(--text);
  background: rgba(148, 163, 184, 0.14);
}
#overview-table tbody tr {
  transition: background-color 0.15s ease;
}
#overview-table tbody tr.is-drag-arming td,
.acct-card.is-drag-arming,
.overview-acct-card.is-drag-arming {
  background: rgba(79, 140, 255, 0.10) !important;
  border-color: rgba(79, 140, 255, 0.55) !important;
  transform: scale(0.992);
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}
.acct-card.is-drag-placeholder,
.overview-acct-card.is-drag-placeholder {
  background: rgba(79, 140, 255, 0.08) !important;
  border: 1.5px dashed rgba(79, 140, 255, 0.58) !important;
  box-shadow: none !important;
}
.acct-card.is-drag-placeholder > *,
.overview-acct-card.is-drag-placeholder > * {
  opacity: 0 !important;
  pointer-events: none;
}
tr.is-drag-placeholder td {
  background: rgba(79, 140, 255, 0.08) !important;
  border-top: 1px dashed rgba(79, 140, 255, 0.55) !important;
  border-bottom: 1px dashed rgba(79, 140, 255, 0.55) !important;
}
tr.is-drag-placeholder td > * {
  opacity: 0 !important;
  pointer-events: none;
}
.acct-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  margin: 0 !important;
  will-change: transform;
}
.acct-drag-ghost-inner {
  width: 100%;
  height: 100%;
  border-radius: 11px;
  border: 1.5px solid rgba(79, 140, 255, 0.85) !important;
  background: #182332 !important;
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(56, 189, 248, 0.25);
  transform: scale(1.018);
  animation: acctGhostPop 150ms cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}
.acct-drag-ghost.is-dropping .acct-drag-ghost-inner {
  transform: scale(1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms ease;
}
.acct-drag-ghost-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.9rem;
}
.acct-drag-ghost-table td {
  border-bottom: none;
  background: transparent;
}
@keyframes acctGhostPop {
  from { transform: scale(0.992); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32); }
  to { transform: scale(1.018); box-shadow: 0 22px 46px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(56, 189, 248, 0.25); }
}
body.is-reordering-accounts,
body.is-reordering-accounts * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* —— Mobile Pull-to-Refresh indicator —— */
.ptr-indicator {
  position: fixed;
  top: 56px;
  left: 50%;
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  background: rgba(22, 29, 39, 0.96);
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(-50%, -56px, 0);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.ptr-indicator.is-visible {
  visibility: visible;
}
.ptr-indicator.is-ready {
  border-color: var(--primary);
  color: #dbeafe;
  box-shadow: 0 10px 28px rgba(79, 140, 255, 0.25), 0 6px 18px rgba(0, 0, 0, 0.45);
}
.ptr-indicator.is-refreshing {
  border-color: var(--ok);
  color: #d1fae5;
}
.ptr-spinner {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.ptr-arrow {
  display: block;
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
  color: var(--primary);
}
.ptr-indicator.is-ready .ptr-arrow {
  color: var(--ok);
}
.ptr-ring {
  display: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(52, 211, 153, 0.28);
  border-top-color: var(--ok);
  animation: ptrSpin 0.75s linear infinite;
}
.ptr-indicator.is-refreshing .ptr-arrow {
  display: none;
}
.ptr-indicator.is-refreshing .ptr-ring {
  display: block;
}
@keyframes ptrSpin {
  to { transform: rotate(360deg); }
}

/* Rounds date-range toolbar & cumulative summary cards */
.round-range-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-top: 0.7rem;
  padding: 0.55rem 0.7rem;
  background: rgba(15, 21, 30, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.round-range-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.32rem;
}
.round-preset-btn.is-active {
  background: rgba(79, 140, 255, 0.2);
  border-color: var(--primary);
  color: #dbeafe;
  font-weight: 700;
}
.round-range-inputs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.round-range-inputs input[type="date"] {
  width: auto;
  min-width: 0;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  background: var(--bg-soft, #0f151e);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.round-range-sep {
  color: var(--text-dim);
  font-size: 0.82rem;
}
.round-period-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}
@media (max-width: 900px) {
  .round-period-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 768px) {
  .round-range-bar {
    padding: 0.48rem 0.52rem;
    gap: 0.42rem;
  }
  .round-range-inputs {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.3rem;
  }
  .round-range-inputs input[type="date"] {
    width: 100%;
    padding: 0.32rem 0.35rem;
    font-size: 0.75rem;
  }
  .round-period-grid {
    margin-top: 0.55rem;
    margin-bottom: 0.55rem;
  }
}

/* —— Beginner Low-Seed Mode —— */
.badge.beginner-badge {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.38);
  font-weight: 600;
}
.beginner-mode-box {
  background: rgba(14, 24, 38, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
}
.beginner-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
}
.beginner-check-label input[type="checkbox"] {
  width: 1.08rem;
  height: 1.08rem;
  accent-color: #38bdf8;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}
.beginner-form-toggle {
  margin: 0.35rem 0 0.55rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(14, 24, 38, 0.55);
  border: 1px solid var(--border);
  display: flex;
}
.beginner-check-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.virtual-stacks-box {
  margin: 0.55rem 0 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: rgba(15, 25, 40, 0.75);
  border: 1px dashed rgba(56, 189, 248, 0.35);
}
.virtual-stacks-head {
  font-size: 0.78rem;
  font-weight: 600;
  color: #7dd3fc;
  margin-bottom: 0.45rem;
}
.virtual-stacks-list {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}
.virtual-stack-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  padding: 0.36rem 0.55rem;
  border-radius: 8px;
  background: rgba(9, 15, 24, 0.7);
  border: 1px solid rgba(51, 65, 85, 0.55);
}

.strategy-meta-line,
.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}
.candle-timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.2rem 0.58rem;
  border-radius: 999px;
  font-size: 0.78rem;
  line-height: 1.25;
  color: #dbeafe;
  background: rgba(15, 29, 48, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.32);
  font-variant-numeric: tabular-nums;
}
.candle-timer-chip b {
  color: #38bdf8;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.candle-timer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.75);
  flex-shrink: 0;
}
.candle-window {
  font-size: 0.72rem;
  color: var(--muted);
}
.candle-timer-chip.is-closing {
  color: #fef3c7;
  background: rgba(69, 39, 10, 0.65);
  border-color: rgba(251, 191, 36, 0.55);
}
.candle-timer-chip.is-closing b {
  color: #fbbf24;
}
.candle-timer-chip.is-closing .candle-timer-dot {
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.9);
}

.badge.emergency-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.45);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.badge.emergency-badge b {
  color: #fecaca;
  font-weight: 700;
}
.badge.emergency-badge.is-closing {
  background: rgba(180, 83, 9, 0.32);
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.6);
}
.badge.emergency-badge.is-closing b {
  color: #fbbf24;
}

/* —— Member Lookup & Quick Jump Bar (/engine) + Unified Quantitative Operations Theme —— */
.ops-engine-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}
.ops-engine-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--primary) 0%, #0284c7 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(20, 184, 166, 0.25);
}
.ops-engine-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.18;
}
.ops-engine-kicker {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary-bright);
  text-transform: uppercase;
}
.ops-engine-main {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.brand .ver {
  color: var(--primary-bright);
  background: var(--primary-dim);
  border: 1px solid var(--primary-border);
  font-family: var(--mono);
  font-size: 0.7rem;
  margin-left: 0.2rem;
}

main {
  max-width: 1440px;
  padding: 1.15rem 1.5rem 3.5rem;
}

.nav-main a,
.nav-main .tab {
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.38rem 0.72rem;
  border-radius: 6px;
}
.nav-main a.active,
.nav-main .tab.active {
  background: var(--primary-dim);
  border-color: var(--primary-border);
  color: var(--primary-bright);
}
.nav-main a.nav-admin-link {
  color: var(--pro-accent);
  background: var(--pro-dim);
  border-color: rgba(56, 189, 248, 0.32);
  font-weight: 700;
}
.nav-main a.nav-admin-link:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--pro-accent);
  color: var(--pro-accent);
}

/* Panels, Cards & Telemetry Top Accents */
.panel,
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.summary-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-strong);
}
.summary-card.hero::before {
  background: linear-gradient(90deg, var(--primary), var(--pro-accent));
}
.summary-card .label {
  color: var(--text-dim);
  font-size: 0.76rem;
}
.s-dot.dot-primary {
  background: var(--primary);
  box-shadow: 0 0 7px rgba(20, 184, 166, 0.55);
}
.card-title::before {
  background: var(--primary);
  box-shadow: 0 0 7px rgba(20, 184, 166, 0.55);
}

/* Unified Surfaces replacing old blue gradients */
.settings-card,
.round-progress-card {
  background: var(--card);
  border-color: var(--border);
}
.settings-tabs,
.detail-account-tabs,
.round-range-bar,
.funding-status-box,
.beginner-mode-box,
.virtual-stacks-box {
  background: var(--bg-elev);
  border-color: var(--border);
}
.settings-panel {
  background: var(--input-bg);
  border-color: var(--border);
}
.settings-tab {
  color: var(--text-dim);
}
.settings-tab:hover {
  background: var(--card-hover);
  color: var(--text);
}
.settings-tab.active {
  background: var(--primary-dim);
  border-color: var(--primary-border);
  color: var(--primary-bright);
  box-shadow: none;
}
.cap-mode-card,
.cap-mode-btn,
.acct-card,
.overview-acct-card,
.stat,
.mobile-access-box,
.pos-hero-pnl {
  background: var(--bg-elev);
  border-color: var(--border);
}
.cap-mode-head strong {
  color: var(--text);
}
.cap-mode-btn:hover,
.overview-acct-card:hover {
  background: var(--card-hover);
  border-color: var(--border-strong);
}
.cap-mode-btn.active,
.detail-acct-tab.active,
.round-preset-btn.is-active {
  background: var(--primary-dim);
  border-color: var(--primary-border);
  color: var(--primary-bright);
  box-shadow: none;
}
.detail-acct-tab {
  background: var(--card);
  border-color: var(--border);
  color: var(--text-dim);
}
.detail-acct-tab:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* Inputs & Buttons */
input, textarea, select,
.round-range-inputs input[type="date"] {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-dim);
}
.btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  font-weight: 600;
}
.btn:hover {
  background: var(--card-hover);
  border-color: var(--border-strong);
}
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
.btn.primary:hover {
  background: #0d9488;
  border-color: #0d9488;
  filter: none;
}
.btn.ghost {
  background: transparent;
}
.badge {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text-dim);
  border-radius: 5px;
}
.badge.live, .badge.mainnet {
  color: var(--pro-accent);
  background: var(--pro-dim);
  border-color: rgba(56, 189, 248, 0.3);
}
.badge.live::before, .badge.mainnet::before {
  background: var(--pro-accent);
  box-shadow: none;
}

/* Tables & Dual Position Matrix */
thead th {
  background: var(--bg-elev);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  padding: 0.68rem 0.8rem;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 0.72rem 0.8rem;
  border-bottom: 1px solid var(--border);
}
#overview-table tbody tr:hover {
  background: var(--card-hover);
}
.link-detail {
  color: var(--text);
  font-weight: 700;
}
.link-detail:hover {
  color: var(--primary-bright);
}
#detail-pos.pos-dual-table thead th {
  background: var(--bg-elev);
}
#detail-pos.pos-dual-table .pos-group-header td,
.pos-group-header td,
.pos-sym-head {
  background: var(--bg-elev);
  border-color: var(--border);
}
.pos-sym-title,
.pos-val-chip b,
.dot-meta-chip b,
.round-progress-card .card-title,
.settings-panel .field label,
.funding-metric strong {
  color: var(--text);
}
.pos-live-px,
.pos-val-chip,
.dot-meta-chip,
.round-start-summary,
.round-target-summary {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text-dim);
}
#detail-pos.pos-dual-table tr.pos-dual-row td.pos-dual-td,
.pos-sym-block {
  background: var(--card);
  border-color: var(--border);
}
.pos-side-box {
  background: var(--bg-elev);
  border-color: var(--border);
}
.pos-side-box.is-lead {
  background: var(--card-hover);
  border-color: var(--border-strong);
}
.pos-side-box.is-empty {
  background: var(--input-bg);
  border-color: var(--border);
}
.pos-box-pnl-row,
.pos-metric,
.virtual-stack-chip {
  background: var(--input-bg);
  border-color: var(--border);
}
.progress-bar,
.round-progress-card .progress-bar {
  background: var(--input-bg);
  border-color: var(--border);
  box-shadow: none;
}
.progress-bar::after {
  display: none;
}
.progress-fill,
.round-progress-card .progress-fill {
  background: linear-gradient(90deg, var(--primary), var(--pro-accent));
}
.candle-timer-chip {
  background: var(--primary-dim);
  border-color: var(--primary-border);
  color: var(--text);
}
.candle-timer-chip b {
  color: var(--primary-bright);
}
.candle-timer-dot {
  background: var(--primary);
  box-shadow: none;
}
.log {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text-dim);
}

/* Member Quick Lookup Bar (Matched to Quantitative Ops Strip) */
.member-lookup-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.member-lookup-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.member-lookup-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.member-lookup-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 320px;
  min-width: 0;
  flex-wrap: wrap;
}
.member-lookup-input {
  flex: 1 1 200px;
  min-width: 0;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 0.44rem 0.7rem;
  font-size: 0.85rem;
  font-family: inherit;
}
.member-lookup-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-dim);
}
.member-lookup-results {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin-top: 0.55rem;
  padding-top: 0.52rem;
  border-top: 1px solid var(--border);
}
.member-lookup-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.34rem 0.65rem;
  border-radius: 6px;
  background: var(--primary-dim);
  border: 1px solid var(--primary-border);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  max-width: 100%;
}
.member-lookup-item:hover {
  background: rgba(20, 184, 166, 0.22);
  border-color: var(--primary);
}
.member-lookup-item.is-unlinked {
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--border);
  color: var(--text-dim);
}
.badge.member-meta-badge {
  background: var(--primary-dim);
  color: var(--primary-bright);
  border: 1px solid var(--primary-border);
  font-family: var(--mono);
  font-weight: 700;
}
.badge.member-uid-badge {
  background: var(--pro-dim);
  color: var(--pro-accent);
  border: 1px solid rgba(56, 189, 248, 0.32);
  font-family: var(--mono);
  font-weight: 600;
}
@media (max-width: 768px) {
  .nav-main {
    background: var(--card);
    border-color: var(--border);
  }
  .nav-main a.active,
  .nav-main .tab.active {
    background: var(--primary-dim);
    border-color: var(--primary-border);
    color: var(--primary-bright);
  }
}
@media (max-width: 640px) {
  .member-lookup-bar { padding: 0.6rem 0.7rem; }
  .member-lookup-controls { flex: 1 1 100%; }
  .member-lookup-input { flex: 1 1 100%; font-size: 0.82rem; }
}
