/* ============================================================
   TradePanel Pro — CSS Variables & Base
   ============================================================ */

/* Google Fonts — loaded via <link> in HTML headers */

/* ── DARK THEME (default) ── */
[data-theme="dark"], :root {
  --bg-base:       #080c12;
  --bg-surface:    #0d1321;
  --bg-elevated:   #121b2e;
  --bg-card:       #141e33;
  --bg-hover:      #1a2640;
  --bg-input:      #0f1825;

  --border:        #1e2d45;
  --border-light:  #253550;

  --text-primary:  #e8edf5;
  --text-secondary:#8fa3c0;
  --text-muted:    #4a6080;

  --accent:        #00d4ff;
  --accent-dim:    rgba(0, 212, 255, 0.12);
  --accent-hover:  #33deff;
  --accent-glow:   0 0 20px rgba(0, 212, 255, 0.3);

  --green:         #00e676;
  --green-dim:     rgba(0, 230, 118, 0.12);
  --red:           #ff3d6e;
  --red-dim:       rgba(255, 61, 110, 0.12);
  --yellow:        #ffc107;
  --yellow-dim:    rgba(255, 193, 7, 0.12);
  --purple:        #a855f7;
  --purple-dim:    rgba(168, 85, 247, 0.12);

  --sidebar-w:     260px;
  --topbar-h:      64px;
  --radius:        10px;
  --radius-lg:     16px;
  --shadow:        0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.6);
  --transition:    0.2s ease;
  --font-display:  'Syne', sans-serif;
  --font-mono:     'Space Mono', monospace;
}

/* ── LIGHT THEME ── */
[data-theme="light"] {
  --bg-base:       #f0f4fb;
  --bg-surface:    #ffffff;
  --bg-elevated:   #f8fafd;
  --bg-card:       #ffffff;
  --bg-hover:      #eef2f9;
  --bg-input:      #f4f7fc;

  --border:        #d8e2f0;
  --border-light:  #e5ecf7;

  --text-primary:  #0d1b2e;
  --text-secondary:#4a6080;
  --text-muted:    #8fa3c0;

  --accent:        #0085cc;
  --accent-dim:    rgba(0, 133, 204, 0.1);
  --accent-hover:  #0099ee;
  --accent-glow:   0 0 20px rgba(0, 133, 204, 0.2);

  --green:         #00994d;
  --green-dim:     rgba(0, 153, 77, 0.1);
  --red:           #cc2244;
  --red-dim:       rgba(204, 34, 68, 0.1);
  --yellow:        #cc8800;
  --yellow-dim:    rgba(204, 136, 0, 0.1);

  --shadow:        0 2px 16px rgba(0,20,60,0.08);
  --shadow-lg:     0 4px 32px rgba(0,20,60,0.14);
}

/* ── DARK EMERALD THEME ── */
[data-theme="dark-emerald"] {
  --bg-base:       #060f0a;
  --bg-surface:    #0a1a10;
  --bg-elevated:   #0f2618;
  --bg-card:       #112e1c;
  --bg-hover:      #163a24;
  --bg-input:      #081508;

  --border:        #1a3d25;
  --border-light:  #245030;

  --text-primary:  #e0f5e8;
  --text-secondary:#8fc0a0;
  --text-muted:    #4a7860;

  --accent:        #00e676;
  --accent-dim:    rgba(0, 230, 118, 0.12);
  --accent-hover:  #33ff99;
  --accent-glow:   0 0 20px rgba(0, 230, 118, 0.3);

  --green:         #00e676;
  --green-dim:     rgba(0, 230, 118, 0.12);
  --red:           #ff5252;
  --red-dim:       rgba(255, 82, 82, 0.12);
  --yellow:        #ffd740;
  --yellow-dim:    rgba(255, 215, 64, 0.12);
  --purple:        #b388ff;
  --purple-dim:    rgba(179, 136, 255, 0.12);

  --shadow:        0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.7);
}

/* ── DARK CRIMSON THEME ── */
[data-theme="dark-crimson"] {
  --bg-base:       #0c0608;
  --bg-surface:    #150a0e;
  --bg-elevated:   #1e0f15;
  --bg-card:       #24121a;
  --bg-hover:      #301820;
  --bg-input:      #100810;

  --border:        #3a1a28;
  --border-light:  #4a2236;

  --text-primary:  #f5e0e8;
  --text-secondary:#c08fa0;
  --text-muted:    #784a60;

  --accent:        #ff4081;
  --accent-dim:    rgba(255, 64, 129, 0.12);
  --accent-hover:  #ff6ea1;
  --accent-glow:   0 0 20px rgba(255, 64, 129, 0.3);

  --green:         #69f0ae;
  --green-dim:     rgba(105, 240, 174, 0.12);
  --red:           #ff1744;
  --red-dim:       rgba(255, 23, 68, 0.12);
  --yellow:        #ffab40;
  --yellow-dim:    rgba(255, 171, 64, 0.12);
  --purple:        #ea80fc;
  --purple-dim:    rgba(234, 128, 252, 0.12);

  --shadow:        0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.7);
}

