:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --ok: #22c55e;
  --warn: #f59e0b;
  --page-gutter: 0.75rem;
  --panel-radius: 8px;
  --opp-row-h: 2rem;
  --exec-list-max-h: 11rem;
}

html {
  height: 100%;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  font-size: 0.875rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  padding: 0.55rem var(--page-gutter);
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.header h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}

.app-title-meta {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.82rem;
}

.header-title-wrap {
  min-width: 0;
  flex: 1 1 auto;
}

.panel-head.hidden,
.account-panel-head.hidden {
  display: none;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1rem 1.5rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.card h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.card .status { font-weight: 600; }
.card .status.ok { color: var(--ok); }
.card .status.bad { color: var(--danger); }
.card p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.85rem; }

.panel {
  margin: 0 var(--page-gutter) 0.55rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--panel-radius);
  padding: 0.55rem 0.75rem;
}

#account-panel {
  flex-shrink: 0;
}

#opp-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

#opp-panel .opp-panel-head,
#opp-panel .opp-tabs,
#opp-panel .formula-note {
  flex-shrink: 0;
}

.panel.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 900px) {
  .panel.two-col { grid-template-columns: 1fr; }
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.panel h2 { margin: 0 0 0.45rem; font-size: 0.92rem; font-weight: 600; }
.panel-head h2 { margin: 0; }
.panel.two-col > div > h2 { margin: 0 0 0.45rem; font-size: 0.92rem; }

.panel-strategy-meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.3;
}

.panel-strategy-meta.hidden {
  display: none;
}

.opp-panel-head {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  margin-bottom: 0.35rem;
}

.scan-stats {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted, #8b949e);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opp-refresh-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem 0.45rem;
  margin-left: auto;
}

.scan-control-group {
  display: inline-flex;
  gap: 0.35rem;
}

.refresh-interval-label.disabled {
  opacity: 0.55;
}

.refresh-interval-label.disabled input {
  pointer-events: none;
}

.refresh-interval-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.refresh-interval-label input {
  width: 4.25rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0f1419;
  color: var(--text);
  font-size: 0.85rem;
}

.refresh-status {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.badge {
  background: var(--border);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
}

.opp-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}

.opp-tab {
  border: 1px solid var(--border);
  background: #1e2a3d;
  color: var(--muted);
  padding: 0.28rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
}

.opp-tab:hover { background: #243044; color: var(--text); }

.opp-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.opp-tab-count {
  display: inline-block;
  min-width: 1.25rem;
  margin-left: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow-x: auto;
}

/* 对冲场次表：占满剩余视口高度，表头固定、内容区滚动 */
#opp-panel > .table-wrap {
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  overflow-x: auto;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(45, 58, 79, 0.65);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.08);
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.65) rgba(255, 255, 255, 0.05);
}

/* 对冲场次表：WebKit 滚动条始终可见 */
#opp-panel > .table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
#opp-panel > .table-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}
#opp-panel > .table-wrap::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.65);
  border-radius: 10px;
  border: 2px solid rgba(15, 20, 25, 0.35);
}
#opp-panel > .table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(203, 213, 225, 0.9);
}

#opp-panel .table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #1e2a3d;
  box-shadow: 0 1px 0 var(--border);
  padding: 0.35rem 0.4rem;
  font-size: 0.72rem;
  white-space: nowrap;
}

#opp-panel .table-wrap tbody td {
  padding: 0.3rem 0.4rem;
  font-size: 0.78rem;
  line-height: 1.25;
  vertical-align: middle;
}

#opp-panel .table-wrap tbody tr {
  min-height: var(--opp-row-h);
}

#opp-panel .match-cell .match-name {
  font-size: 0.78rem;
  line-height: 1.25;
}

#opp-panel .col-theoretical-pnl {
  line-height: 1.2;
  font-size: 0.74rem;
}

#opp-panel .col-theoretical-pnl > div + div {
  margin-top: 0;
}

#opp-panel .opp-actions .btn.small {
  padding: 0.2rem 0.4rem;
  font-size: 0.72rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th, td {
  padding: 0.4rem 0.45rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 500; }
.empty { color: var(--muted); text-align: center; }

tr.opp-row-new td {
  animation: opp-row-new 1.2s ease;
}

tr.opp-row-updated td {
  animation: opp-row-updated 0.9s ease;
}

@keyframes opp-row-new {
  0% { background: rgba(56, 189, 248, 0.22); }
  100% { background: transparent; }
}

@keyframes opp-row-updated {
  0% { background: rgba(250, 204, 21, 0.18); }
  100% { background: transparent; }
}

/* 港盘赔率变化：升高红、降低绿（A 股习惯） */
.odds-val.odds-flash-up {
  color: #f87171;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.2);
  border-radius: 3px;
  padding: 0 0.15rem;
  animation: odds-flash-pulse 2.4s ease forwards;
}

.odds-val.odds-flash-down {
  color: #4ade80;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.2);
  border-radius: 3px;
  padding: 0 0.15rem;
  animation: odds-flash-pulse 2.4s ease forwards;
}

@keyframes odds-flash-pulse {
  0%, 18% {
    filter: brightness(1.15);
  }
  100% {
    font-weight: 600;
    background: transparent;
    filter: none;
  }
}

.col-odds-primary,
.col-odds-hedge {
  font-variant-numeric: tabular-nums;
}

.btn {
  border: 1px solid var(--border);
  background: #243044;
  color: var(--text);
  padding: 0.32rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
}

