:root, body.theme-dark {
  --bg-0: #07090f;
  --bg-1: #0c1220;
  --bg-2: #111a2e;
  --panel: rgba(20, 28, 48, 0.55);
  --panel-solid: #131b2e;
  --border: rgba(120, 140, 200, 0.12);
  --border-strong: rgba(140, 160, 220, 0.22);
  --text: #e7ecf5;
  --text-dim: #9aa6c2;
  --muted: #5f6b87;

  --accent: #4fd1ff;
  --accent-2: #7c5cff;

  --up: #25e0a0;
  --up-glow: rgba(37, 224, 160, 0.35);
  --down: #ff5577;
  --down-glow: rgba(255, 85, 119, 0.35);

  --bybit: #f7a600;
  --bybit-soft: rgba(247, 166, 0, 0.16);
  --aster: #ff4dd2;
  --aster-soft: rgba(255, 77, 210, 0.16);
  --kucoin: #24ae8f;
  --kucoin-soft: rgba(36, 174, 143, 0.16);
  --binance: #fcd535;
  --binance-soft: rgba(252, 213, 53, 0.16);
  --hyperliquid: #97fce4;
  --hyperliquid-soft: rgba(151, 252, 228, 0.16);
  --okx: #3b8aff;
  --okx-soft: rgba(59, 138, 255, 0.16);
  --gate: #17a2ff;
  --gate-soft: rgba(23, 162, 255, 0.16);
  --bitget: #00f0ff;
  --bitget-soft: rgba(0, 240, 255, 0.16);
  --htx: #0d8be9;
  --htx-soft: rgba(13, 139, 233, 0.16);
  --mexc: #1eb8a5;
  --mexc-soft: rgba(30, 184, 165, 0.16);
  --lighter: #c08bff;
  --lighter-soft: rgba(192, 139, 255, 0.16);
  --weex: #ff6b35;
  --weex-soft: rgba(255, 107, 53, 0.16);

  --radius: 11px;
  --radius-sm: 8px;

  --sidebar-w: 44px;
  --sidebar-bg: rgba(10, 14, 24, 0.7);
  --sidebar-border: rgba(120, 140, 200, 0.10);

  --input-bg: rgba(8, 12, 22, 0.7);
  --pill-bg: rgba(8, 12, 22, 0.5);
  --popover-bg: rgba(12, 18, 32, 0.96);
  --brand-grad: linear-gradient(90deg, #ffffff 0%, #b6c5e8 100%);
}

body.theme-light {
  --bg-0: #f3f5fa;
  --bg-1: #e7ebf3;
  --bg-2: #dde3ee;
  --panel: rgba(255, 255, 255, 0.7);
  --panel-solid: #ffffff;
  --border: rgba(20, 30, 60, 0.08);
  --border-strong: rgba(20, 30, 60, 0.18);
  --text: #1a2236;
  --text-dim: #4d5878;
  --muted: #8a93ab;
  --sidebar-bg: rgba(255, 255, 255, 0.85);
  --sidebar-border: rgba(20, 30, 60, 0.08);

  --input-bg: rgba(255, 255, 255, 0.8);
  --pill-bg: rgba(255, 255, 255, 0.65);
  --popover-bg: rgba(255, 255, 255, 0.96);
  --brand-grad: linear-gradient(90deg, #1a2236 0%, #4a5a82 100%);

  /* В светлой теме часть фирменных цветов слишком блеклые на белом фоне.
     Делаем их более насыщенными/контрастными. */
  --hyperliquid: #11b4a3;
  --hyperliquid-soft: rgba(17, 180, 163, 0.18);
  --binance: #d4a514;
  --binance-soft: rgba(212, 165, 20, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11.5px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(79, 209, 255, 0.12), transparent 55%),
    linear-gradient(180deg, #07090f 0%, #050810 100%);
  padding: 0;
}

body.theme-light {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(79, 209, 255, 0.10), transparent 55%),
    linear-gradient(180deg, #eef1f8 0%, #e2e7f1 100%);
}

.main {
  margin-left: var(--sidebar-w);
  padding: 8px 0 10px;
  display: flex;
  flex-direction: column;
  /* Lock the layout to the viewport so the chart-area is the only flexing
     child — collapsing the exchange-preview cards then hands its space to
     the charts, and window resizes scale them proportionally. */
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  z-index: 200;
}

.sidebar-top, .sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.sidebar-logo {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(79, 209, 255, 0.18), rgba(124, 92, 255, 0.14));
  color: #d8efff;
  border: 1px solid rgba(79, 209, 255, 0.28);
}

.sidebar-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
  padding: 0;
}

.sidebar-btn:hover {
  color: var(--text);
  background: rgba(120, 140, 200, 0.08);
  border-color: var(--border-strong);
}

.sidebar-account {
  cursor: pointer;
  border-color: var(--border);
  color: var(--text-dim);
  overflow: hidden;
  padding: 0;
}

.sidebar-account .account-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.account-avatar { overflow: hidden; padding: 0; position: relative; }
.account-avatar .account-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.sidebar-account:hover {
  border-color: var(--border-strong);
  background: rgba(120, 140, 200, 0.06);
}
.sidebar-account.open {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(79, 209, 255, 0.10);
}

.account-popover {
  position: fixed;
  left: calc(var(--sidebar-w) + 8px);
  top: 60px;
  z-index: 300;
  min-width: 240px;
  padding: 12px 14px;
  background: var(--popover-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-popover[hidden] { display: none; }

/* ----- News (release notes) ----- */
.sidebar-news { position: relative; }
.news-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4d6a;
  box-shadow: 0 0 0 2px var(--sidebar-bg, #0a0f1c);
  animation: news-pulse 1.6s ease-in-out infinite;
  pointer-events: none;
}
.news-dot[hidden] { display: none; }
@keyframes news-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--sidebar-bg, #0a0f1c), 0 0 0 0 rgba(255, 77, 106, 0.55); }
  50%      { box-shadow: 0 0 0 2px var(--sidebar-bg, #0a0f1c), 0 0 0 6px rgba(255, 77, 106, 0); }
}

.news-popover {
  position: fixed;
  left: calc(var(--sidebar-w) + 8px);
  bottom: 12px;
  z-index: 300;
  width: 380px;
  max-width: calc(100vw - var(--sidebar-w) - 24px);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--popover-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  overflow: hidden;
}
.news-popover[hidden] { display: none; }
.news-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.news-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text);
}
.news-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
}
.news-close:hover { color: var(--text); background: rgba(120, 140, 200, 0.12); }
.news-list {
  overflow-y: auto;
  padding: 6px 4px 8px;
}
.news-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.news-item:last-child { border-bottom: 0; }
.news-item__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.news-item__date {
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}
.news-item__title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.news-item__body {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-line;
}
.news-item.is-unread .news-item__title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #ff4d6a;
  vertical-align: middle;
}
.news-empty {
  padding: 24px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

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

.account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(79, 209, 255, 0.18), rgba(124, 92, 255, 0.14));
  border: 1px solid rgba(79, 209, 255, 0.28);
  color: #d8efff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.account-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
}