/* ── LIGHT OCEAN THEME ── */
[data-theme="light-ocean"] {
  --bg-base:       #eef5fa;
  --bg-surface:    #f5faff;
  --bg-elevated:   #f0f7fd;
  --bg-card:       #ffffff;
  --bg-hover:      #e4f0fa;
  --bg-input:      #f0f6fc;

  --border:        #c4ddf0;
  --border-light:  #d4e8f7;

  --text-primary:  #0a1e33;
  --text-secondary:#3a6890;
  --text-muted:    #7aa0c0;

  --accent:        #0277bd;
  --accent-dim:    rgba(2, 119, 189, 0.1);
  --accent-hover:  #0288d1;
  --accent-glow:   0 0 20px rgba(2, 119, 189, 0.2);

  --green:         #00897b;
  --green-dim:     rgba(0, 137, 123, 0.1);
  --red:           #c62828;
  --red-dim:       rgba(198, 40, 40, 0.1);
  --yellow:        #f9a825;
  --yellow-dim:    rgba(249, 168, 37, 0.1);

  --shadow:        0 2px 16px rgba(0,40,80,0.08);
  --shadow-lg:     0 4px 32px rgba(0,40,80,0.12);
}

/* ── LIGHT MINT THEME ── */
[data-theme="light-mint"] {
  --bg-base:       #cffde1;
  --bg-surface:    #e0fee9;
  --bg-elevated:   #d8fddf;
  --bg-card:       #eaffef;
  --bg-hover:      #c2f5d4;
  --bg-input:      #d5fce0;

  --border:        #a0e6b8;
  --border-light:  #b8eeca;

  --text-primary:  #0a2618;
  --text-secondary:#2d5a42;
  --text-muted:    #5a9070;

  --accent:        #0d9e5a;
  --accent-dim:    rgba(13, 158, 90, 0.12);
  --accent-hover:  #10b868;
  --accent-glow:   0 0 20px rgba(13, 158, 90, 0.2);

  --green:         #0d9e5a;
  --green-dim:     rgba(13, 158, 90, 0.1);
  --red:           #c0392b;
  --red-dim:       rgba(192, 57, 43, 0.1);
  --yellow:        #d4a017;
  --yellow-dim:    rgba(212, 160, 23, 0.1);

  --shadow:        0 2px 16px rgba(10,40,20,0.08);
  --shadow-lg:     0 4px 32px rgba(10,40,20,0.12);
}

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: var(--font-display);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 14px;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ============================================================
   LAYOUT
   ============================================================ */
.admin-layout, .client-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  transition: transform var(--transition), box-shadow var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding:3px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg-surface);
  z-index: 2;
}

.logo-icon {
  width: 40px; height: 40px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: var(--accent-glow);
}

.logo-text .logo-main { font-size: 14px; font-weight: 800; color: var(--text-primary); }
.logo-text .logo-accent { font-size: 14x; font-weight: 800; color: var(--accent); }
.logo-text small { display: block; font-size: 10px; color: #fff; font-family: var(--font-mono); letter-spacing: 1px; text-transform: uppercase; }

.sidebar-close { display: none; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px; margin-left: auto; }

/* Profile in sidebar (client) */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.profile-avatar {
  width: 42px; height: 42px;
  background: var(--accent-dim);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: 18px;
  position: relative;
  flex-shrink: 0;
}

.profile-badge {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 18px; height: 18px;
  background: var(--bg-elevated);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
  border: 1px solid var(--border);
}

.profile-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.profile-group { font-size: 11px; font-family: var(--font-mono); }

/* Nav */
.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-section-label {
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  cursor: pointer;
  position: relative;
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; }

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  position: sticky; bottom: 0;
}

.sidebar-admin-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-avatar {
  width: 36px; height: 36px;
  background: var(--accent-dim);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: 15px;
}

.admin-name { font-size: 13px; font-weight: 700; }
.admin-role { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: 1px; text-transform: uppercase; }

.sidebar-actions { display: flex; gap: 8px; }

