/* AffsCash2 - Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b27;
  --bg-card: #1a2035;
  --bg-input: #111827;
  --border: #1e2a3a;
  --border-light: #243047;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --purple: #7c3aed;
  --purple-light: #a78bfa;
  --cyan: #06b6d4;
  --cyan-light: #67e8f9;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --orange: #f97316;
  --pink: #ec4899;
  --gradient: linear-gradient(135deg, #7c3aed, #06b6d4);
  --gradient-card: linear-gradient(135deg, rgba(124,58,237,.15), rgba(6,182,212,.08));
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.5);
  --transition: .2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  /* overflow-x removed — was blocking table horizontal scroll inside .table-wrapper */
}

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

/* ── Layout ── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--transition);
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--header-height);
}

.sidebar-logo {
  font-size: 20px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.sidebar-badge {
  font-size: 10px;
  background: var(--gradient);
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  -webkit-text-fill-color: #fff;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(124, 58, 237, .12);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(124,58,237,.25), rgba(6,182,212,.12));
  color: var(--purple-light);
  border: 1px solid rgba(124,58,237,.25);
}

.nav-item.active .nav-icon { color: var(--purple-light); }

.nav-icon {
  width: 18px;
  height: 18px;
  opacity: .8;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.sidebar-user:hover { background: rgba(124,58,237,.1); }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0; /* prevent flex child from overflowing its container */
  overflow-x: hidden; /* clip at main-content, not body, so table-wrapper scroll works */
}

