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

:root {
  --bg-primary: #0e1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2333;
  --bg-input: #21262d;
  --bg-hover: #282e38;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-teal: #14b8a6;
  --accent-orange: #f59e0b;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-tertiary: #484f58;
  --border: #30363d;
  --border-light: #3a424d;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: 150ms ease;
}

* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-rows: 50px 1fr;
  grid-template-columns: 260px 1fr 280px;
  grid-template-areas: "header header header" "sidebar chart trading";
  height: 100vh;
  width: 100vw;
}

/* ─── Top Nav ────────────────────────────────────────────────────────────── */
.top-nav {
  grid-area: header;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 4px;
  z-index: 100;
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px; font-weight: 700; font-size: 14px;
  color: var(--accent-blue);
}
.nav-logo .logo-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-teal));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff;
}
.nav-link {
  padding: 6px 14px; font-size: 12px; color: var(--text-secondary);
  text-decoration: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition); display: flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-link .nav-icon { font-size: 13px; }
.nav-center {
  flex: 1; display: flex; justify-content: center;
}
.nav-brand {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 16px; background: var(--bg-tertiary);
  border-radius: var(--radius-md); font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border);
}
.nav-brand .brand-badge {
  background: var(--accent-blue); color: #fff; padding: 2px 6px;
  border-radius: var(--radius-sm); font-size: 10px; font-weight: 700;
}
.nav-right {
  display: flex; align-items: center; gap: 6px;
}
.nav-icon-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-secondary); display: flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 13px;
  transition: all var(--transition);
}
.nav-icon-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.nav-icon-btn.ai-btn { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; border: none; font-size: 11px; font-weight: 700; }
.balance-display {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; background: var(--bg-tertiary);
  border-radius: var(--radius-md); font-size: 13px;
  border: 1px solid var(--border); cursor: pointer;
}
.balance-display .bal-icon {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-orange); display: flex;
  align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #000;
}
.balance-amount { font-weight: 600; }
.balance-flash { animation: flash 0.5s; }
@keyframes flash { 0%,100%{opacity:1} 50%{opacity:0.5} }
.deposit-btn {
  padding: 6px 18px; background: var(--accent-green);
  color: #fff; border: none; border-radius: var(--radius-md);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.deposit-btn:hover { background: #0ea572; transform: translateY(-1px); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; position: relative;
}
.user-menu {
  position: absolute; top: 44px; right: 8px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 8px 0;
  min-width: 200px; box-shadow: var(--shadow);
  display: none; z-index: 200;
}
.user-menu.active { display: block; }
.user-menu-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.user-menu-header .um-name { font-weight: 600; font-size: 14px; }
.user-menu-header .um-email { font-size: 11px; color: var(--text-secondary); }
.user-menu-item {
  padding: 8px 16px; font-size: 13px; display: flex;
  align-items: center; gap: 10px; cursor: pointer;
  color: var(--text-secondary); transition: all var(--transition);
}
.user-menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.user-menu-item.danger { color: var(--accent-red); }
.user-menu-item.danger:hover { background: rgba(239,68,68,0.1); }

