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

:root {
  --bg-primary: #0a0e14;
  --bg-secondary: #11151c;
  --bg-tertiary: #161c24;
  --bg-input: #1a2030;
  --border: #222d3a;
  --text-primary: #d4dce6;
  --text-secondary: #6b7a8d;
  --text-muted: #3d4a5a;
  --green: #00b061;
  --green-bg: #00b06118;
  --red: #e0294a;
  --red-bg: #e0294a18;
  --blue: #2563eb;
  --accent: #4a9eff;
  --yellow: #e6a817;
  --font: 'Segoe UI', -apple-system, Arial, Helvetica, sans-serif;
  --font-mono: 'Consolas', 'SF Mono', 'Cascadia Code', monospace;
}


html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  user-select: none;
}

/* AUTH SCREEN */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: #0a0e17;
  position: relative;
  overflow: hidden;
}

#auth-bg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.auth-box {
  background: rgba(15, 20, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 36px 36px 32px;
  width: 400px;
  max-width: 92vw;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.auth-title {
  text-align: center;
  font-size: 22px;
  margin-bottom: 4px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.auth-subtitle {
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 24px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.auth-hint {
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 16px;
  line-height: 1.5;
}

#auth-form input, #keys-form input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-body input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#auth-form input:focus, #keys-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.15);
}

.modal-body input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

#auth-form input::placeholder, #keys-form input::placeholder {
  color: var(--text-muted);
}

/* Password wrapper with eye toggle */
.auth-password-wrap {
  position: relative;
  width: 100%;
}
.auth-password-wrap input {
  padding-right: 40px !important;
}
.auth-eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(calc(-50% - 6px));
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.auth-eye-btn:hover,
.auth-eye-btn.active {
  color: var(--accent);
}

.auth-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 8px;
  min-height: 16px;
  text-align: center;
}

.auth-pending-msg {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--accent);
  text-align: center;
  line-height: 1.5;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 9px 0;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  border-radius: 7px;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--blue);
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.auth-tab:hover:not(.active) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.auth-status {
  font-size: 12px;
  margin-top: 8px;
  min-height: 16px;
  text-align: center;
}

.auth-status.validating {
  color: var(--yellow);
}

.auth-status.success {
  color: var(--green);
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 0.5px;
}

/* BUTTONS */
.btn-primary {
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  margin-top: 4px;
}

.btn-primary:hover {
  opacity: 0.92;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: 3px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 10px;
  font-family: var(--font);
  transition: all 0.1s;
}

.btn-sm:hover { background: var(--bg-input); color: var(--text-primary); }
.btn-sm:focus { outline: none; box-shadow: none; }
.btn-sm:focus-visible { outline: 1px solid var(--accent); }

.btn-admin {
  color: #f0b429;
  border-color: rgba(240, 180, 41, 0.3);
  text-decoration: none;
}
.btn-admin:hover {
  background: rgba(240, 180, 41, 0.1);
  color: #f0b429;
  border-color: rgba(240, 180, 41, 0.5);
}

/* User info & logout */
.user-info-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}
.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  flex-shrink: 0;
}
.user-name {
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 500;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-logout {
  color: #ea3943;
  border-color: rgba(234, 57, 67, 0.3);
  font-size: 10px;
  padding: 2px 8px;
}
.btn-logout:hover {
  background: rgba(234, 57, 67, 0.1);
  border-color: rgba(234, 57, 67, 0.5);
}

.btn-tiny {
  padding: 1px 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 10px;
}

/* TERMINAL CONTAINER */
#terminal {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

#terminal.hidden {
  display: none;
}

