/* ═══════════════════════════════════════════════════════════════════
   META ADS INTELLIGENCE DASHBOARD
   Brand: Sm Logo (Green Leaf) × Facebook Blue
   Design: Professional Dark | Premium SaaS
═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

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

/* ── DESIGN TOKENS ──────────────────────────────────────────────── */
:root {
  /* Primary — Facebook Blue */
  --fb:          #1877F2;
  --fb-hover:    #0d6ce0;
  --fb-dim:      rgba(24, 119, 242, 0.12);
  --fb-glow:     rgba(24, 119, 242, 0.30);
  --fb-border:   rgba(24, 119, 242, 0.35);

  /* Brand — Logo Green (Sm leaf) */
  --brand:       #22c55e;
  --brand-2:     #16a34a;
  --brand-dim:   rgba(34, 197, 94, 0.12);
  --brand-glow:  rgba(34, 197, 94, 0.25);

  /* Backgrounds — Deep Navy Dark */
  --bg:          #070b13;
  --bg-1:        #0c1220;
  --bg-2:        #111c2d;
  --bg-3:        #172338;
  --bg-4:        #1e2d47;

  /* Borders */
  --border:      rgba(255,255,255,0.055);
  --border-md:   rgba(255,255,255,0.10);
  --border-hi:   rgba(255,255,255,0.18);

  /* Text */
  --text:        #e4eaf5;
  --text-2:      #a8b8d0;
  --muted:       #546882;
  --dim:         #2d4059;

  /* Status Colors */
  --green:       #22c55e;
  --green-dim:   rgba(34, 197, 94, 0.12);
  --amber:       #f59e0b;
  --amber-dim:   rgba(245, 158, 11, 0.12);
  --red:         #ef4444;
  --red-dim:     rgba(239, 68, 68, 0.12);
  --purple:      #a78bfa;
  --purple-dim:  rgba(167, 139, 250, 0.12);

  /* Layout */
  --sidebar:     252px;

  /* Typography */
  --ff-ui:    'Inter', -apple-system, sans-serif;
  --ff-mono:  'JetBrains Mono', 'Courier New', monospace;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.6);
  --shadow-fb:   0 4px 20px rgba(24,119,242,0.25);

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  18px;
}

html { font-size: 14px; }

body {
  font-family: var(--ff-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── PREMIUM NOISE TEXTURE ─────────────────────────────────────── */
.noise {
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.018; pointer-events: none; z-index: 9999;
}

/* ─────────────────────────────────────────────────────────────────
   SIDEBAR
───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar);
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  background-image: linear-gradient(180deg, rgba(24,119,242,0.04) 0%, transparent 40%);
}

/* Brand / Logo */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--brand-dim), 0 4px 12px rgba(0,0,0,0.4);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text { flex: 1; min-width: 0; }

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
  line-height: 1.2;
}

.brand-sub {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--ff-mono);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  color: var(--fb);
  background: var(--fb-dim);
  border: 1px solid var(--fb-border);
  border-radius: 99px;
  padding: 2px 7px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Nav */
.nav-section { padding: 8px 0; }

.nav-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 12px 18px 6px;
}

.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  position: relative;
  letter-spacing: -0.1px;
}

.nav-link:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-2);
}

.nav-link.active {
  background: var(--fb-dim);
  color: var(--fb);
  font-weight: 600;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 2.5px;
  background: var(--fb);
  border-radius: 0 3px 3px 0;
}

.nav-link svg { flex-shrink: 0; opacity: 0.8; }
.nav-link.active svg { opacity: 1; }

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
}

.live-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 10px var(--brand);
  animation: pulse 2s ease infinite;
}

.live-dot.err { background: var(--red); box-shadow: 0 0 10px var(--red); animation: none; }
.live-dot.wait { background: var(--amber); box-shadow: 0 0 10px var(--amber); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.live-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand);
}

.live-label.err { color: var(--red); }
.live-label.wait { color: var(--amber); }

.sync-time {
  font-size: 10.5px;
  color: var(--muted);
  font-family: var(--ff-mono);
}

.run-count {
  font-size: 10px;
  color: var(--dim);
  font-family: var(--ff-mono);
  margin-top: 3px;
}