/* ─── Left Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-tab {
  flex: 1; padding: 10px 8px; text-align: center;
  font-size: 11px; color: var(--text-secondary);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: all var(--transition); white-space: nowrap;
}
.sidebar-tab:hover { color: var(--text-primary); }
.sidebar-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-blue);
}
.tab-count { font-size: 10px; }
.sidebar-content {
  flex: 1; overflow-y: auto; position: relative;
}
.sidebar-panel {
  display: none; padding: 4px;
}
.sidebar-panel.active { display: block; }
.sidebar-footer {
  padding: 10px 12px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-secondary);
  flex-shrink: 0;
}
.sidebar-footer .sf-label { color: var(--text-tertiary); font-size: 10px; }
.session-pnl { font-weight: 700; font-size: 14px; }
.session-pnl.positive { color: var(--accent-green); }
.session-pnl.negative { color: var(--accent-red); }

/* ─── Trade Cards ────────────────────────────────────────────────────────── */
.trade-card {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.trade-card:hover { background: var(--bg-hover); }
.trade-card-header {
  display: flex; align-items: center; gap: 8px;
}
.trade-status {
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: var(--radius-sm); text-transform: uppercase;
}
.status-open { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.status-win { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.status-loss { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.trade-instrument { font-size: 11px; color: var(--text-secondary); flex: 1; }
.trade-pnl { font-size: 13px; font-weight: 700; }
.pnl-positive { color: var(--accent-green); }
.pnl-negative { color: var(--accent-red); }
.trade-card-body {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px; font-size: 11px; color: var(--text-tertiary);
}
.trade-card-footer { margin-top: 4px; font-size: 10px; color: var(--text-tertiary); }
.trade-card-animate { animation: slideIn 0.3s ease; }
@keyframes slideIn { from{opacity:0;transform:translateX(-10px)} to{opacity:1;transform:translateX(0)} }

.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px; color: var(--text-tertiary);
  text-align: center;
}
.empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.empty-state span { font-size: 11px; margin-top: 4px; }

/* ─── Chart Area ─────────────────────────────────────────────────────────── */
.chart-area {
  grid-area: chart;
  display: flex; flex-direction: column;
  background: var(--bg-primary);
  overflow: hidden; position: relative;
}

/* main wrapper that holds chart + trading panel */
.main-content {
  grid-column: 2 / -1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}
.content-inner {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-height: 0;
  background: var(--bg-primary);
}
.chart-header {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.instrument-selector {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; background: var(--bg-tertiary);
  border-radius: var(--radius-md); cursor: pointer;
  border: 1px solid var(--border); position: relative;
  transition: all var(--transition);
}
.instrument-selector:hover { border-color: var(--accent-blue); }
.instrument-selector .inst-type {
  background: var(--accent-blue); color: #fff;
  padding: 2px 5px; border-radius: 3px; font-size: 10px; font-weight: 700;
}
.instrument-name { font-size: 13px; font-weight: 600; }
.instrument-price { font-size: 12px; font-weight: 500; }
.price-up { color: var(--accent-green); }
.price-down { color: var(--accent-red); }
.instrument-change { font-size: 11px; margin-left: 4px; }
.change-up { color: var(--accent-green); }
.change-down { color: var(--accent-red); }
.instrument-dropdown-arrow { font-size: 10px; color: var(--text-secondary); margin-left: 4px; }
.instrument-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); min-width: 280px;
  box-shadow: var(--shadow); display: none; z-index: 150;
  max-height: 400px; overflow-y: auto;
}
.instrument-dropdown.active { display: block; }
.instrument-list {}
.instrument-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; cursor: pointer; font-size: 13px;
  transition: background var(--transition);
}
.instrument-item:hover { background: var(--bg-hover); }
.instrument-item.active { background: var(--bg-tertiary); }
.inst-icon { font-size: 14px; opacity: 0.5; }
.inst-name { flex: 1; }
.inst-badge { color: var(--accent-green); font-size: 8px; }

.chart-toolbar {
  display: flex; flex-direction: column; gap: 4px;
  position: absolute; top: 56px; left: 8px; z-index: 10;
}
.toolbar-btn {
  width: 30px; height: 30px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); display: flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 13px;
  transition: all var(--transition);
}
.toolbar-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.toolbar-btn.active { color: var(--accent-blue); border-color: var(--accent-blue); }

.chart-container {
  flex: 1; position: relative; overflow: hidden;
  display: flex; flex-direction: column;
}
.chart-container canvas {
  display: block; width: 100%; height: 100%;
}
#chart {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
}

.chart-progress {
  position: absolute; top: 8px; right: 80px; z-index: 10;
  font-size: 12px; font-weight: 600; color: var(--text-primary);
  background: var(--bg-secondary); padding: 3px 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}

.chart-zoom {
  position: absolute; bottom: 50px; left: 8px; z-index: 10;
  display: flex; flex-direction: column; gap: 2px;
}
.zoom-btn {
  width: 28px; height: 28px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); display: flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 16px;
  transition: all var(--transition);
}
.zoom-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }

/* ─── Tick Bar ───────────────────────────────────────────────────────────── */
.tick-bar-container {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 0; background: var(--bg-secondary);
  border-top: 1px solid var(--border); position: relative;
  flex-shrink: 0;
}
.tick-digit {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; cursor: default;
  background: var(--bg-tertiary); color: var(--text-secondary);
  border: 1px solid var(--border); transition: all 0.3s ease;
  position: relative;
}
.tick-digit.tick-current {
  background: var(--accent-blue);
  color: #fff; border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(59,130,246,0.4);
  transform: scale(1.15);
}
.tick-digit .tick-sub {
  position: absolute; bottom: -14px;
  font-size: 8px; color: var(--text-tertiary);
}
.tick-marker {
  position: absolute; bottom: -2px;
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid var(--accent-orange);
  transition: left 0.3s ease; opacity: 0;
}