.btn:hover { background: #2d3d56; }
.btn.primary { background: var(--primary); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.accent { background: #0d9488; border-color: #0d9488; }
.btn.accent:hover { background: #0f766e; }
.btn.accent-warn { background: var(--warn); border-color: var(--warn); color: #111; }
.btn.accent-warn:hover { background: #d97706; }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-hover); }
.btn.small { padding: 0.22rem 0.45rem; font-size: 0.72rem; }
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn.primary:disabled,
.btn.primary[aria-disabled="true"] {
  background: var(--primary);
  border-color: var(--primary);
}
.btn.is-active:not(:disabled) {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.opp-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.form { display: flex; flex-direction: column; gap: 0.45rem; }
.form label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; color: var(--muted); }
.form input {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #111827;
  color: var(--text);
  font-size: 0.82rem;
}

.form-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.stake-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.stake-readonly {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  min-height: 2rem;
  cursor: default;
}

.stake-readonly.muted {
  color: var(--muted);
}

@media (max-width: 640px) {
  .stake-dual {
    grid-template-columns: 1fr;
  }
}

.result-box {
  margin: 0;
  min-height: 5.5rem;
  max-height: 11rem;
  overflow: auto;
  background: #111827;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.edge-good { color: var(--ok); font-weight: 600; }

.opp-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-weight: 600;
}
.opp-badge-dual { background: #2a3a5c; color: #9ec5ff; }
.opp-badge-multi { background: #3a2a5c; color: #d4b5ff; }
.opp-leg-sat { font-size: 0.72rem; color: #d4b5ff; font-weight: 600; }
.opp-badge-split { background: #3d3420; color: #f0c674; }
.opp-badge-depth-warn { background: #3d3420; color: #f0c674; margin-left: 0.35rem; font-size: 0.72rem; }
.opp-badge-depth-ok { background: #1e3d2a; color: #7dcea0; margin-left: 0.35rem; font-size: 0.72rem; }
.opp-badge-ordered { background: #1e3d2a; color: #7dcea0; margin-left: 0.35rem; font-size: 0.72rem; }
.opp-badge-running { background: #2a3a4a; color: #9ec5ff; margin-left: 0.35rem; font-size: 0.72rem; }
.opp-badge-failed { background: #3d2020; color: #f0a0a0; margin-left: 0.35rem; font-size: 0.72rem; }
.opp-badge-live { background: #4a2020; color: #ff9e7a; margin-left: 0.35rem; font-size: 0.72rem; }
.opp-satellite-hint { font-size: 0.72rem; color: var(--danger, #e06c75); margin-top: 0.2rem; line-height: 1.3; }
.opp-leg-sat-warn { color: var(--danger, #e06c75); font-weight: 700; }
.opp-usdc-sub { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.opp-usdc-subline { color: var(--muted); font-size: 0.72rem; margin-top: 0.1rem; font-variant-numeric: tabular-nums; }
.col-segment-pnl { font-size: 0.78rem; line-height: 1.25; max-width: 9rem; }
.col-segment-pnl div { white-space: nowrap; }
.col-hedge-mode { font-size: 0.8rem; color: var(--muted); }
.edge-low { color: var(--warn); }

.pnl-profit { color: var(--ok); font-weight: 600; font-variant-numeric: tabular-nums; }
.pnl-loss { color: var(--danger); font-weight: 600; font-variant-numeric: tabular-nums; }

.col-theoretical-pnl {
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.col-theoretical-pnl > div + div {
  margin-top: 2px;
}

.formula-config {
  margin: 0.5rem 0;
  padding: 0.5rem 0.65rem;
  border-left: 3px solid var(--primary);
  background: rgba(59, 130, 246, 0.06);
  border-radius: 4px;
}

.config-list {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  color: var(--text);
  font-size: 0.85rem;
}

.config-list li { margin: 0.2rem 0; }

.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: #1e293b;
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  max-width: 320px;
}

.hidden { display: none !important; }

.toast.hidden { display: none; }
.toast.error { border-color: var(--danger); }

.opp-alert-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
  animation: opp-alert-fade-in 0.25s ease;
}

.opp-alert-overlay.hidden { display: none !important; }

.config-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
}

.config-editor-overlay.hidden { display: none !important; }

.config-editor-card {
  width: min(920px, 100%);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem 1.1rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f172a;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.config-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.config-editor-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.config-editor-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.config-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.config-file-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.config-file-select {
  min-width: 11rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #1e293b;
  color: var(--text);
}

.config-editor-content {
  flex: 1;
  min-height: 320px;
  width: 100%;
  resize: vertical;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #020617;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  tab-size: 2;
}

.config-editor-error {
  margin: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--danger);
  background: rgba(127, 29, 29, 0.25);
  color: #fecaca;
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.config-editor-card-wide {
  width: min(960px, 100%);
  max-height: min(94vh, 920px);
}

.config-editor-meta {
  margin: 0;
  font-size: 0.78rem;
}

.config-editor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.cfg-tab {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
}

.cfg-tab:hover {
  color: var(--text);
  background: rgba(30, 41, 59, 0.6);
}

.cfg-tab.active {
  color: var(--text);
  border-color: var(--border);
  background: #1e293b;
}

.config-editor-panels {
  flex: 1;
  overflow: auto;
  min-height: 200px;
  max-height: 58vh;
  padding: 0.5rem 0.15rem;
}

.cfg-panel.hidden {
  display: none !important;
}

.cfg-section-desc,
.cfg-group-desc {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.cfg-group {
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.35);
}

.cfg-group legend {
  padding: 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.cfg-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.65rem 0.85rem;
}

.cfg-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
}

.cfg-field-wide {
  grid-column: 1 / -1;
}

.cfg-field-label {
  color: var(--muted);
}

.cfg-field input,
.cfg-field select,
.cfg-field textarea {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: var(--text);
  font-size: 0.82rem;
}

.cfg-field textarea.cfg-yaml {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  resize: vertical;
}

.cfg-field-help {
  margin: 0.15rem 0 0;
  grid-column: 1 / -1;
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.35;
}

.cfg-check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.cfg-multiselect {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
}

.cfg-check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.config-editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.opp-alert-card {
  position: relative;
  width: min(520px, 100%);
  padding: 1.5rem 1.35rem 1.25rem;
  border-radius: 14px;
  border: 2px solid #22c55e;
  background: linear-gradient(165deg, #052e16 0%, #0f172a 55%);
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.25),
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(34, 197, 94, 0.15);
  animation: opp-alert-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.opp-alert-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 3rem;
  text-align: center;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
}

.opp-alert-title {
  margin: 0 0 0.5rem;
  text-align: center;
  font-size: 1.35rem;
  color: #bbf7d0;
}

.opp-alert-summary {
  margin: 0 0 0.85rem;
  text-align: center;
  color: #e2e8f0;
  font-size: 0.95rem;
}

.opp-alert-list {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  list-style: none;
  max-height: 220px;
  overflow: auto;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.opp-alert-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  font-size: 0.88rem;
  line-height: 1.45;
}

.opp-alert-list li:last-child { border-bottom: none; }

.opp-alert-list .opp-alert-edge {
  color: #4ade80;
  font-weight: 600;
}

.opp-alert-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.opp-alert-close {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

.opp-alert-close:hover { color: #e2e8f0; }

@keyframes opp-alert-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes opp-alert-pop {
  from { opacity: 0; transform: scale(0.88) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.opp-panel-highlight {
  animation: opp-panel-flash 2.4s ease;
}

@keyframes opp-panel-flash {
  0%, 100% { box-shadow: none; }
  15%, 45% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.45); }
}

body.opp-alert-open { overflow: hidden; }

.hint { color: var(--muted); font-size: 0.72rem; margin: 0.25rem 0; }
.hint code { background: #111827; padding: 0.1rem 0.35rem; border-radius: 4px; }

.form textarea, .form select {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #111827;
  color: var(--text);
  font-size: 0.9rem;
}

.capture-list { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow: auto; }
.capture-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font-size: inherit;
}
.link-btn:hover { text-decoration: underline; }

.header-actions { display: flex; gap: 0.5rem; align-items: center; }
.header-actions a.btn { text-decoration: none; display: inline-block; }

.panel-login {
  margin-top: 0.45rem;
  border-color: var(--border);
  box-shadow: none;
}

.account-grid,
.login-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.5rem;
}

.account-placeholder,
.login-placeholder {
  border-style: dashed;
}

.account-card,
.login-card {
  background: #111827;
  border: 1px solid var(--border);
  border-radius: var(--panel-radius);
  padding: 0.55rem 0.65rem;
}

.account-card-head,
.login-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.account-card-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 0;
}

.account-card h3,
.login-card h3 { margin: 0; font-size: 0.85rem; }

.account-meta,
.login-meta {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.account-meta-warn {
  color: var(--danger);
}

.account-msg,
.login-msg {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  min-height: 1.1em;
  color: var(--text);
}

.account-card-warn {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.06);
}

.account-card-actions {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 0.3rem;
  margin: 0;
}

.account-card-actions .btn {
  padding: 0.12rem 0.38rem;
  font-size: 0.625rem;
  line-height: 1.15;
  white-space: nowrap;
  min-height: 1.35rem;
  box-sizing: border-box;
}

.account-card-toolbar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.28rem;
}

.account-card-toolbar .account-leg-monitor {
  flex: 1 1 auto;
  min-width: 0;
}

.account-leg-monitor {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
}

.account-leg-monitor.leg-primary .progress-track-labeled {
  box-shadow: inset 3px 0 0 var(--primary);
}

.account-leg-monitor.leg-hedge .progress-track-labeled {
  box-shadow: inset 3px 0 0 #a78bfa;
}

.progress-track-labeled {
  position: relative;
  height: 1.35rem;
  min-height: 1.35rem;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  overflow: hidden;
}

.progress-track-labeled .progress-bar {
  height: 100%;
  border-radius: 0;
}

.account-leg-monitor-summary {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  padding: 0 0.35rem 0 0.5rem;
  font-size: 0.625rem;
  line-height: 1;
  color: #d1d9e6;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.account-leg-monitor.leg-error .account-leg-monitor-summary {
  color: #fecaca;
}

.account-card-toolbar .account-card-actions {
  align-self: center;
}

.progress-panel {
  flex-shrink: 0;
  margin: 0 var(--page-gutter) 0.45rem;
  padding: 0.45rem 0.65rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--panel-radius);
}

.progress-panel:not(.hidden):not(.exec-preview-progress) {
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.exec-preview-progress {
  margin: 0 0 0.45rem;
}

.exec-preview-progress:not(.hidden) {
  position: static;
  box-shadow: none;
  z-index: auto;
}

.progress-panel.hidden { display: none; }

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
}

.progress-percent {
  color: var(--primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 8px;
  background: #111827;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-bar.indeterminate {
  width: 40% !important;
  animation: progress-slide 1.2s ease-in-out infinite;
}

@keyframes progress-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.progress-detail {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  min-height: 1em;
}

.leg-progress-list,
.scan-leg-progress {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.75rem;
}

.leg-progress-list > .leg-progress,
.scan-leg-progress > .leg-progress {
  flex: 1 1 50%;
  min-width: 0;
  max-width: 50%;
}

.leg-progress-list {
  margin-top: 0.85rem;
}

.scan-leg-progress {
  margin: 0 0 0.85rem;
}

@media (max-width: 720px) {
  .leg-progress-list,
  .scan-leg-progress {
    flex-direction: column;
  }

  .leg-progress-list > .leg-progress,
  .scan-leg-progress > .leg-progress {
    max-width: 100%;
  }
}

.leg-progress-list.hidden,
.scan-leg-progress.hidden {
  display: none;
}

.leg-progress {
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  background: #0b1220;
  border: 1px solid var(--border);
}

.leg-progress.leg-primary {
  border-color: rgba(59, 130, 246, 0.35);
}

.leg-progress.leg-hedge {
  border-color: rgba(234, 179, 8, 0.35);
}

.leg-progress.leg-done .leg-status {
  color: var(--primary);
}

.leg-progress.leg-error .leg-status {
  color: var(--danger);
}

.leg-progress.leg-listen .leg-status {
  color: var(--muted);
}

.leg-progress.leg-listen .progress-bar {
  opacity: 0.55;
}

.leg-step-tag {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.leg-progress.leg-primary .leg-step-tag {
  color: #8ec5ff;
  background: rgba(100, 160, 255, 0.12);
}

.leg-progress.leg-hedge .leg-step-tag {
  color: #b8a0ff;
  background: rgba(160, 120, 255, 0.12);
}

.leg-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

.leg-progress-head .leg-label {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leg-progress-head .leg-status {
  flex-shrink: 0;
}

.leg-progress-head .leg-role {
  color: var(--muted);
  font-size: 0.75rem;
  margin-left: 0.35rem;
}

.leg-status {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.leg-data-age {
  margin: 0.15rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.leg-progress .progress-track {
  height: 6px;
}

.leg-progress-detail {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  min-height: 1.1em;
}

.fixture-picked-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fixture-picked {
  display: block;
  min-height: 2.25rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.9rem;
}

.fixture-picked:empty::before,
.fixture-picked.hint:only-child {
  color: var(--muted);
}

.match-cell .match-name {
  font-weight: 500;
}

.match-cell .match-kickoff {
  margin-top: 0.15rem;
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.match-cell .match-venues {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.venue-leg-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.venue-tag {
  display: inline-block;
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}

.venue-tag.venue-primary {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}

.venue-tag.venue-hedge {
  border-color: #fcd34d;
  color: #b45309;
  background: #fffbeb;
}

.match-cell .match-id {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

#fixture-match {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  min-height: 1.2em;
}

.health-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0.25rem 0;
}

.card-warn {
  border-color: var(--warn);
}

.badge-ok {
  background: rgba(34, 197, 94, 0.2);
  color: var(--ok);
}

.badge-bad {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.formula-note {
  margin-top: 0.45rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.78rem;
}

.formula-body {
  margin-top: 0.4rem;
  line-height: 1.45;
  font-size: 0.75rem;
}

.formula-body p {
  margin: 0.25rem 0;
}

.formula-note summary {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
  font-size: 0.78rem;
}

.formula-note summary:hover {
  color: var(--text);
}

.formula-body sub {
  font-size: 0.75em;
}

.formula-hint {
  color: var(--muted);
  font-size: 0.72rem;
}

.exec-step-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.execution-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: var(--exec-list-max-h);
  overflow-y: auto;
  padding-right: 0.15rem;
}

.exec-job {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.exec-job-active {
  border-color: rgba(234, 179, 8, 0.55);
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.15);
}

.exec-job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.exec-job-meta,
.exec-job-summary {
  margin: 0 0 0.3rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.exec-step {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 0.5rem;
  font-size: 0.75rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.15);
}

.exec-step.ok {
  border-left: 3px solid var(--ok);
}

.exec-step.bad {
  border-left: 3px solid var(--bad);
}

.exec-step.running {
  border-left: 3px solid var(--warn);
}

.exec-step-msg {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.82rem;
}

.execution-progress-panel {
  border-color: rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.06);
  padding: 0.4rem 0.5rem;
}

.execution-progress-panel.exec-done {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.06);
}

.execution-progress-panel.exec-failed {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
}

.exec-progress-compact-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.3;
}

.exec-progress-compact-head .progress-percent {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.exec-steps-log {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0.3rem 0 0;
  padding: 0.4rem 0.5rem;
  min-height: 2.75rem;
  max-height: 5rem;
  overflow: auto;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.68rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.exec-steps-log-inline {
  max-height: 4rem;
  margin: 0.2rem 0 0;
}

/* —— 右侧浮动面板 —— */
.float-dock {
  position: fixed;
  inset: 0;
  z-index: 850;
  pointer-events: none;
}

.float-dock-rail {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.35rem 0.2rem;
  pointer-events: auto;
}

.float-dock-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  padding: 0.65rem 0.45rem;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.25);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.float-dock-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(147, 197, 253, 0.45);
}

.float-dock-btn-active {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(147, 197, 253, 0.55);
  color: #93c5fd;
}

.float-dock-btn-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.float-dock-btn-icon {
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.5rem;
}

.float-dock-icon {
  display: block;
  width: 1.2rem;
  height: 1.2rem;
}

.float-dock-icon-coin {
  width: 1.28rem;
  height: 1.28rem;
  filter: drop-shadow(0 1px 1px rgba(180, 83, 9, 0.35));
}

.float-dock-btn:hover .float-dock-icon-coin circle {
  fill: #fcd34d;
}

.float-dock-btn-active .float-dock-icon-coin circle {
  fill: #f59e0b;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.55rem;
  line-height: 0;
}

.btn-icon-svg {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
}

.float-dock-badge {
  position: absolute;
  top: 0.2rem;
  left: 0.15rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.2rem;
  border-radius: 999px;
  background: var(--warn);
  color: #1a1a1a;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
}

.float-dock-badge.hidden {
  display: none;
}

@keyframes float-dock-blink {
  0%, 100% { box-shadow: -2px 0 12px rgba(0, 0, 0, 0.25); }
  50% { box-shadow: -2px 0 16px rgba(234, 179, 8, 0.75), 0 0 0 2px rgba(234, 179, 8, 0.35); }
}

.float-dock-btn-blink {
  animation: float-dock-blink 0.65s ease-in-out 3;
}

.float-panel {
  position: fixed;
  right: 2.55rem;
  width: min(21rem, calc(100vw - 3.5rem));
  max-height: min(72vh, 28rem);
  overflow: auto;
  padding: 0.55rem 0.65rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px 0 0 10px;
  background: var(--panel);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.float-panel.hidden {
  display: none;
}

#float-panel-exec {
  top: auto;
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  left: max(0.75rem, env(safe-area-inset-left));
  right: 2.55rem;
  width: auto;
  height: 50vh;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.65rem 0.85rem 0.85rem;
  border-radius: 12px;
  --exec-bg: #f8fafc;
  --exec-surface: #ffffff;
  --exec-border: #cbd5e1;
  --exec-text: #0f172a;
  --exec-muted: #64748b;
  --exec-primary: #2563eb;
  --exec-primary-hover: #1d4ed8;
  --exec-danger: #dc2626;
  --exec-danger-hover: #b91c1c;
  --exec-ok: #16a34a;
  --exec-warn: #d97706;
  background: linear-gradient(165deg, #ffffff 0%, var(--exec-bg) 100%);
  color: var(--exec-text);
  border: 1px solid var(--exec-border);
  box-shadow:
    0 20px 50px rgba(15, 23, 42, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.9) inset;
}

#float-panel-exec.float-panel-maximized {
  left: max(0.5rem, env(safe-area-inset-left)) !important;
  right: max(0.5rem, env(safe-area-inset-right)) !important;
  top: max(0.5rem, env(safe-area-inset-top)) !important;
  bottom: max(0.5rem, env(safe-area-inset-bottom)) !important;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  z-index: 10050;
}

#float-panel-exec.float-panel-maximized .plan-preview-box {
  max-height: min(42vh, 28rem);
}

#float-panel-exec.float-panel-maximized .float-exec-jobs-table-wrap {
  max-height: min(28vh, 16rem);
}

#float-panel-exec .float-panel-head {
  flex-shrink: 0;
  border-bottom-color: var(--exec-border);
}

#float-panel-exec .float-panel-head.panel-drag-handle {
  cursor: grab;
}

.float-exec-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: hidden;
}

#hedge-action-panel.float-exec-action {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

#hedge-action-panel .execution-progress-panel {
  margin: 0;
}

#hedge-action-panel #action-form {
  margin: 0;
  min-width: 0;
}

.plan-preview-panel {
  width: 100%;
  min-width: 0;
}

.plan-preview-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  margin: 0.35rem 0 0.25rem;
}

.plan-preview-box {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 3.25rem;
  max-height: 9.5rem;
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
}

.float-exec-form .stake-dual {
  margin: 0.35rem 0;
}

.float-exec-stakes {
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.float-exec-jobs-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.float-exec-jobs-section > .float-subtitle {
  flex-shrink: 0;
  margin: 0 0 0.3rem;
}

.exec-jobs-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
  overflow-y: scroll; /* 始终保留滚动条占位，避免“看不到” */
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

/* WebKit（Chrome/Safari）滚动条可见性：暗色主题 */
.exec-jobs-table-wrap::-webkit-scrollbar {
  width: 10px;
}
.exec-jobs-table-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}
.exec-jobs-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.6);
  border-radius: 10px;
  border: 2px solid rgba(0, 0, 0, 0.15);
}
.exec-jobs-table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(203, 213, 225, 0.85);
}

.exec-jobs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.exec-jobs-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.45rem 0.5rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.exec-jobs-table tbody td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

.exec-jobs-table .exec-col-pnl {
  font-size: 0.72rem;
  line-height: 1.25;
  max-width: 9rem;
}

.exec-jobs-table .exec-col-pnl div {
  white-space: nowrap;
}

.exec-job-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.exec-job-row.exec-job-active {
  background: rgba(234, 179, 8, 0.08);
}

.exec-job-row.exec-job-active td {
  border-bottom-color: transparent;
}

.exec-job-detail td {
  padding: 0 0.35rem 0.55rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

.exec-job-detail.exec-job-active td {
  box-shadow: inset 0 0 0 1px rgba(234, 179, 8, 0.2);
}

.exec-match-cell {
  min-width: 8.5rem;
  max-width: 14rem;
}

.exec-match-name {
  display: block;
  font-size: 0.8rem;
  line-height: 1.3;
}

.exec-match-id {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.68rem;
  color: var(--muted);
  word-break: break-all;
}

.exec-progress-cell {
  min-width: 4.5rem;
  white-space: nowrap;
}

.exec-log-toggle {
  padding: 0.12rem 0.35rem;
  font-size: 0.65rem;
  vertical-align: middle;
}

.exec-job-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.15rem 0 0.25rem;
  padding: 0 0.1rem;
}

.exec-job-log-head .hint {
  font-size: 0.68rem;
}

.exec-progress-pct {
  display: inline-block;
  min-width: 2.2rem;
  margin-right: 0.35rem;
  font-weight: 600;
  font-size: 0.74rem;
  color: var(--muted);
}

.exec-step-pips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: 0.2rem;
}

.exec-pip {
  display: inline-block;
  padding: 0.08rem 0.28rem;
  border-radius: 4px;
  font-size: 0.62rem;
  line-height: 1.2;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  white-space: nowrap;
}

.exec-pip.ok {
  border-color: rgba(34, 197, 94, 0.45);
  color: var(--ok);
  background: rgba(34, 197, 94, 0.12);
}

.exec-pip.bad {
  border-color: rgba(239, 68, 68, 0.5);
  color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}

.exec-pip.running {
  border-color: rgba(234, 179, 8, 0.55);
  color: var(--warn);
  background: rgba(234, 179, 8, 0.12);
}

.exec-msg-cell {
  min-width: 7rem;
  max-width: 14rem;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
  word-break: break-word;
}

.exec-time-cell {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.72rem;
}

.exec-jobs-empty td {
  text-align: center;
  padding: 1.25rem 0.5rem;
}

.exec-job-legs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  margin-bottom: 0.5rem;
}

.exec-job-legs-table th,
.exec-job-legs-table td {
  padding: 0.28rem 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
}

.exec-job-legs-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.68rem;
  white-space: nowrap;
}

.exec-leg-row.ok td:first-child {
  border-left: 3px solid var(--ok);
}

.exec-leg-row.bad td:first-child {
  border-left: 3px solid var(--danger);
}

.exec-leg-row.running td:first-child {
  border-left: 3px solid var(--warn);
}

.exec-leg-status {
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}

.exec-leg-status-success { color: var(--ok); }
.exec-leg-status-failed { color: var(--danger); }
.exec-leg-status-planned { color: var(--muted); }
.exec-leg-status-running { color: var(--warn); }

.exec-order-id {
  font-size: 0.68rem;
  color: #9ec5ff;
  word-break: break-all;
}

.exec-leg-msg {
  max-width: 12rem;
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-word;
}

.exec-col-actions {
  white-space: nowrap;
  width: 5.5rem;
}

.opp-verify-row td {
  padding: 0.35rem 0.5rem 0.75rem;
  background: #151d2b;
  border-bottom: 1px solid var(--border);
}

.exec-verify-panel {
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #3d4f6a;
  border-radius: 6px;
  background: #1e2a3d;
  color: var(--text);
}

.exec-verify-panel.ok {
  border-color: color-mix(in srgb, var(--ok) 55%, #3d4f6a);
  background: color-mix(in srgb, var(--ok) 8%, #1e2a3d);
}

.exec-verify-panel.warn {
  border-color: color-mix(in srgb, var(--warn) 55%, #3d4f6a);
  background: color-mix(in srgb, var(--warn) 8%, #1e2a3d);
}

.exec-verify-panel.bad {
  border-color: color-mix(in srgb, var(--danger) 55%, #3d4f6a);
  background: color-mix(in srgb, var(--danger) 8%, #1e2a3d);
}

.exec-verify-panel .hint {
  color: #b8c5d9;
  font-size: 0.8rem;
}

.exec-verify-summary {
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #f1f5f9;
  font-size: 0.88rem;
}

.exec-verify-checks {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.84rem;
  color: #e2e8f0;
}

.exec-verify-checks li {
  margin: 0.25rem 0;
}

.exec-verify-checks li strong {
  color: #f8fafc;
}

.exec-verify-check-pass { color: #4ade80; }
.exec-verify-check-warn { color: #fbbf24; }
.exec-verify-check-fail { color: #f87171; }

.exec-verify-issues {
  color: #fbbf24 !important;
}

.exec-leg-actions {
  white-space: nowrap;
}

.exec-leg-actions .btn {
  margin-right: 0.25rem;
}

.exec-verify-pnl {
  margin-top: 0.45rem;
  font-size: 0.84rem;
  color: #e2e8f0;
}

.exec-verify-calc-wrap {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: #dbe4f0;
}

.exec-verify-calc-title {
  margin: 0.35rem 0 0.25rem;
  color: #b8c5d9;
}

.exec-verify-calc-seg {
  margin: 0.35rem 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid #4a5d78;
  border-radius: 4px;
  background: #121a26;
  color: #e7ecf3;
}

.exec-verify-calc-seg strong {
  color: #f8fafc;
}

.exec-verify-formula-list {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  color: #d1dae8;
  line-height: 1.5;
}

.opp-verify-progress {
  padding: 0.55rem 0.65rem;
  border: 1px solid #4a5d78;
  border-radius: 6px;
  background: #121a26;
  color: #e7ecf3;
}

.opp-verify-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.84rem;
}

.opp-verify-progress-pct {
  font-variant-numeric: tabular-nums;
  color: #93c5fd;
}

.opp-verify-progress-track {
  height: 6px;
  margin-bottom: 0.35rem;
}

.opp-verify-progress-msg {
  margin: 0.15rem 0 0;
  color: #b8c5d9;
  font-size: 0.8rem;
}

.opp-verify-progress-detail {
  margin: 0.2rem 0 0;
  color: #94a3b8;
  font-size: 0.75rem;
}

.opp-verify-row-loading td {
  background: #151d2b;
}

.exec-job-detail-panel {
  padding: 0.15rem 0;
}

.exec-job-steps-head {
  margin-top: 0.35rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.exec-job-no-legs {
  margin: 0.25rem 0 0.5rem;
}

.exec-job-steps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.exec-job-steps-table th,
.exec-job-steps-table td {
  padding: 0.3rem 0.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: left;
}

.exec-job-steps-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.68rem;
}

.exec-step-row.ok td:first-child {
  border-left: 3px solid var(--ok);
}

.exec-step-row.bad td:first-child {
  border-left: 3px solid var(--bad);
}

.exec-step-row.running td:first-child {
  border-left: 3px solid var(--warn);
}

.float-exec-jobs-list {
  --exec-list-max-h: 14rem;
}

#float-panel-trial {
  top: 4%;
  width: min(27rem, calc(100vw - 3.5rem));
  max-height: min(92vh, 42rem);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#float-panel-trial.hidden {
  display: none;
}

.float-trial-subtitle {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.float-panel-trial .float-panel-head {
  flex-shrink: 0;
  margin: 0;
  padding: 0.5rem 0.6rem;
}

.float-trial-frame-wrap {
  flex: 1 1 auto;
  min-height: 0;
}

.float-trial-frame {
  display: block;
  width: 100%;
  height: min(78vh, 36rem);
  min-height: 22rem;
  border: none;
  background: #0f1419;
}

.float-panel-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.45rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.panel-drag-handle {
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.panel-drag-handle:active,
.is-dragging.panel-drag-handle,
.is-dragging .panel-drag-handle {
  cursor: grabbing;
}

body.panel-drag-active {
  user-select: none;
  cursor: grabbing;
}

body.panel-drag-active * {
  cursor: grabbing !important;
}

.app-modal-title.panel-drag-handle {
  padding: 0.15rem 0.1rem 0.35rem;
  margin: -0.15rem -0.1rem 0;
  border-radius: 6px;
}

.opp-alert-title.panel-drag-handle {
  padding: 0.25rem 0.5rem;
  margin: -0.25rem -0.5rem 0.35rem;
  border-radius: 8px;
}

.config-editor-head.panel-drag-handle {
  padding-bottom: 0.35rem;
  margin-bottom: 0.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.float-panel-head h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.float-panel-close {
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  cursor: pointer;
}

.float-panel-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.float-panel-actions .btn.small {
  padding: 0.2rem 0.45rem;
  font-size: 0.65rem;
}

.float-panel-close:hover {
  color: var(--text);
  border-color: rgba(147, 197, 253, 0.45);
}

.float-subtitle {
  margin: 0.55rem 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
}

@media (max-width: 640px) {
  .float-panel {
    right: 2.35rem;
    width: calc(100vw - 2.75rem);
  }

  #float-panel-exec {
    left: max(0.5rem, env(safe-area-inset-left));
    right: 2.35rem;
    height: 50vh;
    max-height: 50vh;
  }

  .plan-preview-box {
    max-height: 7.5rem;
  }

  .exec-match-cell,
  .exec-msg-cell {
    max-width: none;
  }

  #float-panel-trial {
    top: 4%;
    max-height: 88vh;
    width: calc(100vw - 2.75rem);
  }

  .float-trial-frame {
    min-height: 18rem;
    height: 72vh;
  }
}

@media (max-width: 720px) {
  body {
    overflow-y: auto;
    display: block;
  }

  #opp-panel {
    display: flex;
    flex-direction: column;
    min-height: 55vh;
  }

  #opp-panel > .table-wrap:not(.hidden) {
    flex: 1 1 0;
    min-height: 0;
    max-height: 100%;
  }
}

/* —— 对冲执行面板：浅色主题 —— */
#float-panel-exec .float-panel-head h2 {
  color: var(--exec-text);
}

#float-panel-exec .hint,
#float-panel-exec .float-subtitle,
#float-panel-exec .form label {
  color: var(--exec-muted);
}

#float-panel-exec .fixture-picked {
  background: #1a2332;
  border-color: #2d3a4f;
  color: #ffffff;
}

#float-panel-exec .fixture-picked.hint {
  color: rgba(255, 255, 255, 0.52);
}

#float-panel-exec #fixture-match {
  color: inherit;
}

#float-panel-exec .btn {
  background: var(--exec-surface);
  border-color: var(--exec-border);
  color: var(--exec-text);
}

#float-panel-exec .btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

#float-panel-exec .btn.primary {
  background: var(--exec-primary);
  border-color: var(--exec-primary);
  color: #fff;
}

#float-panel-exec .btn.primary:hover {
  background: var(--exec-primary-hover);
  border-color: var(--exec-primary-hover);
}

#float-panel-exec .btn.danger {
  background: var(--exec-danger);
  border-color: var(--exec-danger);
  color: #fff;
}

#float-panel-exec .btn.danger:hover {
  background: var(--exec-danger-hover);
  border-color: var(--exec-danger-hover);
}

#float-panel-exec .float-panel-close {
  color: var(--exec-muted);
  border-color: var(--exec-border);
  background: var(--exec-surface);
}

#float-panel-exec .float-panel-close:hover {
  color: var(--exec-text);
  border-color: #94a3b8;
  background: #f1f5f9;
}