/* ── MAIN WRAPPER ── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed; top: 0; z-index: 100;
  width: calc(100% - var(--sidebar-w));
  right: 0;
}

.topbar-left { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.sidebar-toggle { display: none !important; }

.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted); font-family: var(--font-mono);
}
.breadcrumb i { font-size: 9px; }
.breadcrumb span:last-child { color: var(--text-primary); font-weight: 700; }

.topbar-clock {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.ticker-mini { display: flex; align-items: center; gap: 8px; }
.ticker-pair { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.ticker-price { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--green); }

/* Live ticker (client) */
.live-ticker {
  overflow: hidden;
  flex: 1;
  min-width: 0;
}
.ticker-scroll {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  animation: tickerAnim 30s linear infinite;
}
@keyframes tickerAnim {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  padding: 28px 28px;
  padding-top: calc(var(--topbar-h) + 28px);
  max-width: 100%;
  overflow-x: hidden;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--accent-glow); }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline:hover { background: var(--accent-dim); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: var(--red);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-success {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green);
}
.btn-success:hover { background: var(--green); color: #000; }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-icon {
  width: 36px; height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all var(--transition);
}
.btn-icon:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.btn-icon-sm { width: 30px; height: 30px; font-size: 12px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 15px; font-weight: 800; color: var(--text-primary);
  display: flex; align-items: center; gap: 10px;
}
.card-title i { color: var(--accent); }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: 20px;
  margin-bottom: 14px;
}
.stat-icon.green { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.stat-icon.red   { background: var(--red-dim);   border-color: var(--red);   color: var(--red);   }
.stat-icon.yellow{ background: var(--yellow-dim); border-color: var(--yellow); color: var(--yellow); }
.stat-icon.purple{ background: var(--purple-dim); border-color: var(--purple); color: var(--purple); }

.stat-value { font-size: 28px; font-weight: 800; font-family: var(--font-mono); color: var(--text-primary); }
.stat-label { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: 1px; text-transform: uppercase; margin-top: 4px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead tr { background: var(--bg-elevated); }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-hover); }
.mono { font-family: var(--font-mono); font-size: 12px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; margin-bottom: 7px;
  font-size: 11px; font-weight: 700;
  font-family: var(--font-mono); letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-secondary);
}
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}
.badge-active  { background: var(--green-dim);  color: var(--green);  border: 1px solid var(--green); }
.badge-expired { background: var(--red-dim);    color: var(--red);    border: 1px solid var(--red); }
.badge-pending { background: var(--yellow-dim); color: var(--yellow); border: 1px solid var(--yellow); }
.badge-vip     { background: var(--yellow-dim); color: var(--yellow); border: 1px solid var(--yellow); }
.badge-standard{ background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent); }
.badge-guest   { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
  padding: 20px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
  box-shadow: var(--shadow-lg);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 800; }
.modal-body  { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
  min-width: 260px; max-width: 360px;
  position: relative;
}
.toast span { flex: 1; }
.toast-close {
  background: none; border: none; color: inherit; opacity: 0.5;
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0 0 0 8px;
  flex-shrink: 0; transition: opacity 0.15s;
}
.toast-close:hover { opacity: 1; }
.toast-close-all {
  position: absolute; top: 0;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-secondary);
  font-size: 16px; line-height: 1; cursor: pointer;
  padding: 6px 10px; box-shadow: var(--shadow);
  text-decoration: underline; transition: all 0.15s;
  z-index: 1; left: -44px; right: auto;
}
.toast-close-all:hover { color: var(--red); border-color: var(--red); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left: 3px solid var(--green); color: var(--green); }
.toast.error   { border-left: 3px solid var(--red);   color: var(--red);   }
.toast.info    { border-left: 3px solid var(--accent); color: var(--accent); }
.toast.warning { border-left: 3px solid var(--yellow); color: var(--yellow); }

/* ============================================================
   LOADING
   ============================================================ */
.loading-overlay {
  display: none !important; /* Отключён — не нужен */
}

/* Плавный переход контента при SPA навигации */
.main-content {
  transition: opacity 0.15s ease;
}

