/* ═══════════════════════════════════════════════════════════════════════
 * Whale Monitor V2 · Design System
 * 词汇底层来自 binance-monitor V1（color/panel/badge/dot 等已验证好用）
 * 现代化点缀：Inter 字体、Horizon 风格 sidebar/topbar、shadcn 风格 form
 * ═══════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ─── Tokens ─── */
:root {
  --bg:        #050816;
  --bg-grad:   radial-gradient(circle at top, #0b1120 0, #020617 55%, #000 100%);
  --card:      rgba(15,23,42,0.92);
  --card-2:    rgba(15,23,42,0.8);
  --border:    rgba(31,41,55,0.9);
  --border-2:  rgba(55,65,81,0.65);

  --text:      #e5e7eb;
  --text-2:    #cbd5e1;
  --muted:     #9ca3af;
  --dim:       #64748b;

  --accent:    #3b82f6;          /* 主蓝 */
  --accent-2:  #60a5fa;
  --accent-bg: rgba(59,130,246,0.12);

  --success:   #22c55e;
  --warning:   #eab308;
  --danger:    #ef4444;
  --purple:    #a855f7;          /* 异动紫 */
  --orange:    #f97316;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-1:  0 4px 12px rgba(0,0,0,0.35);
  --shadow-2:  0 8px 24px rgba(0,0,0,0.5);
  --shadow-glow-blue:   0 0 0 3px rgba(59,130,246,0.3);
  --shadow-glow-purple: 0 0 0 3px rgba(168,85,247,0.3);
}

/* ─── Reset ─── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #93c5fd; }
button { font-family: inherit; }

/* ─── Layout ─── */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 56px 1fr;
}
.app.with-sidebar { grid-template-columns: 240px 1fr; grid-template-areas: "topbar topbar" "sidebar main"; }
.app.with-sidebar > .topbar  { grid-area: topbar; }
.app.with-sidebar > .sidebar { grid-area: sidebar; }
.app.with-sidebar > .main    { grid-area: main; }

