/* ═══════════════════════════════════════════════════════
   PlanQx — Premium dark theme, smooth & animated
   All devices: Android, tablet, PC. Perfect color match.
   ═══════════════════════════════════════════════════════ */

:root {
  --neon: #00FFBF;
  --neon-rgb: 0, 255, 191;
  --bg-body: #06080b;
  --bg-surface: #0a0d12;
  --bg-card: #0e1218;
  --bg-hover: #131820;
  --bg-active: #181e28;
  --border: #151b24;
  --border-light: #1e2632;
  --text-primary: #e4ecf2;
  --text-secondary: #8e9cad;
  --text-muted: #4d5a6b;
  --accent: #00FFBF;
  --accent-hover: #33ffcc;
  --accent-glow: rgba(0, 255, 191, 0.45);
  --accent-soft: rgba(0, 255, 191, 0.1);
  --neon-shadow: 0 0 20px rgba(0, 255, 191, 0.3);
  --neon-shadow-strong: 0 0 30px rgba(0, 255, 191, 0.4);
  --sell: #ff4757;
  --sell-hover: #ff6b7a;
  --sell-soft: rgba(255, 71, 87, 0.12);
  --buy: #00FFBF;
  --buy-soft: rgba(0, 255, 191, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --topbar-h: 52px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition);
}

/* Safe area for notched / rounded devices */
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

@media (prefers-reduced-motion: reduce) {
  :root { --transition: 0.08s ease; --transition-fast: 0.06s ease; --transition-smooth: 0.12s ease; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.08s !important; }
}

/* ── Top Bar ───────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-card) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: relative;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

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

.logo {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.logo:hover { opacity: 0.95; transform: translateY(-1px); }
.logo-mark {
  color: var(--neon);
  font-size: 20px;
  filter: drop-shadow(0 0 12px var(--accent-glow)) drop-shadow(0 0 24px rgba(0, 255, 191, 0.25));
  transition: filter var(--transition), transform var(--transition-fast);
}
.logo:hover .logo-mark { filter: drop-shadow(0 0 18px var(--accent-glow)) drop-shadow(0 0 36px rgba(0, 255, 191, 0.3)); }

/* Layout Switcher */
.layout-switcher {
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 4px;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.layout-btn {
  width: 36px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition), transform var(--transition-fast);
  color: var(--text-muted);
}
.layout-btn .material-icons-round { font-size: 18px; transition: transform var(--transition-fast); }
.layout-btn:hover { color: var(--text-secondary); background: var(--bg-hover); transform: scale(1.02); }
.layout-btn:active { transform: scale(0.98); }
.layout-btn.active {
  color: var(--neon);
  background: var(--bg-active);
  box-shadow: 0 0 0 1px rgba(0, 255, 191, 0.3), 0 0 16px rgba(0, 255, 191, 0.12), 0 2px 6px rgba(0,0,0,0.2);
}
.layout-btn.active:hover { color: var(--accent-hover); box-shadow: 0 0 0 1px rgba(0, 255, 191, 0.4), 0 0 24px rgba(0, 255, 191, 0.18); }

/* WS Status */
.ws-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  transition: border-color var(--transition), color var(--transition), box-shadow var(--transition);
}
.ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--transition), box-shadow var(--transition);
}
.ws-status.connected .ws-dot {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
  animation: pulse-dot 2s ease-in-out infinite;
}
.ws-status.connected .ws-text { color: var(--text-secondary); }
.ws-status.connected { border-color: rgba(0, 255, 191, 0.35); box-shadow: 0 0 24px var(--accent-soft), 0 0 40px rgba(0, 255, 191, 0.08); }
.ws-status.error .ws-dot { background: var(--sell); }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 2px var(--accent-glow); }
  50% { opacity: 0.9; box-shadow: 0 0 0 5px var(--accent-glow); }
}

/* ── Chart Grid ────────────────────────────────────────── */
.chart-grid {
  display: grid;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  min-height: 0;
  gap: 3px;
  background: var(--border);
  overflow: hidden;
}