/* TOP BAR */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding: 0 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.top-bar-left, .top-bar-center, .top-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pair-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23787b86' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
  min-width: 120px;
}
.pair-select:focus {
  outline: none;
  border-color: var(--accent, #2962ff);
}
.pair-select option {
  background: #1e222d;
  color: #d1d4dc;
  padding: 8px;
  font-size: 13px;
}

.current-price {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.price-change {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.price-change.up { color: var(--green); }
.price-change.down { color: var(--red); }

.exchange-badge {
  background: var(--blue);
  color: white;
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.exchange-selector-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 3px 10px 3px 3px;
}

.exchange-select {
  background: var(--accent);
  color: white;
  padding: 4px 22px 4px 10px;
  border: none;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  font-family: var(--font);
  appearance: none;
  -webkit-appearance: none;
  padding-right: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='white'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.exchange-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
}

.exchange-select option:disabled {
  color: var(--text-muted);
}

.exchange-status {
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.leverage-select {
  background: rgba(255, 180, 0, 0.08);
  border: 1px solid rgba(255, 180, 0, 0.25);
  color: var(--yellow);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.leverage-select:hover {
  background: rgba(255, 180, 0, 0.14);
  border-color: rgba(255, 180, 0, 0.4);
}
.leverage-badge {
  background: rgba(255, 180, 0, 0.12);
  border: 1px solid rgba(255, 180, 0, 0.3);
  color: var(--yellow);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
}
.leverage-badge:hover {
  background: rgba(255, 180, 0, 0.2);
  border-color: rgba(255, 180, 0, 0.5);
}

/* GRID TOGGLE */
.grid-toggle {
  display: flex;
  gap: 1px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.grid-btn {
  padding: 3px 7px;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.1s;
}

.grid-btn:hover { color: var(--text-secondary); }
.grid-btn.active { background: var(--blue); color: white; }

/* TOP SECTION (collapsible header + ticker bar) */
.top-section {
  flex-shrink: 0;
  position: relative;
}

.top-section.collapsed .top-bar,
.top-section.collapsed .ticker-bar-wrap {
  display: none;
}

.top-section.collapsed .top-section-toggle {
  border-bottom: 1px solid var(--border);
}

.top-section.collapsed .top-section-toggle svg {
  transform: rotate(180deg);
}

.top-section-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 10px;
  background: var(--bg-secondary);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.top-section-toggle:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.top-section-toggle svg {
  transition: transform 0.15s;
}

/* TICKER INFO BAR (collapsible) */
.ticker-bar-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 14px;
}

.ticker-bar-wrap.collapsed .ticker-info-bar {
  display: none;
}

.tib-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px 2px 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.tib-toggle:hover { color: var(--text-secondary); }

.tib-toggle svg {
  transition: transform 0.15s;
}

.ticker-bar-wrap.collapsed .tib-toggle svg {
  transform: rotate(-90deg);
}

.ticker-info-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px 0 0;
  flex: 1;
  overflow-x: auto;
  height: 22px;
}

.tib-item {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 6px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.tib-item:last-child { border-right: none; }

.tib-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tib-value {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

/* CHART TYPE SELECT */
.chart-type-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 10px;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
}

/* TIMEFRAME BAR */
.timeframe-bar {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 24px;
  padding: 0 8px 0 48px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tf-btn {
  padding: 2px 7px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 10px;
  font-family: var(--font);
  border-radius: 2px;
  transition: all 0.1s;
}

.tf-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.tf-btn.active { background: var(--blue); color: white; }
.tf-separator { color: var(--text-muted); margin: 0 4px; font-size: 10px; }

.tf-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 4px;
}

/* MAIN LAYOUT */
.main-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Resize handles */
.resize-handle-v {
  width: 5px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 50;
  transition: background 0.15s;
}

.resize-handle-v::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -3px;
  width: 11px;
}

.resize-handle-v:hover,
.resize-handle-v.active {
  background: var(--accent);
}

.resize-handle-h {
  height: 5px;
  cursor: row-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 50;
  transition: background 0.15s;
}

.resize-handle-h::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: -3px;
  height: 11px;
}

.resize-handle-h:hover,
.resize-handle-h.active {
  background: var(--accent);
}

body.resizing-col { cursor: col-resize !important; }
body.resizing-row { cursor: row-resize !important; }
body.resizing-col *, body.resizing-row * { cursor: inherit !important; user-select: none !important; }

/* MODAL */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 360px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 13px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
}

.modal-body {
  padding: 12px 16px;
}

.modal-body label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 3px;
  margin-top: 8px;
}

.modal-body label:first-child { margin-top: 0; }

/* Settings Modal v2 */
.settings-modal-v2 {
  width: 420px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.03) inset;
  overflow: hidden;
}