#float-panel-exec .form input {
  background: var(--exec-surface);
  border: 1px solid var(--exec-border);
  color: var(--exec-text);
}

#float-panel-exec .float-exec-stakes input,
#float-panel-exec .float-exec-stakes .stake-readonly {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  box-sizing: border-box;
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

#float-panel-exec .float-exec-stakes input {
  background: var(--exec-surface);
  border: 1px solid var(--exec-border);
  color: var(--exec-text);
}

#float-panel-exec .float-exec-stakes .stake-readonly {
  background: #e8edf3;
  border: 1px solid #c5d0de;
  color: var(--exec-text);
  cursor: default;
  user-select: none;
}

#float-panel-exec .float-exec-stakes .stake-readonly.muted {
  color: var(--exec-muted);
  background: #f1f5f9;
  border-color: #d1d9e6;
}

#float-panel-exec .plan-preview-box,
#float-panel-exec .result-box {
  background: #f8fafc;
  border-color: var(--exec-border);
  color: var(--exec-text);
}

#float-panel-exec .execution-progress-panel {
  border-color: #fcd34d;
  background: #fffbeb;
  color: var(--exec-text);
}

#float-panel-exec .execution-progress-panel.exec-done {
  border-color: #86efac;
  background: #f0fdf4;
}

#float-panel-exec .execution-progress-panel.exec-failed {
  border-color: #fca5a5;
  background: #fef2f2;
}

