/* ==========================================================================
   SMART LINK SHORTENER - VIBRANT RED & WHITE DESIGN SYSTEM
   Professional UI/UX | Fully Responsive Mobile + Desktop
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS VARIABLES ── */
:root {
  /* Core Brand Colors - Vibrant Royal Electric Blue */
  --red-primary:   #1877f2;
  --red-dark:      #0b57cf;
  --red-light:     #4294ff;
  --red-soft:      #ebf3fe;
  --red-glow:      rgba(24, 119, 242, 0.28);

  /* Accent Colors */
  --coral:         #ff5252;
  --orange:        #f77f00;
  --amber:         #ffb703;
  --teal:          #00b4d8;
  --blue:          #1877f2;
  --purple:        #7209b7;

  /* Neutrals */
  --bg:            #f0f5ff;
  --surface:       #ffffff;
  --surface-2:     #e4efff;
  --border:        #c9deff;
  --border-focus:  #1877f2;

  /* Text */
  --text-primary:  #0f172a;
  --text-secondary:#334155;
  --text-muted:    #64748b;
  --text-on-red:   #ffffff;

  /* Gradients */
  --grad-brand:    linear-gradient(135deg, #1877f2 0%, #0052cc 50%, #00c6ff 100%);
  --grad-red:      linear-gradient(135deg, #1877f2 0%, #0d5cc7 100%);
  --grad-card:     linear-gradient(135deg, #ffffff 0%, #f4f8ff 100%);
  --grad-bg:       linear-gradient(160deg, #dbeafe 0%, #f0f5ff 50%, #eff6ff 100%);

  /* Shadows */
  --shadow-sm:     0 2px 6px rgba(24, 119, 242, 0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md:     0 6px 20px rgba(24, 119, 242, 0.10), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-lg:     0 16px 48px rgba(24, 119, 242, 0.16), 0 6px 16px rgba(0,0,0,0.06);
  --shadow-red:    0 8px 24px rgba(24, 119, 242, 0.35);
  --shadow-red-sm: 0 4px 14px rgba(24, 119, 242, 0.25);

  /* Radii */
  --r-sm:  10px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  28px;
  --r-pill:9999px;

  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --base-font-size: 16.5px;
}

/* ── DARK THEME ── */
[data-theme="dark"] {
  --bg:            #0e0f1a;
  --surface:       #171828;
  --surface-2:     #1e2035;
  --border:        rgba(255,255,255,0.08);
  --border-focus:  #ff6b6b;
  --text-primary:  #f0f2ff;
  --text-secondary:#9aa0b9;
  --text-muted:    #565c7a;
  --red-soft:      rgba(230,57,70,0.12);
  --grad-bg:       linear-gradient(160deg,#1a0a0b 0%,#0e0f1a 50%,#0a0b1a 100%);
  --shadow-md:     0 4px 20px rgba(0,0,0,0.35);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.55);
}

/* ── MULTI-COLOR THEME (Vibrant Sunset) ── */
[data-theme="multi"] {
  --bg:            #120c1f;
  --surface:       #1e1435;
  --surface-2:     #2b1d4a;
  --border:        rgba(255, 107, 107, 0.22);
  --border-focus:  #ff6b6b;
  --text-primary:  #fff5f5;
  --text-secondary:#d8cde6;
  --text-muted:    #8b7ea8;
  --red-soft:      rgba(255, 107, 107, 0.15);
  --red-primary:   #ff5c8a;
  --grad-bg:       linear-gradient(160deg, #1f0c18 0%, #120c1f 50%, #0d1b2a 100%);
  --grad-red:      linear-gradient(135deg, #ff007f 0%, #7928ca 100%);
  --grad-brand:    linear-gradient(135deg, #ff007f 0%, #7928ca 50%, #ff5c8a 100%);
  --shadow-md:     0 4px 20px rgba(255, 0, 127, 0.2);
  --shadow-lg:     0 12px 40px rgba(255, 0, 127, 0.35);
  --shadow-red-sm: 0 4px 12px rgba(255, 0, 127, 0.25);
  --shadow-red:    0 8px 24px rgba(255, 0, 127, 0.35);
}

/* ── COOL OCEAN THEME ── */
[data-theme="ocean"] {
  --bg:            #0a192f;
  --surface:       #112240;
  --surface-2:     #233554;
  --border:        rgba(100, 255, 218, 0.2);
  --border-focus:  #64ffda;
  --text-primary:  #e6f1ff;
  --text-secondary:#8892b0;
  --text-muted:    #495670;
  --red-soft:      rgba(100, 255, 218, 0.12);
  --red-primary:   #64ffda;
  --red-dark:      #0a192f;
  --grad-bg:       linear-gradient(160deg, #020c1b 0%, #0a192f 50%, #112240 100%);
  --grad-red:      linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
  --grad-brand:    linear-gradient(135deg, #00b4db 0%, #64ffda 50%, #0083b0 100%);
  --shadow-md:     0 4px 20px rgba(100, 255, 218, 0.15);
  --shadow-lg:     0 12px 40px rgba(100, 255, 218, 0.25);
  --shadow-red-sm: 0 4px 12px rgba(100, 255, 218, 0.2);
  --shadow-red:    0 8px 24px rgba(100, 255, 218, 0.3);
}

/* ── CRIMSON WINE THEME (Luxury Burgundy) ── */
[data-theme="wine"] {
  --bg:            #1e0811;
  --surface:       #2c0d1b;
  --surface-2:     #3c1226;
  --border:        rgba(230, 57, 70, 0.25);
  --border-focus:  #e63946;
  --text-primary:  #fff2f5;
  --text-secondary:#d9b5c3;
  --text-muted:    #9d6e82;
  --red-soft:      rgba(230, 57, 70, 0.15);
  --red-primary:   #ff4d6d;
  --grad-bg:       linear-gradient(160deg, #1e0811 0%, #12030a 50%, #000000 100%);
  --grad-red:      linear-gradient(135deg, #c9184a 0%, #ff4d6d 100%);
  --grad-brand:    linear-gradient(135deg, #c9184a 0%, #ff4d6d 50%, #ff8fa3 100%);
  --shadow-md:     0 4px 20px rgba(201, 24, 74, 0.2);
  --shadow-lg:     0 12px 40px rgba(201, 24, 74, 0.35);
  --shadow-red-sm: 0 4px 12px rgba(201, 24, 74, 0.25);
  --shadow-red:    0 8px 24px rgba(201, 24, 74, 0.35);
}

/* ── EMERALD FOREST THEME (Sleek Dark Green) ── */
[data-theme="forest"] {
  --bg:            #061a12;
  --surface:       #0c2b1e;
  --surface-2:     #123c2b;
  --border:        rgba(6, 214, 160, 0.25);
  --border-focus:  #06d6a0;
  --text-primary:  #f0fbf7;
  --text-secondary:#92c2b1;
  --text-muted:    #528271;
  --red-soft:      rgba(6, 214, 160, 0.12);
  --red-primary:   #06d6a0;
  --red-dark:      #061a12;
  --grad-bg:       linear-gradient(160deg, #03120c 0%, #061a12 50%, #0c2b1e 100%);
  --grad-red:      linear-gradient(135deg, #059669 0%, #06d6a0 100%);
  --grad-brand:    linear-gradient(135deg, #059669 0%, #06d6a0 50%, #34d399 100%);
  --shadow-md:     0 4px 20px rgba(6, 214, 160, 0.18);
  --shadow-lg:     0 12px 40px rgba(6, 214, 160, 0.35);
  --shadow-red-sm: 0 4px 12px rgba(6, 214, 160, 0.22);
  --shadow-red:    0 8px 24px rgba(6, 214, 160, 0.3);
}

/* ── GLOBAL RESET & SELECTION REMOVAL ── */
* {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
}

body, html, table, thead, tbody, tr, td, th, .card, .glass-panel, .action-btn-group, .btn,
tr *, td *, .card *, .glass-panel * {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

::selection {
  background: transparent !important;
  color: inherit !important;
}
::-moz-selection {
  background: transparent !important;
  color: inherit !important;
}

:root {
  --base-font-size: 15px;
}
html { scroll-behavior: smooth; font-size: var(--base-font-size) !important; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  background-image: var(--grad-bg);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}

h1,h2,h3,h4,h5 { font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.02em; }

/* ── CONTAINER ── */
.container {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

/* ════════════════════════════════════════
   AUTH / LOGIN PAGE
════════════════════════════════════════ */
.auth-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  background: linear-gradient(135deg, #0b57cf 0%, #1877f2 50%, #0052cc 100%);
}

/* Left brand panel */
.auth-brand {
  background: linear-gradient(135deg, rgba(24, 119, 242, 0.95) 0%, rgba(11, 87, 207, 0.95) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  position: relative;
  overflow: hidden;
  gap: 2rem;
}
.auth-brand::before {
  content: '';
  position: absolute;
  width: 450px; height: 450px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  top: -100px; right: -100px;
}
.auth-brand::after {
  content: '';
  position: absolute;
  width: 350px; height: 350px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  bottom: -80px; left: -80px;
}
.brand-logo {
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem;
  backdrop-filter: blur(10px);
  position: relative; z-index: 1;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}
.brand-tagline {
  text-align: center;
  position: relative; z-index: 1;
  color: white;
}
.brand-tagline h2 { font-size: 2.2rem; font-weight: 800; margin-bottom: 0.6rem; letter-spacing: -0.02em; }
.brand-tagline p { font-size: 1rem; opacity: 0.9; line-height: 1.7; max-width: 360px; font-weight: 500; }
.brand-features {
  list-style: none;
  position: relative; z-index: 1;
  width: 100%;
  max-width: 360px;
}
.brand-features li {
  display: flex; align-items: center; gap: 0.75rem;
  color: rgba(255,255,255,0.95);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
.brand-features li:last-child { border-bottom: none; }
.brand-features li span.icon {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* Right login panel */
.auth-form-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: linear-gradient(160deg, #dbeafe 0%, #f0f5ff 50%, #eff6ff 100%);
  overflow-y: auto;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 24px;
  padding: 2rem 1.6rem;
  border: 1.5px solid #d0e1ff;
  box-shadow: 0 15px 45px rgba(24, 119, 242, 0.12);
  position: relative;
}
.auth-card-header { margin-bottom: 1.6rem; text-align: center; }
.auth-card-header h2 { font-size: 1.4rem; font-weight: 800; color: #0f172a; display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin: 0; }

/* Topbar theme toggle on login */
.auth-topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.8rem;
  width: 100%;
}
.auth-topbar .mini-logo {
  display: flex !important; align-items: center !important; gap: 0.6rem !important;
  font-size: 1.15rem !important; font-weight: 800 !important; color: #0f172a !important;
  font-family: 'Space Grotesk', sans-serif !important;
  text-decoration: none !important;
}
.auth-topbar .mini-logo img {
  width: 36px !important; height: 36px !important; border-radius: 10px !important; object-fit: cover !important; display: block !important;
}
.auth-topbar .mini-logo span {
  color: #0f172a !important; font-weight: 800 !important;
}
.auth-topbar .theme-toggle-btn {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #c9deff !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
  padding: 0.4rem 0.9rem !important;
  border-radius: var(--r-pill) !important;
  cursor: pointer !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
}
.auth-topbar .theme-toggle-btn:hover {
  border-color: #1877f2 !important;
  color: #1877f2 !important;
}

/* Auth Card Form Control Explicit High Contrast */
.auth-card .form-control {
  background: #ffffff !important;
  color: #334155 !important;
  border: 1.5px solid #c9deff !important;
  border-radius: 12px !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 0.85rem !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  outline: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  box-shadow: none !important;
}
.auth-card .form-control:focus {
  border-color: #1877f2 !important;
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.18) !important;
  background: #ffffff !important;
  color: #0f172a !important;
}
.auth-card .form-control::placeholder {
  color: #64748b !important;
  opacity: 1 !important;
  font-weight: 500 !important;
}
.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus {
  -webkit-text-fill-color: #0f172a !important;
  -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
  transition: background-color 5000s ease-in-out 0s !important;
}
.auth-topbar .mini-logo-icon {
  width: 36px; height: 36px;
  background: var(--grad-brand);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.1rem;
  font-weight: 800;
  box-shadow: 0 0 15px var(--red-glow);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ════════════════════════════════════════
   SITE HEADER
════════════════════════════════════════ */
header.site-header {
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
  padding: 0.65rem 1.25rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}
.header-inner {
  max-width: 1560px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.logo-group {
  display: flex; align-items: center; gap: 0.85rem;
  flex-shrink: 0;
}
.logo-badge {
  width: 42px; height: 42px;
  background: var(--grad-brand);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.3rem;
  font-weight: 800;
  box-shadow: var(--shadow-red-sm);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.logo-badge::after {
  content: '';
  position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 60%);
  transform: rotate(30deg);
}
.logo-text h1 {
  font-size: 1.2rem; font-weight: 800;
  color: var(--red-primary);
  -webkit-text-fill-color: var(--red-primary);
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.02em;
}
.logo-text p {
  font-size: 0.725rem; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: -0.1rem;
}
.header-actions {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}

/* ════════════════════════════════════════
   NAVIGATION TABS
════════════════════════════════════════ */
.tabs {
  display: flex; gap: 0.35rem;
  padding: 0.75rem 1.25rem 0;
  border-bottom: 1.5px solid var(--border);
  overflow-x: auto;
  background: var(--surface);
  position: sticky; top: 58px; z-index: 90;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 0.65rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1.5px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 0.45rem;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  font-family: inherit;
}
.tab-btn:hover {
  color: var(--red-primary);
  background: var(--red-soft);
  transform: translateY(-1px);
}
.tab-btn.active {
  color: var(--red-primary);
  border-bottom-color: var(--red-primary);
  background: var(--red-soft);
  font-weight: 800;
  box-shadow: inset 0 -2px 0 var(--red-primary);
}

/* ════════════════════════════════════════
   GLASS PANEL / CARDS
════════════════════════════════════════ */
.glass-panel, .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card-red-accent {
  border-left: 4px solid var(--red-primary) !important;
}

/* ════════════════════════════════════════
   STATS GRID
════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  padding: 1.1rem 1.25rem;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; gap: 0.85rem;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.stat-icon.red    { background: var(--red-soft); }
.stat-icon.teal   { background: rgba(6,214,160,0.12); }
.stat-icon.amber  { background: rgba(255,209,102,0.18); }
.stat-icon.blue   { background: rgba(17,138,178,0.12); }
.stat-body { flex: 1; }
.stat-value {
  font-size: 1.7rem; font-weight: 800;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text-primary); line-height: 1.1;
}
.stat-title { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-desc  { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ════════════════════════════════════════
   TOP HEADER BAR BUTTONS (Mockup Accurate)
════════════════════════════════════════ */
.hamburger-menu-btn {
  width: 38px !important;
  height: 38px !important;
  padding: 7px 6px !important;
  border-radius: 12px !important;
  border: 1.5px solid #dbeafe !important;
  background: #f0f7ff !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 4px !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}
.hamburger-menu-btn span {
  display: block !important;
  width: 18px !important;
  height: 2.2px !important;
  background: #0f172a !important;
  border-radius: 2px !important;
}
.top-refresh-btn {
  background: #059669 !important;
  border: none !important;
  color: #ffffff !important;
  border-radius: 12px !important;
  width: 38px !important;
  height: 38px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25) !important;
  transition: transform 0.15s ease, background 0.15s ease !important;
}
.top-refresh-btn:active {
  transform: scale(0.93) !important;
}
.top-pill-btn, .theme-toggle-btn {
  background: #ffffff !important;
  border: 1.5px solid #d1d5db !important;
  border-radius: 9999px !important;
  padding: 0.38rem 0.82rem !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.3rem !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.15s ease !important;
  height: 38px !important;
  box-sizing: border-box !important;
}
.top-pill-btn:hover, .theme-toggle-btn:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}
.user-badge-pill {
  background: #ffffff !important;
  border: 1.5px solid #d1d5db !important;
  color: #000000 !important;
  border-radius: 9999px !important;
  padding: 0.38rem 0.95rem !important;
  font-size: 0.84rem !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.35rem !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  height: 38px !important;
  box-sizing: border-box !important;
  text-transform: capitalize !important;
}
#logout-btn {
  background: #ffffff !important;
  border: 1.5px solid #d1d5db !important;
  border-radius: 9999px !important;
  padding: 0.38rem 0.82rem !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.3rem !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  height: 38px !important;
  box-sizing: border-box !important;
}

[data-theme="dark"] .top-pill-btn,
[data-theme="dark"] .theme-toggle-btn,
[data-theme="dark"] #logout-btn {
  background: #1e293b !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #f1f5f9 !important;
}
[data-theme="dark"] .user-badge-pill {
  background: #1e293b !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #f1f5f9 !important;
}

/* ════════════════════════════════════════
   TOP STATS STACK (Mockup Accurate)
════════════════════════════════════════ */
.top-stats-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  width: 100%;
}
.top-stat-row {
  background: #ffffff;
  border: 1.5px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  padding: 0.75rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
  min-height: 56px;
}
.top-stat-row:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
  border-color: rgba(203, 213, 225, 0.95);
}
.top-stat-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 1;
  min-width: 0;
}
.top-stat-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.top-stat-icon-box.green { background: #dcfce7; }
.top-stat-icon-box.amber { background: #fef9c3; }
.top-stat-icon-box.red   { background: #fee2e2; }
.top-stat-icon-box.blue  { background: #e0f2fe; }
.top-stat-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.2;
}
.top-stat-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}
.top-stat-num {
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1;
  min-width: 38px;
  text-align: right;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.top-stat-num.green { color: #059669; }
.top-stat-num.amber { color: #b45309; }
.top-stat-num.red   { color: #dc2626; }
.top-stat-num.blue  { color: #2563eb; }
.top-stat-divider {
  width: 1.5px;
  height: 30px;
  background: #e2e8f0;
}
.top-stat-desc {
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 0.72rem;
  line-height: 1.25;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}
[data-theme="dark"] .top-stat-row {
  background: #1e293b !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
}
[data-theme="dark"] .top-stat-title {
  color: #f1f5f9 !important;
}
[data-theme="dark"] .top-stat-divider {
  background: rgba(255, 255, 255, 0.12) !important;
}
[data-theme="dark"] .top-stat-desc {
  color: #94a3b8 !important;
}
[data-theme="dark"] .top-stat-icon-box.green { background: rgba(16, 185, 129, 0.2) !important; }
[data-theme="dark"] .top-stat-icon-box.amber { background: rgba(245, 158, 11, 0.2) !important; }
[data-theme="dark"] .top-stat-icon-box.red   { background: rgba(239, 68, 68, 0.2) !important; }
[data-theme="dark"] .top-stat-icon-box.blue  { background: rgba(59, 130, 246, 0.2) !important; }
[data-theme="dark"] .top-stat-icon-box.blue  { background: rgba(59, 130, 246, 0.2) !important; }

/* ════════════════════════════════════════
   FORM ELEMENTS
════════════════════════════════════════ */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.775rem; font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.form-control {
  width: 100%;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: inherit; font-size: 0.875rem; font-weight: 500;
  outline: none;
  transition: var(--transition);
  /* Mobile keyboard fix: must be tappable */
  -webkit-tap-highlight-color: rgba(220, 38, 38, 0.1);
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
.form-control:hover { border-color: #d0d5e8; }
.form-control:focus {
  border-color: var(--red-primary);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.14);
  background: var(--surface);
  outline: none;
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
input.form-control, textarea.form-control { cursor: text; }

/* ── PLATFORM CHIPS ── */
.platform-chips-row {
  display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap;
}
.platform-chip {
  display: inline-flex; align-items: center !important; justify-content: center !important; gap: 0.5rem !important;
  padding: 0.45rem 0.9rem !important;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer; user-select: none;
  font-size: 0.8rem !important; font-weight: 700 !important;
  color: var(--text-secondary);
  transition: var(--transition);
  height: 38px; white-space: nowrap; line-height: 1 !important;
  text-transform: none !important;
  margin-bottom: 0 !important;
  letter-spacing: normal !important;
}
.platform-chip:hover { border-color: var(--red-primary); color: var(--red-primary); }
.platform-chip input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--red-primary);
  cursor: pointer; flex-shrink: 0; margin: 0 !important;
  padding: 0 !important;
  display: inline-block;
  vertical-align: middle;
}
.platform-chip svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.platform-chip:hover svg {
  transform: scale(1.08);
}
.platform-chip span {
  display: inline-flex; align-items: center;
  line-height: 1 !important;
  height: auto;
}

/* Platform Chips Base Styling (Inactive) */
.platform-chip {
  background: var(--input-bg, #f3f4f6) !important;
  border: 1.5px solid var(--border, #e5e7eb) !important;
  color: var(--text-primary, #333) !important;
  box-shadow: none !important;
  transition: all 0.2s ease !important;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.platform-chip svg {
  fill: #4b5563 !important;
}
.platform-chip span {
  color: var(--text-primary, #333) !important;
}

/* A selected source gets an unmistakable checkmark without losing its colour. */
.platform-chip {
  position: relative;
}
.platform-chip.active {
  padding-right: 2.8rem !important;
  outline: 3px solid rgba(15, 23, 42, 0.22);
  outline-offset: 2px;
  transform: translateY(-1px);
}
.platform-chip.active::after {
  content: '✓';
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: #166534;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Keep each traffic source in its recognizable brand colour, selected or not. */
.platform-chip:has(input[value="facebook"]:checked),
#chip-facebook {
  background: #1877f2 !important; border-color: #1877f2 !important;
  color: #ffffff !important; box-shadow: 0 4px 14px rgba(24,119,242,0.3) !important;
}
.platform-chip:has(input[value="facebook"]:checked) svg,
#chip-facebook svg {
  fill: #ffffff !important;
}
.platform-chip:has(input[value="facebook"]:checked) span,
#chip-facebook span {
  color: #ffffff !important;
}

.platform-chip:has(input[value="instagram"]:checked),
#chip-instagram {
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%) !important;
  border: none !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(220,39,67,0.35) !important;
}
.platform-chip:has(input[value="instagram"]:checked) svg,
#chip-instagram svg {
  fill: #ffffff !important;
}
.platform-chip:has(input[value="instagram"]:checked) span,
#chip-instagram span {
  color: #ffffff !important;
}

.platform-chip:has(input[value="custom_website"]:checked),
#chip-custom-website {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
  border: none !important;
  color: #ffffff !important; box-shadow: 0 4px 14px rgba(99,102,241,0.35) !important;
}
.platform-chip:has(input[value="custom_website"]:checked) svg,
#chip-custom-website svg {
  fill: #ffffff !important;
}
.platform-chip:has(input[value="custom_website"]:checked) span,
#chip-custom-website span {
  color: #ffffff !important;
}

/* Tag Input */
.tag-input-container {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); min-height: 40px; align-items: center;
  transition: var(--transition);
}
.tag-input-container:focus-within { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(131,56,236,0.12); }
.domain-tag {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: rgba(131,56,236,0.12); border: 1px solid rgba(131,56,236,0.3);
  color: #6d28d9; padding: 0.15rem 0.55rem;
  border-radius: var(--r-pill); font-size: 0.75rem; font-weight: 700;
}
.domain-tag .remove-tag { cursor: pointer; color: var(--red-primary); font-weight: 800; font-size: 0.9rem; }
.tag-input-field {
  flex: 1; min-width: 140px; border: none; background: transparent;
  color: var(--text-primary); font-family: inherit; font-size: 0.825rem; outline: none; padding: 0.1rem;
}

/* ── PRO SETTINGS ACCORDION ── */
.pro-accordion {
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-top: 1.1rem;
  transition: var(--transition);
}
.pro-accordion-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, #fff5f5 0%, #fff9f0 100%);
  cursor: pointer; user-select: none; gap: 0.5rem; flex-wrap: wrap;
  border-bottom: 1px solid transparent;
  transition: var(--transition);
}
[data-theme="dark"] .pro-accordion-header {
  background: rgba(230,57,70,0.08);
}
.pro-accordion-header:hover { background: var(--red-soft); }
.pro-accordion-header.open { border-bottom-color: var(--border); }
.pro-accordion-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.85rem; font-weight: 800; color: var(--red-primary);
}
.pro-accordion-icon { font-size: 0.75rem; color: var(--text-muted); transition: transform 0.25s; font-weight: 700; }
.pro-accordion-icon.open { transform: rotate(90deg); }
.pro-accordion-body {
  display: none; padding: 1.1rem;
  background: var(--surface-2);
}
.pro-accordion-body.open { display: block; }

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.825rem; font-weight: 700; font-family: inherit;
  border-radius: var(--r-sm); border: 1.5px solid transparent;
  cursor: pointer; transition: var(--transition);
  text-decoration: none; white-space: nowrap; min-height: 38px; line-height: 1;
}
.btn-primary {
  background: var(--grad-red); color: white; border: none;
  box-shadow: var(--shadow-red-sm);
}
.btn-primary:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: var(--shadow-red); }

.btn-secondary {
  background: var(--surface); color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--red-primary); color: var(--red-primary); background: var(--red-soft); }

.btn-danger {
  background: linear-gradient(135deg, #1877f2 0%, #0b57cf 100%);
  color: #ffffff;
  border: 1.5px solid #1877f2;
  box-shadow: 0 4px 12px rgba(24, 119, 242, 0.22);
  font-weight: 800;
}
.btn-danger:hover {
  background: linear-gradient(135deg, #0b57cf 0%, #073884 100%);
  border-color: #0b57cf;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(24, 119, 242, 0.35);
}

.btn-ghost {
  background: transparent; color: var(--text-secondary); border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }

.btn-block { width: 100%; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.75rem; min-height: 30px; border-radius: 6px; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.95rem; border-radius: var(--r-md); }

/* ════════════════════════════════════════
   TABLE
════════════════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: 0.815rem; }
thead tr { background: var(--surface-2); }
th {
  padding: 0.7rem 0.85rem;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-secondary);
  border-bottom: 2px solid var(--border); white-space: nowrap;
  text-align: left;
}
td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary); vertical-align: middle;
  word-break: break-word;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: transparent; }

/* Traffic Logs Reason & Signals cell (Desktop) */
.reason-signals-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 260px;
}
.reason-action-text {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.35;
  word-break: break-word;
}
.reason-signals-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: #f1f5f9;
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
[data-theme="dark"] .reason-signals-tag {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

/* ════════════════════════════════════════
   BADGES
════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 0.2rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--r-pill); font-size: 0.75rem; font-weight: 700;
  white-space: nowrap; letter-spacing: 0.02em;
}
#user-badge {
  background: #ffffff !important;
  color: #000000 !important;
  border: 1.5px solid #d1d5db !important;
  font-weight: 700 !important;
  font-size: 0.825rem !important;
  padding: 0.35rem 0.75rem !important;
  border-radius: var(--r-pill) !important;
  letter-spacing: 0.03em !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  text-transform: capitalize !important;
}
.badge-red    { background: rgba(24,119,242,0.15); color: #1877f2; border: 1px solid rgba(24,119,242,0.3); }
.badge-green  { background: rgba(6,214,160,0.15); color: #059669; border: 1px solid rgba(6,214,160,0.3); }
.badge-amber  { background: rgba(247,127,0,0.15); color: #b45309; border: 1px solid rgba(247,127,0,0.3); }
.badge-blue   { background: rgba(24,119,242,0.15); color: #0b57cf; border: 1px solid rgba(24,119,242,0.3); }
.badge-purple { background: rgba(131,56,236,0.15); color: #6d28d9; border: 1px solid rgba(131,56,236,0.3); }
.badge-gray   { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }

/* Alias for backwards compat */
.badge-success { background: rgba(6,214,160,0.15); color: #059669; border: 1px solid rgba(6,214,160,0.3); }
.badge-warning { background: rgba(247,127,0,0.15); color: #b45309; border: 1px solid rgba(247,127,0,0.3); }
.badge-danger  { background: rgba(239,68,68,0.15); color: #dc2626; border: 1px solid rgba(239,68,68,0.3); }
.badge-info    { background: rgba(24,119,242,0.15); color: #0b57cf; border: 1px solid rgba(24,119,242,0.3); }
.badge-custom  { background: rgba(131,56,236,0.15); color: #6d28d9; border: 1px solid rgba(131,56,236,0.3); }

/* ════════════════════════════════════════
   FLOATING TOAST ALERTS & NOTIFICATIONS
════════════════════════════════════════ */
#dashboard-alert {
  position: fixed !important;
  top: 22px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 99999999 !important;
  min-width: min(92vw, 420px) !important;
  max-width: 95vw !important;
  padding: 0.85rem 1.4rem !important;
  border-radius: 16px !important;
  font-size: 0.92rem !important;
  font-weight: 800 !important;
  text-align: center !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.2) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  animation: alertToastSlideDown 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards !important;
}

@keyframes alertToastSlideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.alert {
  padding: 0.7rem 1rem; border-radius: var(--r-sm);
  font-size: 0.825rem; font-weight: 600; display: none; margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-success {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  color: #ffffff !important;
}
.alert-danger {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  color: #ffffff !important;
}

/* ════════════════════════════════════════
   SHORTLINK CELL COMPONENT (DESKTOP & MOBILE)
════════════════════════════════════════ */
.shortlink-card-component {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.shortlink-meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  flex-wrap: wrap;
  width: 100%;
}

.shortlink-code-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.shortlink-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  color: #1877f2;
}

.shortlink-action-box {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  background: rgba(24, 119, 242, 0.05);
  border: 1.5px solid rgba(24, 119, 242, 0.28);
  border-radius: 10px;
  padding: 3px 3px 3px 8px;
  box-sizing: border-box;
  transition: all 0.2s ease;
  gap: 6px;
}

.shortlink-action-box:hover,
.shortlink-action-box:focus-within {
  border-color: #1877f2;
  background: rgba(24, 119, 242, 0.09);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.14);
}

.shortlink-url-display {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: #1877f2;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.2rem;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-user-select: all !important;
  user-select: all !important;
}

.btn-copy-shortlink {
  background: linear-gradient(135deg, #1877f2 0%, #1d4ed8 100%);
  color: #ffffff !important;
  border: none;
  border-radius: 7px;
  padding: 0.35rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  box-shadow: 0 2px 6px rgba(24, 119, 242, 0.3);
  white-space: nowrap;
  min-height: 30px;
  height: 30px;
  transition: all 0.15s ease;
}

.btn-copy-shortlink:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(24, 119, 242, 0.4);
}

.btn-copy-shortlink:active {
  transform: translateY(0);
}

[data-theme="dark"] .shortlink-action-box {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.35);
}

[data-theme="dark"] .shortlink-url-display {
  color: #60a5fa;
}

.code-box {
  display: block;
  background: rgba(24,119,242,0.06);
  border: 1px solid rgba(24,119,242,0.22);
  color: #1877f2;
  padding: 0.32rem 0.6rem;
  border-radius: 8px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.8rem;
  font-weight: 700;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-all;
  white-space: normal;
  line-height: 1.4;
  transition: all 0.15s ease;
}

.url-link {
  color: var(--red-primary); text-decoration: none; font-weight: 600;
  display: block; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.url-link:hover { text-decoration: underline; }

/* Mobile: full width truncation */
@media (max-width: 768px) {
  .url-link {
    max-width: calc(100vw - 3rem);
  }
  .shortlink-card-component {
    width: 100% !important;
    max-width: 100% !important;
  }
  .shortlink-action-box {
    width: 100% !important;
    max-width: 100% !important;
  }
  .shortlink-url-display {
    font-size: 0.8rem !important;
  }
  .btn-copy-shortlink {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.74rem !important;
  }
}
.action-btn-group { display: inline-flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }

/* Theme Toggle */
.theme-toggle-btn {
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--text-primary); padding: 0.35rem 0.7rem;
  border-radius: var(--r-sm); cursor: pointer; font-size: 0.775rem; font-weight: 700;
  display: inline-flex; align-items: center; gap: 0.35rem;
  transition: var(--transition); font-family: inherit;
}
.theme-toggle-btn:hover { border-color: var(--red-primary); color: var(--red-primary); }

/* Section divider heading */
.section-title {
  font-size: 1rem; font-weight: 800; color: var(--text-primary);
  margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.4rem;
}
.section-title .accent { color: var(--red-primary); }

/* Date filter toolbar */
.filter-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.65rem;
  padding: 0.75rem 1.1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.filter-group { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.filter-label { font-size: 0.775rem; font-weight: 700; color: var(--text-secondary); }

/* Search box */
.search-box { position: relative; display: inline-flex; align-items: center; }
.search-box .form-control { padding-left: 2.5rem !important; }
.search-box::before {
  content: '🔍'; position: absolute; left: 0.85rem; top: 50%;
  transform: translateY(-50%); font-size: 0.85rem; z-index: 5; pointer-events: none;
}

/* QR Modal */
.qr-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100050;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.qr-modal-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 1.5rem;
  text-align: center;
  max-width: 380px;
  width: 92%;
  max-height: min(90vh, 590px);
  overflow-y: auto;
  margin: auto;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
@keyframes popIn {
  from { transform: scale(0.88); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.qr-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle, rgba(226, 232, 240, 0.5));
}
.qr-link-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.qr-link-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface-hover, #f8fafc);
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: var(--r-md);
  padding: 0.25rem 0.35rem 0.25rem 0.6rem;
  gap: 0.4rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
[data-theme="dark"] .qr-link-input-wrap {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.12);
}
.qr-link-input-wrap:focus-within {
  border-color: var(--primary, #1877f2);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.18);
}
.qr-link-icon {
  font-size: 0.95rem;
  flex-shrink: 0;
}
.qr-link-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text, #0f172a);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: monospace;
  outline: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .qr-link-input {
  color: #f8fafc;
}
.btn-copy-qr {
  flex-shrink: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--r-sm);
  background: var(--primary, #1877f2);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-copy-qr:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.qr-open-link-btn {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--primary, #1877f2);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}
.qr-open-link-btn:hover {
  text-decoration: underline;
}
.qr-img-wrapper {
  background: #ffffff;
  padding: 0.75rem;
  border-radius: var(--r-lg);
  display: inline-flex;
  align-self: center;
  justify-content: center;
  align-items: center;
  margin: 0.2rem 0;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.qr-img-wrapper img {
  display: block;
  width: 155px;
  height: 155px;
  max-width: 100%;
  object-fit: contain;
}
.qr-modal-actions {
  width: 100%;
  margin-top: 0.2rem;
}

/* ════════════════════════════════════════
   RESPONSIVE DESIGN — MOBILE FIRST
   Mobile: 320-480px | Tablet: 481-768px
   Laptop: 769-1024px | Desktop: 1025px+
════════════════════════════════════════ */

/* ── Base: Prevent iOS auto-zoom on input focus ── */
/* iOS zooms when input font-size < 16px — fix globally */
input, select, textarea, button {
  touch-action: manipulation;
}

/* ── DESKTOP / LAPTOP — 1025px+ (already default) ── */
@media (min-width: 1025px) {
  .auth-wrapper { grid-template-columns: 1fr 1fr; }
  .auth-brand { display: flex; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .header-inner { flex-direction: row; }
  .header-actions { flex-direction: row; }
}

/* ── LAPTOP — 769px to 1024px ── */
@media (max-width: 1024px) and (min-width: 769px) {
  :root { --base-font-size: 15.5px; }
  .container { padding: 1.25rem; max-width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-wrapper { grid-template-columns: 1fr 1fr; }
  .auth-brand { display: flex; }
  .header-inner { flex-direction: row; align-items: center; }
  .logo-text h1 { font-size: 1.15rem; }
  .tabs { overflow-x: auto; }
  .tab-btn { padding: 0.75rem 1.1rem; font-size: 0.92rem; }
}

/* ── TABLET — 481px to 768px ── */
@media (max-width: 768px) and (min-width: 481px) {
  :root { --base-font-size: 15.5px; }
  input, select, textarea {
    font-size: 16px !important;
    min-height: 46px !important;
    touch-action: manipulation;
  }

  /* Layout */
  .container { padding: 1rem 1.15rem; max-width: 100%; }
  body { background-attachment: scroll; }

  /* Login */
  .auth-wrapper { grid-template-columns: 1fr; min-height: 100svh; }
  .auth-brand { display: none; }
  .auth-form-panel { padding: 2.5rem 2rem; justify-content: flex-start; padding-top: 3rem; }
  .auth-card { max-width: 100%; }
  .auth-topbar { flex-direction: row; align-items: center; }

  /* Header */
  .header-inner { flex-direction: row; align-items: center; gap: 0.75rem; }
  .logo-text h1 { font-size: 1.1rem; }
  .logo-text p { display: none; }
  .logo-badge { width: 40px; height: 40px; font-size: 1.2rem; }
  .header-actions { gap: 0.65rem; }
  .theme-toggle-btn { padding: 0.45rem 0.85rem; font-size: 0.85rem; font-weight: 700; }
  .btn.btn-sm { min-height: 38px; padding: 0.45rem 0.85rem; font-size: 0.85rem; font-weight: 700; }

  /* Tabs */
  .tabs {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 0.5rem 0.85rem 0; gap: 0.35rem;
    height: auto; top: 54px;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { padding: 0.7rem 1rem; font-size: 0.9rem; font-weight: 700; white-space: nowrap; }

  /* Stats grid */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.85rem; }
  .stat-value { font-size: 1.6rem; font-weight: 800; }

  /* Forms */
  .form-group { margin-bottom: 0.85rem; }
  .form-control { padding: 0.55rem 0.85rem !important; min-height: 42px !important; font-size: 0.95rem !important; }

  /* Tables */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-sm); }
  table { min-width: 600px; }
  th, td { padding: 0.75rem 0.85rem; font-size: 0.85rem; white-space: nowrap; }

  /* Buttons */
  .btn { min-height: 44px; font-size: 0.92rem; font-weight: 700; }
  .btn-lg { width: 100%; }
  .action-btn-group { flex-wrap: wrap; gap: 0.5rem; }

  /* Platform chips */
  .platform-chips-row { flex-wrap: wrap; gap: 0.65rem; }
  .platform-chip { height: 44px; font-size: 0.88rem !important; }

  /* Grids */
  div[style*="grid-template-columns:repeat(auto-fit"] { grid-template-columns: 1fr !important; }

  /* Filter toolbar */
  .filter-toolbar { flex-direction: column; align-items: stretch; gap: 0.65rem; }
  .filter-group { flex-wrap: wrap; }

  /* Cards */
  .card, .glass-panel { padding: 1.25rem !important; }

  /* Pro accordion */
  .pro-accordion-header { flex-direction: row; align-items: center; }

  /* QR Modal */
  .qr-modal-card { padding: 1.5rem; max-width: 380px; }
  .qr-img-wrapper img { width: 155px; height: 155px; }
}

/* ── MOBILE — max 480px ── */
@media (max-width: 480px) {
  :root { --base-font-size: 15.5px; }
  .hide-mobile { display: none !important; }

  header.site-header {
    padding: 0.45rem 0.35rem !important;
    overflow-x: hidden !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  .hide-mobile-header, .logo-link { display: none !important; }
  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.2rem !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .logo-group { gap: 0.25rem !important; flex-shrink: 0; display: flex; align-items: center; }
  .hamburger-menu-btn { width: 34px !important; height: 36px !important; padding: 5px 4px !important; border-radius: 10px !important; flex-shrink: 0 !important; }
  .top-refresh-btn { width: 34px !important; height: 36px !important; border-radius: 10px !important; flex-shrink: 0 !important; }
  .header-actions { gap: 0.15rem !important; flex-wrap: nowrap !important; flex-shrink: 0; display: flex; align-items: center; }
  .theme-toggle-btn, .top-pill-btn, #logout-btn {
    padding: 0 0.42rem !important;
    font-size: 0.72rem !important;
    height: 36px !important;
    min-height: 36px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
  }
  #user-badge, .user-badge-pill {
    display: inline-flex !important;
    padding: 0 0.45rem !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    color: #000000 !important;
    background: #ffffff !important;
    border: 1.5px solid #d1d5db !important;
    border-radius: 9999px !important;
    flex-shrink: 0 !important;
    height: 36px !important;
    min-height: 36px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    text-transform: capitalize !important;
  }

  /* Top Stat Row Mobile (Matching User Favorite Screenshot) */
  .top-stats-stack {
    gap: 0.65rem !important;
    margin-bottom: 1.15rem !important;
  }
  .top-stat-row {
    padding: 0.65rem 0.85rem !important;
    border-radius: 16px !important;
    gap: 0.45rem !important;
    min-height: 54px !important;
  }
  .top-stat-left {
    gap: 0.65rem !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }
  .top-stat-icon-box {
    width: 42px !important;
    height: 42px !important;
    font-size: 1.3rem !important;
    border-radius: 12px !important;
    flex-shrink: 0 !important;
  }
  .top-stat-title {
    font-size: 0.82rem !important;
    font-weight: 800 !important;
    color: #1e293b !important;
    letter-spacing: 0.02em !important;
    text-transform: uppercase !important;
    white-space: normal !important;
    line-height: 1.2 !important;
  }
  .top-stat-right {
    gap: 0.55rem !important;
    flex-shrink: 0 !important;
  }
  .top-stat-num {
    font-size: 1.65rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    min-width: 32px !important;
  }
  .top-stat-divider {
    height: 28px !important;
    width: 1.5px !important;
  }
  .top-stat-desc {
    font-size: 0.68rem !important;
    line-height: 1.25 !important;
    color: #64748b !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
  }

  /* Stats grid: 1 column */
  .stats-grid { grid-template-columns: 1fr; gap: 0.75rem; margin-bottom: 1.1rem; }
  .stat-card { padding: 1.1rem 1.25rem !important; }
  .stat-value { font-size: 1.55rem; font-weight: 800; }
  .stat-icon { width: 44px; height: 44px; font-size: 1.25rem; }

  /* Forms: full width, compact touch targets */
  .form-group { margin-bottom: 0.85rem; }
  .form-group label { font-size: 0.825rem !important; font-weight: 800 !important; }
  .form-control {
    padding: 0.55rem 0.75rem !important;
    min-height: 42px !important;
    border-radius: var(--r-sm);
    font-size: 0.95rem !important;
  }
  select.form-control { padding-right: 2rem; }

  /* Tables: scrollable horizontally */
  .table-wrap {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    border-radius: 0; margin-left: -0.75rem; margin-right: -0.75rem;
    border-left: none; border-right: none;
    width: calc(100% + 1.5rem);
  }
  table { min-width: 520px; }
  th, td { padding: 0.7rem 0.85rem; font-size: 0.85rem; white-space: nowrap; }

  /* Buttons: full width on mobile */
  .btn { min-height: 48px; font-size: 0.92rem; font-weight: 700; border-radius: var(--r-sm); }
  .btn-sm { min-height: 40px; font-size: 0.85rem; }
  .btn-lg, .btn-block { width: 100%; font-size: 1rem; }
  .action-btn-group { flex-direction: column; gap: 0.6rem; }
  .action-btn-group .btn { width: 100%; justify-content: center; font-size: 0.9rem; font-weight: 700; }

  /* Platform chips row: wrap */
  .platform-chips-row { flex-wrap: wrap; gap: 0.6rem; }
  .platform-chip { height: 44px; min-width: auto; flex: 1 1 auto; justify-content: center; font-size: 0.88rem !important; font-weight: 700 !important; }

  /* Grid overrides */
  div[style*="grid-template-columns:1fr 1fr"]:not(.traffic-grid-2col):not(#traffic-filter-cards-grid):not(#traffic-action-buttons-grid):not(.firewall-settings-2col):not(#bot-settings-group):not(#vpn-settings-group) { grid-template-columns: 1fr !important; }
  div[style*="repeat(auto-fit"]:not(.traffic-grid-2col) { grid-template-columns: 1fr !important; }
  .form-row-2, .form-grid { grid-template-columns: 1fr !important; }

  /* 2-Column Grid for Real-Time Traffic Audit Logs on Mobile */
  .traffic-grid-2col,
  #traffic-filter-cards-grid,
  #traffic-action-buttons-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.45rem !important;
    width: 100% !important;
  }
  .traffic-filter-btn[data-filter="country-block"] {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }
  .traffic-filter-btn {
    padding: 0.35rem 0.55rem !important;
    gap: 0.4rem !important;
    border-radius: 12px !important;
    min-height: 42px !important;
    max-height: 46px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .traffic-filter-btn > div:first-child {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  .traffic-filter-btn svg {
    width: 15px !important;
    height: 15px !important;
  }
  .traffic-filter-btn span:first-child {
    font-size: 0.76rem !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
    letter-spacing: -0.02em !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
  .traffic-filter-btn span:last-child {
    font-size: 0.68rem !important;
    font-weight: 600 !important;
    line-height: 1.15 !important;
    margin-top: 1px !important;
  }
  #traffic-action-buttons-grid a,
  #traffic-action-buttons-grid button {
    padding: 0.45rem 0.65rem !important;
    font-size: 0.78rem !important;
    border-radius: 11px !important;
    min-height: 36px !important;
    max-height: 38px !important;
    min-width: 0 !important;
  }

  /* Filter toolbar */
  .filter-toolbar { flex-direction: column; align-items: stretch; gap: 0.65rem; padding: 0.85rem 1rem; }
  .filter-group { flex-wrap: wrap; gap: 0.5rem; }
  .filter-label { font-size: 0.85rem; font-weight: 800; }

  /* Date presets */
  .date-preset-btn { padding: 0.45rem 0.75rem; font-size: 0.8rem; font-weight: 700; min-height: 38px; }

  /* Cards */
  .card, .glass-panel { padding: 1.15rem !important; border-radius: var(--r-md) !important; }

  /* Section title */
  .section-title { font-size: 1.05rem; font-weight: 800; }

  /* Pro Settings Accordion */
  .pro-accordion-header { flex-direction: row; align-items: center; justify-content: space-between; padding: 0.9rem 1.1rem; }
  .pro-accordion-title { font-size: 0.9rem; font-weight: 800; }
  .pro-accordion-icon { font-size: 0.8rem; }

  /* QR Modal: centered, responsive, always visible download button on mobile */
  .qr-overlay {
    padding: 0.75rem;
    align-items: center !important;
    justify-content: center !important;
    z-index: 100050 !important;
  }
  .qr-modal-card {
    width: 92% !important;
    max-width: 360px !important;
    border-radius: var(--r-xl) !important;
    padding: 1.2rem 1rem !important;
    max-height: 88vh !important;
    animation: popIn 0.22s ease-out !important;
    margin: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.6rem !important;
  }
  .qr-img-wrapper {
    padding: 0.5rem !important;
    margin: 0.15rem 0 !important;
  }
  .qr-img-wrapper img {
    width: min(145px, 42vw) !important;
    height: min(145px, 42vw) !important;
  }

  /* Badge: larger on mobile */
  .badge { font-size: 0.75rem; padding: 0.28rem 0.6rem; font-weight: 800; }

  /* Auth topbar */
  .auth-topbar { flex-direction: row; margin-bottom: 2rem; }

  /* Collapse all custom grids to single column on mobile */
  div[style*="display:grid"],
  div[style*="display: grid"],
  .stats-grid,
  .form-row-2,
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }
}

/* ── Extra small phones — max 360px ── */
@media (max-width: 360px) {
  .logo-text h1 { font-size: 0.8rem; }
  .tab-btn { padding: 0.4rem 0.6rem; font-size: 0.7rem; }
  .stat-value { font-size: 1.2rem; }
  .form-control { font-size: 16px !important; padding: 0.65rem 0.75rem; }
  .btn { min-height: 44px; font-size: 0.825rem; }
}


/* ── MULTI-LAYOUTS / DENSITY ── */
html.density-standard {
  --base-font-size: 14.5px !important;
}
body.density-standard {
  font-size: 14.5px;
}
body.density-standard .container {
  padding: 0.85rem 1rem;
}
body.density-standard .card, 
body.density-standard .glass-panel {
  padding: 1.15rem !important;
  margin-bottom: 1rem !important;
}

html.density-compact {
  --base-font-size: 13px !important;
}
body.density-compact {
  font-size: 13px;
}
body.density-compact .container {
  padding: 0.4rem 0.65rem;
}
body.density-compact .card, 
body.density-compact .glass-panel {
  padding: 0.8rem !important;
  margin-bottom: 0.65rem !important;
}
body.density-compact .form-group {
  margin-bottom: 0.5rem;
}
body.density-compact td, 
body.density-compact th {
  padding: 0.35rem 0.5rem !important;
}
body.density-compact .stat-card {
  padding: 0.65rem 0.85rem !important;
}

html.density-cozy {
  --base-font-size: 15.5px !important;
}
body.density-cozy {
  font-size: 15.5px;
}
body.density-cozy .container {
  padding: 1.1rem 1.35rem;
}
body.density-cozy .card, 
body.density-cozy .glass-panel {
  padding: 1.35rem !important;
  margin-bottom: 1.25rem !important;
}
body.density-cozy td, 
body.density-cozy th {
  padding: 0.75rem 1rem !important;
}

/* ── TYPOGRAPHY OVERRIDES ── */
body.font-sans { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }
body.font-grotesk { font-family: 'Space Grotesk', system-ui, sans-serif; }
body.font-outfit { font-family: 'Outfit', system-ui, sans-serif; }

body.font-grotesk h1, body.font-grotesk h2, body.font-grotesk h3, 
body.font-grotesk h4, body.font-grotesk h5, body.font-grotesk label, 
body.font-grotesk button, body.font-grotesk table {
  font-family: 'Space Grotesk', sans-serif !important;
}

body.font-outfit h1, body.font-outfit h2, body.font-outfit h3, 
body.font-outfit h4, body.font-outfit h5, body.font-outfit label, 
body.font-outfit button, body.font-outfit table {
  font-family: 'Outfit', sans-serif !important;
}

/* ── SHADOW MODES ── */
body.shadow-flat .card, 
body.shadow-flat .glass-panel, 
body.shadow-flat .stat-card,
body.shadow-flat .btn,
body.shadow-flat header.site-header {
  box-shadow: none !important;
}

body.shadow-glow .card, 
body.shadow-glow .glass-panel,
body.shadow-glow .stat-card {
  box-shadow: 0 8px 30px var(--red-glow) !important;
}

/* ── GLASSMORPHISM DISABLE ── */
body.glass-disabled .card, 
body.glass-disabled .glass-panel,
body.glass-disabled .pro-accordion-header,
body.glass-disabled .qr-modal-card {
  backdrop-filter: none !important;
  background: var(--surface) !important;
}

/* ── MOBILE RESPONSIVE HAMBURGER & DRAWER OVERRIDES ── */

/* Hamburger Button */
.hamburger-menu-btn {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
  z-index: 1010;
  width: 38px;
  height: 38px;
  justify-content: center;
  align-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.hamburger-menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Transform Hamburger Bars to X when open */
.menu-open .hamburger-menu-btn span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-open .hamburger-menu-btn span:nth-child(2) {
  opacity: 0;
}
.menu-open .hamburger-menu-btn span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Menu Backdrop Overlay */
.menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 990;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.menu-open .menu-overlay {
  display: block;
  opacity: 1;
}

/* Drawer Header & Close Button (Hidden on Desktop) */
.drawer-header {
  display: none;
}

/* Mobile responsive media query (Tablet/Mobile) */
@media (max-width: 768px) {
  .hamburger-menu-btn {
    display: flex;
  }

  .drawer-header {
    display: flex !important;
    width: 100% !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-bottom: 0.85rem !important;
    margin-bottom: 0.75rem !important;
    border-bottom: 1px solid var(--border) !important;
    box-sizing: border-box !important;
  }

  .drawer-title {
    font-size: 1rem !important;
    font-weight: 800 !important;
    color: var(--text-primary) !important;
    letter-spacing: -0.01em !important;
  }

  .drawer-close-btn {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    border: 1.5px solid rgba(239, 68, 68, 0.3) !important;
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
  }

  .drawer-close-btn:hover, .drawer-close-btn:active {
    background: #ef4444 !important;
    color: #ffffff !important;
    transform: scale(1.05) !important;
  }

  /* Transform tabs into a side drawer */
  .tabs {
    position: fixed !important;
    top: 0 !important;
    left: -250px !important;
    bottom: 0 !important;
    width: 250px !important;
    height: 100vh !important;
    flex-direction: column !important;
    align-items: stretch !important;
    background: #ffffff !important;
    border-right: 1.5px solid var(--border) !important;
    border-bottom: none !important;
    padding: 1rem 0.85rem 1.25rem !important;
    gap: 0.35rem !important;
    z-index: 10000 !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow-y: auto !important;
    box-shadow: 15px 0 35px rgba(0, 0, 0, 0.15) !important;
    display: flex !important;
  }

  .menu-open .tabs {
    left: 0 !important;
  }

  /* Style tab button inside the side drawer */
  .tab-btn {
    width: 100% !important;
    justify-content: flex-start !important;
    padding: 0.65rem 0.85rem !important;
    font-size: 0.9rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    background: transparent !important;
    border: 1.5px solid transparent !important;
    border-left: 3.5px solid transparent !important;
    border-radius: var(--r-sm) !important;
    margin-bottom: 0.2rem !important;
    text-align: left !important;
  }

  .tab-btn:hover {
    background: var(--red-soft) !important;
    color: var(--red-primary) !important;
  }

  .tab-btn.active {
    border: 1.5px solid #c9deff !important;
    border-left: 3.5px solid #1877f2 !important;
    background: #ebf3fe !important;
    color: #1877f2 !important;
    font-weight: 800 !important;
    box-shadow: 0 3px 10px rgba(24, 119, 242, 0.1) !important;
  }

  /* Typography scale down & logo text hide for mobile view */
  .logo-text {
    display: none !important;
  }

  h1 {
    font-size: 1.2rem !important;
    font-weight: 800 !important;
  }

  .section-title {
    font-size: 1.05rem !important;
    font-weight: 800 !important;
  }

  /* Inputs kept at 16px to prevent iOS auto-zoom on focus */
  input, select, textarea {
    font-size: 16px !important;
    font-weight: 600 !important;
  }

  /* Prevent virtual keyboard layout shifts */
  body {
    height: 100%;
    min-height: -webkit-fill-available;
    overflow-y: auto;
    background-attachment: scroll !important;
  }
}

/* Desktop layout: hide hamburger */
@media (min-width: 769px) {
  .hamburger-menu-btn {
    display: none !important;
  }
  .menu-overlay {
    display: none !important;
  }
}

/* ── TABLE & PLATFORM CHIPS ADDITIONAL RESPONSIVENESS ── */

/* Table Cell Wrapping & Sizing Constraints */
table td {
  max-width: 250px;
  word-break: break-all;
}
/* ── Blocked Countries Pills Component (Compact & Sleek) ── */
.blocked-countries-wrap {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 0.3rem !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
}

.blocked-country-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.25rem !important;
  background: #ffffff !important;
  border: 1px solid #fecaca !important;
  color: #111827 !important;
  padding: 0.18rem 0.45rem !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.01em !important;
  box-shadow: 0 1px 2px rgba(239, 68, 68, 0.06) !important;
  flex-shrink: 0 !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.blocked-country-pill:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.12) !important;
}

.blocked-country-pill .country-flag {
  font-size: 0.82rem !important;
  line-height: 1 !important;
  display: inline-block !important;
}

.blocked-country-pill .country-code {
  font-weight: 700 !important;
  color: #111827 !important;
  font-family: 'Outfit', sans-serif !important;
  font-size: 0.7rem !important;
}

.blocked-country-pill-none {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.3rem !important;
  background: #ecfdf5 !important;
  border: 1px solid #a7f3d0 !important;
  color: #059669 !important;
  padding: 0.18rem 0.45rem !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
  font-size: 0.7rem !important;
}

[data-theme="dark"] .blocked-country-pill {
  background: #1e293b !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #f8fafc !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .blocked-country-pill .country-code {
  color: #f8fafc !important;
}

@media (max-width: 768px) {
  /* Hide original table headers and change wrapping */
  .table-wrap {
    overflow-x: visible !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    width: 100% !important;
  }
  
  table, thead, tbody, th, td, tr {
    display: block !important;
    width: 100% !important;
  }
  
  thead {
    display: none !important;
  }
  
  tr {
    background: #ffffff !important;
    border: 1.5px solid var(--border) !important;
    border-radius: var(--r-md) !important;
    padding: 0.85rem 1.1rem !important;
    margin-bottom: 1rem !important;
    box-shadow: var(--shadow-md) !important;
  }
  
  td {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.42rem 0 !important;
    border: none !important;
    border-bottom: 1px dashed var(--border) !important;
    min-height: 34px !important;
    white-space: normal !important;
    text-align: right !important;
    gap: 0.6rem !important;
    font-size: 0.88rem !important;
    background: transparent !important;
  }
  
  td:last-child {
    border-bottom: none !important;
  }
  
  /* Inject the data-label dynamically */
  td[data-label]::before {
    content: attr(data-label) !important;
    font-weight: 800 !important;
    color: var(--text-secondary) !important;
    font-size: 0.78rem !important;
    text-transform: uppercase !important;
    text-align: left !important;
    flex-shrink: 0 !important;
    letter-spacing: 0.03em !important;
  }

  /* Align values properly on the right */
  td > * {
    text-align: right !important;
  }
  
  /* Make action buttons fit nicely in a 2-column full-width grid at the bottom of the card */
  td[data-label="Actions"] {
    flex-direction: column !important;
    align-items: stretch !important;
    border-bottom: none !important;
    margin-top: 0.4rem !important;
    padding-bottom: 0.25rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  td[data-label="Actions"]::before {
    margin-bottom: 0.5rem !important;
    text-align: left !important;
  }
  table td .action-btn-group,
  td[data-label="Actions"] .action-btn-group,
  td[data-label="Actions"] > div {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    box-sizing: border-box !important;
  }
  td[data-label="Actions"] .action-btn-group:has(> :only-child),
  td[data-label="Actions"] > div:has(> :only-child),
  td[data-label="Actions"] > div:has(> button:only-child) {
    grid-template-columns: 1fr !important;
  }
  table td .action-btn-group .btn,
  td[data-label="Actions"] .action-btn-group .btn,
  td[data-label="Actions"] > div > .btn,
  td[data-label="Actions"] > div > button,
  td[data-label="Actions"] > button {
    width: 100% !important;
    margin: 0 !important;
    min-height: 38px !important;
    padding: 0.45rem 0.65rem !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    justify-content: center !important;
    display: flex !important;
    align-items: center !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }

  /* Reason & Signals: Full-width stacked column on mobile (prevents 3-letter vertical wrapping) */
  td[data-label="Reason & Signals"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    width: 100% !important;
    padding: 0.6rem 0 !important;
    gap: 0.35rem !important;
    box-sizing: border-box !important;
  }
  td[data-label="Reason & Signals"]::before {
    text-align: left !important;
    margin-bottom: 0.2rem !important;
  }
  td[data-label="Reason & Signals"] > *,
  td[data-label="Reason & Signals"] .reason-signals-wrap {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    gap: 0.35rem !important;
    box-sizing: border-box !important;
  }
  td[data-label="Reason & Signals"] .reason-action-text {
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    color: var(--text-primary, #1e293b) !important;
    line-height: 1.4 !important;
    text-align: left !important;
    width: 100% !important;
    max-width: 100% !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
  }
  td[data-label="Reason & Signals"] .reason-signals-tag {
    display: inline-flex !important;
    align-items: center !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    color: #475569 !important;
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 7px !important;
    padding: 0.25rem 0.6rem !important;
    max-width: 100% !important;
    word-break: break-word !important;
    white-space: normal !important;
    text-align: left !important;
    box-sizing: border-box !important;
  }
  [data-theme="dark"] td[data-label="Reason & Signals"] .reason-action-text {
    color: #f1f5f9 !important;
  }
  [data-theme="dark"] td[data-label="Reason & Signals"] .reason-signals-tag {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #cbd5e1 !important;
  }

  /* Short Link stays column (too long for row) */
  td[data-label="Short Link"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  td[data-label="Short Link"]::before {
    margin-bottom: 0.25rem !important;
  }
  td[data-label="Short Link"] > * {
    text-align: left !important;
    width: 100% !important;
    max-width: 100% !important;
    word-break: break-all !important;
    overflow-wrap: anywhere !important;
    box-sizing: border-box !important;
  }

  /* Target URL & Fallback URL — compact inline row */
  td[data-label="Target URL"],
  td[data-label="Fallback URL"] {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
  }
  td[data-label="Target URL"] > *,
  td[data-label="Fallback URL"] > * {
    text-align: right !important;
    max-width: 55% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 0.8rem !important;
    box-sizing: border-box !important;
  }

  /* Source badges inline — label LEFT, badge RIGHT, same row */
  td[data-label="Allowed Sources"] {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    text-align: left !important;
    flex-wrap: nowrap !important;
  }
  td[data-label="Allowed Sources"] > div {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 0.3rem !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex-shrink: 1 !important;
  }
  td[data-label="Allowed Sources"] .badge {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    font-size: 0.75rem !important;
    padding: 0.28rem 0.65rem !important;
  }

  /* Blocked Countries mobile card layout — Compact, sleek chips centered */
  td[data-label="Blocked Countries"] {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    gap: 0.25rem !important;
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
  }
  td[data-label="Blocked Countries"]::before {
    margin-bottom: 0.15rem !important;
    display: block !important;
    text-align: center !important;
    width: 100% !important;
    font-size: 0.72rem !important;
    font-weight: 800 !important;
    color: #1e293b !important;
    letter-spacing: 0.04em !important;
  }
  [data-theme="dark"] td[data-label="Blocked Countries"]::before {
    color: #cbd5e1 !important;
  }
  td[data-label="Blocked Countries"] > * {
    text-align: center !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  td[data-label="Blocked Countries"] .blocked-countries-wrap {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 0.25rem 0.35rem !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
  }
  td[data-label="Blocked Countries"] .blocked-country-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.22rem !important;
    background: #ffffff !important;
    border: 1px solid #fca5a5 !important;
    color: #111827 !important;
    padding: 0.15rem 0.42rem !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
    font-size: 0.68rem !important;
    letter-spacing: 0.01em !important;
    box-shadow: 0 1px 2px rgba(239, 68, 68, 0.05) !important;
    flex-shrink: 0 !important;
  }
  td[data-label="Blocked Countries"] .country-flag {
    font-size: 0.78rem !important;
    line-height: 1 !important;
  }
  td[data-label="Blocked Countries"] .country-code {
    font-size: 0.65rem !important;
    font-weight: 700 !important;
  }
  td[data-label="Blocked Countries"] .blocked-country-pill-none {
    padding: 0.15rem 0.42rem !important;
    font-size: 0.68rem !important;
    border-radius: 6px !important;
  }

  [data-theme="dark"] td[data-label="Blocked Countries"] .blocked-country-pill {
    background: #1e293b !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #f8fafc !important;
  }

  /* Status / Action & Risk Score mobile row alignment — prevents badge overflowing card edge */
  td[data-label="Status / Action"],
  td[data-label="Risk Score"] {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0.4rem !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  td[data-label="Status / Action"] .badge,
  td[data-label="Risk Score"] .badge {
    max-width: 62% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 0.72rem !important;
    padding: 0.22rem 0.52rem !important;
    flex-shrink: 1 !important;
    box-sizing: border-box !important;
    text-align: right !important;
  }

  /* Referrer & IP / ISP same-line row alignment on mobile */
  td[data-label="Referrer"] {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  /* Sub-row layout for IP & ISP on Mobile */
  td[data-label="IP / ISP"]::before {
    display: none !important;
  }
  td[data-label="IP / ISP"] {
    display: block !important;
    padding: 0.5rem 0.85rem !important;
  }
  .ip-isp-cell {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.35rem !important;
  }
  .mobile-sublabel {
    display: inline-block !important;
    font-size: 0.7rem !important;
    font-weight: 800 !important;
    color: var(--text-muted, #64748b) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    flex-shrink: 0 !important;
  }
  .ip-row {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 1.5rem !important;
    width: 100% !important;
    padding-bottom: 0.35rem !important;
    border-bottom: 1px dashed var(--border, #e2e8f0) !important;
  }
  .isp-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }
  .isp-text {
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    color: var(--text-primary, #1e293b) !important;
    text-align: right !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  /* Prevent IP address wrapping / line distortion on mobile */
  td code,
  td[data-label="IP / ISP"] code,
  td[data-label="IP Address"] code {
    white-space: nowrap !important;
    word-break: normal !important;
    font-family: monospace, SFMono-Regular, Consolas, monospace !important;
    font-weight: 700 !important;
    font-size: 0.88rem !important;
    display: inline-block !important;
    background: rgba(59, 130, 246, 0.08) !important;
    color: #1d4ed8 !important;
    padding: 0.15rem 0.45rem !important;
    border-radius: 6px !important;
    margin-bottom: 0.2rem !important;
  }

  /* Allowed Traffic Sources Responsiveness: 1 Column Full Width per Chip */
  .platform-chips-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.6rem !important;
    width: 100% !important;
  }
  .platform-chip {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    height: 46px !important;
    padding: 0.55rem 1rem !important;
    box-sizing: border-box !important;
    justify-content: center !important;
    border-radius: 12px !important;
  }
  #custom-domains-container {
    width: 100% !important;
    min-width: 100% !important;
    flex: 1 0 100% !important;
    margin-top: 0.25rem !important;
  }
}

/* ── PREVENT BOTTOM SCROLLBARS & ENFORCE FULL RESPONSIVENESS ── */

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

@media (max-width: 768px) {
  table {
    min-width: 0 !important;
    width: 100% !important;
  }
  
  /* Force all inline grids with 300px or 320px auto-fit minmax to stack cleanly */
  div[style*="minmax(300px"], 
  div[style*="minmax(320px"] {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  /* Make settings card fields full width */
  .card form div[style*="display:grid"] {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  /* Auth / Login Page Mobile Fix */
  .auth-wrapper {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    min-height: 100vh !important;
    width: 100% !important;
    overflow-x: hidden !important;
    background: #f0f5ff !important;
    background-image: linear-gradient(160deg, #dbeafe 0%, #f0f5ff 50%, #eff6ff 100%) !important;
  }
  .auth-brand {
    display: none !important;
  }
  .auth-form-panel {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 1.5rem 1.15rem !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
    background: linear-gradient(160deg, #dbeafe 0%, #f0f5ff 50%, #eff6ff 100%) !important;
    min-height: 100vh !important;
  }
  .auth-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.5rem 0 !important;
    box-sizing: border-box !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }
  .auth-topbar {
    width: 100% !important;
    margin-bottom: 2rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
}

/* ── DUAL LOGIN TABS ── */
.login-tabs-container {
  display: flex;
  background: #ffffff;
  border: 1.5px solid #c9deff;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 1.35rem;
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(24, 119, 242, 0.08);
}

.login-tab-btn {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.6rem;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  white-space: nowrap;
  touch-action: manipulation;
  user-select: none;
}

.login-tab-btn:hover:not(.active) {
  background: rgba(24, 119, 242, 0.08);
  color: #1877f2;
}

.login-tab-btn.active {
  background: #1877f2;
  color: #ffffff !important;
  box-shadow: 0 3px 10px rgba(24, 119, 242, 0.28);
  font-weight: 700;
  border-radius: 8px;
}

/* Mobile: stack icons above text if very small */
/* ── MOBILE BOTTOM NAVIGATION BAR ── */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  body {
    padding-bottom: 72px !important;
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: space-around;
    padding: 0 0.25rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
  }

  [data-theme="dark"] .mobile-bottom-nav {
    background: rgba(15, 23, 42, 0.92);
    border-top-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.2rem;
    color: #64748b;
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    gap: 0.2rem;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  [data-theme="dark"] .mobile-nav-item {
    color: #94a3b8;
  }

  .mobile-nav-item .nav-icon {
    font-size: 1.25rem;
    line-height: 1;
    transition: transform 0.2s ease;
  }

  .mobile-nav-item.active {
    color: #3b82f6 !important;
  }

  [data-theme="dark"] .mobile-nav-item.active {
    color: #60a5fa !important;
  }

  .mobile-nav-item.active .nav-icon {
    transform: scale(1.15);
  }
}

/* ── PREVENT TAP HIGHLIGHT & ALL BROWSER SELECTION BOXES ── */
::selection {
  background: transparent !important;
  color: inherit !important;
}
::-moz-selection {
  background: transparent !important;
  color: inherit !important;
}

table, thead, tbody, tr, td, th, .card, .glass-panel, .action-btn-group, .btn,
table *, .card *, .glass-panel * {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

/* ── PERMISSION-BASED COLUMN & ELEMENT HIDING (MOBILE & DESKTOP) ── */
.col-hidden-perm,
th.col-hidden-perm,
td.col-hidden-perm,
table td.col-hidden-perm,
table th.col-hidden-perm,
td[data-label].col-hidden-perm,
td[data-label="Target URL"].col-hidden-perm,
td[data-label="Fallback URL"].col-hidden-perm,
td[data-label="Allowed Sources"].col-hidden-perm,
td[data-label="Blocked Countries"].col-hidden-perm,
td.col-blocked-countries.col-hidden-perm,
th#th-blocked-countries.col-hidden-perm,
td[data-label="Settings"].col-hidden-perm,
td[data-label="Clicks"].col-hidden-perm,
td[data-label="Actions"].col-hidden-perm {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-bottom: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

td[data-label].col-hidden-perm::before,
td[data-label].col-hidden-perm > * {
  display: none !important;
  content: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
}

/* ── Facebook Sub-Source Analytics Widget (Seamless & Filled Design) ── */
#fb-breakdown-card {
  padding: 1.15rem !important;
  margin-bottom: 1.15rem !important;
  background: #ffffff !important;
  border: 1px solid rgba(226, 232, 240, 0.85) !important;
  border-radius: 20px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04) !important;
  box-sizing: border-box !important;
}

.fb-subsource-header {
  margin-bottom: 0.45rem !important;
  text-align: left !important;
}

.fb-subsource-title-row {
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  white-space: nowrap !important;
  flex-wrap: nowrap !important;
}

.fb-subsource-target-icon {
  font-size: 1.25rem !important;
  line-height: 1 !important;
  display: inline-flex !important;
  flex-shrink: 0 !important;
}

.fb-subsource-title {
  margin: 0 !important;
  font-size: clamp(0.78rem, 3.8vw, 1.05rem) !important;
  font-weight: 800 !important;
  color: #0066fe !important;
  letter-spacing: -0.01em !important;
  white-space: nowrap !important;
  line-height: 1.1 !important;
}

.fb-subsource-subtitle {
  display: none !important;
}

.fb-subsource-stack {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  width: 100% !important;
}

.fb-subsource-row {
  display: grid !important;
  grid-template-columns: 1fr auto 1fr !important;
  align-items: center !important;
  padding: 3px 0.75rem !important;
  border-radius: 9px !important;
  background: #ffffff !important;
  min-height: 30px !important;
  max-height: 34px !important;
  box-sizing: border-box !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.fb-subsource-left {
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  justify-self: start !important;
}

.fb-subsource-left span {
  font-size: 0.82rem !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
  line-height: 1 !important;
}

.fb-subsource-icon {
  width: 16px !important;
  height: 16px !important;
  flex-shrink: 0 !important;
}

.fb-subsource-center {
  justify-self: center !important;
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  min-width: 40px !important;
}

.fb-subsource-num {
  font-size: 1.35rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

.fb-subsource-bar-track,
.fb-subsource-bar-fill {
  display: none !important;
}

.fb-subsource-right {
  justify-self: end !important;
  text-align: right !important;
  color: #475569 !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  line-height: 1 !important;
}

/* Individual Color Themes */
.fb-subsource-row.theme-profile {
  border: 1.5px solid #60a5fa !important;
  background: rgba(239, 246, 255, 0.35) !important;
}
.fb-subsource-row.theme-profile .fb-subsource-left span,
.fb-subsource-row.theme-profile .fb-subsource-num {
  color: #0066fe !important;
}
.theme-profile .fb-subsource-bar-fill {
  background: linear-gradient(90deg, #3b82f6, #0066fe) !important;
}

.fb-subsource-row.theme-group {
  border: 1.5px solid #c084fc !important;
  background: rgba(250, 245, 255, 0.35) !important;
}
.fb-subsource-row.theme-group .fb-subsource-left span,
.fb-subsource-row.theme-group .fb-subsource-num {
  color: #7c3aed !important;
}
.theme-group .fb-subsource-bar-fill {
  background: linear-gradient(90deg, #a855f7, #7c3aed) !important;
}

.fb-subsource-row.theme-page {
  border: 1.5px solid #34d399 !important;
  background: rgba(240, 253, 250, 0.35) !important;
}
.fb-subsource-row.theme-page .fb-subsource-left span,
.fb-subsource-row.theme-page .fb-subsource-num {
  color: #059669 !important;
}
.theme-page .fb-subsource-bar-fill {
  background: linear-gradient(90deg, #10b981, #059669) !important;
}

.fb-subsource-row.theme-story {
  border: 1.5px solid #fbbf24 !important;
  background: rgba(255, 251, 235, 0.35) !important;
}
.fb-subsource-row.theme-story .fb-subsource-left span,
.fb-subsource-row.theme-story .fb-subsource-num {
  color: #d97706 !important;
}
.theme-story .fb-subsource-bar-fill {
  background: linear-gradient(90deg, #f59e0b, #d97706) !important;
}

.fb-subsource-row.theme-fake {
  border: 1.5px solid #f87171 !important;
  background: rgba(254, 242, 242, 0.35) !important;
}
.fb-subsource-row.theme-fake .fb-subsource-left span,
.fb-subsource-row.theme-fake .fb-subsource-num {
  color: #dc2626 !important;
}
.theme-fake .fb-subsource-bar-fill {
  background: linear-gradient(90deg, #ef4444, #dc2626) !important;
}

@media (max-width: 480px) {
  #fb-breakdown-card {
    padding: 0.55rem 0.65rem !important;
    border-radius: 14px !important;
  }
  .fb-subsource-header {
    margin-bottom: 0.35rem !important;
  }
  .fb-subsource-title-row {
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
  }
  .fb-subsource-target-icon {
    font-size: 1.15rem !important;
  }
  .fb-subsource-title {
    font-size: clamp(0.72rem, 3.6vw, 0.95rem) !important;
    white-space: nowrap !important;
    line-height: 1.1 !important;
  }
  .fb-subsource-stack {
    gap: 2.5px !important;
  }
  .fb-subsource-row {
    padding: 2px 0.65rem !important;
    border-radius: 8px !important;
    min-height: 28px !important;
    max-height: 32px !important;
    box-shadow: none !important;
  }
  .fb-subsource-left {
    gap: 0.35rem !important;
  }
  .fb-subsource-left span {
    font-size: 0.78rem !important;
    line-height: 1 !important;
  }
  .fb-subsource-icon {
    width: 15px !important;
    height: 15px !important;
  }
  .fb-subsource-center {
    padding: 0 !important;
    min-width: 35px !important;
  }
  .fb-subsource-num {
    font-size: 1.25rem !important;
    line-height: 1 !important;
  }
  .fb-subsource-right {
    font-size: 0.72rem !important;
    line-height: 1 !important;
  }
}

[data-theme="dark"] #fb-breakdown-card {
  background: var(--surface) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}
[data-theme="dark"] .fb-subsource-header {
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}
[data-theme="dark"] .fb-subsource-row {
  background: rgba(30, 41, 59, 0.85) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}
[data-theme="dark"] .fb-subsource-bar-track {
  background: rgba(255, 255, 255, 0.12) !important;
}
[data-theme="dark"] .fb-subsource-right {
  color: #94a3b8 !important;
}
[data-theme="dark"] .fb-subsource-subtitle {
  color: #94a3b8 !important;
}

/* ── Firewall Tab: Role-Based Card Visibility ── */
/* For Editors / Non-Admins: ONLY show the Block IP Address card (#block-ip-card).
   Completely hide Auto Shield, Global FB Rules, Country Block, Blocked IPs table, Temp Blocks, and Allowlist */
body:not(.is-admin) #tab-firewall #auto-shield-card,
body:not(.is-admin) #tab-firewall #global-fb-rules-card,
body:not(.is-admin) #tab-firewall #editor-country-block-card,
body:not(.is-admin) #tab-firewall #permanently-blocked-card,
body:not(.is-admin) #tab-firewall #temp-blocks-card,
body:not(.is-admin) #tab-firewall #allowlist-card {
  display: none !important;
}

/* Editor view styling: centered clean card */
body:not(.is-admin) #tab-firewall #block-ip-card {
  max-width: 580px;
  margin: 0 auto;
  width: 100%;
}

/* ── Traffic Logs & Facebook Analytics: Super Admin Only (Problem 5 Fix) ── */
/* In Editor accounts: completely hide Logs tab, Top Stats Stack, and Facebook Traffic Sub-Source Analytics.
   Everything runs strictly in the backend for Editors and displays only in Super Admin account */
body:not(.is-admin) .tab-btn[data-tab="tab-analytics"],
body:not(.is-admin) .mobile-nav-item[data-tab="tab-analytics"],
body:not(.is-admin) #tab-analytics,
body:not(.is-admin) .top-stats-stack,
body:not(.is-admin) #fb-breakdown-card {
  display: none !important;
}

/* ── Zero-Flash: Instantly hide Geo tab for Editors without Geo permission ── */
html.is-editor:not(.has-geo-perm) .tab-btn[data-tab="tab-geo"],
html.is-editor:not(.has-geo-perm) .mobile-nav-item[data-tab="tab-geo"],
html.is-editor:not(.has-geo-perm) #tab-geo,
body.is-editor:not(.has-geo-perm) .tab-btn[data-tab="tab-geo"],
body.is-editor:not(.has-geo-perm) .mobile-nav-item[data-tab="tab-geo"],
body.is-editor:not(.has-geo-perm) #tab-geo,
html.hide-geo-tab .tab-btn[data-tab="tab-geo"],
html.hide-geo-tab .mobile-nav-item[data-tab="tab-geo"],
html.hide-geo-tab #tab-geo,
body.hide-geo-tab .tab-btn[data-tab="tab-geo"],
body.hide-geo-tab .mobile-nav-item[data-tab="tab-geo"],
body.hide-geo-tab #tab-geo {
  display: none !important;
}

/* ── Fallback Redirect: Super Admin Only (Hidden from Editors & Normal Admins) ── */
html:not(.is-superadmin) #wrap-new-col-fallback-url,
html:not(.is-superadmin) #wrap-edit-col-fallback-url,
html:not(.is-superadmin) #wrap-new-logs-fallback-clicks,
html:not(.is-superadmin) #wrap-edit-logs-fallback-clicks,
body:not(.is-superadmin) #default-fallback-url-card,
body:not(.is-superadmin) #wrap-new-col-fallback-url,
body:not(.is-superadmin) #wrap-edit-col-fallback-url,
body:not(.is-superadmin) #wrap-new-logs-fallback-clicks,
body:not(.is-superadmin) #wrap-edit-logs-fallback-clicks,
body:not(.is-admin) #create-fallback-url-group,
body:not(.is-admin) #fallback-url,
body:not(.is-admin) #modal-rule-fallback-wrap,
body:not(.is-admin) #default-fallback-url-card,
body.is-editor #wrap-new-col-fallback-url,
body.is-editor #wrap-edit-col-fallback-url,
body.is-editor #wrap-new-logs-fallback-clicks,
body.is-editor #wrap-edit-logs-fallback-clicks,
body.is-editor #create-fallback-url-group,
body.is-editor #fallback-url,
body.is-editor #modal-rule-fallback-wrap,
body.is-editor #default-fallback-url-card {
  display: none !important;
}

/* ── QR Code Modal: Hide Tagged Links (Group, Page, Story) from Editors ── */
html.is-editor #qr-tagged-links-wrap,
body.is-editor #qr-tagged-links-wrap,
html:not(.is-admin) #qr-tagged-links-wrap,
body:not(.is-admin) #qr-tagged-links-wrap {
  display: none !important;
}

/* ── Target URL: Non-Clickable for Editors (Prevents Bypassing the Shortener) ── */
.non-clickable-target-url,
body.is-editor .col-target-url a,
body.is-editor .col-target-url .url-link,
body.is-editor .col-target-url span,
body:not(.is-admin) .col-target-url a,
body:not(.is-admin) .col-target-url .url-link,
body:not(.is-admin) .col-target-url span {
  pointer-events: none !important;
  cursor: default !important;
  text-decoration: none !important;
  color: var(--text-primary) !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* ── Facebook Traffic & AdX Rules: Admin & Super Admin Only ── */
/* In Editor accounts: completely hide Facebook Traffic & AdX Rules button and modal from editor dashboard.
   Rules are configured only by Admin and execute in the backend */
body:not(.is-admin) .btn-traffic-rules,
body:not(.is-admin) #traffic-rules-modal,
body.is-editor .btn-traffic-rules,
body.is-editor #traffic-rules-modal {
  display: none !important;
}

/* ── Custom Domains (Add Domain / Sub Domain): Super Admin Only (Hidden from Editors & Normal Admins) ── */
body:not(.is-superadmin) #custom-domains-card,
body:not(.is-admin) #custom-domains-card,
body.is-editor #custom-domains-card {
  display: none !important;
}

/* ── Google Authenticator 2FA Manager: Single-line Title ── */
#two-factor-auth-card .section-title {
  white-space: nowrap !important;
  font-size: clamp(0.78rem, 3.8vw, 1.05rem) !important;
  letter-spacing: -0.015em !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
}

@media (max-width: 480px) {
  #two-factor-auth-card {
    padding: 1.25rem 1rem !important;
  }
  #two-factor-auth-card .section-title {
    font-size: clamp(0.74rem, 3.7vw, 0.95rem) !important;
    white-space: nowrap !important;
  }
}

/* ── Fallback Redirect Card: Dark Theme Support ── */
[data-theme="dark"] #default-fallback-url-card .fallback-card-title {
  color: #f8fafc !important;
}
[data-theme="dark"] #default-fallback-url-card .fallback-notice-box-styled {
  background: rgba(245, 158, 11, 0.08) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}
[data-theme="dark"] #default-fallback-url-card .fallback-notice-title-styled {
  color: #fbbf24 !important;
}
[data-theme="dark"] #default-fallback-url-card .fallback-notice-desc-styled {
  color: #cbd5e1 !important;
}

/* ── Firewall Tab & Auto Shield Mobile Polish (Corner Radius, Padding & Inputs Alignment) ── */
@media (max-width: 768px) {
  #tab-firewall .card,
  #auto-shield-card,
  #block-ip-card,
  #global-fb-rules-card,
  #editor-country-block-card {
    border-radius: 12px !important;
    padding: 1.1rem !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }
  #apply-firewall-globally-wrap,
  #block-ip-globally-wrap {
    border-radius: 10px !important;
    padding: 0.75rem 0.85rem !important;
  }
  #bot-settings-group,
  #vpn-settings-group {
    padding-left: 0.25rem !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
  }
  .firewall-settings-2col {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
  }
}

@media (max-width: 480px) {
  #tab-firewall .card,
  #auto-shield-card,
  #block-ip-card,
  #global-fb-rules-card,
  #editor-country-block-card {
    border-radius: 12px !important;
    padding: 1rem 0.85rem !important;
  }
  #apply-firewall-globally-wrap,
  #block-ip-globally-wrap {
    border-radius: 9px !important;
    padding: 0.65rem 0.75rem !important;
  }
  #bot-settings-group,
  #vpn-settings-group {
    padding-left: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.45rem !important;
  }
  .firewall-settings-2col {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.45rem !important;
  }
  #auto-shield-card .section-title {
    font-size: 0.95rem !important;
  }
}

/* ── Quick Country Toggle Buttons: Perfectly Centered 4x4 Grid ── */
#quick-country-buttons {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 0.45rem !important;
  width: 100% !important;
  box-sizing: border-box !important;
  justify-items: center !important;
  justify-content: center !important;
}

.quick-country-btn {
  width: 100% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
}

#new-user-quick-countries,
#edit-user-quick-countries {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 0.35rem !important;
  width: 100% !important;
  box-sizing: border-box !important;
  justify-items: center !important;
  justify-content: center !important;
}

.new-quick-country-btn,
.edit-quick-country-btn {
  width: 100% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
}

#editor-blocked-countries-tags {
  justify-content: center !important;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  #publytics-dashboard-frame {
    height: 650px !important;
  }
}









/* Domain Management Animations */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