.chart-grid[data-layout="1"] { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.chart-grid[data-layout="2"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.chart-grid[data-layout="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

/* ── Chart Slot ────────────────────────────────────────── */
.chart-slot {
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-height: 0;
  transition: background var(--transition), box-shadow var(--transition);
  animation: slotIn 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
}
@keyframes slotIn {
  from { opacity: 0.6; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}
.chart-slot:focus-within { background: var(--bg-card); box-shadow: inset 0 0 0 1px rgba(0, 255, 191, 0.12); }

/* Slot Header */
.slot-header {
  height: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-surface) 0%, rgba(17,21,28,0.97) 100%);
  flex-shrink: 0;
  z-index: 5;
}

.asset-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  transition: background var(--transition), color var(--transition), transform var(--transition-fast);
  white-space: nowrap;
  color: var(--text-primary);
}
.asset-btn:hover { background: var(--bg-hover); transform: translateY(-1px); }
.asset-btn:active { transform: translateY(0); }
.asset-btn .material-icons-round { font-size: 16px; color: var(--text-muted); transition: transform var(--transition-fast); }
.asset-btn:hover .material-icons-round { transform: translateY(1px); }
.asset-btn .asset-payment {
  font-weight: 600;
  font-size: 11px;
  color: var(--accent);
  margin-left: 2px;
}

.slot-divider { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; opacity: 0.8; }

/* Signal Toggle */
.signal-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
  white-space: nowrap;
}
.signal-toggle:hover { background: var(--bg-hover); color: var(--text-secondary); }
.signal-toggle.active { color: var(--accent); background: var(--accent-soft); }
.signal-toggle .toggle-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition), transform var(--transition-fast), box-shadow var(--transition);
}
.signal-toggle.active .toggle-dot { background: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.signal-toggle:hover .toggle-dot { transform: scale(1.15); }

/* Strategy Selector */
.strategy-sel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.strategy-sel:hover, .strategy-sel:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* ── Candle countdown: time left (broker-style, on chart) ── */
.candle-countdown {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  min-width: 64px;
  background: rgba(14, 18, 24, 0.95);
  border: 1px solid rgba(0, 255, 191, 0.25);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md), 0 0 20px rgba(0, 255, 191, 0.08), 0 0 0 1px rgba(0, 255, 191, 0.06);
  pointer-events: none;
  transition: top var(--transition-smooth), opacity var(--transition-fast), transform var(--transition-fast);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.candle-countdown.hidden { display: none !important; opacity: 0; }
.candle-countdown.countdown-fallback { right: 12px; }
.candle-countdown-row {
  display: flex;
  align-items: baseline;
  gap: 2px;
  line-height: 1.2;
}
.candle-countdown-value {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--neon);
  letter-spacing: -0.02em;
  text-shadow: 0 0 12px var(--accent-glow);
}
.candle-countdown-suffix {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}
.candle-countdown-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
  display: block;
}

/* Slot connection status */
.slot-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
}
.slot-status .slot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition), box-shadow var(--transition);
}
.slot-status.connected .slot-dot {
  background: var(--neon);
  box-shadow: 0 0 0 2px var(--accent-glow), 0 0 12px rgba(0, 255, 191, 0.4);
  animation: pulse-dot 2s ease-in-out infinite;
}
.slot-status.connected { color: var(--text-secondary); }

/* Chart Container — subtle neon tint to match theme */
.slot-chart {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse 120% 100% at 100% 50%, rgba(0, 255, 191, 0.03) 0%, transparent 50%);
}
.slot-chart.hidden { display: none; }

/* Empty Slot — fill full area on first load and when chart is removed */
.slot-empty {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition-fast), color var(--transition);
}
.slot-empty.hidden { display: none; }
.slot-empty:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.slot-empty:hover .material-icons-round { opacity: 0.8; transform: scale(1.08); }
.slot-empty .material-icons-round { font-size: 40px; opacity: 0.45; transition: opacity var(--transition), transform var(--transition); }
.slot-empty span:last-child { font-size: 13px; font-weight: 500; }

/* Slot closed message */
.slot-closed-msg {
  position: absolute;
  inset: 0;
  top: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--text-secondary);
  background: radial-gradient(ellipse 80% 50% at 50% 45%, rgba(244, 63, 94, 0.08) 0%, transparent 60%), var(--bg-surface);
}
.slot-closed-msg.hidden { display: none; }
.slot-closed-msg .slot-closed-icon {
  font-size: 56px;
  color: var(--sell);
  filter: drop-shadow(0 0 12px rgba(244, 63, 94, 0.5));
  animation: closed-icon-pulse 2.2s ease-in-out infinite;
}
.slot-closed-msg .slot-closed-icon::before {
  content: '';
  position: absolute;
  width: 80px;
  height: 80px;
  left: 50%;
  top: 50%;
  margin-left: -40px;
  margin-top: -40px;
  border-radius: 50%;
  border: 2px solid rgba(244, 63, 94, 0.2);
  animation: closed-ring-pulse 2.2s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}
@keyframes closed-icon-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.05); }
}
@keyframes closed-ring-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.08); }
}
.slot-closed-msg span:last-child {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-primary);
  animation: closed-text-glow 2.2s ease-in-out infinite;
}
@keyframes closed-text-glow {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; }
}