#float-panel-exec .exec-steps-log {
  background: #f8fafc;
  border-color: var(--exec-border);
  color: var(--exec-text);
}

#float-panel-exec .exec-jobs-table-wrap {
  background: var(--exec-surface);
  border-color: var(--exec-border);
}

/* WebKit 滚动条可见性：浅色 exec 面板 */
#float-panel-exec .exec-jobs-table-wrap::-webkit-scrollbar-track {
  background: #eef2f7;
}
#float-panel-exec .exec-jobs-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.55);
  border: 2px solid #eef2f7;
}
#float-panel-exec .exec-jobs-table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(51, 65, 85, 0.65);
}

#float-panel-exec .exec-jobs-table thead th {
  color: var(--exec-muted);
  background: #f1f5f9;
  border-bottom-color: var(--exec-border);
}

#float-panel-exec .exec-jobs-table tbody td {
  border-bottom-color: #e2e8f0;
  color: var(--exec-text);
}

#float-panel-exec .exec-job-row:hover {
  background: #f8fafc;
}

#float-panel-exec .exec-job-row.exec-job-active {
  background: #fffbeb;
}

#float-panel-exec .exec-job-detail td {
  background: #f8fafc;
  border-bottom-color: var(--exec-border);
}

/* 执行清单内验证面板：浅色高对比 */
#float-panel-exec .exec-verify-panel {
  background: #ffffff;
  color: var(--exec-text);
  border-color: #94a3b8;
}