.main {
  padding: 20px 24px 40px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Top Bar ─── */
.topbar {
  display: flex; align-items: center;
  padding: 0 20px;
  background: rgba(11,15,24,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: #fff; }
.brand-logo {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.brand-tag {
  font-size: 10px; font-weight: 500;
  padding: 2px 6px; border-radius: 4px;
  background: var(--accent-bg); color: var(--accent-2);
  margin-left: 4px;
}

.nav-tabs {
  display: flex; align-items: center; gap: 2px;
  margin-left: 24px; flex: 1;
  overflow-x: auto;
}
.nav-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--muted);
  background: transparent; border: none;
  border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap;
  transition: all 0.15s;
}
.nav-tab:hover { color: var(--text); background: rgba(59,130,246,0.06); }
.nav-tab.active {
  color: #93c5fd;
  background: var(--accent-bg);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.nav-tab i { font-size: 14px; opacity: 0.85; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ─── Live indicator ─── */
.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.4);
  color: #86efac;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: radial-gradient(circle, #22c55e, #16a34a);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.35), 0 0 8px rgba(34,197,94,0.8);
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ─── Status dots (loading/ok/error) ─── */
.dot { width:8px; height:8px; border-radius:999px; display:inline-block; }
.dot-ok      { background:radial-gradient(circle,#22c55e,#16a34a); box-shadow:0 0 0 3px rgba(34,197,94,0.3),0 0 8px rgba(34,197,94,0.7); }
.dot-loading { background:radial-gradient(circle,#eab308,#ca8a04); box-shadow:0 0 0 3px rgba(234,179,8,0.3),0 0 8px rgba(234,179,8,0.8); animation:pulse 1.4s infinite; }
.dot-error   { background:radial-gradient(circle,#ef4444,#b91c1c); box-shadow:0 0 0 3px rgba(239,68,68,0.3),0 0 8px rgba(239,68,68,0.8); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
  background: rgba(30,41,59,0.6);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap;
  transition: all 0.12s;
}
.btn:hover { background: rgba(51,65,85,0.8); border-color: rgba(96,165,250,0.5); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  color: #dbeafe;
  background: radial-gradient(circle at 0 0, rgba(96,165,250,0.4), transparent 70%), rgba(59,130,246,0.5);
  border-color: rgba(37,99,235,0.8);
}
.btn-primary:hover { background: radial-gradient(circle at 0 0, rgba(96,165,250,0.55), transparent 70%), rgba(59,130,246,0.65); }

.btn-purple {
  color: #e9d5ff;
  background: radial-gradient(circle at 0 0, rgba(168,85,247,0.35), transparent 70%), rgba(124,58,237,0.4);
  border-color: rgba(168,85,247,0.7);
}
.btn-danger {
  color: #fecaca;
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.5);
}
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }

/* ─── Cards / Panels ─── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
}
.card-lg { padding: 20px; border-radius: var(--radius-lg); }
.card-hover { transition: transform 0.15s, border-color 0.15s; }
.card-hover:hover { transform: translateY(-2px); border-color: rgba(96,165,250,0.4); }

.panel {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(55,65,81,0.9);
  padding: 14px;
  position: relative;
  overflow: hidden;
}
.panel-blue   { background: radial-gradient(circle at 0 0,rgba(59,130,246,0.12),transparent 60%),radial-gradient(circle at 100% 0,rgba(56,189,248,0.10),transparent 50%),linear-gradient(135deg,rgba(15,23,42,0.95),rgba(3,7,18,0.98)); }
.panel-green  { background: radial-gradient(circle at 0 0,rgba(34,197,94,0.13),transparent 60%),linear-gradient(135deg,rgba(15,23,42,0.95),rgba(2,6,23,0.98)); }
.panel-purple { background: radial-gradient(circle at 0 0,rgba(168,85,247,0.14),transparent 58%),radial-gradient(circle at 100% 0,rgba(249,115,22,0.16),transparent 50%),linear-gradient(135deg,rgba(15,23,42,0.95),rgba(2,6,23,0.98)); }
.panel-cold   { background: radial-gradient(circle at 0 0,rgba(56,189,248,0.1),transparent 58%),linear-gradient(135deg,rgba(15,23,42,0.95),rgba(2,6,23,0.98)); }
.panel::after { content:""; position:absolute; inset:0; background:radial-gradient(circle at 50% -40%,rgba(248,250,252,0.10),transparent 70%); mix-blend-mode:soft-light; opacity:0.7; pointer-events:none; }

.panel-header { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:10px; position:relative; z-index:1; }
.panel-title  { font-size:14px; font-weight:600; display:flex; align-items:center; gap:6px; }
.panel-sub    { font-size:11px; color: rgba(209,213,219,0.7); margin-top:2px; }
.panel > * { position: relative; z-index: 1; }

/* ─── Stat cards ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content:""; position:absolute; inset:0;
  background: radial-gradient(circle at 100% 0%, rgba(59,130,246,0.06), transparent 60%);
  pointer-events: none;
}
.stat-label { font-size:11px; color: var(--muted); margin-bottom:6px; display:flex; align-items:center; gap:4px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-sub   { font-size:11px; color: var(--muted); margin-top:4px; }
.stat-trend { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; display: inline-block; margin-top: 6px; }
.stat-trend.up   { color: #86efac; background: rgba(34,197,94,0.15); }
.stat-trend.down { color: #fca5a5; background: rgba(239,68,68,0.15); }

/* ─── Badges / Chips ─── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 500;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(15,23,42,0.85);
  border: 1px solid rgba(148,163,184,0.4);
  color: var(--muted);
  text-transform: none; letter-spacing: 0.02em;
}
.badge-blue   { color:#bfdbfe; background:rgba(59,130,246,0.18);  border-color:rgba(59,130,246,0.55); }
.badge-green  { color:#bbf7d0; background:rgba(34,197,94,0.18);   border-color:rgba(34,197,94,0.6); }
.badge-purple { color:#e9d5ff; background:rgba(168,85,247,0.2);   border-color:rgba(168,85,247,0.6); }
.badge-orange { color:#fed7aa; background:rgba(249,115,22,0.18);  border-color:rgba(249,115,22,0.6); }
.badge-red    { color:#fecaca; background:rgba(239,68,68,0.18);   border-color:rgba(239,68,68,0.55); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: rgba(30,41,59,0.85);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.chip:hover { border-color: rgba(96,165,250,0.5); cursor: pointer; }

/* ─── Tables ─── */
.tw {
  border-radius: var(--radius);
  background: rgba(15,23,42,0.92);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
table.t {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
table.t thead {
  background: linear-gradient(90deg, rgba(11,15,24,0.98), rgba(15,23,42,0.92));
}
table.t th {
  font-weight: 500; font-size: 11px;
  color: rgba(209,213,219,0.85);
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px; text-align: left;
  position: sticky; top: 0; z-index: 1;
}
table.t td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid rgba(31,41,55,0.5);
}
table.t tr:last-child td { border-bottom: none; }
table.t tbody tr:hover td { background: rgba(30,64,175,0.18); }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; }

.alert-row td { background: rgba(168,85,247,0.06) !important; }
.alert-row:hover td { background: rgba(168,85,247,0.16) !important; }

/* Rank pill */
.rk {
  font-size: 10px;
  width: 18px; height: 18px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.rk-top   { background: radial-gradient(circle at 30% 0, rgba(250,204,21,0.18), rgba(15,23,42,0.98)); border: 1px solid rgba(250,204,21,0.8); color: #facc15; }
.rk-bot   { background: radial-gradient(circle at 30% 0, rgba(248,113,113,0.16), rgba(15,23,42,0.98)); border: 1px solid rgba(248,113,113,0.8); color: #fecaca; }
.rk-surge { background: radial-gradient(circle at 30% 0, rgba(168,85,247,0.22), rgba(15,23,42,0.98)); border: 1px solid rgba(168,85,247,0.75); color: #d8b4fe; }
.rk-cold  { background: radial-gradient(circle at 30% 0, rgba(100,116,139,0.18), rgba(15,23,42,0.98)); border: 1px solid rgba(100,116,139,0.65); color: #94a3b8; }

/* ─── Form controls ─── */
.input, .select, textarea.input {
  font-family: inherit; font-size: 13px;
  padding: 7px 11px;
  background: rgba(15,23,42,0.95);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text); outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) center, calc(100% - 9px) center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
.input-group { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(15,23,42,0.85); border: 1px solid var(--border-2); font-size: 12px; color: var(--muted); }
.input-group .select { background: transparent; border: none; padding: 2px 18px 2px 2px; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(75,85,99,0.6);
  border-radius: 999px;
  transition: background 0.2s;
}
.switch-track::before {
  content: "";
  position: absolute; left: 2px; top: 2px;
  width: 16px; height: 16px;
  background: #fff; border-radius: 999px;
  transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::before { transform: translateX(16px); }
.switch input:disabled + .switch-track { opacity: 0.5; cursor: not-allowed; }

/* ─── Sidebar (token list) ─── */
.sidebar {
  background: rgba(11,15,24,0.7);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
}
.sidebar-search {
  width: 100%;
  padding: 7px 11px;
  background: rgba(15,23,42,0.95);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  margin-bottom: 12px;
  outline: none;
}
.sidebar-section { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 10px 0 6px 4px; }

.token-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
  margin-bottom: 2px;
}
.token-row:hover { background: rgba(30,41,59,0.6); }
.token-row.active { background: var(--accent-bg); border-left: 2px solid var(--accent); padding-left: 8px; }
.token-row.disabled { opacity: 0.4; }
.token-icon { width: 22px; height: 22px; border-radius: 999px; background: linear-gradient(135deg,#1e293b,#0f172a); display:inline-flex; align-items:center; justify-content:center; font-size:10px; font-weight:600; color: var(--muted); }
.token-symbol { font-weight: 600; font-size: 13px; }
.token-meta { font-size: 10px; color: var(--muted); margin-top: 1px; }

/* ─── Dropdown menu ─── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  min-width: 200px;
  background: rgba(11,15,24,0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 6px;
  z-index: 100;
  display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13px;
  cursor: pointer;
}
.dropdown-item:hover { background: rgba(59,130,246,0.1); color: var(--text); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.dropdown-section { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 10px 2px; }

/* ─── Alert card (Dashboard 用) ─── */
.alert-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(15,23,42,0.85);
  padding: 14px 16px;
  margin-bottom: 8px;
  position: relative;
  transition: border-color 0.15s;
}
.alert-card:hover { border-color: rgba(168,85,247,0.4); }
.alert-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.alert-card-title { font-weight: 500; flex: 1; }
.alert-card-meta { font-size: 11px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.alert-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.alert-cell { background: rgba(11,15,24,0.6); border: 1px solid var(--border); padding: 6px 10px; border-radius: var(--radius-sm); }
.alert-cell-label { font-size: 10px; color: var(--muted); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.alert-cell-value { font-size: 14px; font-weight: 600; }

/* ─── Toast ─── */
#toasts { position: fixed; top: 70px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 12px; font-weight: 500;
  background: rgba(11,15,24,0.97);
  color: var(--text);
  box-shadow: var(--shadow-2);
  border: 1px solid var(--border);
  pointer-events: auto;
  animation: toastIn .25s ease-out, toastOut .35s ease-in 4.4s forwards;
  max-width: 360px;
}
.toast.success { border-color: rgba(34,197,94,0.5); color: #bbf7d0; box-shadow: var(--shadow-2), 0 0 18px rgba(34,197,94,0.18); }
.toast.error   { border-color: rgba(239,68,68,0.55); color: #fecaca; box-shadow: var(--shadow-2), 0 0 18px rgba(239,68,68,0.18); }
.toast.warn    { border-color: rgba(234,179,8,0.55); color: #fde68a; box-shadow: var(--shadow-2), 0 0 18px rgba(234,179,8,0.18); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(20px); } }

/* ─── Skeleton / Loading ─── */
.skeleton {
  background: linear-gradient(90deg, rgba(30,41,59,0.4), rgba(51,65,85,0.6), rgba(30,41,59,0.4));
  background-size: 200% 100%;
  animation: skel 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── Utilities ─── */
.muted { color: var(--muted); }
.dim   { color: var(--dim); }
.bull  { color: var(--success); font-weight: 600; }
.bear  { color: var(--orange);  font-weight: 600; }
.surge { color: var(--purple);  font-weight: 600; }
.danger{ color: var(--danger);  font-weight: 600; }
.mono  { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-1 { flex: 1; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1400px) { .grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px)  { .grid-4, .grid-3, .grid-2, .grid-5 { grid-template-columns: 1fr; } .nav-tabs { gap: 0; } .nav-tab { padding: 8px 10px; } .main { padding: 16px 14px; } }

.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }

.text-sm  { font-size: 12px; }
.text-xs  { font-size: 11px; }
.text-lg  { font-size: 16px; }
.text-xl  { font-size: 20px; }
.text-2xl { font-size: 28px; }

.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; line-height: 1.2; }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

.scroll-y { overflow-y: auto; }
.h-screen-minus-topbar { height: calc(100vh - 56px); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(75,85,99,0.5); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(75,85,99,0.8); }

/* ═══════════════════════════════════════════════════════════════════════
 * LIGHT THEME OVERRIDES — html[data-theme="light"]
 * 用法：在 <html> 上加 data-theme="light"，全部组件自动切换
 * ═══════════════════════════════════════════════════════════════════════ */
html[data-theme="light"] {
  --bg:        #f3f6fb;
  --bg-grad:   radial-gradient(circle at top, #ffffff 0, #eef2f7 50%, #e2e8f0 100%);
  --card:      #ffffff;
  --card-2:    #f8fafc;
  --border:    rgba(15,23,42,0.08);
  --border-2:  rgba(15,23,42,0.12);

  --text:      #0f172a;
  --text-2:    #334155;
  --muted:     #64748b;
  --dim:       #94a3b8;

  --accent-bg: rgba(59,130,246,0.10);
}
html[data-theme="light"] body { color: var(--text); }

/* Top bar light */
html[data-theme="light"] .topbar {
  background: rgba(255,255,255,0.88);
  border-bottom: 1px solid var(--border);
}
html[data-theme="light"] .brand { color: #0f172a; }
html[data-theme="light"] .brand-tag { background: rgba(59,130,246,0.12); color: #1d4ed8; }

html[data-theme="light"] .nav-tab { color: var(--muted); }
html[data-theme="light"] .nav-tab:hover { color: var(--text); background: rgba(59,130,246,0.06); }
html[data-theme="light"] .nav-tab.active { color: #1d4ed8; background: rgba(59,130,246,0.10); box-shadow: inset 0 -2px 0 var(--accent); }

html[data-theme="light"] .live-pill { background: rgba(34,197,94,0.10); color: #15803d; border-color: rgba(34,197,94,0.4); }

/* Buttons light */
html[data-theme="light"] .btn { background: #ffffff; color: var(--text); border-color: var(--border-2); box-shadow: 0 1px 2px rgba(15,23,42,0.04); }
html[data-theme="light"] .btn:hover { background: #f8fafc; border-color: rgba(59,130,246,0.45); }
html[data-theme="light"] .btn-primary { color: #ffffff; background: linear-gradient(135deg, #3b82f6, #2563eb); border-color: #2563eb; }
html[data-theme="light"] .btn-primary:hover { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
html[data-theme="light"] .btn-purple { color: #ffffff; background: linear-gradient(135deg, #a855f7, #7c3aed); border-color: #7c3aed; }
html[data-theme="light"] .btn-danger { color: #b91c1c; background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.4); }

/* Cards light */
html[data-theme="light"] .card { background: var(--card); border-color: var(--border); box-shadow: 0 1px 3px rgba(15,23,42,0.06); }

/* Stat light */
html[data-theme="light"] .stat { background: var(--card); border-color: var(--border); box-shadow: 0 1px 3px rgba(15,23,42,0.05); }
html[data-theme="light"] .stat::before { background: radial-gradient(circle at 100% 0%, rgba(59,130,246,0.04), transparent 60%); }
html[data-theme="light"] .stat-value { color: #0f172a; }

/* Panels light — 改为柔和的有色阴影 + 浅渐变 */
html[data-theme="light"] .panel {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15,23,42,0.05);
}
html[data-theme="light"] .panel::after { display: none; }
html[data-theme="light"] .panel-blue   { background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%); border-color: rgba(59,130,246,0.18); }
html[data-theme="light"] .panel-green  { background: linear-gradient(135deg, #ffffff 0%, #ecfdf5 100%); border-color: rgba(34,197,94,0.18); }
html[data-theme="light"] .panel-purple { background: linear-gradient(135deg, #ffffff 0%, #faf5ff 100%); border-color: rgba(168,85,247,0.20); }
html[data-theme="light"] .panel-cold   { background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%); border-color: rgba(56,189,248,0.18); }
html[data-theme="light"] .panel-sub { color: #475569; }

/* Tables light */
html[data-theme="light"] .tw { background: var(--card); border-color: var(--border); }
html[data-theme="light"] table.t thead { background: linear-gradient(90deg, #f8fafc, #f1f5f9); }
html[data-theme="light"] table.t th { color: #475569; border-bottom-color: var(--border); }
html[data-theme="light"] table.t td { border-bottom-color: rgba(15,23,42,0.05); }
html[data-theme="light"] table.t tbody tr:hover td { background: rgba(59,130,246,0.06); }
html[data-theme="light"] .alert-row td { background: rgba(168,85,247,0.05) !important; }
html[data-theme="light"] .alert-row:hover td { background: rgba(168,85,247,0.10) !important; }

/* Badges / chips light */
html[data-theme="light"] .badge { background: #f1f5f9; color: #475569; border-color: var(--border-2); }
html[data-theme="light"] .badge-blue   { background: #dbeafe; color: #1e40af; border-color: rgba(59,130,246,0.3); }
html[data-theme="light"] .badge-green  { background: #d1fae5; color: #065f46; border-color: rgba(34,197,94,0.3); }
html[data-theme="light"] .badge-purple { background: #ede9fe; color: #5b21b6; border-color: rgba(168,85,247,0.3); }
html[data-theme="light"] .badge-orange { background: #ffedd5; color: #9a3412; border-color: rgba(249,115,22,0.3); }
html[data-theme="light"] .badge-red    { background: #fee2e2; color: #991b1b; border-color: rgba(239,68,68,0.3); }
html[data-theme="light"] .chip { background: #ffffff; color: #334155; border-color: var(--border-2); box-shadow: 0 1px 2px rgba(15,23,42,0.04); }

/* Form controls light */
html[data-theme="light"] .input,
html[data-theme="light"] .select,
html[data-theme="light"] textarea.input { background: #ffffff; color: var(--text); border-color: var(--border-2); }
html[data-theme="light"] .input-group { background: #ffffff; color: var(--muted); border-color: var(--border-2); }

/* Switch light */
html[data-theme="light"] .switch-track { background: #cbd5e1; }
html[data-theme="light"] .switch input:checked + .switch-track { background: var(--accent); }

/* Sidebar / dropdown light */
html[data-theme="light"] .sidebar { background: rgba(248,250,252,0.85); border-right-color: var(--border); }
html[data-theme="light"] .sidebar-search { background: #ffffff; border-color: var(--border-2); color: var(--text); }
html[data-theme="light"] .token-row:hover { background: #f1f5f9; }
html[data-theme="light"] .token-row.active { background: rgba(59,130,246,0.10); }
html[data-theme="light"] .token-icon { background: linear-gradient(135deg,#e2e8f0,#cbd5e1); color: #475569; }

html[data-theme="light"] .dropdown-menu { background: #ffffff; border-color: var(--border); box-shadow: 0 8px 24px rgba(15,23,42,0.12); }
html[data-theme="light"] .dropdown-item { color: var(--text-2); }
html[data-theme="light"] .dropdown-item:hover { background: rgba(59,130,246,0.08); color: var(--text); }
html[data-theme="light"] .dropdown-divider { background: var(--border); }

/* Alert card light */
html[data-theme="light"] .alert-card { background: var(--card); border-color: var(--border); box-shadow: 0 1px 3px rgba(15,23,42,0.05); }
html[data-theme="light"] .alert-cell { background: #f8fafc; border-color: var(--border); }
html[data-theme="light"] .alert-cell-label { color: var(--muted); }

/* Toast light */
html[data-theme="light"] .toast { background: #ffffff; color: var(--text); border-color: var(--border); box-shadow: 0 8px 24px rgba(15,23,42,0.15); }
html[data-theme="light"] .toast.success { color: #065f46; border-color: rgba(34,197,94,0.4); box-shadow: 0 8px 24px rgba(34,197,94,0.18); }
html[data-theme="light"] .toast.error   { color: #991b1b; border-color: rgba(239,68,68,0.45); box-shadow: 0 8px 24px rgba(239,68,68,0.18); }
html[data-theme="light"] .toast.warn    { color: #92400e; border-color: rgba(234,179,8,0.45); box-shadow: 0 8px 24px rgba(234,179,8,0.15); }

/* Skeleton light */
html[data-theme="light"] .skeleton {
  background: linear-gradient(90deg, #e2e8f0, #f1f5f9, #e2e8f0);
  background-size: 200% 100%;
}

/* Scrollbar light */
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(15,23,42,0.18); }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(15,23,42,0.32); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: modalIn 0.18s ease-out;
}
html[data-theme="light"] .modal-overlay { background: rgba(15,23,42,0.35); }
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  min-width: 420px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close {
  border: none; background: transparent;
  font-size: 22px; line-height: 1; color: var(--muted);
  cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-footer {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  padding: 12px 18px; border-top: 1px solid var(--border);
}
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 12px; color: var(--muted); font-weight: 500; }
.form-hint { font-size: 11px; color: var(--dim); margin-top: 2px; }

/* Theme toggle button (在 topbar 里) */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 16px;
  transition: background 0.12s, border-color 0.12s;
}
.theme-toggle:hover { background: rgba(148,163,184,0.12); border-color: rgba(96,165,250,0.4); }