/* Slot buttons */
.slot-deselect-btn, .slot-reload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.slot-deselect-btn.hidden, .slot-reload-btn.hidden { display: none; }
.slot-deselect-btn:hover { background: var(--sell-soft); color: var(--sell); }
.slot-reload-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.slot-reload-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.slot-deselect-btn .material-icons-round, .slot-reload-btn .material-icons-round { font-size: 18px; }
.slot-reload-btn.reloading .material-icons-round { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.slot-tool-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
  white-space: nowrap;
}
.slot-tool-btn .material-icons-round { font-size: 15px; }
.slot-tool-btn:hover { background: var(--bg-hover); color: var(--text-secondary); }
.slot-tool-btn.active { color: var(--accent); background: var(--accent-soft); }

/* ── Telegram Join Modal (matches background, neon accent) ── */
.telegram-modal-overlay {
  z-index: 1001;
  background: rgba(6, 8, 11, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: overlayIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.telegram-modal-overlay.telegram-modal-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.telegram-modal {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 380px;
  max-width: 100%;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 255, 191, 0.08), 0 0 40px rgba(0, 255, 191, 0.06);
  animation: modalIn 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
  overflow: hidden;
}
.telegram-modal-glow {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(0, 255, 191, 0.12) 0%, transparent 55%);
  pointer-events: none;
}
.telegram-modal .modal-header {
  position: relative;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.telegram-modal .modal-header h3 {
  color: var(--text-primary);
  font-size: 17px;
}
.telegram-modal-body {
  position: relative;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.telegram-modal-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}
.telegram-modal-text strong { color: var(--neon); }
.telegram-join-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--neon);
  color: #06080b;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition-fast);
  box-shadow: 0 0 20px rgba(0, 255, 191, 0.4), 0 0 40px rgba(0, 255, 191, 0.15);
}
.telegram-join-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 28px rgba(0, 255, 191, 0.5), 0 0 56px rgba(0, 255, 191, 0.2);
  transform: translateY(-2px);
}
.telegram-join-btn:active { transform: translateY(0); }
.telegram-join-btn .material-icons-round { font-size: 20px; }
.telegram-later-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.telegram-later-btn:hover {
  border-color: var(--border-light);
  color: var(--text-secondary);
}

/* ── Asset Picker Modal ────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: overlayIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay[hidden] { display: none; }

@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 440px;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  animation: modalIn 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.04);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
}
.modal-header h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition), transform var(--transition-fast);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-close:active { transform: scale(0.92); }

.modal-search {
  padding: 0 18px 12px;
  position: relative;
}
.modal-search .search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--text-muted);
  pointer-events: none;
}
.modal-search input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.modal-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.modal-search input::placeholder { color: var(--text-muted); }

/* Asset category tabs */
.modal-asset-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.asset-tab {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.asset-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}
.asset-tab.active {
  color: var(--neon);
  background: var(--accent-soft);
  border-color: rgba(0, 255, 191, 0.35);
  box-shadow: 0 0 12px rgba(0, 255, 191, 0.08);
}
.asset-tab.active:hover {
  background: rgba(0, 255, 191, 0.15);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 16px;
  min-height: 0;
}

/* Asset modal: header row + sortable Payout */
.modal-asset-body {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  min-height: 0;
}
.modal-asset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.asset-col-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.asset-col-payout {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), box-shadow var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.asset-col-payout:hover {
  border-color: var(--neon);
  color: var(--neon);
  box-shadow: 0 0 12px var(--accent-soft);
}
.asset-col-payout .sort-icon {
  font-size: 10px;
  color: var(--neon);
}
.modal-asset-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 16px;
  min-height: 0;
}