#float-panel-exec .exec-verify-panel.ok {
  background: #f0fdf4;
  border-color: #86efac;
}

#float-panel-exec .exec-verify-panel.warn {
  background: #fffbeb;
  border-color: #fcd34d;
}

#float-panel-exec .exec-verify-panel.bad {
  background: #fef2f2;
  border-color: #fca5a5;
}

#float-panel-exec .exec-verify-panel .hint,
#float-panel-exec .exec-verify-calc-title {
  color: #475569;
}

#float-panel-exec .exec-verify-summary {
  color: #0f172a;
}

#float-panel-exec .exec-verify-checks,
#float-panel-exec .exec-verify-pnl,
#float-panel-exec .exec-verify-calc-wrap {
  color: #1e293b;
}

#float-panel-exec .exec-verify-checks li strong,
#float-panel-exec .exec-verify-calc-seg strong {
  color: #0f172a;
}

#float-panel-exec .exec-verify-check-pass { color: #15803d; }
#float-panel-exec .exec-verify-check-warn { color: #b45309; }
#float-panel-exec .exec-verify-check-fail { color: #b91c1c; }

#float-panel-exec .exec-verify-issues {
  color: #b45309 !important;
}

#float-panel-exec .exec-verify-calc-seg {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

#float-panel-exec .exec-verify-formula-list {
  color: #334155;
}