/* ─────────────────────────────────────────────────────────────────
   LAYOUT
───────────────────────────────────────────────────────────────── */
.layout {
  margin-left: var(--sidebar);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* ─────────────────────────────────────────────────────────────────
   TOPBAR
───────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(7,11,19,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-l { display: flex; align-items: center; gap: 14px; }

.page-h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  line-height: 1;
}

.page-desc {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--ff-mono);
  margin-top: 3px;
  letter-spacing: 0.01em;
}

.topbar-r { display: flex; align-items: center; gap: 10px; }

/* Action Buttons */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-family: var(--ff-ui);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: -0.1px;
  white-space: nowrap;
}

.action-btn:hover {
  background: var(--bg-3);
  border-color: var(--border-hi);
  color: var(--text);
}

.action-btn:active { transform: scale(0.97); }
.action-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Primary / FB Button */
.btn-primary {
  background: var(--fb);
  border-color: var(--fb);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-fb);
}

.btn-primary:hover {
  background: var(--fb-hover);
  border-color: var(--fb-hover);
  color: #fff;
}

/* Green Button */
.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #000;
  font-weight: 700;
}

.btn-brand:hover {
  background: var(--brand-2);
  border-color: var(--brand-2);
  color: #000;
}

/* Danger Button */
.btn-danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}

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

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
}

/* ─────────────────────────────────────────────────────────────────
   CONTENT & PANES
───────────────────────────────────────────────────────────────── */
.content { flex: 1; overflow-y: auto; }

.pane { display: none; padding: 24px 28px; }

.pane.active {
  display: block;
  animation: fadeUp 0.28s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────────────────────────
   KPI STRIP
───────────────────────────────────────────────────────────────── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 20px;
  position: relative;
}

/* Top gradient bar */
.kpi-strip::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--fb) 0%, var(--brand) 50%, var(--fb) 100%);
  background-size: 200% 100%;
  animation: gradientSlide 4s linear infinite;
}

@keyframes gradientSlide {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.kpi {
  padding: 18px 16px 15px;
  border-right: 1px solid var(--border);
  position: relative;
  transition: background 0.18s;
}

.kpi:last-child { border-right: none; }

.kpi:hover { background: rgba(24,119,242,0.04); }

.kpi:hover::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--fb);
}

.kpi-v {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.8px;
  line-height: 1;
  margin-bottom: 5px;
  color: var(--text);
}

.kpi-l {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

/* ─────────────────────────────────────────────────────────────────
   PANEL GRID
───────────────────────────────────────────────────────────────── */
.panel-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 14px;
}

.panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  transition: border-color 0.2s;
}

.panel:hover { border-color: var(--border-md); }

.panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-ttl {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: var(--text);
}

/* ─────────────────────────────────────────────────────────────────
   CHIPS & BADGES
───────────────────────────────────────────────────────────────── */
.chip {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--ff-mono);
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.04em;
}

.chip--blue   { background: var(--fb-dim); color: var(--fb); }
.chip--green  { background: var(--green-dim); color: var(--green); }
.chip--amber  { background: var(--amber-dim); color: var(--amber); }
.chip--red    { background: var(--red-dim); color: var(--red); }
.chip--brand  { background: var(--brand-dim); color: var(--brand); }
.chip--slate  { background: var(--bg-3); color: var(--muted); border: 1px solid var(--border); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
}

.badge-active  { background: var(--green-dim); color: var(--green); }
.badge-active::before  { background: var(--green); }
.badge-paused  { background: var(--amber-dim); color: var(--amber); }
.badge-paused::before  { background: var(--amber); }
.badge-archived { background: var(--bg-2); color: var(--muted); border: 1px solid var(--border); }
.badge-archived::before { background: var(--dim); }

/* ─────────────────────────────────────────────────────────────────
   CONVERSIONS GRID
───────────────────────────────────────────────────────────────── */
.conv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.conv-cell {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 15px;
  transition: border-color 0.18s, background 0.18s;
}

.conv-cell:hover {
  border-color: var(--fb-border);
  background: rgba(24,119,242,0.04);
}

.conv-cell-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 8px;
}

.conv-cell-val {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--text);
}

.conv-cell-val.c-green  { color: var(--green); }
.conv-cell-val.c-blue   { color: var(--fb); }
.conv-cell-val.c-amber  { color: var(--amber); }