.asset-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition-fast), box-shadow var(--transition);
  gap: 12px;
  margin-bottom: 4px;
  border: 1px solid transparent;
}
.asset-item:hover {
  background: var(--bg-hover);
  transform: translateX(4px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.asset-item:active { transform: translateX(2px) scale(0.995); }
.asset-item .asset-info { flex: 1; min-width: 0; }
.asset-item .asset-pair-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.asset-item .asset-pair {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asset-off-badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  background: var(--border-light);
  border: 1px solid var(--sell);
  border-radius: 4px;
  flex-shrink: 0;
}
.asset-item .asset-name {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asset-item .asset-payout {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.asset-item .asset-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.asset-item .asset-status-dot.open { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.asset-item .asset-status-dot.closed { background: var(--sell); }
.asset-item:hover .asset-status-dot.open { transform: scale(1.2); }

/* ── Responsive: all device sizes ───────────────────────── */
@media (max-width: 768px) {
  .topbar { padding: 0 12px; height: 48px; min-height: 48px; }
  .logo { font-size: 15px; }
  .layout-btn { width: 34px; height: 30px; }
  .ws-status { padding: 6px 12px; font-size: 11px; }
  .chart-grid { height: calc(100vh - 48px); height: calc(100dvh - 48px); gap: 2px; }
  .slot-header { height: 38px; min-height: 38px; padding: 0 8px; }
  .asset-btn { font-size: 12px; padding: 5px 10px; }
  .candle-countdown { padding: 8px 12px; min-width: 56px; right: 10px; }
  .candle-countdown-value { font-size: 18px; }
  .candle-countdown-suffix { font-size: 12px; }
  .candle-countdown-label { font-size: 9px; margin-top: 3px; }
  .modal { max-width: 96vw; }
  .layout-btn[data-layout="4"] { display: none; }
  .chart-grid[data-layout="4"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .chart-grid[data-layout="4"] .chart-slot:nth-child(n+3) { display: none; }
  .chart-grid[data-layout="2"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
}

@media (max-width: 480px) {
  :root { --topbar-h: 48px; }
  .topbar { padding: 0 10px; padding-bottom: 8px; min-height: 48px; height: auto; flex-wrap: wrap; }
  .topbar-left { min-width: 0; }
  .logo { font-size: 14px; max-width: 140px; }
  .layout-switcher { flex-shrink: 0; }
  .layout-btn { width: 32px; height: 28px; }
  .layout-btn .material-icons-round { font-size: 16px; }
  .ws-status { padding: 6px 10px; font-size: 10px; }
  .chart-grid { grid-template-columns: 1fr; min-height: 0; gap: 2px; }
  .chart-grid[data-layout="1"] { grid-template-rows: 1fr; }
  .chart-grid[data-layout="1"] .chart-slot:nth-child(n+2) { display: none; }
  .chart-grid[data-layout="2"] .chart-slot { display: flex; min-height: 0; }
  .chart-grid[data-layout="2"] .chart-slot:nth-child(n+3) { display: none; }
  .chart-slot { min-height: 0; }
  .slot-header {
    flex-wrap: wrap;
    min-height: 36px;
    height: auto;
    padding: 8px;
    gap: 6px;
  }
  .slot-header .asset-btn { font-size: 11px; padding: 4px 8px; flex: 1 1 auto; max-width: 100%; }
  .slot-header .asset-btn .asset-label { max-width: 100px; }
  .slot-deselect-btn, .slot-reload-btn { width: 26px; height: 26px; }
  .slot-deselect-btn .material-icons-round, .slot-reload-btn .material-icons-round { font-size: 16px; }
  .slot-divider { display: none; }
  .slot-tool-btn { padding: 4px 8px; font-size: 10px; }
  .slot-tool-btn span:not(.material-icons-round) { display: none; }
  .signal-toggle { padding: 4px 8px; font-size: 10px; }
  .signal-toggle span:not(.toggle-dot) { display: none; }
  .strategy-sel { font-size: 10px; padding: 4px 6px; max-width: 78px; }
  .slot-status { font-size: 10px; }
  .candle-countdown { padding: 6px 10px; min-width: 52px; right: 8px; }
  .candle-countdown-value { font-size: 16px; }
  .candle-countdown-suffix { font-size: 11px; }
  .candle-countdown-label { font-size: 9px; letter-spacing: 0.05em; }
  .modal-asset-tabs { padding: 6px 8px 0; gap: 3px; }
  .asset-tab { padding: 5px 8px; font-size: 11px; }
  .asset-item { padding: 10px 12px; }
  .asset-item .asset-pair { font-size: 13px; }
  .asset-item .asset-name { font-size: 11px; }
}

@media (max-width: 360px) {
  .logo { max-width: 100px; }
  .slot-header .asset-btn .asset-label { max-width: 72px; }
  .strategy-sel { max-width: 68px; }
}

/* Touch-friendly: larger tap targets on small screens */
@media (pointer: coarse) and (max-width: 768px) {
  .layout-btn { min-width: 44px; min-height: 40px; }
  .asset-btn { min-height: 44px; padding: 8px 12px; }
  .slot-deselect-btn, .slot-reload-btn { min-width: 36px; min-height: 36px; }
  .signal-toggle, .slot-tool-btn { min-height: 36px; padding: 6px 10px; }
  .modal-close { min-width: 44px; min-height: 44px; }
  .asset-item { min-height: 52px; }
  .candle-countdown { padding: 10px 14px; }
}

/* ── Lightweight Charts ─────────────────────────────────── */
.slot-chart canvas { background: transparent !important; }
#tv-attr-logo,
a[href*="tradingview.com"][title*="Charting"] {
  display: none !important;
  visibility: hidden !important;
}
