/* ============================================================
   OKX Market Radar — UI Design System
   结构：令牌 → 基础 → 顶栏 → 布局 → KPI → 面板/筛选 → 行情表
        → 告警流 → 覆盖 → 纸面交易 → 弹窗 → 登录页 → 页脚 → 响应式
   ============================================================ */

:root {
  color-scheme: dark;
  --bg: #0b1015;
  --surface: #10161d;
  --surface-raised: #141c24;
  --surface-soft: #17212a;
  --line: #24303a;
  --line-strong: #33424e;
  --text: #edf4f2;
  --muted: #85949e;
  --muted-strong: #a9b7bf;
  --teal: #31d4b5;
  --teal-soft: rgba(49, 212, 181, 0.12);
  --coral: #ff6d70;
  --coral-soft: rgba(255, 109, 112, 0.12);
  --amber: #f0b95e;
  --amber-soft: rgba(240, 185, 94, 0.12);
  --lime: #a7dc72;
  --lime-soft: rgba(167, 220, 114, 0.12);
  --blue: #7db4ef;
  --blue-soft: rgba(125, 180, 239, 0.12);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.3);
  --radius: 6px;
  --mono: "SFMono-Regular", "Roboto Mono", "Cascadia Code", Consolas, monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select,
input[type="range"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 8px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: #465764;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
p {
  margin: 0;
}

/* ============================ 顶栏 ============================ */

.topbar {
  min-height: 60px;
  padding: 0 clamp(14px, 2.6vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(11, 16, 21, 0.95);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 36px);
  min-width: 0;
}

.brand {
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 0 auto;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border: 1px solid var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  border-radius: var(--radius);
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-copy strong {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.brand-copy small {
  color: var(--muted);
  font-size: 10px;
}

/* 工作区标签 */

.tab-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  align-self: stretch;
  min-width: 0;
}

.tab-button {
  position: relative;
  align-self: stretch;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--muted-strong);
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease;
}

.tab-button:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.tab-button.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
  flex: 0 0 auto;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.tab-button.active .tab-dot {
  background: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-soft);
}

.tab-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--coral);
  color: #fff;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.connection-pill {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 12px;
  white-space: nowrap;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

.connection-pill[data-state="live"] {
  border-color: rgba(49, 212, 181, 0.38);
  color: var(--teal);
}

.connection-pill[data-state="live"] .connection-dot {
  background: var(--teal);
  animation: live-pulse 1.8s ease-out infinite;
}

.connection-pill[data-state="simulation"] {
  border-color: rgba(240, 185, 94, 0.42);
  color: var(--amber);
}

.connection-pill[data-state="degraded"] {
  border-color: rgba(255, 109, 112, 0.42);
  color: var(--coral);
}

.connection-pill[data-state="degraded"] .connection-dot {
  background: var(--coral);
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(49, 212, 181, 0.3); }
  70% { box-shadow: 0 0 0 6px rgba(49, 212, 181, 0); }
  100% { box-shadow: 0 0 0 0 rgba(49, 212, 181, 0); }
}

.server-clock {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  min-width: 64px;
  text-align: center;
}

.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted-strong);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.icon-button:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-soft);
}

.icon-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: var(--line);
  color: var(--muted);
  background: var(--surface);
}

.icon-button.active {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-soft);
}

.icon-button.spinning {
  animation: rotate 0.8s linear infinite;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

.account-badge {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted-strong);
  font-size: 12px;
  padding: 0 2px;
}

.text-button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.text-button:hover {
  background: var(--teal-soft);
  border-color: rgba(49, 212, 181, 0.35);
}

.text-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: var(--muted);
}

.text-button:disabled:hover {
  background: transparent;
  border-color: transparent;
}

/* ============================ 布局 ============================ */

.page-content {
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 2.6vw, 40px) 40px;
  flex: 1;
}

.view {
  animation: view-in 0.2s ease;
}

.view[hidden] {
  display: none;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ============================ KPI 带 ============================ */

.kpi-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 14px;
}

.kpi-item {
  position: relative;
  min-height: 84px;
  padding: 12px 14px 11px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
}

.kpi-item + .kpi-item {
  border-left: 1px solid var(--line);
}

.kpi-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--line-strong);
}