.account-email {
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
  color: var(--text);
  word-break: break-all;
  margin-top: 2px;
}

.account-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
  color: var(--down);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}

.account-logout:hover {
  border-color: rgba(255, 85, 119, 0.45);
  background: rgba(255, 85, 119, 0.08);
}

.account-version {
  margin-top: 2px;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.4px;
  color: var(--muted);
  text-align: center;
  user-select: text;
}

.sidebar-btn .ico-sun  { display: none; }
.sidebar-btn .ico-moon { display: block; }

body.theme-light .sidebar-btn .ico-sun  { display: block; }
body.theme-light .sidebar-btn .ico-moon { display: none; }

@media (max-width: 600px) {
  :root { --sidebar-w: 48px; }
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ---------- TOPBAR ---------- */
.topbar {
  position: relative;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  margin-bottom: 8px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 30px rgba(0, 0, 0, 0.35);
}

body.theme-light .topbar {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 4px 14px rgba(20, 30, 60, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px var(--accent), 0 0 28px var(--accent-2);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.85); opacity: 0.75; }
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2px;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ---------- CONTROLS ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ctrl {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ctrl-label {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  padding-left: 2px;
}

.ctrl select,
.ctrl input,
.btn-refresh {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
  min-width: 90px;
  outline: none;
  font-family: inherit;
}

.ctrl input {
  cursor: text;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-family: "JetBrains Mono", monospace;
}

.ctrl input::placeholder { color: var(--muted); text-transform: none; }

.combobox {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 1001;
}

.combobox input {
  padding-right: 30px;
  min-width: 130px;
}

.combobox-caret {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  transition: transform 0.18s, opacity 0.15s;
}
.combobox.open .combobox-caret { transform: translateY(-50%) rotate(180deg); }
.combobox.loading .combobox-caret { opacity: 0; }

.combobox.loading::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid rgba(79, 209, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: cb-spin 0.8s linear infinite;
  pointer-events: none;
}
@keyframes cb-spin { to { transform: rotate(360deg); } }

.combobox-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--popover-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1002;
  display: none;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
}
.combobox.open .combobox-list { display: block; }

.combobox-list li {
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-dim);
  white-space: nowrap;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.combobox-list li:hover,
.combobox-list li.active {
  background: rgba(79, 209, 255, 0.10);
  color: var(--text);
}

.combobox-list li mark {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}

.combobox-list .empty {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  cursor: default;
  text-align: center;
}
.combobox-list .empty:hover { background: transparent; }

.ctrl select:hover,
.ctrl input:hover,
.btn-refresh:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 209, 255, 0.08);
}

