:root {
  --primary: #ee4d2d;
  --primary-hover: #d73211;
  --primary-light: #fff5f1;
  --primary-glow: rgba(238, 77, 45, 0.35);
  --secondary: #ff7337;
  --dark-bg: #0f172a;
  --dark-card: #1e293b;
  --dark-border: #334155;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-white: #ffffff;
  --card-bg: #ffffff;
  --body-bg: #f8fafc;
  --border-color: #e2e8f0;
  --sidebar-bg: #ffffff;
  --topbar-bg: #ffffff;
  --success: #10b981;
  --warning: #f59e0b;
  --info: #3b82f6;
  --radius: 14px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 25px var(--primary-glow);
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --body-bg: #0b0f19;
  --card-bg: #151d2f;
  --sidebar-bg: #111827;
  --topbar-bg: #111827;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --border-color: #232e42;
  --primary-light: rgba(238, 77, 45, 0.15);
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

body {
  background-color: var(--body-bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  top: 0;
  left: 0;
  z-index: 100;
}

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

.brand-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.sidebar-close-btn:hover {
  background: rgba(238, 77, 45, 0.1);
  color: var(--primary);
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
  font-weight: 800;
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.nav-menu {
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  border-radius: 10px;
}

.nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

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

.nav-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 12px 14px 4px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0.75;
}

.nav-group-collapse {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--sidebar-bg);
}

/* Main Content Area */
.main-wrapper {
  margin-left: 270px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-title h1 {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
}

.topbar-title p {
  font-size: 12px;
  color: var(--text-muted);
}

.content-body {
  padding: 28px 32px;
  flex: 1;
}

/* UI Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

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

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

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

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.stat-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

/* Form Styles */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 7px;
  color: var(--text-main);
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-main);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Table */
.table-responsive {
  overflow-x: auto;
}

.custom-table, .data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th, .data-table th {
  background: rgba(0,0,0,0.02);
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
}

.custom-table td, .data-table td {
  padding: 13px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.custom-table tbody tr:hover, .data-table tbody tr:hover {
  background: rgba(238, 77, 45, 0.03);
}

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

.badge-orange {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

/* Strategy Banner */
.strategy-banner {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: var(--radius);
  color: white;
  padding: 24px 30px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
  position: relative;
  overflow: hidden;
}

.strategy-content h2 {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.strategy-content p {
  font-size: 13px;
  color: #94a3b8;
  max-width: 700px;
  line-height: 1.6;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Sidebar Backdrop */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Hamburger Button */
.btn-hamburger {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-hamburger:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* Mobile Floating Bottom App Navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  z-index: 990;
  padding: 0 12px;
  align-items: center;
  justify-content: space-around;
}
.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 700;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 12px;
  transition: all 0.2s;
  min-width: 60px;
}
.mobile-nav-link i {
  font-size: 18px;
  transition: transform 0.2s;
}
.mobile-nav-link:hover, .mobile-nav-link.active {
  color: var(--primary);
}
.mobile-nav-link.active i {
  transform: translateY(-2px);
}
.mobile-nav-highlight {
  position: relative;
  margin-top: -24px;
}
.mobile-nav-highlight .highlight-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 6px 18px var(--primary-glow);
  border: 3px solid var(--card-bg);
  transition: transform 0.2s;
}
.mobile-nav-highlight:hover .highlight-circle {
  transform: scale(1.08);
}
.mobile-nav-highlight span {
  margin-top: 2px;
  font-weight: 800;
  color: var(--primary);
}

/* ====================================================== */
/* RESPONSIVE BREAKPOINTS (Mobile & Tablet Admin View)   */
/* ====================================================== */
@media (max-width: 900px) {
  .btn-hamburger {
    display: inline-flex;
  }
  .sidebar-close-btn {
    display: flex;
  }
  
  /* Slide-Out Drawer Sidebar on Mobile */
  .sidebar {
    width: 290px;
    max-width: 85vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    box-shadow: 0 0 40px rgba(0,0,0,0.3);
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  /* Keep all labels, subtitles, and icons crystal clear in mobile drawer */
  .brand-title, .brand-subtitle, .nav-item span, .sidebar-footer {
    display: block !important;
  }
  .nav-item {
    justify-content: flex-start !important;
    padding: 12px 14px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
  }
  .nav-item i {
    font-size: 16px !important;
    width: 22px !important;
  }
  .nav-section-title {
    display: flex !important;
  }

  /* Topbar & Main Wrapper */
  .main-wrapper {
    margin-left: 0;
    width: 100%;
  }
  .topbar {
    padding: 12px 16px;
    gap: 10px;
  }
  .topbar-title h1 {
    font-size: 16px;
  }
  .topbar-title p {
    font-size: 11px;
    display: none;
  }
  .topbar-user-badge span {
    max-width: 110px !important;
  }
  .topbar-btn-export {
    display: none;
  }
  .topbar-btn-create {
    padding: 7px 12px;
    font-size: 11px;
  }

  .content-body {
    padding: 16px 14px 85px 14px; /* extra bottom padding for mobile bottom nav */
  }

  /* Show Bottom App Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
  }
}

@media (max-width: 600px) {
  .topbar-user-badge span {
    display: none !important;
  }
  .topbar-actions {
    gap: 6px;
  }
}

/* UTM Copy Buttons Pill Group */
.utm-copy-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.utm-btn-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.utm-btn {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  line-height: 1.3;
  text-decoration: none;
}
.utm-btn:active {
  transform: scale(0.96);
}
.utm-ig { background: #fdf2f8; color: #db2777; border-color: #fbcfe8; }
.utm-ig:hover { background: #db2777; color: #fff; }

.utm-fb { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.utm-fb:hover { background: #1d4ed8; color: #fff; }

.utm-tt { background: #0f172a; color: #ffffff; border-color: #0f172a; }
.utm-tt:hover { background: #000; color: #22d3ee; }

.utm-wa { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.utm-wa:hover { background: #15803d; color: #fff; }

.utm-oth { background: #f8fafc; color: #475569; border-color: #cbd5e1; }
.utm-oth:hover { background: #475569; color: #fff; }

[data-theme="dark"] .utm-ig { background: rgba(219, 39, 119, 0.15); color: #f472b6; border-color: rgba(219, 39, 119, 0.3); }
[data-theme="dark"] .utm-fb { background: rgba(29, 78, 216, 0.15); color: #60a5fa; border-color: rgba(29, 78, 216, 0.3); }
[data-theme="dark"] .utm-tt { background: rgba(255, 255, 255, 0.1); color: #ffffff; border-color: rgba(255, 255, 255, 0.2); }
[data-theme="dark"] .utm-wa { background: rgba(22, 163, 74, 0.15); color: #4ade80; border-color: rgba(22, 163, 74, 0.3); }
[data-theme="dark"] .utm-oth { background: rgba(255, 255, 255, 0.05); color: #94a3b8; border-color: rgba(255, 255, 255, 0.1); }