/* ─── Chart Header Instrument Selector ──────────────────────────────────── */
.inst-badge {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-teal));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.inst-info { display: flex; flex-direction: column; gap: 1px; }
.inst-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.inst-price-row { display: flex; align-items: center; gap: 6px; }
.timeframe-selector {
  display: flex; gap: 3px; margin-left: auto;
}
.tf-btn {
  padding: 4px 8px; font-size: 11px; font-weight: 600;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  cursor: pointer; transition: all var(--transition);
}
.tf-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.tf-btn.active { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }

/* ─── Risk Controls ──────────────────────────────────────────────────────── */
.risk-row { display: flex; gap: 6px; }
.risk-item { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.risk-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.3px; white-space: nowrap;
}
.risk-target { color: var(--accent-green); }
.risk-stop   { color: var(--accent-red); }
.risk-mult   { color: var(--accent-orange); }
.risk-input {
  width: 100%; padding: 6px 8px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 13px; font-weight: 700;
  text-align: center; font-family: inherit; outline: none;
  transition: border-color var(--transition);
}
.risk-input:focus { border-color: var(--accent-blue); }

/* ─── Right Trading Panel ────────────────────────────────────────────────── */
.trading-panel {
  grid-area: trading;
  width: 280px; min-width: 280px; max-width: 280px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; padding: 0;
}
.panel-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.panel-label {
  font-size: 10px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 8px;
}

/* Mode Toggle */
.mode-toggle {
  display: flex; background: var(--bg-input);
  border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--border);
}
.mode-btn {
  flex: 1; padding: 8px; text-align: center;
  font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--text-secondary); transition: all var(--transition);
  border: none; background: none;
}
.mode-btn.active {
  background: var(--accent-blue); color: #fff;
}
.mode-btn:hover:not(.active) { background: var(--bg-hover); }

/* Trade Type Buttons */
.trade-types {
  display: flex; gap: 4px;
}
.trade-type-btn {
  flex: 1; padding: 7px 4px; text-align: center;
  font-size: 11px; font-weight: 500; cursor: pointer;
  color: var(--text-secondary); background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: all var(--transition); white-space: nowrap;
}
.trade-type-btn.active {
  background: var(--bg-tertiary); color: var(--text-primary);
  border-color: var(--accent-blue);
}
.trade-type-btn:hover:not(.active) { border-color: var(--border-light); color: var(--text-primary); }

/* Stake Amount */
.stake-section { display: flex; flex-direction: column; gap: 8px; }
.stake-row {
  display: flex; align-items: center; justify-content: center; gap: 2px;
}
.stake-row .stake-type-tabs {
  display: flex; gap: 2px; margin-bottom: 4px;
}
.stake-type-tab {
  padding: 3px 10px; font-size: 10px; font-weight: 600;
  border-radius: var(--radius-sm); cursor: pointer;
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border);
}
.stake-type-tab.active { background: var(--accent-green); color: #fff; border-color: var(--accent-green); }
.stake-control {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-input); border-radius: var(--radius-lg);
  border: 1px solid var(--border); overflow: hidden;
  width: 100%;
}
.stake-btn {
  width: 44px; height: 48px; display: flex; align-items: center;
  justify-content: center; background: none; border: none;
  color: var(--text-secondary); cursor: pointer; font-size: 20px;
  font-weight: 300; transition: all var(--transition); flex-shrink: 0;
}
.stake-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.stake-currency {
  font-size: 14px; color: var(--text-secondary); padding: 0 4px;
}
.stake-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 28px; font-weight: 700;
  text-align: center; font-family: inherit; width: 60px;
}
.stake-presets {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.stake-preset {
  padding: 5px 10px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 11px; font-weight: 500;
  cursor: pointer; transition: all var(--transition); flex: 1;
  text-align: center; min-width: 36px;
}
.stake-preset:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.stake-preset.active { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }

/* Payout & Last */
.payout-row {
  display: flex; justify-content: space-between;
  align-items: center; font-size: 12px;
}
.payout-label { color: var(--text-tertiary); }
.payout-value { font-weight: 700; color: var(--text-primary); }
.payout-value .payout-currency { font-size: 10px; color: var(--text-tertiary); margin-left: 2px; }
.last-row {
  display: flex; justify-content: space-between;
  align-items: center; font-size: 12px;
  padding-top: 4px; border-top: 1px solid var(--border); margin-top: 4px;
}
.last-label { color: var(--text-tertiary); font-size: 11px; }
.last-result { font-weight: 700; font-size: 14px; }
.last-result.positive { color: var(--accent-green); }
.last-result.negative { color: var(--accent-red); }

/* Digit Selector */
.digit-grid {
  display: flex; gap: 4px; flex-wrap: wrap; justify-content: center;
}
.digit-btn {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-secondary); transition: all var(--transition);
}
.digit-btn:hover { border-color: var(--accent-teal); color: var(--text-primary); }
.digit-btn.active {
  background: var(--accent-teal); color: #fff;
  border-color: var(--accent-teal);
  box-shadow: 0 0 10px rgba(20,184,166,0.3);
}