.settings-modal-v2 .modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%);
}

.settings-modal-v2 .modal-header h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.settings-modal-v2 .modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 16px;
  transition: all 0.15s;
}

.settings-modal-v2 .modal-close:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

.settings-modal-v2 .modal-body {
  padding: 4px 20px 20px;
}

.settings-section {
  padding: 16px 0 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.settings-section:last-of-type {
  border-bottom: none;
}

.settings-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.settings-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.settings-field.full {
  margin-top: 10px;
}

.settings-field label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 5px;
  margin-top: 0;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-field input {
  height: 36px;
  font-size: 13px;
  padding: 0 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  transition: all 0.15s;
}

.settings-field input:hover {
  border-color: rgba(255,255,255,0.12);
}

.settings-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(74,158,255,0.12);
}

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0;
  min-height: 32px;
}

.settings-switch {
  position: relative;
  width: 36px;
  height: 20px;
  cursor: pointer;
  display: inline-block;
}

.settings-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.settings-switch-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: 0.2s;
}

.settings-switch-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.2s;
}

.settings-switch input:checked + .settings-switch-slider {
  background: var(--blue);
  border-color: var(--blue);
}

.settings-switch input:checked + .settings-switch-slider::before {
  transform: translateX(16px);
  background: white;
}

/* Candle color pickers */
.cc-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cc-pick {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.cc-row > input[type="color"] {
  display: none;
}

.cc-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.12);
  transition: border-color 0.15s, transform 0.15s;
}

.cc-pick:hover .cc-dot {
  border-color: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

#cc-dot-up { background: var(--green, #16c784); }
#cc-dot-down { background: var(--red, #ea3943); }

.cc-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.15);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.cc-swatch:hover {
  border-color: rgba(255,255,255,0.4);
  transform: scale(1.1);
}
#swatch-up { background: #16c784; }
#swatch-down { background: #ea3943; }
#swatch-bg { background: #0d1117; }

.cc-txt {
  font-size: 11px;
  font-weight: 600;
}