/* ─────────────────────────────────────────────────────────────────
   ENGAGEMENT LIST
───────────────────────────────────────────────────────────────── */
.eng-grid { display: flex; flex-direction: column; gap: 5px; }

.eng-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color 0.15s;
}

.eng-row:hover { border-color: var(--border-md); }

.eng-lbl { font-size: 12px; color: var(--text-2); font-weight: 500; }
.eng-val { font-size: 12.5px; font-family: var(--ff-mono); font-weight: 500; color: var(--text); }

/* Delivery */
.deliv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.deliv-cell {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
}

.deliv-cell-lbl {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dim);
  margin-bottom: 5px;
}

.deliv-cell-val {
  font-family: var(--ff-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

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

.tbl-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.1);
}

.tbl-title { font-size: 13.5px; font-weight: 600; }

.tbl-count {
  font-size: 10.5px;
  font-family: var(--ff-mono);
  color: var(--muted);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 99px;
}

.tbl-wrap { overflow-x: auto; }

.dt {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 12.5px;
}

.dt thead tr { border-bottom: 1px solid var(--border-md); }

.dt th {
  padding: 11px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
  background: var(--bg-1);
  position: sticky;
  top: 0;
}

.dt tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.dt tbody tr:last-child { border-bottom: none; }
.dt tbody tr:hover { background: rgba(24,119,242,0.04); }

/* Total row styling */
.dt tbody tr.tr-total {
  background: var(--bg-3) !important;
  font-weight: 700;
  border-bottom: 2px solid var(--border-hi);
  position: sticky;
  top: 40px; /* Below the header */
  z-index: 5;
}
.dt tbody tr.tr-total td {
  color: var(--text) !important;
  font-weight: 700;
}

.dt td {
  padding: 11px 16px;
  font-family: var(--ff-mono);
  color: var(--text-2);
}

.dt td:first-child,
.dt td:nth-child(2) {
  font-family: var(--ff-ui);
  font-weight: 500;
  font-size: 12.5px;
  color: var(--text);
}

.dt td.td-money  { color: var(--amber); }
.dt td.td-roas   { color: var(--green); }
.dt td.td-muted  { color: var(--muted); }

/* ─────────────────────────────────────────────────────────────────
   SHIMMER LOADING
───────────────────────────────────────────────────────────────── */
.shimmer {
  background: linear-gradient(90deg, var(--bg-2) 0%, var(--bg-3) 50%, var(--bg-2) 100%);
  background-size: 300% 100%;
  animation: shimmer 1.8s ease infinite;
  border-radius: var(--r-md);
}

@keyframes shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: -100% 50%; }
}

/* ─────────────────────────────────────────────────────────────────
   CONNECT SCREEN — Facebook Login Style
───────────────────────────────────────────────────────────────── */
.connect-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(24,119,242,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(34,197,94,0.06) 0%, transparent 50%),
              var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.connect-screen.hidden { display: none; }

.connect-box {
  background: var(--bg-1);
  border: 1px solid rgba(24,119,242,0.2);
  border-radius: var(--r-xl);
  padding: 38px 42px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 0 0 1px var(--border), var(--shadow-lg), 0 0 80px rgba(24,119,242,0.08);
  animation: fadeUp 0.4s cubic-bezier(.2,0,0,1);
}

/* Logo area inside connect screen */
.connect-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
}

.connect-logo-mark {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 3px var(--brand-dim), 0 8px 24px rgba(0,0,0,0.5);
}

.connect-logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.connect-title {
  text-align: center;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--text);
  margin-bottom: 6px;
}

.connect-sub {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* How-to steps */
.connect-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 26px;
  padding: 16px 18px;
  background: var(--bg-2);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
}

.step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--fb-dim);
  color: var(--fb);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  border: 1px solid var(--fb-border);
}

.step a { color: var(--fb); text-decoration: none; }
.step a:hover { text-decoration: underline; }

.step code {
  background: var(--bg-3);
  color: var(--brand);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--ff-mono);
  font-size: 11px;
}

/* Form */
.connect-form { display: flex; flex-direction: column; gap: 14px; }

.field-group { display: flex; flex-direction: column; gap: 5px; }

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -0.1px;
}

.field-inp {
  background: var(--bg-2);
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--ff-ui);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  width: 100%;
}