.kpi-item.accent-teal::before { background: var(--teal); }
.kpi-item.accent-coral::before { background: var(--coral); }
.kpi-item.accent-amber::before { background: var(--amber); }
.kpi-item.accent-lime::before { background: var(--lime); }

.kpi-item.flash {
  animation: kpi-flash 0.9s ease;
}

@keyframes kpi-flash {
  0% { background: var(--coral-soft); }
  100% { background: transparent; }
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11.5px;
}

.kpi-top i {
  font-style: normal;
  color: var(--line-strong);
  font-family: var(--mono);
}

.kpi-value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.kpi-foot {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================ 面板 ============================ */

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  gap: 14px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
}

.panel-header {
  min-height: 52px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-raised), var(--surface));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header.compact {
  min-height: 46px;
  padding: 8px 13px;
}

.panel-header h2 {
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.2;
}

.panel-kicker {
  color: var(--teal);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  opacity: 0.85;
}

.panel-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.rows-count,
.status-text {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.status-text.negative {
  color: var(--coral);
}

.live-count {
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--teal);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

/* 开关 */

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.toggle-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 30px;
  height: 16px;
  border-radius: 9px;
  background: var(--line-strong);
  position: relative;
  flex: 0 0 auto;
  transition: background 0.18s ease;
}

.toggle-track i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted-strong);
  transition: transform 0.18s ease, background 0.18s ease;
}

.toggle-field input:checked + .toggle-track {
  background: var(--teal);
}

.toggle-field input:checked + .toggle-track i {
  transform: translateX(14px);
  background: #06231d;
}

.toggle-field input:focus-visible + .toggle-track {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.toggle-label {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 600;
}

.toggle-field:has(input:checked) .toggle-label {
  color: var(--teal);
}

/* ============================ 筛选栏 ============================ */

.filters {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-field {
  flex: 1 1 200px;
  min-width: 180px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s ease;
}

.search-field > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 14px;
}

.search-field:focus-within {
  border-color: var(--teal);
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
}

.search-field input::placeholder {
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  flex: 0 0 auto;
}

.segment {
  min-width: 48px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.segment:last-child {
  border-right: 0;
}

.segment:hover {
  color: var(--text);
}

.segment.active {
  background: var(--teal-soft);
  color: var(--teal);
}

.select-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.select-field > span {
  color: var(--muted);
  font-size: 11.5px;
}

.select-field select {
  height: 30px;
  padding: 0 24px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.select-field select:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.score-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.score-filter > span {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.score-filter b {
  color: var(--teal);
  font-family: var(--mono);
}

.score-filter input {
  width: 110px;
  accent-color: var(--teal);
}

/* ============================ 行情表 ============================ */

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 268px);
  min-height: 180px;
}

body.is-paused .table-wrap {
  opacity: 0.55;
}

.market-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.market-table th,
.market-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.market-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
}

.market-table th:first-child,
.market-table td:first-child {
  padding-left: 16px;
}

.market-table th:last-child,
.market-table td:last-child {
  padding-right: 16px;
}

.market-table th.col-num,
.market-table td.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.market-table .col-symbol {
  width: 26%;
  min-width: 190px;
}

.market-table .col-score {
  width: 96px;
}

.market-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.market-table tbody tr:hover {
  background: var(--surface-soft);
}

.market-table tbody tr.watch-row {
  box-shadow: inset 3px 0 0 var(--teal);
}

.market-table tbody tr.high-row {
  box-shadow: inset 3px 0 0 var(--amber);
}

.market-table tbody tr.critical-row {
  box-shadow: inset 3px 0 0 var(--coral);
  background: linear-gradient(90deg, rgba(255, 109, 112, 0.05), transparent 42%);
}

.market-table tbody tr:last-child td {
  border-bottom: 0;
}

.symbol-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.asset-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted-strong);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.asset-mark[data-type="SWAP"] { border-color: rgba(49, 212, 181, 0.4); color: var(--teal); }
.asset-mark[data-type="OPTION"] { border-color: rgba(240, 185, 94, 0.45); color: var(--amber); }
.asset-mark[data-type="FUTURES"] { border-color: rgba(125, 180, 239, 0.45); color: var(--blue); }
.asset-mark[data-type="SPOT"] { border-color: rgba(167, 220, 114, 0.42); color: var(--lime); }