.cc-txt.up { color: var(--green, #16c784); }
.cc-txt.down { color: var(--red, #ea3943); }

.cc-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 5px;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: 2px;
  transition: all 0.15s;
}

.cc-reset:hover {
  color: var(--text-secondary);
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.04);
}

#cc-popup {
  background: var(--bg-secondary, #1a1d23);
  border: 1px solid var(--border, #30363d);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  width: 180px;
}

.cc-popup-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.cc-popup-swatch {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.1s, transform 0.1s;
}
.cc-popup-swatch:hover {
  border-color: #fff;
  transform: scale(1.15);
}

.cc-popup-hex-row {
  display: flex;
  gap: 4px;
}

.cc-popup-hex {
  width: 100%;
  background: var(--bg-primary, #0d1117);
  border: 1px solid var(--border, #30363d);
  color: var(--text, #e6edf3);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  text-align: center;
  box-sizing: border-box;
}
.cc-popup-hex:focus {
  outline: none;
  border-color: var(--accent, #7c3aed);
}

/* API status in settings */
.api-status-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.api-status-badge.checking {
  color: var(--yellow);
  background: rgba(255,193,7,0.1);
}

.api-status-badge.connected {
  color: var(--green);
  background: var(--green-bg);
}

.api-status-badge.error {
  color: var(--red);
  background: var(--red-bg);
}

.api-status-badge.no-keys {
  color: var(--text-muted);
  background: var(--bg-tertiary);
}

.api-check-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  font-family: var(--font);
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.api-check-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74,158,255,0.06);
}

.api-check-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.settings-save-btn {
  width: 100%;
  margin-top: 16px;
  height: 38px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
}

/* STATUS BAR */
.status-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 0 8px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

.status-dot.connected { background: var(--green); }
.status-sep { color: var(--text-muted); }

/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* TOAST NOTIFICATIONS */
.notify-container {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.notify-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-family: var(--font);
  pointer-events: auto;
  transform: translateX(calc(100% + 20px));
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.notify-toast.notify-visible {
  transform: translateX(0);
  opacity: 1;
}

.notify-toast.notify-out {
  transform: translateX(calc(100% + 20px));
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.5, 0, 0.8, 0.3), opacity 0.25s ease;
}

.notify-success { border-left: 3px solid var(--green); }
.notify-error   { border-left: 3px solid var(--red); }

.notify-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.notify-success .notify-icon { color: var(--green); }
.notify-error   .notify-icon { color: var(--red); }

.notify-body {
  flex: 1;
  min-width: 0;
}

.notify-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.notify-msg {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
  word-break: break-word;
}

.notify-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}

.notify-close:hover { color: var(--text-primary); }

/* ===== LIGHT MODE ===== */
body.chart-light {
  --bg-primary: #f5f6f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #ebedf0;
  --bg-input: #f0f1f4;
  --border: #d5d8de;
  --text-primary: #1a1d26;
  --text-secondary: #4a5568;
  --text-muted: #8b95a5;
  --green: #00a854;
  --green-bg: #00a85418;
  --red: #d92e44;
  --red-bg: #d92e4418;
  --blue: #2563eb;
  --accent: #2563eb;
  --yellow: #c08c00;
}

body.chart-light ::-webkit-scrollbar-track { background: #f0f1f4; }
body.chart-light ::-webkit-scrollbar-thumb { background: #c8ccd4; }
body.chart-light ::-webkit-scrollbar-thumb:hover { background: #a8adb8; }

/* ═══════════════════════════════════════════════════════════════════
   HOTKEYS MODAL
   ═══════════════════════════════════════════════════════════════════ */

.hotkeys-modal-content {
  width: 480px;
  max-height: 80vh;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.03) inset;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hotkeys-modal-content .modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%);
  flex-shrink: 0;
}

.hotkeys-modal-content .modal-header h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hotkeys-modal-content .modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 16px;
  transition: all 0.15s;
}

.hotkeys-modal-content .modal-close:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

/* Search bar */
.hotkeys-search-wrap {
  padding: 12px 20px 8px;
  flex-shrink: 0;
}

.hotkeys-search-wrap input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}

.hotkeys-search-wrap input:focus {
  border-color: var(--accent);
}

.hotkeys-search-wrap input::placeholder {
  color: var(--text-muted);
}

/* Scrollable list */
.hotkeys-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 20px 12px;
  max-height: 50vh;
}

/* Category header */
.hk-category {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  padding: 12px 0 6px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.hk-category:first-child {
  padding-top: 4px;
}

/* Row */
.hk-row {
  display: flex;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  gap: 8px;
  transition: background 0.1s;
}

.hk-row:hover {
  background: rgba(255,255,255,0.02);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 4px;
}

.hk-row.hk-capturing {
  background: rgba(74, 158, 255, 0.08);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 4px;
  border-bottom-color: transparent;
}

/* Action name */
.hk-action-name {
  flex: 1;
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
}

/* Shortcut display (keyboard badge) */
.hk-shortcut-display {
  min-width: 80px;
  text-align: center;
  font-size: 11px;
  font-family: monospace;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 4px;
  padding: 3px 8px;
  white-space: nowrap;
}

.hk-shortcut-display.hk-waiting {
  color: var(--accent);
  background: rgba(74, 158, 255, 0.08);
  border-color: rgba(74, 158, 255, 0.2);
  animation: hk-pulse 1s ease-in-out infinite;
}

@keyframes hk-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Change button */
.hk-change-btn {
  font-size: 10px;
  padding: 3px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.hk-change-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.12);
}

/* Clear button */
.hk-clear-btn {
  font-size: 13px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.hk-clear-btn:hover {
  background: rgba(234, 57, 67, 0.1);
  color: var(--red);
}

/* Footer */
.hotkeys-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
}

.hotkeys-reset-btn {
  font-size: 11px;
  padding: 5px 12px;
  background: rgba(234, 57, 67, 0.08);
  border: 1px solid rgba(234, 57, 67, 0.15);
  border-radius: 6px;
  color: var(--red);
  cursor: pointer;
  transition: all 0.15s;
}

.hotkeys-reset-btn:hover {
  background: rgba(234, 57, 67, 0.15);
}

.hotkeys-hint {
  font-size: 10px;
  color: var(--text-muted);
}