.field-inp:focus {
  border-color: var(--fb);
  box-shadow: 0 0 0 3px rgba(24,119,242,0.15);
}

.field-inp::placeholder { color: var(--dim); }

.field-select { cursor: pointer; }
.field-select option { background: var(--bg-2); }

.field-hint {
  font-size: 11px;
  color: var(--dim);
  font-family: var(--ff-mono);
}

.connect-err {
  font-size: 12.5px;
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  display: none;
}

.connect-err.show { display: block; }

/* Connect CTA Button — Facebook style */
.connect-btn {
  width: 100%;
  padding: 13px 16px;
  background: var(--fb);
  border: none;
  border-radius: var(--r-sm);
  color: #fff;
  font-family: var(--ff-ui);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
  margin-top: 4px;
  box-shadow: var(--shadow-fb);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: -0.2px;
}

.connect-btn:hover {
  background: var(--fb-hover);
  box-shadow: 0 6px 24px rgba(24,119,242,0.4);
}

.connect-btn:active { transform: scale(0.98); }
.connect-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Facebook login "f" icon inside button */
.connect-btn-icon {
  width: 20px; height: 20px;
  background: rgba(255,255,255,0.2);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  font-size: 13px;
}

/* ─────────────────────────────────────────────────────────────────
   SCROLLBAR
───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-4); }

/* ─────────────────────────────────────────────────────────────────
   MODAL / CUSTOMIZER
───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-1);
  border: 1px solid var(--border-md);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.25s ease;
}

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

.modal-bd {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-ft {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.1);
}

.close-btn {
  width: 28px; height: 28px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}

.close-btn:hover { background: var(--bg-4); color: var(--text); }

/* Customizer Prefs */
.custom-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pref-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.pref-item:hover { border-color: var(--fb-border); background: var(--fb-dim); }
.pref-item input[type="checkbox"]:checked ~ .pref-label { color: var(--fb); font-weight: 600; }

.pref-label { font-size: 12px; color: var(--muted); }

/* ─────────────────────────────────────────────────────────────────
   META ALERT TOAST
───────────────────────────────────────────────────────────────── */
.meta-alert {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--r-lg);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  z-index: 8000;
  transition: transform 0.35s cubic-bezier(.2,0,0,1);
  font-size: 12.5px;
  max-width: 400px;
}

.meta-alert.active { transform: translateX(-50%) translateY(0); }

.meta-alert-icon { font-size: 16px; flex-shrink: 0; }

.meta-alert-msg { flex: 1; color: var(--text-2); }

.meta-alert-close {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  font-size: 18px; line-height: 1;
  padding: 0 2px;
  transition: color 0.15s;
}

.meta-alert-close:hover { color: var(--text); }

/* ─────────────────────────────────────────────────────────────────
   SETTINGS PANELS — specific overrides
───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--ff-ui);
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--fb);
  box-shadow: 0 0 0 3px rgba(24,119,242,0.12);
}

/* Panel fb connector accent */
.panel-fb {
  border-color: var(--fb-border) !important;
  background-image: linear-gradient(145deg, var(--bg-1), rgba(24,119,242,0.04)) !important;
}

/* ─────────────────────────────────────────────────────────────────
   DATE PILL
───────────────────────────────────────────────────────────────── */
.date-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-md);
  border-radius: 99px;
  font-size: 11px;
  font-family: var(--ff-mono);
  color: var(--muted);
}

/* ─────────────────────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .kpi-strip { grid-template-columns: repeat(4, 1fr); }
  .kpi:nth-child(4) { border-right: none; }
  .kpi:nth-child(n+5) { border-top: 1px solid var(--border); }
}

@media (max-width: 1100px) {
  .panel-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .panel-row { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi { border-right: none; border-bottom: 1px solid var(--border); }
}

@media (max-width: 768px) {
  :root { --sidebar: 0px; }
  .sidebar { transform: translateX(-252px); width: 252px; }
  .sidebar.open { transform: translateX(0); }
  .layout { margin-left: 0; }
  .menu-toggle { display: block; }
  .pane { padding: 16px; }
  .topbar { padding: 14px 16px; }
  .connect-box { padding: 28px 22px; }
  .custom-grid { grid-template-columns: 1fr 1fr; }
}