/* ═══════════════════════════════════════════════════════════════════════
   PINCH AFRICA 2030 — PREMIUM WHITE DESIGN SYSTEM
   Ultra-clean whitish SaaS theme with depth & micro-animations
   ═══════════════════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ─────────────────────────────────────────────────── */
:root {
  /* Surface palette — Pure White */
  --bg-primary:   #F8FAFC;
  --bg-secondary: #F1F5F9;
  --bg-elevated:  #FFFFFF;
  --bg-sunken:    #E2E8F0;

  /* Text palette */
  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;
  --text-inverse:   #FFFFFF;

  /* Accent palette */
  --accent:      #2563EB;
  --accent-hover:#1D4ED8;
  --accent-soft: #EFF6FF;
  --accent-glow: rgba(37, 99, 235, 0.15);

  /* Status palette */
  --success:      #059669;
  --success-soft: #ECFDF5;
  --warning:      #D97706;
  --warning-soft: #FFFBEB;
  --danger:       #DC2626;
  --danger-soft:  #FEF2F2;
  --info:         #0284C7;
  --info-soft:    #F0F9FF;

  /* Brand accents */
  --purple:   #7C3AED;
  --green:    #059669;
  --orange:   #EA580C;
  --red:      #DC2626;
  --blue:     #2563EB;
  --cyan:     #06B6D4;
  --ghl:      #F59E0B;
  --meta:     #1877F2;
  --google:   #4285F4;
  --wa-green: #25D366;
  --meta-blue:#1877F2;

  /* Legacy aliases (used throughout dashboard.html) */
  --bg:   #F8FAFC;
  --card: #FFFFFF;
  --text: #0F172A;
  --muted:#94A3B8;
  --border-light: #F1F5F9;
  --text-main: #0F172A;

  /* Borders & shadows */
  --border:     #E2E8F0;
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md:  0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl:  0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow:0 0 20px rgba(37, 99, 235, 0.12);


  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl:48px;

  /* Typography */
  --font-sans:'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

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

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

/* ── SCROLLBAR STYLING ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.01); }
::-webkit-scrollbar-thumb { background: #E2E8F0; border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ── ANIMATIONS ────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.85); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinning { animation: spin 1s linear infinite; }

/* ── SIDEBAR ───────────────────────────────────────────────────────── */
.sb {
  width: 270px !important;
  min-width: 270px;
  flex-shrink: 0;
  background: #FFFFFF !important;
  border-right: 1px solid #E2E8F0 !important;
  box-shadow: 1px 0 3px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 10;
}

/* Sidebar logo */
.logo, .sb-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #F1F5F9;
}
.logo-icon, .sb-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0548DB, #8B5CF6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  box-shadow: 0 4px 14px rgba(5,72,219,0.3);
}
.logo-text strong, .sb-logo-text strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: #0F172A !important;
  letter-spacing: -0.3px;
}
.logo-text span, .sb-logo-text span {
  display: block;
  font-size: 11px;
  color: #94A3B8 !important;
  font-weight: 500;
  margin-top: 1px;
}