/* ── Topbar ── */
.topbar {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title { font-size: 16px; font-weight: 700; flex: 1; }
.topbar-title span { color: var(--text-muted); font-weight: 400; font-size: 13px; margin-left: 8px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
}

.icon-btn:hover { background: rgba(124,58,237,.15); color: var(--purple-light); border-color: rgba(124,58,237,.3); }

.icon-btn .badge-dot {
  position: absolute;
  top: -3px; right: -3px;
  width: 12px; height: 12px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
  font-size: 8px;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}

/* ── Page Content ── */
.page-content { flex: 1; padding: 24px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header-left h1 { font-size: 22px; font-weight: 700; }
.page-header-left p { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

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

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

.stat-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .06;
  background: var(--stat-color, var(--purple));
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}

.stat-icon.purple { background: rgba(124,58,237,.15); color: var(--purple-light); --stat-color: var(--purple); }
.stat-icon.cyan { background: rgba(6,182,212,.15); color: var(--cyan); --stat-color: var(--cyan); }
.stat-icon.green { background: rgba(16,185,129,.15); color: var(--green); --stat-color: var(--green); }
.stat-icon.yellow { background: rgba(245,158,11,.15); color: var(--yellow); --stat-color: var(--yellow); }
.stat-icon.red { background: rgba(239,68,68,.15); color: var(--red); --stat-color: var(--red); }
.stat-icon.orange { background: rgba(249,115,22,.15); color: var(--orange); --stat-color: var(--orange); }

.stat-value { font-size: 26px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }
.stat-change { font-size: 12px; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: rgba(0,0,0,.1); }

/* ── Table ── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrapper::-webkit-scrollbar { height: 6px; }
.table-wrapper::-webkit-scrollbar-track { background: transparent; }
.table-wrapper::-webkit-scrollbar-thumb { background: rgba(124,58,237,.3); border-radius: 3px; }
.table-wrapper::-webkit-scrollbar-thumb:hover { background: rgba(124,58,237,.55); }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

/* Report tables: allow natural width so horizontal scroll works */
table.data-table.report-table {
  width: max-content;
  min-width: 100%;
}

table.data-table thead th {
  background: rgba(0,0,0,.2);
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

table.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

table.data-table tbody tr:last-child td { border-bottom: none; }

table.data-table tbody tr:hover { background: rgba(124,58,237,.04); }

table.data-table .cell-primary { color: var(--text-primary); font-weight: 500; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  gap: 4px;
}

.badge-active, .badge-approved { background: rgba(16,185,129,.15); color: var(--green); }
.badge-pending { background: rgba(245,158,11,.15); color: var(--yellow); }
.badge-rejected, .badge-suspended, .badge-banned { background: rgba(239,68,68,.15); color: var(--red); }
.badge-paused { background: rgba(100,116,139,.15); color: var(--text-secondary); }
.badge-auto_hidden { background: rgba(249,115,22,.15); color: var(--orange); }
.badge-admin { background: rgba(124,58,237,.15); color: var(--purple-light); }
.badge-affiliate { background: rgba(6,182,212,.15); color: var(--cyan); }
.badge-advertiser { background: rgba(236,72,153,.15); color: var(--pink); }
.badge-info { background: rgba(6,182,212,.1); color: var(--cyan); }
.badge-dot-indicator { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
}
.btn-primary:hover { opacity: .85; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124,58,237,.3); }

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-success { background: rgba(16,185,129,.15); color: var(--green); border-color: rgba(16,185,129,.3); }
.btn-success:hover { background: rgba(16,185,129,.25); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--red); border-color: rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-warning { background: rgba(245,158,11,.15); color: var(--yellow); border-color: rgba(245,158,11,.3); }
.btn-warning:hover { background: rgba(245,158,11,.25); }
.btn-info { background: rgba(6,182,212,.15); color: var(--cyan); border-color: rgba(6,182,212,.3); }
.btn-info:hover { background: rgba(6,182,212,.25); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }

.form-control, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
  appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-control-sm, .form-select-sm {
  padding: 5px 10px;
  font-size: 12px;
}
.form-select-sm {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 8px center;
  padding-right: 28px;
}

.form-control:focus, .form-select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}

textarea.form-control { min-height: 100px; resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.input-group { display: flex; gap: 0; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-prefix {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-right: none;
  padding: 9px 14px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  display: flex; align-items: center;
}
.input-prefix + .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Checkbox/Radio */
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] { display: none; }
.form-check-indicator {
  width: 18px; height: 18px;
  border: 2px solid var(--border-light);
  border-radius: 4px;
  background: var(--bg-input);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.form-check input:checked + .form-check-indicator {
  background: var(--gradient);
  border-color: transparent;
}
.form-check input:checked + .form-check-indicator::after {
  content: '✓';
  color: #fff;
  font-size: 11px;
}
.form-check-label { font-size: 13px; color: var(--text-secondary); }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; }
.alert-success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.25); color: var(--green); }
.alert-danger { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25); color: var(--red); }
.alert-warning { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.25); color: var(--yellow); }
.alert-info { background: rgba(6,182,212,.1); border: 1px solid rgba(6,182,212,.25); color: var(--cyan); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(.97);
  transition: var(--transition);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.active .modal { transform: none; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

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

.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}
.modal-close:hover { background: rgba(239,68,68,.15); color: var(--red); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition);
  font-family: inherit;
  display: flex; align-items: center; gap: 6px;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--purple-light); border-bottom-color: var(--purple); }