.loading-spinner {
  width: 60px; height: 60px;
  position: relative;
}
.spinner-ring {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.spinner-ring:nth-child(2) { inset: 8px; border-top-color: var(--green); animation-duration: 0.8s; }
.spinner-ring:nth-child(3) { inset: 16px; border-top-color: var(--accent); animation-duration: 0.6s; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Content loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap; gap: 16px;
}
.page-header-left h1 {
  font-size: 24px; font-weight: 800;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 12px;
}
.page-header-left h1 i { color: var(--accent); font-size: 22px; }
.page-header-left p { font-size: 13px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   SEARCH & FILTERS
   ============================================================ */
.table-toolbar {
  display: flex; align-items: center;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.search-input-wrap {
  position: relative; flex: 1; min-width: 200px;
}
.search-input-wrap i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 13px;
}
.search-input {
  width: 100%; padding: 9px 14px 9px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-display); font-size: 13px;
  outline: none; transition: all var(--transition);
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
  backdrop-filter: blur(3px);
}

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.active { display: block; }
  .sidebar-close { display: flex; align-items: center; justify-content: center; }
  .sidebar-toggle { display: flex !important; }
  .main-wrapper { margin-left: 0; }
  .main-content { padding: 16px; padding-top: calc(var(--topbar-h) + 16px); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 0 16px; padding-top: env(safe-area-inset-top, 0px); width: 100%; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .live-ticker { max-width: none; flex: 1; min-width: 0; }
  .user-info-card { flex-direction: column; text-align: center; gap: 14px; padding: 18px 14px; }
  .user-stats-row { margin-left: 0; justify-content: center; }
  .user-meta h2 { font-size: 18px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .modal { margin: 0; border-radius: var(--radius); }
  .toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { min-width: unset; }
  .toast-close-all { left: auto; right: -6px; top: -36px; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .main-content { padding: 12px; padding-top: calc(var(--topbar-h) + 12px); padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .user-avatar-lg { width: 56px; height: 56px; font-size: 24px; }
}

/* ============================================================
   TELEGRAM MINI APP
   ============================================================ */
body.tg-webapp {
  min-height: var(--tg-viewport-height, 100vh);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
body.tg-webapp .admin-layout,
body.tg-webapp .client-layout {
  min-height: var(--tg-viewport-height, 100vh);
}
body.tg-webapp .login-page {
  min-height: var(--tg-viewport-height, 100vh);
  padding: 12px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: fixed; inset: 0; z-index: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(0, 230, 118, 0.04) 0%, transparent 50%);
}

.login-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image: linear-gradient(rgba(0,212,255,0.03) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(0,212,255,0.03) 1px, transparent 1px);
  background-size: 50px 50px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%; max-width: 440px;
  position: relative; z-index: 1;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
@media (max-width: 480px) {
  .login-card { padding: 24px 16px; }
}
.login-card img { max-width: 100%; height: auto; }

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-icon-lg {
  width: 64px; height: 64px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  color: var(--accent); font-size: 28px;
  box-shadow: var(--accent-glow);
}
.login-logo h1 { font-size: 24px; font-weight: 800; }
.login-logo h1 span { color: var(--accent); }
.login-logo p { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: 1px; margin-top: 4px; }

.login-tabs {
  display: flex;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 28px;
}
.login-tab {
  flex: 1; text-align: center;
  padding: 8px;
  border-radius: 8px;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
  border: none; background: none;
  font-family: var(--font-display);
}
.login-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow);
}

.pass-toggle {
  position: relative;
}
.pass-toggle .form-control { padding-right: 44px; }
.pass-eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 14px;
  transition: color var(--transition);
}
.pass-eye:hover { color: var(--accent); }

/* ============================================================
   SIGNALS (Client)
   ============================================================ */
.signal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: all var(--transition);
  cursor: pointer;
}
.signal-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }

.signal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.signal-pair { font-size: 18px; font-weight: 800; font-family: var(--font-mono); }
.signal-type { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.signal-type.buy  { background: var(--green-dim); color: var(--green); border: 1px solid var(--green); }
.signal-type.sell { background: var(--red-dim);   color: var(--red);   border: 1px solid var(--red); }

.signal-data { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.signal-data-item { text-align: center; }
.signal-data-item .label { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: 1px; text-transform: uppercase; }
.signal-data-item .value { font-size: 14px; font-weight: 700; font-family: var(--font-mono); margin-top: 2px; }

/* Locked signal */
.signal-locked {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}
.signal-lock-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8,12,18,0.7);
  border-radius: var(--radius-lg);
  flex-direction: column; gap: 8px;
  color: var(--text-muted); font-size: 13px;
}
.signal-lock-overlay i { font-size: 24px; color: var(--yellow); }

/* ============================================================
   DASHBOARD CHARTS PLACEHOLDER
   ============================================================ */
.chart-container {
  position: relative;
  height: 280px;
  display: flex; align-items: center; justify-content: center;
}

/* User profile card (client main) */
.user-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 20px;
  flex-wrap: wrap;
}
.user-avatar-lg {
  width: 72px; height: 72px;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 30px;
  flex-shrink: 0;
}
.user-meta h2 { font-size: 22px; font-weight: 800; }
.user-meta p  { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }

.user-stats-row {
  display: flex; gap: 24px; margin-left: auto;
  flex-wrap: wrap;
}
.user-stat { text-align: center; }
.user-stat .val { font-size: 22px; font-weight: 800; font-family: var(--font-mono); }
.user-stat .lbl { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: 1px; text-transform: uppercase; }

/* Progress bar */
.progress-wrap { margin-top: 4px; }
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.text-accent  { color: var(--accent); }
.text-green   { color: var(--green); }
.text-red     { color: var(--red); }
.text-yellow  { color: var(--yellow); }
.text-muted   { color: var(--text-muted); }
.text-mono    { font-family: var(--font-mono); }
.text-center  { text-align: center; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.mb-0  { margin-bottom: 0; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.w-100 { width: 100%; }

.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* Divider */
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }


#tv-attr-logo {
  display: none!important;
}