/* Client badge */
.client-badge {
  margin: 12px 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(5,72,219,0.1), rgba(139,92,246,0.07));
  border: 1px solid rgba(5,72,219,0.2);
  border-radius: var(--radius-md);
}
.cb-name   { font-size: 13px; font-weight: 800; color: #0F172A !important; }
.cb-role   { font-size: 11px; color: #94A3B8 !important; font-weight: 500; margin-top: 2px; }
.cb-status { display: flex; align-items: center; gap: 6px; font-size: 10px; color: #10B981 !important; font-weight: 700; margin-top: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.dot       { width: 6px; height: 6px; background: #10B981; border-radius: 50%; animation: pulse-dot 1.5s ease infinite; }

/* Nav labels */
.nav-lbl {
  font-size: 10px !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #94A3B8 !important;
  padding: 18px 20px 6px;
  margin-top: 4px;
}

/* Sidebar nav buttons */
.sb-btn, .sb-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 16px;
  margin: 2px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: #94A3B8 !important;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border: 1px solid transparent;
  user-select: none;
}
.sb-btn i, .sb-link i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.sb-btn:hover, .sb-link:hover {
  background: #F1F5F9 !important;
  color: #0F172A !important;
  border-color: #E2E8F0 !important;
}
.sb-btn:hover i, .sb-link:hover i { transform: scale(1.1); }

.sb-btn.active, .sb-link.active {
  background: #EFF6FF !important;
  color: #2563EB !important;
  font-weight: 700;
  border-color: #2563EB !important;
  box-shadow: inset 3px 0 0 #2563EB !important;
}

/* Badges */
.hot-badge {
  font-size: 9px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #EA580C, #DC2626);
  color: white !important;
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulse-dot 2s ease infinite;
}
.new-badge {
  font-size: 9px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #059669, #10B981);
  color: white !important;
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Sidebar footer */
.sb-footer {
  margin-top: auto;
  padding: 12px 0;
  border-top: 1px solid #E2E8F0;
}

/* ── MAIN CONTENT ──────────────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: #F8FAFC !important;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: #FFFFFF !important;
  border-bottom: 1px solid #E2E8F0 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  position: sticky;
  top: 0;
  z-index: 5;
}
.top-bar h1 {
  font-size: 18px !important;
  font-weight: 800 !important;
  color: #0F172A !important;
  letter-spacing: -0.4px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── PANELS ────────────────────────────────────────────────────────── */
.panel {
  display: none;
  padding: 28px;
  min-height: 100%;
  box-sizing: border-box;
  animation: fadeIn 0.35s ease;
}
.panel.active { display: block !important; }

/* Page header */
.page-hdr {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid #E2E8F0;
}
.page-hdr h1 {
  font-size: 22px !important;
  font-weight: 900 !important;
  color: #0F172A !important;
  letter-spacing: -0.5px;
  margin: 0;
}
.page-hdr p {
  font-size: 13px !important;
  color: #94A3B8 !important;
  margin-top: 6px;
  font-weight: 500;
  line-height: 1.5;
}

/* ── STAT CARDS ────────────────────────────────────────────────────── */
.stat-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 16px !important;
  margin-bottom: 24px !important;
}

.stat-card {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: var(--radius-lg) !important;
  padding: 22px !important;
  box-shadow: var(--shadow-sm) !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: #E2E8F0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card:hover {
  box-shadow: var(--shadow-lg) !important;
  transform: translateY(-2px);
  border-color: #2563EB !important;
}

/* Stat card color accents */
.stat-card.blue::before,   .stat-card.sc-blue::before   { background: linear-gradient(90deg,#2563EB,#3B82F6); }
.stat-card.green::before,  .stat-card.sc-green::before  { background: linear-gradient(90deg,#059669,#10B981); }
.stat-card.orange::before, .stat-card.sc-orange::before { background: linear-gradient(90deg,#EA580C,#F59E0B); }
.stat-card.purple::before, .stat-card.sc-purple::before { background: linear-gradient(90deg,#7C3AED,#A855F7); }
.stat-card.red::before,    .stat-card.sc-red::before    { background: linear-gradient(90deg,#DC2626,#EF4444); }
.stat-card.sc-meta::before { background: linear-gradient(90deg,#1877F2,#3B82F6); }
.stat-card.sc-cyan::before { background: linear-gradient(90deg,#0891B2,#06B6D4); }

.stat-lbl {
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #94A3B8 !important;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.stat-val {
  font-size: 30px !important;
  font-weight: 900 !important;
  color: #0F172A !important;
  margin: 6px 0 !important;
  letter-spacing: -1px;
  line-height: 1.1;
}
.stat-sub {
  font-size: 12px !important;
  color: #94A3B8 !important;
  font-weight: 500;
}
.stat-trend { font-size: 11px; color: #94A3B8; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.trend-up   { color: #10B981 !important; }
.trend-down { color: #EF4444 !important; }

/* ── CARDS & CONTAINERS ────────────────────────────────────────────── */
.card {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  transition: box-shadow 0.3s;
  color: #0F172A;
}
.card:hover { box-shadow: var(--shadow-md); }

.table-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.table-hdr h3 {
  font-size: 15px !important;
  font-weight: 800 !important;
  color: #0F172A !important;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── TABLES ────────────────────────────────────────────────────────── */
table, .dt {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 8px;
}
thead th, th {
  background: rgba(0,0,0,0.02) !important;
  color: #94A3B8 !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 16px !important;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #E2E8F0 !important;
  position: sticky;
  top: 0;
  z-index: 1;
}
th:first-child { border-radius: var(--radius-sm) 0 0 0; }
th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

td {
  padding: 14px 16px !important;
  border-bottom: 1px solid #F1F5F9 !important;
  font-size: 13px;
  color: #1E293B !important;
  transition: background 0.15s;
  vertical-align: middle;
}
tr:hover td { background: rgba(0,0,0,0.02) !important; }
tr:last-child td { border-bottom: none !important; }

/* ── BUTTONS ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #0548DB, #0641C4);
  color: white !important;
  box-shadow: 0 2px 10px rgba(5,72,219,0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0641C4, #0537B0);
  box-shadow: 0 4px 16px rgba(5,72,219,0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #F1F5F9;
  color: #94A3B8 !important;
  border-color: #0F172A;
}
.btn-secondary:hover {
  background: #E2E8F0;
  color: #0F172A !important;
}

.btn-ghost {
  background: transparent;
  color: #94A3B8 !important;
  border-color: #0F172A;
}
.btn-ghost:hover {
  background: rgba(0,0,0,0.02);
  border-color: #1E293B;
  color: #0F172A !important;
}

.btn-sm { padding: 6px 12px; font-size: 11px; }

.btn-success {
  background: linear-gradient(135deg, #059669, #047857);
  color: white !important;
  box-shadow: 0 2px 8px rgba(5,150,105,0.3);
}
.btn-danger {
  background: linear-gradient(135deg, #DC2626, #B91C1C);
  color: white !important;
}

/* ── INPUTS ────────────────────────────────────────────────────────── */
.inp, input[type="text"], input[type="email"], input[type="password"], select, textarea {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0,0,0,0.02) !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: var(--radius-sm);
  color: #0F172A !important;
  font-size: 13px;
  font-family: var(--font-sans);
  font-weight: 500;
  outline: none;
  transition: all 0.2s;
}
.inp:focus, input:focus, select:focus, textarea:focus {
  border-color: #0548DB !important;
  box-shadow: 0 0 0 3px rgba(5,72,219,0.2) !important;
  background: rgba(255,255,255,0.07) !important;
}
.lbl {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94A3B8;
  margin-bottom: 6px;
}
select option { background: #FFFFFF; color: #0F172A; }
input::placeholder, textarea::placeholder { color: #475569 !important; }

/* ── TAGS ──────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.tag-green  { background: rgba(16,185,129,0.15) !important; color: #10B981 !important; border: 1px solid rgba(16,185,129,0.25); }
.tag-orange { background: rgba(245,158,11,0.12) !important; color: #F59E0B !important; border: 1px solid rgba(245,158,11,0.2); }
.tag-red    { background: rgba(239,68,68,0.12)  !important; color: #EF4444 !important; border: 1px solid rgba(239,68,68,0.2); }
.tag-blue   { background: rgba(59,130,246,0.12) !important; color: #60A5FA !important; border: 1px solid rgba(59,130,246,0.2); }
.tag-gray   { background: #F1F5F9!important; color: #94A3B8 !important; }

/* ── LOG ENTRIES ───────────────────────────────────────────────────── */
.log-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #F1F5F9;
  font-size: 12px;
  animation: slideInRight 0.3s ease;
  color: #1E293B;
}
.log-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── TOAST ─────────────────────────────────────────────────────────── */
#toastBox {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── AD CARDS ──────────────────────────────────────────────────────── */
.ad-card {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.25s;
  box-shadow: var(--shadow-xs);
}
.ad-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: #2563EB;
}
.ad-thumb {
  width: 100%;
  height: 160px;
  overflow: hidden;
  background: rgba(0,0,0,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.ad-card:hover .ad-thumb img { transform: scale(1.05); }
.ad-thumb-placeholder {
  text-align: center;
  color: #94A3B8;
  padding: 20px;
}
.ad-body { padding: 16px; }
.ad-title {
  font-size: 13px;
  font-weight: 800;
  color: #0F172A !important;
  margin: 6px 0;
  line-height: 1.3;
}
.ad-copy {
  font-size: 11px;
  color: #94A3B8 !important;
  line-height: 1.5;
  margin-bottom: 10px;
}

/* ── WHATSAPP CRM ──────────────────────────────────────────────────── */
.wa-container, .wa-wrapper {
  display: grid !important;
  grid-template-columns: 320px 1fr 340px !important;
  height: calc(100vh - 120px) !important;
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: var(--radius-lg) !important;
  overflow: hidden !important;
  box-shadow: var(--shadow-md);
}

/* ── LOADING & EMPTY STATES ────────────────────────────────────────── */
.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: #94A3B8;
}
.loading-state i {
  font-size: 40px;
  opacity: 0.3;
  margin-bottom: 16px;
}

/* ── RESPONSIVE ────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .sb { width: 220px !important; min-width: 220px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .wa-container { grid-template-columns: 260px 1fr !important; }
}
@media (max-width: 768px) {
  body { flex-direction: column; }
  .sb { width: 100% !important; min-width: 100%; height: auto; max-height: 60px; overflow: hidden; }
  .main { height: calc(100vh - 60px); }
  .stat-grid { grid-template-columns: 1fr !important; }
}

/* ── PRINT ─────────────────────────────────────────────────────────── */
@media print {
  .sb, .sb-footer, .top-bar, .top-actions, .btn, .sb-btn, #toastBox { display: none !important; }
  .main { width: 100% !important; }
  .panel { display: block !important; padding: 20px; }
  .stat-card { box-shadow: none !important; border: 1px solid #334155 !important; }
}

/* ── UTILITY OVERRIDES ─────────────────────────────────────────────── */
h1, h2, h3, h4 { color: #0F172A !important; font-weight: 800; letter-spacing: -0.3px; }
p  { color: #94A3B8 !important; }
strong { color: #0F172A !important; }
code { font-family: var(--font-mono); font-size: 12px; background: #F1F5F9; color: #0F172A; padding: 2px 6px; border-radius: 4px; }
a { color: #60A5FA; text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }

/* ── EXTENDED BUTTON & COMPONENT STYLES ────────────────────────────── */
.btn-wa    { background: linear-gradient(135deg,#25D366,#128C7E); color: white !important; }
.btn-wa:hover { background: linear-gradient(135deg,#128C7E,#075E54); }
.btn-ghl   { background: linear-gradient(135deg,#FF6B35,#F59E0B); color: #0F172A !important; }
.btn-ghl:hover { box-shadow: 0 4px 14px rgba(255,107,53,0.35); transform: translateY(-1px); }
.btn-google{ background: linear-gradient(135deg,#EA4335,#C62828); color: white !important; }
.btn-purple{ background: linear-gradient(135deg,#7C3AED,#5B21B6); color: white !important; }
.btn-purple:hover { box-shadow: 0 4px 14px rgba(124,58,237,0.35); transform: translateY(-1px); }
.btn-green { background: linear-gradient(135deg,#059669,#047857); color: white !important; }
.btn-green:hover { box-shadow: 0 4px 14px rgba(5,150,105,0.35); transform: translateY(-1px); }
.btn-orange{ background: linear-gradient(135deg,#EA580C,#C2410C); color: white !important; }
.btn-red   { background: linear-gradient(135deg,#DC2626,#B91C1C); color: white !important; }
.btn-accent{ background: linear-gradient(135deg,#0548DB,#8B5CF6); color: white !important; box-shadow: 0 2px 10px rgba(5,72,219,0.3); }
.btn-accent:hover { box-shadow: 0 4px 16px rgba(5,72,219,0.4); transform: translateY(-1px); }
.btn-icon  { padding: 7px 10px; }

/* ── AI PANELS ─────────────────────────────────────────────────────── */
.ai-card, .ai-panel {
  background: linear-gradient(135deg, #060E1C 0%, #0D0A2E 100%);
  border-radius: var(--radius-lg);
  padding: 22px;
  color: white;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(139,92,246,0.15);
}
.ai-card::before, .ai-panel::before {
  content: '';
  position: absolute;
  top: -50%; right: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 70% 20%, rgba(139,92,246,0.14), transparent 60%);
  pointer-events: none;
}
.ai-card h3, .ai-panel h3 { color: white !important; font-size: 14px; font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.ai-card p,  .ai-panel p  { color: rgba(255,255,255,0.55) !important; font-size: 12px; margin-bottom: 16px; }
.ai-output-box {
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 12px;
  line-height: 1.7;
  min-height: 80px;
  color: rgba(255,255,255,0.85) !important;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── API GRID ─────────────────────────────────────────────────────── */
.api-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── ADS GRID ─────────────────────────────────────────────────────── */
.ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

/* ── MODAL ────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }
.modal-box {
  background: #FFFFFF !important;
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-xl);
  border: 1px solid #E2E8F0 !important;
  color: #0F172A !important;
  animation: fadeInScale 0.25s ease;
}
.modal-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.modal-hdr h3 { font-size: 16px; font-weight: 800; margin: 0; color: #0F172A !important; }
.modal-close { background: #F1F5F9; border: 1px solid #E2E8F0; cursor: pointer; font-size: 14px; color: #94A3B8; width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.modal-close:hover { background: rgba(239,68,68,0.12); color: #EF4444; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 16px; border-top: 1px solid #E2E8F0; }

/* ── BADGE ────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--radius-full); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-green  { background: rgba(16,185,129,0.15); color: #10B981; border: 1px solid rgba(16,185,129,0.25); }
.badge-orange { background: rgba(245,158,11,0.12); color: #F59E0B; border: 1px solid rgba(245,158,11,0.2); }
.badge-blue   { background: rgba(59,130,246,0.12); color: #60A5FA; border: 1px solid rgba(59,130,246,0.2); }

/* ── PROGRESS ─────────────────────────────────────────────────────── */
.progress-bar  { background: #F1F5F9; border-radius: 4px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width 0.5s ease; }

/* ── PERFORMANCE BARS ─────────────────────────────────────────────── */
.perf-bar  { height: 6px; background: #F1F5F9; border-radius: 100px; overflow: hidden; }
.perf-fill { height: 100%; border-radius: 100px; transition: width 0.6s ease; }

/* ── SECTION HEADERS ──────────────────────────────────────────────── */
.section-h   { font-size: 20px; font-weight: 900; color: #0F172A !important; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.section-sub { font-size: 13px; color: #94A3B8 !important; margin-bottom: 22px; line-height: 1.5; }

/* ── STAT GRID COLS ───────────────────────────────────────────────── */
.sg3 { grid-template-columns: repeat(3, 1fr) !important; }
.sg4 { grid-template-columns: repeat(4, 1fr) !important; }

/* ── TABLE WRAP ───────────────────────────────────────────────────── */
.table-wrap {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

/* ── PLATFORM TABS ────────────────────────────────────────────────── */
.plat-tabs { display: flex; gap: 4px; background: rgba(0,0,0,0.03); border-radius: var(--radius-md); padding: 4px; margin-bottom: 20px; border: 1px solid #E2E8F0; }
.plat-tab  { flex: 1; text-align: center; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; cursor: pointer; transition: all 0.2s; color: #94A3B8; }
.plat-tab.active, .plat-tab:hover { background: #EFF6FF; color: #2563EB; box-shadow: var(--shadow-sm); }
.plat-content { display: none; }
.plat-content.active { display: block; animation: fadeIn 0.25s ease; }

/* ── IMPORT DROPZONE ──────────────────────────────────────────────── */
.import-dropzone {
  border: 2px dashed #1E293B;
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: #94A3B8;
}
.import-dropzone:hover, .import-dropzone.drag-over {
  border-color: #0548DB;
  background: rgba(5,72,219,0.06);
  color: #2563EB;
}

/* ── FONTS ────────────────────────────────────────────────────────── */
body, button, input, select, textarea { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important; }
code, pre, .font-mono { font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace !important; }

/* ── RESPONSIVE MEDIA QUERIES ─────────────────────────────────────── */
@media screen and (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr) !important; }
  .sg3, .sg4 { grid-template-columns: repeat(2, 1fr) !important; }
}

@media screen and (max-width: 768px) {
  body {
    flex-direction: column;
    overflow-y: auto;
  }
  
  .sb {
    width: 100% !important;
    min-width: 100%;
    height: auto;
    border-right: none !important;
    border-bottom: 1px solid #E2E8F0 !important;
    padding-bottom: 20px;
    z-index: 100;
  }

  .main-content {
    width: 100%;
    height: auto;
    overflow-y: visible;
  }
  
  .page-hdr h1 { font-size: 20px; }
  
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }
  .sg3, .sg4 { grid-template-columns: 1fr !important; }
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }
  
  .flex-between { 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 16px; 
  }
  
  .modal-box {
    width: 95%;
    margin: 10px;
    max-height: 90vh;
    overflow-y: auto;
  }
}

@media screen and (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr !important; }
  .sg3, .sg4 { grid-template-columns: 1fr !important; }
  .tab-bar { flex-wrap: wrap; }
  .tab-btn { flex: 1 1 40%; text-align: center; }
}

/* ═══════════════════════════════════════════════════════════════════════
   DARK MODE — BLOOMBERG TERMINAL THEME (2030)
   ═══════════════════════════════════════════════════════════════════════ */
body.dark-mode {
  background: #0B0F19 !important;
  color: #E2E8F0 !important;
}
body.dark-mode * { transition: background 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s; }

/* ── Dark Sidebar */
body.dark-mode .sb {
  background: #0F1629 !important;
  border-right-color: #1E293B !important;
  box-shadow: 1px 0 6px rgba(0,0,0,0.5);
}
body.dark-mode .logo-text strong,
body.dark-mode .sb-logo-text strong { color: #F1F5F9 !important; }
body.dark-mode .logo-text span,
body.dark-mode .sb-logo-text span { color: #64748B !important; }
body.dark-mode .nav-lbl { color: #475569 !important; }
body.dark-mode .sb-btn,
body.dark-mode .sb-link { color: #94A3B8 !important; border-color: transparent !important; }
body.dark-mode .sb-btn:hover,
body.dark-mode .sb-link:hover { background: rgba(255,255,255,0.05) !important; color: #E2E8F0 !important; border-color: #1E293B !important; }
body.dark-mode .sb-btn.active,
body.dark-mode .sb-link.active { background: rgba(37,99,235,0.15) !important; color: #60A5FA !important; border-color: #2563EB !important; }
body.dark-mode .sb-footer { border-top-color: #1E293B; }
body.dark-mode .client-badge { background: linear-gradient(135deg,rgba(37,99,235,0.12),rgba(139,92,246,0.08)); border-color: rgba(37,99,235,0.2); }
body.dark-mode .cb-name { color: #F1F5F9 !important; }
body.dark-mode .cb-role { color: #64748B !important; }

/* ── Dark Main Content */
body.dark-mode .main { background: #0B0F19 !important; }
body.dark-mode .top-bar {
  background: #0F1629 !important;
  border-bottom-color: #1E293B !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
body.dark-mode .top-bar h1 { color: #F1F5F9 !important; }

/* ── Dark Panels */
body.dark-mode .page-hdr { border-bottom-color: #1E293B; }
body.dark-mode .page-hdr h1 { color: #F1F5F9 !important; }
body.dark-mode .page-hdr p { color: #64748B !important; }

/* ── Dark Cards */
body.dark-mode .card,
body.dark-mode .table-wrap {
  background: #111827 !important;
  border-color: #1E293B !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  color: #E2E8F0 !important;
}
body.dark-mode .card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.4); }

/* ── Dark Stat Cards */
body.dark-mode .stat-card {
  background: #111827 !important;
  border-color: #1E293B !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}
body.dark-mode .stat-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.5) !important;
  border-color: #3B82F6 !important;
}
body.dark-mode .stat-lbl { color: #64748B !important; }
body.dark-mode .stat-val { color: #F1F5F9 !important; }
body.dark-mode .stat-sub { color: #475569 !important; }

/* ── Dark Tables */
body.dark-mode thead th, body.dark-mode th {
  background: rgba(255,255,255,0.03) !important;
  color: #64748B !important;
  border-bottom-color: #1E293B !important;
}
body.dark-mode td {
  color: #CBD5E1 !important;
  border-bottom-color: #1E293B !important;
}
body.dark-mode tr:hover td { background: rgba(255,255,255,0.03) !important; }
body.dark-mode strong { color: #F1F5F9 !important; }

/* ── Dark Inputs */
body.dark-mode .inp,
body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode select,
body.dark-mode textarea {
  background: rgba(255,255,255,0.05) !important;
  border-color: #1E293B !important;
  color: #E2E8F0 !important;
}
body.dark-mode .inp:focus,
body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
  border-color: #3B82F6 !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2) !important;
}
body.dark-mode select option { background: #111827; color: #E2E8F0; }
body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder { color: #475569 !important; }
body.dark-mode .lbl { color: #64748B; }

/* ── Dark Buttons */
body.dark-mode .btn-secondary {
  background: #1E293B;
  color: #94A3B8 !important;
  border-color: #334155;
}
body.dark-mode .btn-secondary:hover {
  background: #334155;
  color: #E2E8F0 !important;
}

/* ── Dark Ad Cards */
body.dark-mode .ad-card {
  background: #111827 !important;
  border-color: #1E293B;
}
body.dark-mode .ad-card:hover { border-color: #3B82F6; }
body.dark-mode .ad-title { color: #F1F5F9 !important; }
body.dark-mode .ad-copy { color: #64748B !important; }

/* ── Dark Modal */
body.dark-mode .modal-box {
  background: #111827 !important;
  border-color: #1E293B !important;
  color: #E2E8F0 !important;
}
body.dark-mode .modal-hdr h3 { color: #F1F5F9 !important; }
body.dark-mode .modal-close { background: #1E293B; border-color: #334155; color: #64748B; }
body.dark-mode .modal-footer { border-top-color: #1E293B; }

/* ── Dark Headings & Text */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4 { color: #F1F5F9 !important; }
body.dark-mode p { color: #64748B !important; }
body.dark-mode code { background: #1E293B; color: #E2E8F0; }
body.dark-mode .log-entry { border-bottom-color: #1E293B; color: #CBD5E1; }

/* ── Dark Scrollbar */
body.dark-mode ::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
body.dark-mode ::-webkit-scrollbar-thumb { background: #334155; }
body.dark-mode ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ── Dark Tags */
body.dark-mode .tag-gray { background: #1E293B !important; color: #64748B !important; }

/* ── Dark progress */
body.dark-mode .progress-bar,
body.dark-mode .perf-bar { background: #1E293B; }