.ctrl select:focus,
.ctrl input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 209, 255, 0.15);
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-end;
  background: linear-gradient(180deg, rgba(79, 209, 255, 0.18), rgba(124, 92, 255, 0.12));
  color: #d8efff;
  border-color: rgba(79, 209, 255, 0.35);
  font-weight: 600;
}

body.theme-light .btn-refresh {
  background: linear-gradient(180deg, rgba(79, 209, 255, 0.22), rgba(124, 92, 255, 0.16));
  color: #1a3450;
  border-color: rgba(79, 130, 200, 0.35);
}

.btn-refresh:active { transform: translateY(1px); }

/* ---------- LIVE TOGGLE ---------- */
.btn-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-end;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.2px;
  cursor: pointer;
  background: var(--input-bg);
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.05s;
  outline: none;
}
.btn-live:hover {
  border-color: var(--down);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(255, 85, 119, 0.10);
}
.btn-live:active { transform: translateY(1px); }
.btn-live.disabled,
.btn-live[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: auto;
  filter: grayscale(0.4);
}
.btn-live.disabled:hover,
.btn-live[disabled]:hover {
  border-color: var(--border-strong);
  box-shadow: none;
  color: var(--text-dim);
}
.btn-live .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: none;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-live.on {
  color: #ffe6ec;
  background: linear-gradient(180deg, rgba(255, 85, 119, 0.22), rgba(255, 85, 119, 0.10));
  border-color: rgba(255, 85, 119, 0.55);
}
.btn-live.on .live-dot {
  background: var(--down);
  box-shadow: 0 0 0 0 var(--down-glow);
  animation: live-pulse 1.4s ease-out infinite;
}
body.theme-light .btn-live.on {
  color: #6a0a20;
  background: linear-gradient(180deg, rgba(255, 85, 119, 0.22), rgba(255, 85, 119, 0.12));
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(255, 85, 119, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(255, 85, 119, 0); }
  100% { box-shadow: 0 0 0 0   rgba(255, 85, 119, 0); }
}

.status.live {
  color: var(--down);
  border-color: rgba(255, 85, 119, 0.32);
  background: rgba(255, 85, 119, 0.08);
}

.status {
  align-self: flex-end;
  font-size: 10px;
  color: var(--muted);
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  min-width: 110px;
  text-align: center;
}
.status.ok    { color: var(--up);   border-color: rgba(37, 224, 160, 0.25); }
.status.error { color: var(--down); border-color: rgba(255, 85, 119, 0.25); }
.status.warn  { color: var(--bybit); border-color: rgba(247, 166, 0, 0.32); background: rgba(247, 166, 0, 0.08); }

/* ---------- SUMMARY STRIP ---------- */
.summary {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

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

.sum-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(8px);
}

.sum-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.sum-value {
  font-size: 22px;
  font-weight: 600;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: -0.02em;
}

.sum-delta {
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
  font-weight: 500;
}

/* ---------- CARDS COLLAPSIBLE ---------- */
.cards-block {
  margin-bottom: 8px;
  flex: 0 0 auto;        /* static height — JS auto-collapses on short windows */
}
.cards-block.cards-hidden { display: none; }

.cards-block > .cards-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 2px 0;
  margin: 0 0 4px;
  color: var(--muted);
  transition: color 0.12s;
  flex-wrap: wrap;
  /* Если cards-summary это <button> — сбрасываем дефолты */
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
  width: 100%;
}