#float-panel-exec .exec-match-id {
  color: var(--exec-muted);
}

#float-panel-exec .exec-progress-pct {
  color: var(--exec-muted);
}

#float-panel-exec .badge {
  background: #e2e8f0;
  color: var(--exec-text);
}

#float-panel-exec .badge-ok {
  background: #dcfce7;
  color: #166534;
}

#float-panel-exec .badge-bad {
  background: #fee2e2;
  color: #b91c1c;
}

#float-panel-exec .badge-warn {
  background: #fef3c7;
  color: #b45309;
}

/* —— 应用模态框（居中） —— */
.app-modal-root {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.app-modal-root.hidden {
  display: none !important;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  animation: app-modal-fade-in 0.2s ease;
}

.app-modal-card {
  position: relative;
  z-index: 1;
  width: min(28rem, 100%);
  max-height: min(80vh, 32rem);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem 1.35rem 1.15rem;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.85) inset;
  animation: app-modal-pop 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.app-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}

.app-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #475569;
  white-space: pre-wrap;
  word-break: break-word;
}

.app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.app-modal-btn-cancel {
  background: #fff;
  border-color: #cbd5e1;
  color: #334155;
}

.app-modal-btn-cancel:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.app-modal-btn-confirm {
  min-width: 5.5rem;
}

.app-modal-danger .app-modal-title {
  color: #b91c1c;
}

.app-modal-danger .app-modal-btn-confirm {
  background: #dc2626;
  border-color: #dc2626;
}

.app-modal-danger .app-modal-btn-confirm:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

body.app-modal-open {
  overflow: hidden;
}

@keyframes app-modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes app-modal-pop {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