[data-chart-type] { transition: background .15s, color .15s; }
[data-chart-type].active { background: var(--primary, #7c3aed) !important; color: #fff !important; }
[data-chart-type]:hover:not(.active) { background: var(--bg-tertiary, rgba(100,116,139,.15)) !important; }
[data-perf-metric],[data-perf-type] { transition: background .15s, color .15s, border-color .15s; }
[data-perf-metric].active,[data-perf-type].active { background: var(--primary,#7c3aed) !important; color: #fff !important; border-color: var(--primary,#7c3aed) !important; }
[data-perf-metric]:hover:not(.active),[data-perf-type]:hover:not(.active) { background: var(--bg-tertiary,rgba(100,116,139,.15)) !important; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Progress Bar ── */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--gradient);
  transition: width .5s ease;
}

/* ── Tooltips ── */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #0d1117;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: .15s;
  z-index: 999;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── Search Input ── */
.search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.search-box .search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  width: 14px; height: 14px;
}
.search-box .form-control { padding-left: 32px; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 4px; }
.page-btn {
  min-width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  text-decoration: none;
  padding: 0 8px;
}
.page-btn:hover { background: rgba(124,58,237,.15); color: var(--purple-light); }
.page-btn.active { background: var(--gradient); color: #fff; border-color: transparent; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Charts ── */
.chart-container { position: relative; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.chart-legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ── Copy Input ── */
.copy-field { display: flex; gap: 0; }
.copy-field .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); font-size: 12px; font-family: monospace; }
.copy-field .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ── Status Dot ── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.active { background: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.status-dot.paused { background: var(--yellow); }
.status-dot.offline { background: var(--text-muted); }

/* ── Live Chat ── */
.chat-widget {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 500;
}

.chat-bubble {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--gradient);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(124,58,237,.5);
  transition: var(--transition);
  font-size: 20px;
  position: relative;
}

.chat-bubble:hover { transform: scale(1.08); }
.chat-bubble .unread-dot {
  position: absolute;
  top: -2px; right: -2px;
  width: 16px; height: 16px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
}

.chat-window {
  position: absolute;
  bottom: 64px; right: 0;
  width: 340px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  height: 450px;
}

.chat-window.open { display: flex; }

.chat-win-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.chat-msg.sent {
  align-self: flex-end;
  background: var(--gradient);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg.recv {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.chat-msg-time { font-size: 10px; opacity: .6; margin-top: 3px; }

.chat-input-area {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}

/* ── Notification Dropdown ── */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  width: 320px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  display: none;
}
.notif-dropdown.open { display: block; }
.notif-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 10px; transition: var(--transition); }
.notif-item:hover { background: rgba(124,58,237,.05); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(124,58,237,.04); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.notif-dot.info { background: var(--cyan); }
.notif-dot.success { background: var(--green); }
.notif-dot.warning { background: var(--yellow); }
.notif-dot.danger { background: var(--red); }

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: .3; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 30% 20%, rgba(124,58,237,.15) 0%, transparent 50%), radial-gradient(ellipse at 70% 80%, rgba(6,182,212,.1) 0%, transparent 50%), var(--bg-primary);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 {
  font-size: 32px; font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── Misc ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--text-primary) !important; }
.text-success { color: var(--green) !important; }
.text-danger { color: var(--red) !important; }
.text-warning { color: var(--yellow) !important; }
.text-info { color: var(--cyan) !important; }
.text-purple { color: var(--purple-light) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.flex-1 { flex: 1; }
.mono { font-family: monospace; font-size: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ── Dark Dropdown ── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 160px;
  z-index: 300;
  display: none;
  padding: 4px 0;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
}
.dropdown-item:hover { background: rgba(124,58,237,.1); color: var(--text-primary); }
.dropdown-item.danger:hover { background: rgba(239,68,68,.1); color: var(--red); }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    z-index: 300;
  }
  .sidebar.open {
    transform: none;
    box-shadow: 4px 0 40px rgba(0,0,0,.6);
  }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hamburger { display: flex !important; }
  /* Hide topbar balance widget on tablet to save space */
  .topbar-actions > div:first-child { display: none; }
}