.cards-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
}

.ex-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
  font-family: inherit;
  transition: all 0.12s;
}

.ex-tag-btn i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.ex-tag-btn.active {
  color: var(--text);
  border-color: currentColor;
  background: rgba(255, 255, 255, 0.04);
}

.ex-tag-btn:not(.active) {
  opacity: 0.55;
}

.ex-tag-btn:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  opacity: 1;
}

.card.hidden { display: none; }

.cards-block > .cards-summary::-webkit-details-marker { display: none; }
.cards-block > .cards-summary::marker { content: ""; }

.cards-block > .cards-summary:hover { color: var(--text-dim); }

.cards-title {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.cards-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s;
  opacity: 0.75;
}

.cards-block:not([open]) .cards-toggle { transform: rotate(-90deg); }
.cards-block:not([open]) > .cards-summary { margin-bottom: 0; }

/* ---------- CARDS ---------- */
.cards {
  display: grid;
  /* Auto-fill: tightened for 11 exchanges — cards stay 200–260 px wide so
     5–6 fit per row on a 1440 px monitor instead of the old 3. */
  grid-template-columns: repeat(auto-fill, minmax(200px, 260px));
  gap: 8px;
  margin-bottom: 6px;
}

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

.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 40%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px 0;
  font-size: 12px;
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: border-color 0.18s, transform 0.18s;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  opacity: 0.85;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  filter: blur(0.4px);
  pointer-events: none;
}

.card[data-ex="bybit"]       { color: var(--bybit); }
.card[data-ex="aster"]       { color: var(--aster); }
.card[data-ex="kucoin"]      { color: var(--kucoin); }
.card[data-ex="binance"]     { color: var(--binance); }
.card[data-ex="hyperliquid"] { color: var(--hyperliquid); }
.card[data-ex="okx"]         { color: var(--okx); }
.card[data-ex="gate"]        { color: var(--gate); }
.card[data-ex="bitget"]      { color: var(--bitget); }
.card[data-ex="htx"]         { color: var(--htx); }
.card[data-ex="mexc"]        { color: var(--mexc); }
.card[data-ex="lighter"]     { color: var(--lighter); }
.card[data-ex="weex"]        { color: var(--weex); }

.card[data-ex="bybit"]       { box-shadow: 0 0 0 1px rgba(247, 166, 0, 0.06), 0 12px 40px rgba(247, 166, 0, 0.05); }
.card[data-ex="aster"]       { box-shadow: 0 0 0 1px rgba(255, 77, 210, 0.06), 0 12px 40px rgba(255, 77, 210, 0.05); }
.card[data-ex="kucoin"]      { box-shadow: 0 0 0 1px rgba(36, 174, 143, 0.06), 0 12px 40px rgba(36, 174, 143, 0.05); }
.card[data-ex="binance"]     { box-shadow: 0 0 0 1px rgba(252, 213, 53, 0.06), 0 12px 40px rgba(252, 213, 53, 0.05); }
.card[data-ex="hyperliquid"] { box-shadow: 0 0 0 1px rgba(151, 252, 228, 0.06), 0 12px 40px rgba(151, 252, 228, 0.05); }
.card[data-ex="okx"]         { box-shadow: 0 0 0 1px rgba(59, 138, 255, 0.06), 0 12px 40px rgba(59, 138, 255, 0.05); }
.card[data-ex="gate"]        { box-shadow: 0 0 0 1px rgba(23, 162, 255, 0.06), 0 12px 40px rgba(23, 162, 255, 0.05); }
.card[data-ex="bitget"]      { box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.06), 0 12px 40px rgba(0, 240, 255, 0.05); }
.card[data-ex="htx"]         { box-shadow: 0 0 0 1px rgba(13, 139, 233, 0.06), 0 12px 40px rgba(13, 139, 233, 0.05); }
.card[data-ex="mexc"]        { box-shadow: 0 0 0 1px rgba(30, 184, 165, 0.06), 0 12px 40px rgba(30, 184, 165, 0.05); }
.card[data-ex="lighter"]     { box-shadow: 0 0 0 1px rgba(192, 139, 255, 0.06), 0 12px 40px rgba(192, 139, 255, 0.05); }
.card[data-ex="weex"]        { box-shadow: 0 0 0 1px rgba(255, 107, 53, 0.06), 0 12px 40px rgba(255, 107, 53, 0.05); }