/* Action Buttons */
.action-buttons {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px;
  margin-top: auto;
}
.action-btn {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-radius: var(--radius-lg);
  cursor: pointer; border: none; font-family: inherit;
  transition: all var(--transition); position: relative;
  overflow: hidden;
}
.action-btn::before {
  content: ''; position: absolute; inset: 0;
  opacity: 0; transition: opacity var(--transition);
}
.action-btn:hover::before { opacity: 1; }
.action-btn:active { transform: scale(0.98); }
.action-btn.pressed { transform: scale(0.95); }

.action-btn.action-over {
  background: linear-gradient(135deg, #065f46, #047857);
  color: #fff;
}
.action-btn.action-over::before {
  background: linear-gradient(135deg, #047857, #059669);
}
.action-btn.action-under {
  background: linear-gradient(135deg, #7f1d1d, #991b1b);
  color: #fff;
}
.action-btn.action-under::before {
  background: linear-gradient(135deg, #991b1b, #b91c1c);
}
.action-left {
  display: flex; align-items: center; gap: 10px;
}
.action-icon {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.action-over .action-icon { background: rgba(16,185,129,0.3); }
.action-under .action-icon { background: rgba(239,68,68,0.3); }
.action-label { font-size: 14px; font-weight: 700; position: relative; z-index: 1; }
.action-right { text-align: right; position: relative; z-index: 1; }
.action-payout { font-size: 13px; font-weight: 600; }
.action-percent { font-size: 11px; opacity: 0.8; }

/* ─── Notifications ──────────────────────────────────────────────────────── */
#notifications {
  position: fixed; top: 60px; right: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 500; pointer-events: none;
}
.notification {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  animation: notifIn 0.3s ease;
  pointer-events: auto;
  box-shadow: var(--shadow);
}
.notif-win { background: linear-gradient(135deg, #065f46, #047857); color: #fff; }
.notif-loss { background: linear-gradient(135deg, #7f1d1d, #991b1b); color: #fff; }
.notif-icon { font-size: 16px; font-weight: 700; }
.notif-exit { animation: notifOut 0.3s ease forwards; }
@keyframes notifIn { from{opacity:0;transform:translateX(30px)} to{opacity:1;transform:translateX(0)} }
@keyframes notifOut { to{opacity:0;transform:translateX(30px)} }

/* ─── Account Dropdown ───────────────────────────────────────────────────── */
.balance-display { position: relative; }
.account-dropdown {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); min-width: 220px;
  box-shadow: var(--shadow); display: none; z-index: 200;
  overflow: hidden;
}
.account-dropdown.active { display: block; }
.account-item {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; cursor: pointer; font-size: 13px;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.account-item:last-child { border-bottom: none; }
.account-item:hover { background: var(--bg-hover); }
.account-item.active-account { background: var(--bg-tertiary); }
.account-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.account-dot.real { background: var(--accent-green); }
.account-dot.demo { background: var(--accent-red); }
.account-name { flex: 1; font-weight: 500; }
.account-badge {
  font-size: 10px; font-weight: 600; color: var(--accent-blue);
  padding: 2px 8px; border-radius: var(--radius-sm);
  background: rgba(59,130,246,0.15);
}
.balance-display .bal-type {
  font-size: 9px; font-weight: 700; color: var(--accent-green);
  background: rgba(16,185,129,0.15); padding: 1px 5px;
  border-radius: 3px; margin-right: 2px;
}

/* ─── Modal Overlay ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px); display: none;
  align-items: center; justify-content: center; z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-xl); width: 420px; max-width: 90vw;
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn { from{opacity:0;transform:scale(0.95) translateY(10px)} to{opacity:1;transform:scale(1) translateY(0)} }
.modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 20px; font-weight: 700; }
.modal-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-secondary); display: flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 16px;
  transition: all var(--transition); flex-shrink: 0;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }
.modal-body { padding: 20px 24px 24px; }

/* ── Deposit Method Cards ───────────────────────────────────────────────── */
.deposit-methods { display: flex; flex-direction: column; gap: 10px; }
.deposit-method-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border-radius: var(--radius-md);
  border: 1px solid var(--border); cursor: pointer;
  transition: all var(--transition); background: var(--bg-tertiary);
}
.deposit-method-card:hover {
  border-color: var(--accent-blue);
  background: var(--bg-hover);
  transform: translateX(4px);
}
.method-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.method-icon.mpesa { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.method-icon.usdt { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.method-icon.card { background: rgba(99,102,241,0.15); color: #818cf8; }
.method-info { flex: 1; }
.method-name { font-size: 15px; font-weight: 600; }
.method-desc { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.method-arrow { color: var(--text-tertiary); font-size: 18px; }

/* ── Deposit Form Views ─────────────────────────────────────────────────── */
.deposit-view { display: none; }
.deposit-view.active { display: block; }
.deposit-back {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
  margin-bottom: 18px; transition: color var(--transition);
}
.deposit-back:hover { color: var(--text-primary); }
.form-label {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  margin-bottom: 6px; display: block;
}
.form-input {
  width: 100%; padding: 12px 16px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 14px; font-family: inherit;
  outline: none; transition: border-color var(--transition);
  margin-bottom: 12px;
}
.form-input:focus { border-color: var(--accent-blue); }
.form-input::placeholder { color: var(--text-tertiary); }
.form-row {
  display: flex; gap: 10px;
}
.form-row .form-input { flex: 1; }
.form-hint {
  font-size: 11px; color: var(--text-tertiary); margin-top: -6px;
  margin-bottom: 14px;
}
.form-presets {
  display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap;
}
.form-preset {
  padding: 6px 14px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 12px; cursor: pointer;
  transition: all var(--transition);
}
.form-preset:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.form-preset.active { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }
.form-submit {
  width: 100%; padding: 14px; border: none; border-radius: var(--radius-md);
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: all var(--transition); font-family: inherit;
  margin-top: 4px;
}
.form-submit.mpesa-btn {
  background: var(--accent-blue); color: #fff;
}
.form-submit.mpesa-btn:hover { background: #2563eb; }
.form-submit.card-btn {
  background: linear-gradient(135deg, var(--accent-blue), #8b5cf6);
  color: #fff;
}
.form-submit.card-btn:hover { opacity: 0.9; }

/* ── USDT View ──────────────────────────────────────────────────────────── */
.usdt-address-box {
  padding: 16px; background: var(--bg-tertiary);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 12px;
}
.usdt-address-label {
  font-size: 12px; color: var(--text-secondary); margin-bottom: 8px;
}
.usdt-address {
  font-size: 14px; font-weight: 600; font-family: 'Courier New', monospace;
  word-break: break-all; color: var(--text-primary);
  padding: 10px 14px; background: var(--bg-input);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.copy-btn {
  width: 100%; padding: 12px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px; transition: all var(--transition);
  font-family: inherit; margin-bottom: 14px;
}
.copy-btn:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.info-box {
  padding: 14px 16px; border-radius: var(--radius-md);
  font-size: 12px; line-height: 1.5; margin-bottom: 10px;
}
.info-box.success {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.25);
  color: var(--accent-green);
}
.info-box.warning {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  color: var(--accent-orange);
}
.info-box strong { font-weight: 700; }

/* ── USDT QR & Status ───────────────────────────────────────────────────── */
.usdt-qr-wrapper {
  display: flex; justify-content: center; padding: 12px 0 8px;
}
.usdt-qr {
  width: 160px; height: 160px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-tertiary);
}
.usdt-verify-btn {
  width: 100%; padding: 13px; margin-top: 12px; margin-bottom: 8px;
  background: linear-gradient(135deg, #0d9488, #059669);
  color: #fff; border: none; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: opacity var(--transition); font-family: inherit;
}
.usdt-verify-btn:hover { opacity: 0.9; }
.usdt-verify-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.usdt-status {
  padding: 11px 14px; border-radius: var(--radius-md);
  font-size: 12px; line-height: 1.5; font-weight: 500;
}
.usdt-status.success {
  background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3);
  color: var(--accent-green);
}
.usdt-status.warning {
  background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.3);
  color: var(--accent-orange);
}
.usdt-status.error {
  background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.3);
  color: var(--accent-red);
}
.usdt-status.info {
  background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.3);
  color: #60a5fa;
}

/* ── Withdraw Modal ──────────────────────────────────────────────────────── */
.wd-phone-section { margin: 14px 0 0; }
.wd-phone-info {
  font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-top: 6px;
  padding: 11px 14px; background: var(--bg-tertiary);
  border-radius: var(--radius-md); border: 1px solid var(--border);
}
.wd-phone-info strong { color: var(--text-primary); }
.usdt-wd-btn {
  width: 100%; padding: 13px; margin-top: 16px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; border: none; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: opacity 150ms;
}
.usdt-wd-btn:hover { opacity: .9; }
.usdt-wd-btn:disabled { opacity: .5; cursor: not-allowed; }
.wd-status {
  margin-top: 10px; padding: 10px 14px; border-radius: var(--radius-md);
  font-size: 12px; line-height: 1.5; font-weight: 500;
}
.wd-status.success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3); color: #34d399; }
.wd-status.error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.3);  color: #f87171; }
.wd-status.info    { background: rgba(59,130,246,.1);  border: 1px solid rgba(59,130,246,.3);  color: #60a5fa; }

/* ── History Modal ───────────────────────────────────────────────────────── */
.history-tabs { display: flex; border-bottom: 1px solid var(--border); }
.history-tab {
  flex: 1; padding: 14px; background: transparent; border: none;
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 150ms;
}
.history-tab.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }
.history-body { padding: 0; max-height: 360px; overflow-y: auto; }
.history-panel { display: none; }
.history-panel.active { display: block; }
.history-empty { padding: 44px 20px; text-align: center; color: var(--text-secondary); font-size: 13px; }
.history-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 20px; border-bottom: 1px solid var(--border);
  transition: background 150ms;
}
.history-row:last-child { border-bottom: none; }
.history-row:hover { background: rgba(255,255,255,.02); }
.history-row-left { display: flex; align-items: center; gap: 10px; }
.hist-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.hist-icon.dep { background: rgba(16,185,129,.15); color: #34d399; }
.hist-icon.wd  { background: rgba(245,158,11,.15);  color: #fbbf24; }
.hist-label { font-size: 13px; font-weight: 600; }
.hist-sub   { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.hist-amount { font-size: 14px; font-weight: 700; text-align: right; }
.hist-amount.pos { color: #34d399; }
.hist-amount.neg { color: #fbbf24; }
.hist-status { font-size: 11px; color: var(--text-secondary); text-align: right; margin-top: 2px; text-transform: capitalize; }

/* ── Chat Bubble Button ──────────────────────────────────────────────────── */
.chat-bubble-btn {
  position: fixed; bottom: 24px; right: 24px;
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #0d9488, #7c3aed);
  color: #fff; font-size: 22px; border: none; cursor: pointer;
  box-shadow: 0 4px 24px rgba(0,0,0,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  transition: transform 150ms; flex-shrink: 0;
}
.chat-bubble-btn:hover { transform: scale(1.08); }
.chat-unread-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--accent-red); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ── Chat Widget ─────────────────────────────────────────────────────────── */
.chat-widget {
  position: fixed; bottom: 90px; right: 24px;
  width: 360px; height: 500px; border-radius: 16px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  box-shadow: 0 8px 48px rgba(0,0,0,.6); z-index: 999;
  display: flex; flex-direction: column; overflow: hidden;
  transform: scale(.88) translateY(16px); opacity: 0;
  pointer-events: none; transition: all 200ms cubic-bezier(.4,0,.2,1);
}
.chat-widget.open { transform: none; opacity: 1; pointer-events: all; }
.chat-header {
  padding: 14px 16px; display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0;
  background: linear-gradient(135deg, #0d9488 0%, #7c3aed 100%);
}
.chat-header-left { display: flex; align-items: center; gap: 10px; }
.chat-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.2); display: flex;
  align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.chat-title  { font-size: 14px; font-weight: 700; color: #fff; }
.chat-status { font-size: 11px; color: rgba(255,255,255,.8); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.chat-dot    { width: 7px; height: 7px; background: #4ade80; border-radius: 50%; animation: pulse 2s infinite; }
.chat-header-right { display: flex; gap: 4px; }
.chat-hdr-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.15); border: none; color: #fff;
  font-size: 13px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: background 150ms;
}
.chat-hdr-btn:hover { background: rgba(255,255,255,.3); }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.chat-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 20px;
}
.chat-empty-icon  { font-size: 48px; opacity: .35; }
.chat-empty-title { font-size: 16px; font-weight: 700; }
.chat-empty-sub   { font-size: 12px; color: var(--text-secondary); line-height: 1.6; max-width: 220px; }
.chat-msg { display: flex; flex-direction: column; max-width: 80%; }
.chat-msg-user  { align-self: flex-end; align-items: flex-end; }
.chat-msg-admin { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
  padding: 9px 14px; border-radius: 18px;
  font-size: 13px; line-height: 1.5; word-break: break-word;
}
.chat-msg-user  .chat-bubble { background: var(--accent-blue); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg-admin .chat-bubble { background: var(--bg-tertiary); color: var(--text-primary); border-bottom-left-radius: 4px; }
.chat-time { font-size: 10px; color: var(--text-muted); margin-top: 3px; padding: 0 4px; }
.chat-typing { align-self: flex-start; }
.chat-typing .chat-bubble {
  background: var(--bg-tertiary); display: flex; gap: 4px; align-items: center; padding: 12px 16px;
}
.chat-typing .chat-bubble span {
  width: 6px; height: 6px; background: var(--text-secondary); border-radius: 50%;
  animation: bounce 1.2s infinite; display: inline-block;
}
.chat-typing .chat-bubble span:nth-child(2) { animation-delay: .2s; }
.chat-typing .chat-bubble span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-5px)} }
.chat-footer {
  padding: 12px 14px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; flex-shrink: 0; background: var(--bg-secondary);
}
.chat-attach-btn {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: var(--radius-md);
  background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.chat-attach-btn:hover { color: var(--text-primary); }
.chat-input {
  flex: 1; padding: 9px 14px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 20px;
  color: var(--text-primary); font-size: 13px; font-family: inherit; outline: none;
}
.chat-input:focus { border-color: var(--accent-blue); }
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
  background: var(--accent-blue); border: none; color: #fff;
  font-size: 16px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: opacity 150ms;
}
.chat-send-btn:hover { opacity: .9; }

/* ── Admin Chat Panel ────────────────────────────────────────────────────── */
.chat-admin-layout { display: flex; height: 100%; gap: 0; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--bg-secondary); }
.chat-user-list { width: 240px; min-width: 240px; border-right: 1px solid var(--border); overflow-y: auto; }
.chat-user-list-header { padding: 14px 16px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--border); color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; }
.chat-user-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  cursor: pointer; border-bottom: 1px solid var(--border); transition: background 150ms;
}
.chat-user-item:hover { background: var(--bg-tertiary); }
.chat-user-item.active { background: rgba(139,92,246,.12); }
.chat-user-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-purple); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 14px;
}
.chat-user-name  { font-size: 13px; font-weight: 600; }
.chat-user-email { font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.chat-user-badge {
  margin-left: auto; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--accent-red); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 5px; flex-shrink: 0;
}
.chat-convo-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-convo-header { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.chat-convo-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.chat-convo-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); font-size: 13px; }
.chat-convo-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-shrink: 0; }
.chat-convo-input {
  flex: 1; padding: 9px 14px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 20px;
  color: var(--text-primary); font-size: 13px; font-family: inherit; outline: none;
}
.chat-convo-input:focus { border-color: var(--accent-purple); }
.chat-admin-send {
  padding: 9px 18px; background: var(--accent-purple); color: #fff;
  border: none; border-radius: 20px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.chat-no-users { padding: 30px; text-align: center; color: var(--text-secondary); font-size: 13px; }

/* ── Insufficient Balance Banner ────────────────────────────────────────── */
.insufficient-banner {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px; margin-bottom: 16px;
  text-align: center;
}
.insufficient-banner .ib-title {
  font-size: 14px; font-weight: 700; color: var(--accent-red);
  margin-bottom: 4px;
}
.insufficient-banner .ib-sub {
  font-size: 12px; color: var(--accent-orange);
}