@media (max-width: 768px) {
  :root { --header-height: 56px; }
  .page-content { padding: 12px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-control,
  .filter-bar .form-select,
  .filter-bar .btn { width: 100%; }
  .chat-window { width: calc(100vw - 32px); right: -12px; }
  .modal { max-width: calc(100vw - 24px); border-radius: 12px; margin: 12px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }

  /* Topbar compact */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-title { font-size: 14px; }
  .topbar-title span { display: none; }
  .topbar-actions { gap: 6px; }
  .topbar-actions > div { display: none; } /* hide balance/commission on mobile */
  .icon-btn { width: 32px; height: 32px; }

  /* Page header stacks on mobile */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header-left h1 { font-size: 18px; }

  /* Cards */
  .card-header { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .card-body { padding: 14px; }

  /* Table — horizontal scroll with sticky first col */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrapper::before {
    content: '';
    display: block;
    height: 1px;
  }
  table.data-table { min-width: 500px; }
  table.data-table thead th,
  table.data-table tbody td { padding: 9px 10px; white-space: nowrap; }

  /* Stat cards compact */
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px !important; }
  .stat-label { font-size: 11px; }
  .stat-icon { width: 34px; height: 34px; margin-bottom: 8px; }

  /* Tabs horizontal scroll */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; padding-bottom: 2px; }
  .tab-btn { white-space: nowrap; padding: 8px 12px; font-size: 12px; }

  /* Notification dropdown full-width on mobile */
  .notif-dropdown { width: calc(100vw - 24px); right: -50px; }

  /* Chat widget repositioned */
  .chat-widget { bottom: 12px; right: 12px; }
  .chat-bubble { width: 44px; height: 44px; }

  /* Impersonation banner */
  .impersonate-bar { font-size: 12px; padding: 6px 12px; flex-wrap: wrap; }

  /* Login card */
  .login-card { padding: 24px 18px; border-radius: 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .login-card { padding: 20px 14px; margin: 8px; }
  .page-content { padding: 10px; }
  .btn { font-size: 12px; padding: 7px 14px; }
  .btn-lg { padding: 10px 18px; font-size: 13px; }
  .btn-sm { padding: 4px 10px; font-size: 11px; }
  .badge { font-size: 10px; padding: 2px 8px; }

  /* Single column stats on very small screens */
  .stats-grid.single-mobile { grid-template-columns: 1fr; }

  /* Full-width modals slide up from bottom */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; max-width: 100%; width: 100%; margin: 0; }

  /* Topbar title shorter */
  .topbar-title { font-size: 13px; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ─── Mobile responsive hardening ─────────────────────────────────────────────
   Phones (especially iPhone portrait) were squeezing inline-flex card bodies:
   icon + flex:1 title + toggle leaves <180px for the title, so titles wrapped
   word-by-word. Also clip body overflow so a single wide element (e.g. a long
   URL in a code block) cannot widen the page past the viewport.            */

html, body { max-width: 100vw; overflow-x: hidden; }

@media (max-width: 768px) {
  /* Cards in tab pages must use the full content width on phones. */
  .tabs-container, .tab-content, .tab-content > .card { width: 100%; min-width: 0; }
  .tab-content .card { box-sizing: border-box; }

  /* Generic safety: any flex card-body using inline styles wraps on mobile so
     a fixed-width control on the right (toggle, button) cannot squeeze the
     middle flex:1 column down to a single character per line. */
  .card-body[style*="display:flex"] { flex-wrap: wrap !important; }
  .card-body[style*="display:flex"] > [style*="flex:1"],
  .card-body[style*="display:flex"] > [style*="flex: 1"] { min-width: 0; flex-basis: 100%; }
  .card-body[style*="display:flex"] > .form-check { margin-top: 8px !important; }

  /* Long monospace strings (postback URLs, tracking templates) must wrap rather
     than push the page wider than the viewport. */
  code, pre { word-break: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
}

@media (max-width: 480px) {
  /* Tighter padding inside cards on tiny screens — the screenshot showed 22px
     side padding eating ~25% of the iPhone viewport. */
  .card-body { padding: 12px !important; }
  .card-header { padding: 12px !important; }

  /* ENABLED / DISABLED labels inside form-check were being clipped; allow them
     to wrap onto their own line with the indicator. */
  .form-check { flex-wrap: wrap; gap: 6px; }
  .form-check-label { font-size: 12px; }
}

/* ── Responsive card-style tables (opt-in via .data-table-cards) ── */
@media (max-width: 768px) {
  .table-wrapper:has(.data-table-cards) { overflow-x: visible; }
  table.data-table.data-table-cards { min-width: 0; width: 100%; display: block; }
  table.data-table.data-table-cards thead { display: none; }
  table.data-table.data-table-cards tbody { display: block; }
  table.data-table.data-table-cards tbody tr {
    display: block;
    background: var(--bg-card, transparent);
    border: 1px solid var(--border, rgba(124,58,237,.15));
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
  }
  table.data-table.data-table-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    border: none;
    border-bottom: 1px dashed rgba(148,163,184,.18);
    white-space: normal;
    text-align: right;
    font-size: 13px;
  }
  table.data-table.data-table-cards tbody td:last-child { border-bottom: none; }
  table.data-table.data-table-cards tbody td::before {
    content: attr(data-label);
    flex: 0 0 40%;
    text-align: left;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .4px;
    font-weight: 600;
  }
  table.data-table.data-table-cards tbody td:not([data-label])::before { content: ''; flex: 0; }
  table.data-table.data-table-cards tbody td > div,
  table.data-table.data-table-cards tbody td > span,
  table.data-table.data-table-cards tbody td > a { text-align: right; }
  /* Action button rows wrap right-aligned */
  table.data-table.data-table-cards tbody td[data-label="Actions"] > div { justify-content: flex-end; flex-wrap: wrap; }
  table.data-table.data-table-cards .empty-state { text-align: center; }
}

/* Smooth horizontal-scroll fallback for non-card tables */
@media (max-width: 768px) {
  .table-wrapper { padding-bottom: 4px; }
}

/* ── Page-header / button-group fixes for mobile ── */
@media (max-width: 768px) {
  .page-header > div:last-child { width: 100%; }
  .page-header .btn { font-size: 12px; }
  .page-header [style*="grid-template-columns"] { grid-template-columns: 1fr !important; gap: 12px !important; }
}

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideDown { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

.fade-in { animation: fadeIn .3s ease forwards; }
.loading { animation: pulse 1.5s ease-in-out infinite; }

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ── Glow Effects ── */
.glow-purple { box-shadow: 0 0 20px rgba(124,58,237,.3); }
.glow-cyan { box-shadow: 0 0 20px rgba(6,182,212,.3); }
.glow-green { box-shadow: 0 0 20px rgba(16,185,129,.3); }

/* ── Mobile Hamburger ── */
.hamburger {
  display: none;
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
}

@media (max-width: 1024px) { .hamburger { display: flex; } }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
}

/* ── Light Theme ── */
[data-theme="light"],
body.theme-light {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow: 0 4px 24px rgba(0,0,0,.08);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.12);
}

/* Direct property overrides for light mode — belt-and-suspenders for CSS variable cascade */
body.theme-light {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}
body.theme-light .topbar   { background: #ffffff !important; border-bottom-color: #e2e8f0 !important; }
body.theme-light .sidebar  { background: #ffffff !important; border-right-color: #e2e8f0 !important; }
body.theme-light .card,
body.theme-light .stat-card { background: #ffffff !important; border-color: #e2e8f0 !important; }
body.theme-light .form-control,
body.theme-light .form-select { background: #f8fafc !important; border-color: #e2e8f0 !important; color: #0f172a !important; }
body.theme-light .data-table thead th { background: #f1f5f9 !important; border-color: #e2e8f0 !important; }
body.theme-light .data-table tbody tr { border-color: #e2e8f0 !important; color: #0f172a; }
body.theme-light .nav-item { color: #475569; }
body.theme-light .nav-item:hover { background: rgba(124,58,237,.08) !important; }
body.theme-light .nav-item.active { background: linear-gradient(135deg,rgba(124,58,237,.15),rgba(6,182,212,.08)) !important; }
body.theme-light .sidebar-logo { color: #0f172a; }
body.theme-light .topbar-title { color: #0f172a; }

[data-theme="light"] .nav-item:hover {
  background: rgba(124,58,237,.08);
}

[data-theme="light"] .nav-item.active {
  background: linear-gradient(135deg, rgba(124,58,237,.15), rgba(6,182,212,.08));
}

[data-theme="light"] ::-webkit-scrollbar-track { background: var(--bg-primary); }

[data-theme="light"] .stat-card,
[data-theme="light"] .card {
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

[data-theme="light"] .modal-overlay { background: rgba(0,0,0,.4); }

[data-theme="light"] .topbar {
  background: var(--bg-secondary);
  border-bottom-color: var(--border);
}

[data-theme="light"] .sidebar {
  background: var(--bg-secondary);
  border-right-color: var(--border);
}

[data-theme="light"] .impersonation-bar {
  background: rgba(245,158,11,.12);
  border-color: rgba(245,158,11,.3);
}

[data-theme="light"] .badge-pending { background: rgba(245,158,11,.15); color: #b45309; }
[data-theme="light"] .badge-approved,
[data-theme="light"] .badge-active   { background: rgba(16,185,129,.15); color: #065f46; }
[data-theme="light"] .badge-rejected,
[data-theme="light"] .badge-banned   { background: rgba(239,68,68,.15);  color: #b91c1c; }
[data-theme="light"] .badge-info     { background: rgba(6,182,212,.15);  color: #0e7490; }

[data-theme="light"] .data-table thead th {
  background: var(--bg-primary);
  border-bottom-color: var(--border);
}

[data-theme="light"] .data-table tbody tr:hover {
  background: rgba(124,58,237,.04);
}

[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text-primary);
}

[data-theme="light"] .form-control:focus,
[data-theme="light"] .form-select:focus {
  border-color: var(--purple);
}

[data-theme="light"] .btn-secondary {
  background: var(--bg-primary);
  border-color: var(--border);
  color: var(--text-secondary);
}

[data-theme="light"] .btn-secondary:hover {
  background: var(--border);
  color: var(--text-primary);
}

[data-theme="light"] .alert-info    { background: rgba(6,182,212,.08);  border-color: rgba(6,182,212,.3);  color: #0e7490; }
[data-theme="light"] .alert-warning { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.3); color: #92400e; }
[data-theme="light"] .alert-danger  { background: rgba(239,68,68,.08);  border-color: rgba(239,68,68,.3);  color: #b91c1c; }
[data-theme="light"] .alert-success { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.3); color: #065f46; }

[data-theme="light"] .chat-bubble { box-shadow: 0 4px 16px rgba(124,58,237,.3); }
[data-theme="light"] .chat-window { background: var(--bg-secondary); border-color: var(--border); box-shadow: 0 8px 32px rgba(0,0,0,.12); }
.sidebar-overlay.active { display: block; }

/* ══════════════════════════════════════════════════════
   3D EFFECT SYSTEM
══════════════════════════════════════════════════════ */
:root {
  --shadow-3d:       0 1px 3px rgba(0,0,0,.45), 0 4px 16px rgba(0,0,0,.3);
  --shadow-3d-hover: 0 8px 40px rgba(0,0,0,.55), 0 2px 8px rgba(0,0,0,.35), 0 0 0 1px rgba(124,58,237,.18);
  --shadow-depth:    4px 4px 0 rgba(0,0,0,.25);
  --glow-purple:     0 0 20px rgba(124,58,237,.35), 0 0 40px rgba(124,58,237,.15);
  --glow-cyan:       0 0 20px rgba(6,182,212,.3),   0 0 40px rgba(6,182,212,.1);
  --glow-green:      0 0 20px rgba(16,185,129,.3),  0 0 40px rgba(16,185,129,.1);
}

/* ── Card 3D lift ── */
.card {
  transition: transform .2s cubic-bezier(.4,0,.2,1), box-shadow .2s cubic-bezier(.4,0,.2,1);
  will-change: transform;
  backface-visibility: hidden;
}
.card:hover {
  transform: translateY(-3px) scale(1.002);
  box-shadow: var(--shadow-3d-hover);
}

/* ── Stat widget 3D depth tile ── */
.stat-widget {
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease;
  transform-style: preserve-3d;
}
.stat-widget::before {
  content: '';
  position: absolute;
  inset: 6px -5px -5px 5px;
  background: rgba(0,0,0,.25);
  border-radius: inherit;
  z-index: -1;
  transition: inset .2s ease;
}
.stat-widget:hover {
  transform: translate(-2px, -3px);
  box-shadow: var(--shadow-3d-hover);
}
.stat-widget:hover::before {
  inset: 9px -8px -8px 8px;
}

/* ── Button 3D press ── */
.btn {
  position: relative;
  transition: transform .1s ease, box-shadow .1s ease, background .15s ease, border-color .15s ease;
  transform: translateY(0);
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(1px);  }
.btn-primary {
  box-shadow: 0 4px 0 rgba(0,0,0,.3), 0 0 0 0 rgba(124,58,237,0);
  transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}
.btn-primary:hover {
  box-shadow: 0 6px 0 rgba(0,0,0,.35), var(--glow-purple);
  transform: translateY(-2px);
}
.btn-primary:active {
  box-shadow: 0 1px 0 rgba(0,0,0,.3);
  transform: translateY(3px);
}

/* ── Table row subtle lift ── */
.data-table tbody tr {
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.data-table tbody tr:hover {
  transform: scaleX(1.002) translateZ(0);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  position: relative;
  z-index: 1;
}

/* ── Sidebar 3D depth shadow ── */
.sidebar {
  box-shadow: 4px 0 32px rgba(0,0,0,.45), 2px 0 8px rgba(0,0,0,.25);
}

/* ── Nav item glow on active ── */
.nav-item.active .nav-link,
.nav-link.active {
  box-shadow: inset 0 0 24px rgba(124,58,237,.08), 0 0 12px rgba(124,58,237,.08);
}

/* ── Glass card ── */
.card-glass {
  background: rgba(255,255,255,.03) !important;
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.07) !important;
  box-shadow: 0 8px 40px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.06) !important;
}

/* ── Floating animation for key metric cards ── */
@keyframes float3d {
  0%, 100% { transform: translateY(0);    }
  50%       { transform: translateY(-5px); }
}
.float-anim { animation: float3d 4s ease-in-out infinite; }

/* ── Depth badge ── */
.badge-3d {
  box-shadow: var(--shadow-depth);
  transform: translateZ(0);
}

/* ── Neon glow variants ── */
.glow-purple { box-shadow: var(--glow-purple); }
.glow-cyan   { box-shadow: var(--glow-cyan);   }
.glow-green  { box-shadow: var(--glow-green);  }

/* ── 3D input focus ── */
.form-control:focus, .form-select:focus {
  box-shadow: 0 0 0 3px rgba(124,58,237,.2), 0 4px 12px rgba(124,58,237,.15);
  transform: translateY(-1px);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

/* ── Page header 3D title ── */
.page-header h1 {
  text-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* ── Theme transition (smooth theme switch) ── */
body.theme-switching * {
  transition: background .3s ease, color .3s ease, border-color .3s ease, box-shadow .3s ease !important;
}

/* ══════════════════════════════════════════════════════
   THEME OVERRIDE LAYER — applied by data-theme-id attr
══════════════════════════════════════════════════════ */
/* themes override via [data-theme-id="xxx"] selectors in theme CSS files */

/* ── Light Theme: Login / Register / Auth Pages ── */
[data-theme="light"] .login-page,
body.theme-light .login-page {
  background: radial-gradient(ellipse at 30% 20%, rgba(124,58,237,.08) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(6,182,212,.06) 0%, transparent 50%),
              #f1f5f9 !important;
}
[data-theme="light"] .login-card,
body.theme-light .login-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 8px 40px rgba(0,0,0,.08) !important;
}
[data-theme="light"] .login-logo p,
body.theme-light .login-logo p { color: #64748b !important; }
[data-theme="light"] .form-group label,
body.theme-light .form-group label { color: #475569 !important; }
[data-theme="light"] .form-control,
[data-theme="light"] .form-select,
body.theme-light .form-control,
body.theme-light .form-select {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}
[data-theme="light"] .form-control::placeholder,
body.theme-light .form-control::placeholder { color: #94a3b8 !important; }
[data-theme="light"] .alert,
body.theme-light .alert { border-color: rgba(0,0,0,.1) !important; }
[data-theme="light"] .reg-section-title,
body.theme-light .reg-section-title { border-bottom-color: rgba(124,58,237,.15) !important; }

/* ── Dark Theme: Logo white on login/register/landing pages ── */
[data-theme="dark"] .login-logo img,
body.theme-dark .login-logo img {
  filter: brightness(0) invert(1);
}
[data-theme="light"] .login-logo img,
body.theme-light .login-logo img {
  filter: none;
}

/* ── Login page background (themed) ── */
body.login-bg-themed {
  background: radial-gradient(ellipse at 30% 20%, rgba(124,58,237,.15) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(6,182,212,.1) 0%, transparent 50%),
              var(--bg-primary);
}