.card:hover { transform: translateY(-1px); border-color: var(--border-strong); }

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

.ex-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.ex-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text);
}

.ex-tag {
  margin-left: auto;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  z-index: 1;
}

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

.primary .value {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.primary .unit {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.secondary {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 11px;
  color: var(--text-dim);
}

.secondary .value { color: var(--text); font-weight: 500; }
.secondary .unit  { font-size: 9px; text-transform: uppercase; color: var(--muted); }

.delta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.delta.up   { color: var(--up);   border-color: rgba(37, 224, 160, 0.35); background: rgba(37, 224, 160, 0.08); }
.delta.down { color: var(--down); border-color: rgba(255, 85, 119, 0.35); background: rgba(255, 85, 119, 0.08); }

.delta-period {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sparkline {
  display: block;
  width: 100% !important;
  height: 36px !important;
  margin-top: 4px;
  opacity: 0.95;
}

.spot-cvd-mini {
  margin-top: 3px;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

.mini-chart-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 14px;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.mini-chart-label b {
  max-width: 86px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "JetBrains Mono", monospace;
  font-size: 8.5px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
}

.sparkline-cvd {
  height: 28px !important;
  margin-top: 1px;
  opacity: 0.82;
}

.card-foot {
  margin-top: 2px;
  padding: 5px 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}

/* Chart area = [vertical tool rail] + [unified chart]. The toolbar is a
   slim TradingView-style strip of icon buttons; the chart owns the rest. */
.charts-area {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 4px;
  gap: 0;
}

.chart-toolbar {
  flex: 0 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  backdrop-filter: blur(10px);
}
.chart-toolbar .ct-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.chart-toolbar .ct-btn:hover {
  color: var(--text);
  background: rgba(120, 140, 200, 0.10);
  border-color: var(--border-strong);
}
.chart-toolbar .ct-btn.is-active {
  color: var(--accent);
  background: rgba(79, 209, 255, 0.10);
  border-color: rgba(79, 209, 255, 0.35);
}
.chart-toolbar .ct-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.chart-toolbar .ct-sep {
  width: 22px;
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* TradingView-style measurement badge — solid blue capsule pinned above the
   rectangle the plugin draws. Three text lines stacked vertically. */
.measure-label {
  position: absolute;
  z-index: 4;
  transform: translateX(-50%);     /* X centred on rect midpoint, Y handled in JS */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 10px 7px;
  border-radius: 8px;
  background: #2962ff;
  color: #ffffff;
  font-family: "JetBrains Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(41, 98, 255, 0.45);
}
.measure-label[hidden] { display: none !important; }
.measure-label .measure-line { display: inline-flex; gap: 6px; }
.measure-dur { opacity: 0.85; }

/* TradingView-style single chart with three native panes. The container
   takes the full flex height; lightweight-charts handles every separator,
   pane resize, and price/time axis internally. */
.charts-stack {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) 0;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.lwc-multi {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.spot-cvd-pane-label {
  position: absolute;
  left: 12px;
  z-index: 4;
  pointer-events: none;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(8, 12, 22, 0.58);
  color: var(--text-dim);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

body.theme-light .spot-cvd-pane-label {
  background: rgba(255, 255, 255, 0.72);
}

/* Replica of LightweightCharts' time axis, pinned between the candle pane
   and the OI Δ pane. Visually 1:1 with the strip LC renders at the very
   bottom of the multi-pane stack — same font, colour, tick marks, height. */
.candle-time-axis {
  position: absolute;
  left: 0;
  right: 0;
  height: 22px;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  font-size: 11px;
  color: #8b95b3;                                /* matches chartOpts textColor */
  font-variant-numeric: tabular-nums;
  user-select: none;
  z-index: 4;
  background: transparent;
  border-top: 1px solid rgba(120, 140, 200, 0.10);  /* matches grid border */
}
body.theme-light .candle-time-axis {
  color: #4d5878;
  border-top-color: rgba(20, 30, 60, 0.10);
}
.candle-time-axis .cta-tick {
  position: absolute;
  top: 7px;                /* label baseline sits ~7px below the tick */
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 0 2px;
}
/* The little vertical tick mark above each label, mirroring LC's own axis. */
.candle-time-axis .cta-tick::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -6px;
  width: 1px;
  height: 4px;
  background: rgba(120, 140, 200, 0.30);
  transform: translateX(-50%);
}
body.theme-light .candle-time-axis .cta-tick::before {
  background: rgba(20, 30, 60, 0.30);
}

.lg-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s, transform 0.05s;
  outline: none;
}

.lg-chip:hover { border-color: var(--border-strong); background: rgba(255, 255, 255, 0.04); }
.lg-chip:active { transform: scale(0.98); }
.lg-chip:focus-visible { box-shadow: 0 0 0 2px rgba(79, 209, 255, 0.35); }

.lg-chip.off {
  opacity: 0.42;
  filter: grayscale(0.6);
  text-decoration: line-through;
}

.lg-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.lg-chip[data-ex="bybit"]       i { background: var(--bybit);       box-shadow: 0 0 8px var(--bybit); }
.lg-chip[data-ex="aster"]       i { background: var(--aster);       box-shadow: 0 0 8px var(--aster); }
.lg-chip[data-ex="kucoin"]      i { background: var(--kucoin);      box-shadow: 0 0 8px var(--kucoin); }
.lg-chip[data-ex="binance"]     i { background: var(--binance);     box-shadow: 0 0 8px var(--binance); }
.lg-chip[data-ex="hyperliquid"] i { background: var(--hyperliquid); box-shadow: 0 0 8px var(--hyperliquid); }
.lg-chip[data-ex="okx"]         i { background: var(--okx);         box-shadow: 0 0 8px var(--okx); }
.lg-chip[data-ex="gate"]        i { background: var(--gate);        box-shadow: 0 0 8px var(--gate); }
.lg-chip[data-ex="bitget"]      i { background: var(--bitget);      box-shadow: 0 0 8px var(--bitget); }

.lg-name {
  font-weight: 600;
  color: var(--text);
  font-size: 10px;
}

.lg-stats {
  display: inline-flex;
  gap: 8px;
  padding-left: 6px;
  border-left: 1px solid var(--border);
}

.lg-stat {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 40px;
}

.lg-stat em {
  font-style: normal;
  font-size: 7px;
  color: var(--muted);
  letter-spacing: 0.7px;
}

.lg-stat b {
  font-weight: 500;
  font-family: "JetBrains Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 9px;
  color: var(--text);
  text-transform: none;
  letter-spacing: -0.01em;
  margin-top: 2px;
}

.chart-hint {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

/* (Pane-specific layout / draggable resizer styles removed — handled by
   lightweight-charts v5 internally.) */

/* ---------- FOOTER ---------- */
.footer {
  margin-top: 16px;
  padding: 10px 16px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px dashed var(--border);
  text-align: center;
}

/* ---------- LWC OI TOOLTIP ---------- */
.lwc-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  display: none;
  min-width: 168px;
  padding: 7px 10px 8px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.30);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}
body.theme-light .lwc-tooltip {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 22px rgba(20, 30, 60, 0.14);
}
.lwc-tooltip__time {
  font-size: 10px;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 5px;
}
.lwc-tooltip__row {
  display: flex;
  align-items: center;
  gap: 7px;
  line-height: 1.55;
}
.lwc-tooltip__row i {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}
.lwc-tooltip__ex {
  flex: 1 1 auto;
  text-transform: capitalize;
  color: var(--text-dim);
}
.lwc-tooltip__v {
  flex: 0 0 auto;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Candle OHLC tooltip */
.lwc-tooltip--ohlc { min-width: 168px; }
.lwc-ohlc {
  display: grid;
  grid-template-columns: repeat(2, auto);
  column-gap: 14px;
  row-gap: 2px;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.lwc-ohlc span { display: inline-flex; align-items: baseline; gap: 6px; }
.lwc-ohlc em {
  font-style: normal;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: var(--muted);
  text-transform: uppercase;
  width: 10px;
}
.lwc-ohlc b { color: var(--text); font-weight: 600; font-size: 11.5px; }
.lwc-ohlc__c--up   { color: var(--up); }
.lwc-ohlc__c--down { color: var(--down); }
.lwc-ohlc__change {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}
.lwc-ohlc__change--up   { color: var(--up); }
.lwc-ohlc__change--down { color: var(--down); }
.lwc-ohlc__vol {
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.lwc-ohlc__vol em {
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-size: 9.5px;
}
.lwc-ohlc__vol b { color: var(--text); font-weight: 600; }
.lwc-ohlc__vol span { color: var(--muted); }

/* ---------- SCROLL ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120, 140, 200, 0.18); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 140, 200, 0.32); }

/* ---------- COIN PANEL (watchlist / recent) ---------- */
/* Fixed right column mirroring the icon sidebar. Collapsing overrides the
   width var on <body>, so the panel and .main's margin follow together. */
body { --coinpanel-w: 190px; }
body.cp-collapsed { --coinpanel-w: 34px; }

.main { margin-right: var(--coinpanel-w); }

.coin-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--coinpanel-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--sidebar-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  z-index: 200;
}

.cp-toggle {
  align-self: flex-start;
  width: 26px;
  height: 26px;
  margin: 8px 0 2px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.cp-toggle:hover {
  color: var(--text);
  background: rgba(120, 140, 200, 0.10);
  border-color: var(--border-strong);
}
body.cp-collapsed .cp-toggle-ico { transform: rotate(180deg); }

.cp-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 6px 10px;
}
body.cp-collapsed .cp-body { display: none; }

.cp-title {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  padding: 8px 6px 4px;
}

.cp-sep {
  height: 1px;
  background: var(--border);
  margin: 16px 4px 6px;
}

.cp-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cp-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.3px;
  transition: color 0.12s, background 0.12s;
}
.cp-row:hover {
  color: var(--text);
  background: rgba(120, 140, 200, 0.10);
}
.cp-row.active {
  color: var(--accent);
  background: rgba(79, 209, 255, 0.10);
}
.cp-row .cp-ticker {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cp-pct {
  flex: 0 0 auto;
  min-width: 48px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.cp-pct.up   { color: var(--up); }
.cp-pct.down { color: var(--down); }

.cp-star,
.coin-star {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.cp-star { width: 22px; height: 22px; }
.cp-star:hover, .coin-star:hover {
  color: var(--text);
  background: rgba(120, 140, 200, 0.12);
}
.cp-star.on, .coin-star.on { color: #f5c542; }
.cp-star.on svg path, .coin-star.on svg path { fill: currentColor; }

.coin-star {
  width: 28px;
  height: 28px;
  border-color: var(--border-strong);
  background: var(--input-bg);
}
.coin-star:hover { border-color: var(--accent); }

.coin-ctrl-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cp-empty {
  color: var(--muted);
  font-size: 10px;
  padding: 2px 8px 4px;
  line-height: 1.35;
}

/* ---------- price alerts ---------- */
.cp-alert .cp-alert-level {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: #f5a623;
}
.cp-alert-bell {
  flex: 0 0 auto;
  display: inline-flex;
  color: var(--muted);
}
.cp-alert:hover .cp-alert-bell,
.cp-alert.active .cp-alert-bell { color: currentColor; }
.cp-alert-del { width: 20px; height: 20px; opacity: 0.6; }
.cp-alert:hover .cp-alert-del { opacity: 1; }

.alert-toasts {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.alert-toast {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 260px;
  max-width: 360px;
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  background: var(--popover-bg);
  border: 1px solid var(--border-strong);
  border-left: 3px solid #f5a623;
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  font: inherit;
  animation: alert-toast-in 0.18s ease-out;
}
.alert-toast.up   { border-left-color: var(--up); }
.alert-toast.down { border-left-color: var(--down); }
.alert-toast-title { font-size: 13px; font-weight: 600; }
.alert-toast-sub {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text-dim);
}
@keyframes alert-toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.alert-pop {
  position: fixed;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--popover-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
}
.alert-pop-title { font-size: 13px; font-weight: 600; color: var(--text); }
.alert-pop-sub { font-size: 11px; color: var(--text-dim); }
.alert-pop-del {
  align-self: flex-start;
  margin-top: 2px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  color: var(--down);
  background: transparent;
  border: 1px solid rgba(255, 85, 119, 0.35);
  border-radius: 6px;
  cursor: pointer;
}
.alert-pop-del:hover { background: rgba(255, 85, 119, 0.10); }

.settings-popover {
  position: fixed;
  left: calc(var(--sidebar-w) + 8px);
  z-index: 300;
  min-width: 240px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--popover-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
}
.settings-popover[hidden] { display: none; }
.set-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.set-row span { flex: 1 1 auto; }
.set-variants {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.set-hint { font-size: 11px; color: var(--muted); }
.set-play {
  padding: 0 6px;
  font-size: 10px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
}
.set-play:hover { color: var(--text); }