.symbol-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.symbol-copy strong {
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.symbol-copy small {
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.price,
.percent,
.volume,
.score-number {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.price {
  font-size: 12.5px;
}

.percent {
  font-size: 12px;
  font-weight: 600;
}

.volume {
  color: var(--muted-strong);
  font-size: 11.5px;
}

.positive { color: var(--teal) !important; }
.negative { color: var(--coral) !important; }
.neutral { color: var(--muted-strong) !important; }

.score-cell {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  min-width: 74px;
}

.score-copy {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.score-number {
  font-size: 14px;
  font-weight: 700;
}

.score-copy small,
.signal-chip small,
.model-warming small {
  color: var(--muted);
  font-size: 9.5px;
  font-family: var(--mono);
}

.score-number.warming { color: var(--muted); }
.score-number.watch { color: var(--teal); }
.score-number.high { color: var(--amber); }
.score-number.critical { color: var(--coral); }

.score-meter {
  width: 74px;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
  display: block;
}

.score-meter i {
  display: block;
  height: 100%;
  background: var(--muted);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.score-meter.watch i { background: var(--teal); }
.score-meter.high i { background: var(--amber); }
.score-meter.critical i { background: var(--coral); }

.signal-chip,
.model-warming {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.signal-chip strong,
.model-warming strong {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted-strong);
  white-space: nowrap;
}

.signal-chip[data-signal="price"] strong { color: var(--coral); }
.signal-chip[data-signal="volume"] strong { color: var(--amber); }
.signal-chip[data-signal="openInterest"] strong { color: var(--blue); }
.signal-chip[data-signal="impliedVolatility"] strong { color: var(--lime); }
.model-warming strong { color: var(--amber); }

.empty-row td {
  padding: 34px 12px;
  color: var(--muted);
  text-align: center;
}

.loading-mark {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 8px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: rotate 0.8s linear infinite;
  vertical-align: -2px;
}

.table-footer {
  min-height: 36px;
  padding: 7px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 11px;
  flex-wrap: wrap;
}

.table-footer span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.table-footer-spacer {
  flex: 1;
}

.paused-hint {
  color: var(--amber);
  font-weight: 650;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.teal { background: var(--teal); }
.legend-dot.amber { background: var(--amber); }
.legend-dot.coral { background: var(--coral); }

/* ============================ 侧栏 ============================ */

.side-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.alerts-panel {
  display: flex;
  flex-direction: column;
}

.alerts-panel .panel-header {
  flex: 0 0 auto;
}

.severity-chips {
  padding: 9px 10px 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.severity-chip {
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.severity-chip b {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 10.5px;
  color: var(--muted);
}

.severity-chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.severity-chip.active {
  color: var(--teal);
  border-color: rgba(49, 212, 181, 0.5);
  background: var(--teal-soft);
}

.severity-chip.active b {
  color: var(--teal);
}

.severity-chip.watch.active { color: var(--teal); border-color: rgba(49, 212, 181, 0.5); background: var(--teal-soft); }
.severity-chip.watch.active b { color: var(--teal); }
.severity-chip.high.active { color: var(--amber); border-color: rgba(240, 185, 94, 0.5); background: var(--amber-soft); }
.severity-chip.high.active b { color: var(--amber); }
.severity-chip.critical.active { color: var(--coral); border-color: rgba(255, 109, 112, 0.5); background: var(--coral-soft); }
.severity-chip.critical.active b { color: var(--coral); }

.alert-list {
  max-height: 430px;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.alert-item {
  position: relative;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s ease;
}

.alert-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--amber);
}

.alert-item[data-severity="critical"]::before { background: var(--coral); }
.alert-item[data-severity="watch"]::before { background: var(--teal); }

.alert-item:hover {
  background: var(--surface-soft);
}

.alert-item:last-child {
  border-bottom: 0;
}

.alert-head,
.alert-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.alert-head strong {
  font-size: 12px;
  font-weight: 700;
}

.alert-time,
.alert-foot {
  color: var(--muted);
  font-size: 10.5px;
  font-family: var(--mono);
}

.alert-title {
  font-size: 12.5px;
  font-weight: 600;
  margin: 3px 0 2px;
  color: var(--text);
}

.alert-detail {
  color: var(--muted-strong);
  font-size: 11px;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-score {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.alert-item[data-severity="critical"] .alert-score { color: var(--coral); }
.alert-item[data-severity="high"] .alert-score { color: var(--amber); }
.alert-item[data-severity="watch"] .alert-score { color: var(--teal); }

.empty-state {
  padding: 26px 14px;
  text-align: center;
  color: var(--muted);
}

.empty-state p {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted-strong);
  margin-top: 6px;
}

.empty-state small {
  display: block;
  font-size: 11px;
  margin-top: 3px;
}

.empty-icon {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--line-strong);
}

/* 监控分布 */

.coverage-list {
  padding: 8px 13px 4px;
  display: grid;
  gap: 9px;
}

.coverage-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted-strong);
}

.coverage-row b {
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
  color: var(--text);
}

.coverage-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.coverage-bar i {
  display: block;
  height: 100%;
  background: var(--teal);
  border-radius: 3px;
  transition: width 0.35s ease;
}

.coverage-row:nth-child(2) .coverage-bar i { background: var(--blue); }
.coverage-row:nth-child(3) .coverage-bar i { background: var(--amber); }
.coverage-row:nth-child(4) .coverage-bar i { background: var(--lime); }

.coverage-note {
  margin: 6px 13px 12px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.5;
}

/* ============================ 纸面交易 ============================ */

.paper-account-band {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 18px 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: stretch;
  gap: 26px;
  flex-wrap: wrap;
}

.account-hero {
  min-width: 240px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.account-hero-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-hero-top .panel-kicker {
  margin-bottom: 0;
}

.account-equity-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.account-equity-row strong {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.return-badge {
  padding: 3px 9px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.return-badge.positive {
  color: var(--teal);
  border-color: rgba(49, 212, 181, 0.45);
  background: var(--teal-soft);
}

.return-badge.negative {
  color: var(--coral);
  border-color: rgba(255, 109, 112, 0.45);
  background: var(--coral-soft);
}

.account-hero small {
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
}

.account-stats {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(88px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.account-stat {
  background: var(--surface-raised);
  padding: 10px 12px 9px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}

.account-stat span {
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-stat strong {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-params {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.param-chip {
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.param-chip b {
  color: var(--muted-strong);
  font-family: var(--mono);
  font-weight: 650;
  font-size: 10.5px;
}

.param-chip .paper-rule-off {
  color: var(--muted);
  text-decoration: line-through;
}

/* 三池 */

.paper-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.pool-panel {
  display: flex;
  flex-direction: column;
}

.pool-panel .panel-header {
  flex: 0 0 auto;
}

.paper-list {
  max-height: 400px;
  overflow: auto;
  flex: 1 1 auto;
}

.paper-item {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}

.paper-item:last-child {
  border-bottom: 0;
}

.paper-item:hover {
  background: var(--surface-soft);
}

.paper-item.pending {
  opacity: 0.85;
  background: var(--amber-soft);
}

.paper-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.paper-item-head strong {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.paper-item-head time {
  color: var(--muted);
  font-size: 10.5px;
  font-family: var(--mono);
  flex: 0 0 auto;
}

.paper-item-line {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 3px;
  flex-wrap: wrap;
}

.paper-item-line b {
  color: var(--muted-strong);
  font-family: var(--mono);
  font-weight: 650;
  font-size: 11.5px;
}

.paper-item-line .paper-line-gap {
  margin-left: 10px;
}

.paper-item-note {
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 4px;
  line-height: 1.45;
}

.paper-pending {
  color: var(--amber) !important;
}

.side-badge {
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
  color: var(--muted-strong);
}

.side-badge.long {
  color: var(--teal);
  border-color: rgba(49, 212, 181, 0.45);
  background: var(--teal-soft);
}

.side-badge.short {
  color: var(--coral);
  border-color: rgba(255, 109, 112, 0.45);
  background: var(--coral-soft);
}

.side-badge.watch {
  color: var(--blue);
  border-color: rgba(125, 180, 239, 0.45);
  background: var(--blue-soft);
}

.side-badge.replay {
  color: var(--amber);
  border-color: rgba(240, 185, 94, 0.45);
  background: var(--amber-soft);
}

.pool-chip {
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--muted-strong);
  flex: 0 0 auto;
}

.symbol-cell .pool-chip {
  font-size: 9.5px;
  padding: 0 6px;
}

.pool-chip.watch {
  color: var(--blue);
  border-color: rgba(125, 180, 239, 0.45);
}

.pool-chip.paper.long {
  color: var(--teal);
  border-color: rgba(49, 212, 181, 0.45);
}

.pool-chip.paper.short {
  color: var(--coral);
  border-color: rgba(255, 109, 112, 0.45);
}

/* 平仓历史分组 */

.history-group {
  border-bottom: 1px solid var(--line);
}

.history-group:last-child {
  border-bottom: 0;
}

.history-group-head {
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  transition: background 0.12s ease;
}

.history-group-head:hover {
  background: var(--surface-soft);
}

.history-group-head strong {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-chevron {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  width: 12px;
  flex: 0 0 auto;
}

.history-group-meta {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.history-group-meta b {
  font-family: var(--mono);
}

.history-group-body {
  display: grid;
}

.history-group.collapsed .history-group-body {
  display: none;
}

.history-group.collapsed .history-group-head {
  border-bottom: 0;
}

/* 规则面板 */

.rules-panel {
  margin-top: 0;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.rules-grid.collapsed {
  display: none;
}

.rule-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 11px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rule-card.rule-off {
  opacity: 0.55;
}

.rule-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.rule-card-head strong {
  font-size: 12.5px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
}

.rule-mode {
  color: var(--muted);
  font-size: 10.5px;
  font-family: var(--mono);
  white-space: nowrap;
}

.rule-off-badge {
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.rule-card-condition {
  color: var(--muted-strong);
  font-size: 11px;
  line-height: 1.5;
}

.rule-card-evidence {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
  border-top: 1px dashed var(--line);
  padding-top: 7px;
}

/* ============================ 弹窗 ============================ */

.detail-dialog {
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 60px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.detail-dialog::backdrop {
  background: rgba(4, 8, 12, 0.72);
  backdrop-filter: blur(3px);
}

.dialog-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-raised), var(--surface));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h2 {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--mono);
}

.close-dialog {
  width: 30px;
  height: 30px;
  font-size: 18px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 4px 0;
  max-height: 46vh;
  overflow: auto;
}

.detail-stat {
  padding: 10px 16px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px;
}

.detail-stat:nth-child(3n) { border-right: 0; }
.detail-stat:nth-last-child(-n + 3) { border-bottom: 0; }

.detail-stat span {
  color: var(--muted);
  font-size: 10.5px;
}

.detail-stat strong {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-stat strong.warming { color: var(--amber); }
.detail-stat strong.watch { color: var(--teal); }
.detail-stat strong.high { color: var(--amber); }
.detail-stat strong.critical { color: var(--coral); }

.detail-chart-wrap {
  padding: 10px 16px 6px;
  border-top: 1px solid var(--line);
}

.detail-chart-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10.5px;
  margin-bottom: 7px;
}

.detail-chart {
  height: 74px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
}

.detail-chart i {
  flex: 1;
  min-width: 2px;
  border-radius: 1px 1px 0 0;
  background: var(--teal);
  transition: height 0.3s ease;
}

.detail-chart.down i { background: var(--coral); }

.detail-alerts {
  max-height: 150px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding: 4px 0;
}

.detail-alert-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
}

.detail-alert-row:last-child {
  border-bottom: 0;
}

.detail-alert-row time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  flex: 0 0 auto;
}

.detail-alert-row span {
  color: var(--muted-strong);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-alert-row b {
  color: var(--muted);
  font-weight: 500;
}

/* 邀请 / 重放弹窗 */

.invite-dialog {
  width: min(480px, calc(100vw - 40px));
}

.invite-form {
  padding: 14px 16px;
  display: grid;
  gap: 12px;
}

.invite-result {
  margin: 0 16px 12px;
  padding: 11px 13px;
  border: 1px solid rgba(49, 212, 181, 0.4);
  border-radius: var(--radius);
  background: var(--teal-soft);
}

.invite-result > span,
.auth-field > span {
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 650;
  display: block;
  margin-bottom: 6px;
}

.invite-link-row {
  display: flex;
  gap: 8px;
}

.invite-link-row input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--teal);
  font-family: var(--mono);
  font-size: 11px;
}

.invite-result small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.invite-list {
  max-height: 200px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding: 4px 0;
}

.invite-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
}

.invite-row:last-child {
  border-bottom: 0;
}

.invite-row > div {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.invite-row strong {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-row small {
  color: var(--muted);
  font-size: 10.5px;
}

.invite-status {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--teal);
  white-space: nowrap;
}

.invite-status[data-status="expired"],
.invite-status[data-status="revoked"] {
  color: var(--muted);
}

.invite-status[data-status="used"] {
  color: var(--amber);
}

.invite-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.revoke-invite {
  padding: 3px 8px;
  font-size: 11px;
}

.paper-replay-summary {
  display: grid;
  gap: 7px;
  margin-bottom: 8px;
}

.paper-replay-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11.5px;
}

.paper-replay-line span {
  color: var(--muted-strong);
}

.paper-replay-line b {
  font-family: var(--mono);
  font-weight: 650;
  text-align: right;
}

/* ============================ 登录页 ============================ */

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 85% -10%, rgba(49, 212, 181, 0.07), transparent 60%),
    radial-gradient(900px 480px at -10% 110%, rgba(125, 180, 239, 0.06), transparent 60%),
    var(--bg);
}

.auth-shell {
  width: min(400px, 100%);
}

.auth-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 30px 30px 26px;
}

.auth-brand {
  margin-bottom: 22px;
}

.auth-kicker {
  color: var(--teal);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.auth-panel h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.auth-message {
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 109, 112, 0.4);
  border-radius: var(--radius);
  background: var(--coral-soft);
  color: var(--coral);
  font-size: 12px;
  line-height: 1.5;
}

.auth-message[data-tone="success"] {
  border-color: rgba(49, 212, 181, 0.4);
  background: var(--teal-soft);
  color: var(--teal);
}

.auth-form {
  display: grid;
  gap: 13px;
}

.auth-field input,
.invite-link-row input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.auth-field input:focus,
.invite-link-row input:focus {
  outline: 0;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.auth-field input[readonly] {
  color: var(--muted-strong);
  cursor: default;
}

.auth-field em {
  font-style: normal;
  color: var(--muted);
  font-size: 10.5px;
}

.auth-submit,
.primary-button {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: var(--radius);
  background: var(--teal);
  color: #06231d;
  font-size: 13.5px;
  font-weight: 750;
  transition: filter 0.15s ease;
}

.auth-submit:hover,
.primary-button:hover {
  filter: brightness(1.1);
}

.auth-submit:disabled,
.primary-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.auth-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.auth-foot a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}

.auth-foot a:hover {
  text-decoration: underline;
}

/* ============================ 页脚 ============================ */

.footer-bar {
  min-height: 38px;
  padding: 0 clamp(14px, 2.6vw, 40px);
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.footer-separator {
  color: var(--line-strong);
}

.footer-spacer {
  flex: 1;
}

.footer-bar b {
  color: var(--amber);
  font-weight: 700;
}

.footer-bar b.live { color: var(--teal); }

/* ============================ 响应式 ============================ */

@media (max-width: 1240px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .alert-list {
    max-height: 320px;
  }

  .rules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .paper-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .topbar {
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 8px;
  }

  .topbar-left {
    flex-basis: 100%;
    justify-content: space-between;
  }

  .topbar-actions {
    flex-basis: 100%;
    justify-content: flex-end;
  }

  .kpi-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-item:nth-child(3) {
    border-left: 0;
  }

  .kpi-item:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .side-column,
  .paper-grid {
    grid-template-columns: 1fr;
  }

  .history-panel {
    grid-column: auto;
  }

  .account-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .account-hero {
    min-width: 0;
  }

  .rules-grid {
    grid-template-columns: 1fr;
  }

  .brand-copy {
    display: none;
  }

  .account-badge {
    display: none;
  }
}

@media (max-width: 560px) {
  .tab-button {
    padding: 0 10px;
    font-size: 12.5px;
  }

  .server-clock {
    display: none;
  }

  .score-filter input {
    width: 80px;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-stat:nth-child(3n) { border-right: 1px solid var(--line); }
  .detail-stat:nth-child(2n) { border-right: 0; }
  .detail-stat:nth-last-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .detail-stat:nth-last-child(-n + 2) { border-bottom: 0; }

  .account-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
