:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(20, 28, 46, 0.8);
  --bg-card-hover: rgba(30, 41, 67, 0.95);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(59, 130, 246, 0.3);
  --primary: #3b82f6;
  --primary-gradient: linear-gradient(135deg, #2563eb, #1d4ed8);
  --accent-emerald: #10b981;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --sidebar-width: 260px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  display: flex;
  height: 100vh;
  overflow: hidden;
  background-image:
    radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.1) 0%, transparent 40%);
}

/* Sidebar Layout */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(13, 19, 33, 0.88);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.5rem 0.5rem 1.5rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: white;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.brand-title h2 {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(to right, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-title p {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.nav-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 1.2rem 0.5rem 0.4rem 0.5rem;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

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

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.05));
  border-left: 3.5px solid var(--primary);
  color: #ffffff;
  font-weight: 600;
}

.nav-item.active i {
  color: var(--primary);
}

.badge {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 700;
}

.badge-primary {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 70px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(13, 19, 33, 0.5);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.page-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.page-title p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.75rem 2rem 1.75rem;
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.content-body.is-loading {
  opacity: 0.85;
  filter: saturate(0.92);
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* FIXED HEADER WRAPPER FOR UNIVERSAL FILTER BAR - PINNED ACROSS ALL BROWSERS (EDGE, CHROME) */
.filter-bar-fixed-wrapper {
  position: relative;
  z-index: 100;
  background: var(--bg-main);
  padding: 0.85rem 1.75rem 0.5rem 1.75rem;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .filter-bar-fixed-wrapper {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

/* TOP RUNNING PROGRESS BAR (CYAN - BLUE - PURPLE GRADIENT) */
.top-loading-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #06b6d4, #3b82f6, #8b5cf6, #06b6d4);
  background-size: 250% 100%;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.7), 0 0 4px rgba(139, 92, 246, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 101;
}

.top-loading-progress-bar.active {
  opacity: 1;
  animation: topProgressShimmer 1.1s linear infinite;
}

@keyframes topProgressShimmer {
  0% {
    background-position: 250% 0;
  }
  100% {
    background-position: -250% 0;
  }
}

/* TOP UNIVERSAL FILTER BAR - HORIZONTALLY ALIGNED */
.global-filter-bar {
  margin-bottom: 0;
  background: rgba(20, 28, 46, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: all 0.25s ease;
}


.filter-row-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-box-date {
  flex: 1.8;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-box-select, .filter-box-search {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-box-date label, .filter-box-select label, .filter-box-search label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  height: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-input, .filter-box-select select {
  background: rgba(13, 19, 33, 0.9);
  border: 1px solid var(--border-color);
  color: white;
  padding: 0 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
  width: 100%;
  height: 42px;
  font-weight: 600;
}

.date-input {
  padding-left: 2.4rem;
  cursor: pointer;
}

.date-input:focus, .filter-box-select select:focus, .filter-box select:focus { border-color: var(--primary); }
.filter-box-select select { cursor: pointer; }

.preset-btn-group {
  display: flex;
  gap: 6px;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-preset:hover,
.btn-preset.active {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--primary);
  color: white;
}

.filter-loading-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #60a5fa;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  height: 42px;
  box-sizing: border-box;
  animation: filterPulse 2s infinite ease-in-out;
}

@keyframes filterPulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; border-color: rgba(59, 130, 246, 0.7); }
}

.btn-apply-filter {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.6rem 1.3rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
}

.btn-apply-filter:hover {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.6);
}

.btn-apply-filter:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.filter-row-bottom {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-status-badge {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Cards & Layout */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* KPI Cards Responsive Grid */
.kpi-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.1rem;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.kpi-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

.kpi-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.kpi-val {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--accent-emerald);
  margin-top: 4px;
}

/* CALENDAR COMPONENT STYLING */
.calendar-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.leg-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.leg-sdt {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.leg-booking {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.leg-appointment {
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(167, 139, 250, 0.3);
}

.leg-arrived {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
  text-align: center;
}

.calendar-weekdays div {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day-cell {
  background: rgba(13, 19, 33, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.day-cell:hover {
  border-color: var(--primary);
  background: rgba(30, 41, 67, 0.85);
}

.day-cell.other-month { opacity: 0.3; }
.day-cell.active-range {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.08);
}

.day-num {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-metrics {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.day-metric-item {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Flatpickr Custom Styling */
.flatpickr-calendar {
  background: #131b2e !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6) !important;
  border-radius: 12px !important;
}
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
}

.map-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 62% 28%, rgba(239, 68, 68, 0.6) 0%, rgba(245, 158, 11, 0.3) 15%, transparent 30%),
    radial-gradient(circle at 65% 82%, rgba(59, 130, 246, 0.6) 0%, rgba(16, 185, 129, 0.3) 15%, transparent 30%);
  pointer-events: none;
}
.flatpickr-day.inRange {
  background: rgba(59, 130, 246, 0.2) !important;
  border-color: transparent !important;
  color: white !important;
}

.heatmap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.heatmap-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.85rem;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.heatmap-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.thumb-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 65px;
  height: 65px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid var(--border-color);
  color: #60a5fa;
  font-size: 1.4rem;
}

.sql-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* VIETNAM HEATMAP & DEMOGRAPHICS STYLING */
.vn-map-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .vn-map-layout {
    grid-template-columns: 1fr;
  }
}

.vn-svg-card {
  position: relative;
  background: rgba(13, 19, 33, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 480px;
}

.metric-toggle-group {
  display: flex;
  gap: 6px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.btn-metric {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-metric:hover, .btn-metric.active {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
}

.vn-svg-wrapper {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 440px;
}

.vn-svg-canvas {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.25));
}

.heat-node {
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.heat-node:hover {
  transform: scale(1.3);
  filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.8));
}

.vn-map-tooltip {
  position: absolute;
  display: none;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.7);
  pointer-events: none;
  z-index: 100;
  backdrop-filter: blur(8px);
}

/* LEAFLET DARK THEME POPUP CUSTOMIZATION */
.leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.92) !important;
  border: 1px solid rgba(59, 130, 246, 0.4) !important;
  color: #f8fafc !important;
  border-radius: 10px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: blur(10px) !important;
}
.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.92) !important;
}
.leaflet-container {
  font-family: 'Plus Jakarta Sans', sans-serif !important;
}

/* CONVERSION FUNNEL MULTI-STEP STYLES */
.funnel-grid-layout {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 20px;
}
@media (max-width: 1024px) {
  .funnel-grid-layout {
    grid-template-columns: 1fr;
  }
}
.funnel-step-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.funnel-step-card {
  position: relative;
  background: rgba(13, 19, 33, 0.75);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 18px;
  overflow: hidden;
  transition: all 0.25s ease;
}
.funnel-step-card:hover {
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.funnel-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  border-radius: 10px;
  z-index: 0;
  opacity: 0.16;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.funnel-card-body {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.funnel-left-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.funnel-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
}
.funnel-title-group h4 {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-main);
}
.funnel-title-group p {
  margin: 2px 0 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.funnel-right-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: right;
}
.funnel-main-num {
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.funnel-pill-tag {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  white-space: nowrap;
}
.funnel-connector-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -6px 0;
  z-index: 2;
}
.funnel-rate-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
  background: rgba(20, 28, 46, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.diag-card {
  background: rgba(13, 19, 33, 0.75);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 12px;
  transition: all 0.25s ease;
}
.diag-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
}
.diag-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.diag-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.diag-card-value {
  font-size: 0.95rem;
  font-weight: 800;
}
.diag-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* TAB 3 CONTENT & ANGLE EVALUATION STYLES */
.ad-thumb-img {
  width: 40px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.2s ease;
  cursor: pointer;
  background: #0f172a;
  display: block;
}

.ad-thumb-img:hover {
  border-color: #60a5fa;
  box-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
  transform: translateY(-1px);
}

.thumb-preview-box {
  width: 40px;
  height: 54px;
  border-radius: 6px;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--text-dim);
  border: 1px solid var(--border-color);
  font-weight: 600;
}

/* FLOATING AD PREVIEW POPOVER (HD PREVIEW) */
.floating-ad-preview {
  position: fixed;
  display: none;
  z-index: 999999;
  width: 270px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.85), 0 0 25px rgba(59, 130, 246, 0.25);
  pointer-events: none;
  transition: opacity 0.12s ease;
  opacity: 0;
}

.floating-ad-preview.active {
  display: block;
  opacity: 1;
}

.floating-ad-preview-img {
  width: 100%;
  max-height: 320px;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: block;
  image-rendering: auto;
  image-rendering: -webkit-optimize-contrast;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.floating-ad-preview-meta {
  margin-top: 8px;
  font-size: 0.78rem;
}

.floating-ad-preview-title {
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.floating-ad-preview-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #94a3b8;
  font-size: 0.72rem;
  margin-top: 4px;
}


.tab3-sub-toggle-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab3-sub-toggle-btn.active, .tab3-sub-toggle-btn:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--primary);
  color: #60a5fa;
}

.action-pill {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.action-scale {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.action-hook {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.action-cta {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.status-pill {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
}
.status-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.status-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.3);
}
.status-info {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.status-neutral {
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* =========================================================================
   TAB 3: CONTENT SORTING & VIEW CONTROLS
   ========================================================================= */
.tab3-sort-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(59, 130, 246, 0.35);
  padding: 5px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.tab3-sort-select {
  background: transparent;
  border: none;
  color: #f8fafc;
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  padding: 2px 4px;
}

.tab3-sort-select option {
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.82rem;
  padding: 6px 10px;
}

th.sortable-th {
  cursor: pointer !important;
  user-select: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

th.sortable-th:hover {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #60a5fa !important;
}

th.sortable-th.active-sort {
  background: rgba(59, 130, 246, 0.28) !important;
  color: #93c5fd !important;
  border-bottom: 2px solid #3b82f6 !important;
}

.sort-icon-box {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.72rem;
  opacity: 0.45;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

th.sortable-th:hover .sort-icon-box {
  opacity: 0.85;
}

th.sortable-th.active-sort .sort-icon-box {
  opacity: 1;
  color: #60a5fa;
}

/* ==========================================================================
   DYNAMIC COLUMN CUSTOMIZER MODAL STYLES
   ========================================================================== */
.customizer-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(4, 7, 15, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.customizer-modal-dialog {
  background: #0d1321;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  width: 100%;
  max-width: 860px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.customizer-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(20, 28, 46, 0.6);
}

.customizer-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
}

.customizer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s;
}

.customizer-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.customizer-toolbar {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(13, 19, 33, 0.4);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.customizer-search-box {
  position: relative;
  width: 100%;
}

.customizer-search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.customizer-search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: rgba(30, 41, 67, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.customizer-search-box input:focus {
  border-color: var(--primary);
}

.customizer-presets-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.customizer-presets-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.customizer-preset-btn {
  background: rgba(30, 41, 67, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

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

.customizer-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.customizer-group-card {
  background: rgba(20, 28, 46, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
}

.customizer-group-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #93c5fd;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.customizer-group-count {
  font-size: 0.72rem;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  padding: 2px 8px;
  border-radius: 10px;
}

.customizer-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.customizer-col-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(30, 41, 67, 0.45);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.customizer-col-item:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

.customizer-col-item.active {
  background: rgba(59, 130, 246, 0.18);
  border-color: #3b82f6;
}

.customizer-col-item.locked {
  opacity: 0.85;
  cursor: default;
}

.customizer-col-item input[type="checkbox"] {
  accent-color: #3b82f6;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.customizer-col-item.locked input[type="checkbox"] {
  cursor: default;
}

.customizer-col-item .col-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customizer-locked-badge {
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 1px 5px;
  border-radius: 4px;
}

.customizer-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: rgba(20, 28, 46, 0.6);
}

.customizer-footer-left {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.customizer-footer-right {
  display: flex;
  gap: 8px;
}

.customizer-btn-secondary {
  background: rgba(30, 41, 67, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.customizer-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.customizer-btn-primary {
  background: var(--primary-gradient);
  border: none;
  color: #fff;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transition: all 0.2s;
}

.customizer-btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
}

/* ==============================================================================
 * CENTRAL BUTTON & TRIGGER STYLES
 * ============================================================================== */
.customizer-trigger-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  cursor: pointer;
  transition: all 0.2s ease;
}

.customizer-trigger-btn:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #60a5fa;
  color: #ffffff;
  transform: translateY(-1px);
}

.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--primary);
  color: #38bdf8;
  transform: translateY(-1px);
}

/* ==============================================================================
 * PREMIUM LIGHT MODE DESIGN SYSTEM & ULTRA CLEAN ELEVATIONS
 * ============================================================================== */
[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-glow: rgba(37, 99, 235, 0.15);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
}

[data-theme="light"] body {
  background-color: #f8fafc;
  color: #0f172a;
  background-image:
    radial-gradient(circle at 12% 12%, rgba(37, 99, 235, 0.04) 0%, transparent 45%),
    radial-gradient(circle at 88% 88%, rgba(139, 92, 246, 0.03) 0%, transparent 45%);
}

[data-theme="light"] .sidebar {
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .brand-title h2 {
  background: linear-gradient(to right, #0f172a, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .nav-section {
  color: #94a3b8;
}

[data-theme="light"] .nav-item {
  color: #475569;
}

[data-theme="light"] .nav-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.02));
  border-left-color: #2563eb;
  color: #2563eb;
}

[data-theme="light"] .topbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .page-title h1 {
  color: #0f172a;
}

/* TOP GLOBAL FILTER BAR IN LIGHT MODE */
[data-theme="light"] .global-filter-bar {
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .filter-box-date label,
[data-theme="light"] .filter-box-select label {
  color: #475569 !important;
}

[data-theme="light"] .date-input,
[data-theme="light"] .filter-box-select select {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .date-input:focus,
[data-theme="light"] .filter-box-select select:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

[data-theme="light"] .btn-preset {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
}

[data-theme="light"] .btn-preset:hover {
  background: #f1f5f9 !important;
  border-color: #2563eb !important;
  color: #2563eb !important;
}

[data-theme="light"] .btn-preset.active {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25) !important;
}

[data-theme="light"] .filter-loading-badge {
  background: #eff6ff !important;
  border: 1px solid #93c5fd !important;
  color: #1d4ed8 !important;
}

[data-theme="light"] .btn-apply-filter {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35) !important;
}

/* CARDS & CONTAINERS ELEVATION */
[data-theme="light"] .card,
[data-theme="light"] .glass-card,
[data-theme="light"] .kpi-card,
[data-theme="light"] .chart-container,
[data-theme="light"] .filter-bar,
[data-theme="light"] .table-card,
[data-theme="light"] .matrix-summary-bar {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02) !important;
}

[data-theme="light"] .kpi-card:hover {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 10px 24px -2px rgba(0, 0, 0, 0.08) !important;
  transform: translateY(-2px);
}

[data-theme="light"] .kpi-title {
  color: #64748b;
}

[data-theme="light"] .kpi-value {
  color: #0f172a;
}

/* CALENDAR MATRIX & DAYS GRID IN LIGHT MODE */
[data-theme="light"] .calendar-pagination {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .calendar-weekdays div {
  background: #f1f5f9 !important;
  color: #475569 !important;
}

[data-theme="light"] .day-cell {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .day-cell:hover {
  background: #f8fafc !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.1) !important;
}

[data-theme="light"] .day-cell.other-month {
  background: #f8fafc !important;
  border-color: #f1f5f9 !important;
  opacity: 0.4 !important;
}

[data-theme="light"] .day-cell.active-range {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 1px #3b82f6 !important;
}

[data-theme="light"] .day-num {
  color: #0f172a !important;
}

[data-theme="light"] .day-metric-item.leg-sdt {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfdbfe !important;
}

[data-theme="light"] .day-metric-item.leg-appointment {
  background: #fffbeb !important;
  color: #b45309 !important;
  border: 1px solid #fde68a !important;
}

[data-theme="light"] .day-metric-item.leg-booking {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border: 1px solid #a7f3d0 !important;
}

[data-theme="light"] .day-metric-item.leg-arrived {
  background: #fff1f2 !important;
  color: #be123c !important;
  border: 1px solid #fecdd3 !important;
}

/* TABLES & MATRIX */
[data-theme="light"] .heatmap-table,
[data-theme="light"] .custom-table {
  background: #ffffff !important;
}

[data-theme="light"] .heatmap-table thead th,
[data-theme="light"] .custom-table thead th {
  background: #f8fafc !important;
  color: #334155 !important;
  border-bottom: 2px solid #e2e8f0 !important;
  font-weight: 700;
}

[data-theme="light"] .heatmap-table tbody tr,
[data-theme="light"] .custom-table tbody tr {
  border-bottom: 1px solid #f1f5f9 !important;
}

[data-theme="light"] .heatmap-table tbody tr:hover,
[data-theme="light"] .custom-table tbody tr:hover {
  background: #f1f5f9 !important;
}

[data-theme="light"] .heatmap-table tbody tr:nth-child(even),
[data-theme="light"] .custom-table tbody tr:nth-child(even) {
  background: #f8fafc !important;
}

[data-theme="light"] .heatmap-table td,
[data-theme="light"] .custom-table td {
  color: #0f172a;
  border-color: #f1f5f9;
}

/* BUTTONS IN LIGHT MODE */
[data-theme="light"] .customizer-trigger-btn {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .customizer-trigger-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

[data-theme="light"] .tab3-sub-toggle-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
}

[data-theme="light"] .tab3-sub-toggle-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .tab3-sub-toggle-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

[data-theme="light"] .theme-toggle-btn,
[data-theme="light"] .sidebar-theme-toggle-btn {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .theme-toggle-btn:hover,
[data-theme="light"] .sidebar-theme-toggle-btn:hover {
  background: #f1f5f9 !important;
  border-color: #2563eb !important;
  color: #2563eb !important;
}

/* FUNNEL & DIAGNOSTICS */
[data-theme="light"] .funnel-step-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .funnel-step-card:hover {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.07) !important;
}

[data-theme="light"] .funnel-title-group h4 {
  color: #0f172a !important;
}

[data-theme="light"] .funnel-pill-tag {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  color: #475569 !important;
}

[data-theme="light"] .funnel-rate-badge {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .diag-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .diag-card-title {
  color: #0f172a !important;
}

[data-theme="light"] .diag-card-desc {
  color: #64748b !important;
}

/* MODAL COLUMN CUSTOMIZER */
[data-theme="light"] .customizer-modal-backdrop {
  background: rgba(15, 23, 42, 0.4) !important;
  backdrop-filter: blur(4px) !important;
}

[data-theme="light"] .customizer-modal-dialog {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.22) !important;
}

[data-theme="light"] .customizer-modal-header {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .customizer-modal-title {
  color: #0f172a !important;
}

[data-theme="light"] .customizer-close-btn {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  color: #64748b !important;
}

[data-theme="light"] .customizer-close-btn:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-theme="light"] .customizer-toolbar {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .customizer-search-box input {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .customizer-search-box input:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

[data-theme="light"] .customizer-modal-body {
  background: #ffffff !important;
}

[data-theme="light"] .customizer-group-card {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .customizer-group-title {
  color: #0f172a !important;
}

[data-theme="light"] .customizer-col-item {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .customizer-col-item.active {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  color: #1d4ed8 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15) !important;
}

[data-theme="light"] .customizer-preset-btn {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
}

[data-theme="light"] .customizer-preset-btn:hover {
  background: #f1f5f9 !important;
  border-color: #2563eb !important;
  color: #2563eb !important;
}

[data-theme="light"] .customizer-modal-footer {
  background: #f8fafc !important;
  border-top: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .customizer-footer-left span {
  color: #475569 !important;
}

[data-theme="light"] .customizer-btn-secondary {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
}

[data-theme="light"] .customizer-btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* THUMBNAIL & FLOATING HD PREVIEW */
[data-theme="light"] .ad-thumb-img,
[data-theme="light"] .thumb-preview-box {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

[data-theme="light"] .floating-ad-preview {
  background: rgba(255, 255, 255, 0.98) !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15), 0 0 15px rgba(37, 99, 235, 0.1) !important;
}

[data-theme="light"] .floating-ad-preview-img {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

/* TAB 2 MAP & GEOGRAPHY IN LIGHT/DARK MODE */
[data-theme="dark"] #leafletVnMap .leaflet-tile-pane {
  filter: brightness(0.65) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7);
}

[data-theme="light"] #leafletVnMap .leaflet-tile-pane {
  filter: none !important;
}

[data-theme="light"] .vn-svg-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] #leafletVnMap {
  background: #f8fafc !important;
}

[data-theme="light"] .map-legend-bar {
  background: #f8fafc !important;
  border-top: 1px solid #e2e8f0 !important;
  color: #475569 !important;
}

[data-theme="light"] .btn-metric {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
}

[data-theme="light"] .btn-metric:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

[data-theme="light"] .btn-metric.active {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}

/* STATUS & SQL BADGES */
[data-theme="light"] #topbar-sync-time {
  color: #0f172a !important;
}

[data-theme="light"] .sql-status-badge {
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  color: #1d4ed8 !important;
}

/* FLATPICKR DATEPICKER IN LIGHT MODE */
[data-theme="light"] .flatpickr-calendar {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .flatpickr-calendar .flatpickr-months {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .flatpickr-calendar .flatpickr-month,
[data-theme="light"] .flatpickr-calendar .flatpickr-current-month,
[data-theme="light"] .flatpickr-calendar .flatpickr-current-month .cur-month,
[data-theme="light"] .flatpickr-calendar .flatpickr-current-month input.cur-year {
  color: #0f172a !important;
  fill: #0f172a !important;
}

[data-theme="light"] .flatpickr-calendar .flatpickr-weekday {
  color: #64748b !important;
  background: #f8fafc !important;
}

[data-theme="light"] .flatpickr-calendar .flatpickr-day {
  color: #0f172a !important;
}

[data-theme="light"] .flatpickr-calendar .flatpickr-day:hover {
  background: #f1f5f9 !important;
}

[data-theme="light"] .flatpickr-calendar .flatpickr-day.selected,
[data-theme="light"] .flatpickr-calendar .flatpickr-day.startRange,
[data-theme="light"] .flatpickr-calendar .flatpickr-day.endRange {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}

[data-theme="light"] .flatpickr-calendar .flatpickr-day.inRange {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
  color: #1d4ed8 !important;
}

/* ==============================================================================
 * MOBILE RESPONSIVE SYSTEM (DESIGN.MD TOKENS & ALIGNED WITH GRILL-ME INTERVIEW)
 * ============================================================================== */

/* 1. Default desktop states for mobile-only elements */
.mobile-menu-toggle-btn {
  display: none;
}
.mobile-bottom-nav {
  display: none;
}
.mobile-filter-compact-trigger {
  display: none;
}
.mobile-sheet-header {
  display: none;
}
.mobile-filter-apply-bar {
  display: none;
}
.mobile-card-list {
  display: none;
}
.desktop-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.map-interactive-toggle-btn {
  display: none;
}
.mobile-drawer-backdrop,
.mobile-filter-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.mobile-drawer-backdrop.is-active,
.mobile-filter-backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* 2. TABLET ADAPTATION (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: 220px;
  }
  .content-body {
    padding: 1.25rem 1.25rem 2rem 1.25rem;
  }
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
  }
}

/* 3. MOBILE PHONES (< 768px) - CORE MOBILE OPTIMIZATION */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  /* SIDEBAR: Off-canvas Drawer */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.7);
    background: #0d1321;
  }
  [data-theme="light"] .sidebar {
    background: #ffffff;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.15);
  }
  .sidebar.is-open {
    transform: translateX(0);
  }

  .mobile-drawer-backdrop,
  .mobile-filter-backdrop {
    display: block;
  }

  /* TOPBAR HEADER */
  .topbar {
    height: 58px;
    padding: 0 14px;
  }
  .page-title h1 {
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
  }
  .page-title p {
    display: none;
  }
  .mobile-menu-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  [data-theme="light"] .mobile-menu-toggle-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #0f172a;
  }
  .topbar-actions .sql-status-badge {
    display: none;
  }
  .theme-toggle-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  #themeText {
    display: none;
  }

  /* MAIN WRAPPER & CONTENT BODY PADDING FOR BOTTOM NAV */
  .main-wrapper {
    width: 100vw;
  }
  .content-body {
    padding: 10px 12px 85px 12px !important;
  }

  /* BOTTOM NAVIGATION BAR */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: rgba(13, 19, 33, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    z-index: 950;
    justify-content: space-around;
    align-items: center;
    padding: 0 6px;
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.5);
  }
  [data-theme="light"] .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  }
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex: 1;
    height: 100%;
  }
  .mobile-nav-item i {
    font-size: 1.15rem;
  }
  .mobile-nav-item.active {
    color: #38bdf8;
  }
  [data-theme="light"] .mobile-nav-item {
    color: #64748b;
  }
  [data-theme="light"] .mobile-nav-item.active {
    color: #2563eb;
  }

  /* COMPACT GLOBAL FILTER BAR & BOTTOM SHEET */
  .filter-bar-fixed-wrapper {
    z-index: 1000 !important;
    padding: 8px 12px 6px 12px;
  }
  .mobile-filter-compact-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(20, 28, 46, 0.92);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  }
  [data-theme="light"] .mobile-filter-compact-trigger {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }
  .mobile-filter-trigger-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
  }
  [data-theme="light"] .mobile-filter-trigger-info {
    color: #0f172a;
  }
  .mobile-filter-trigger-btn {
    background: rgba(59, 130, 246, 0.18);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #60a5fa;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 5px 11px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
  }
  [data-theme="light"] .mobile-filter-trigger-btn {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
  }

  /* FILTER BAR CONVERTED TO BOTTOM SHEET ON MOBILE */
  #main-global-filter-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    overflow-y: auto;
    background: #0d1322;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px 20px 0 0;
    z-index: 1050;
    padding: 14px 16px 28px 16px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
    transform: translateY(115%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  }
  [data-theme="light"] #main-global-filter-bar {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
  }
  #main-global-filter-bar.is-open {
    transform: translateY(0);
  }
  .mobile-sheet-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
  }
  .mobile-sheet-handle {
    width: 44px;
    height: 5px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
  }
  [data-theme="light"] .mobile-sheet-handle {
    background: rgba(0, 0, 0, 0.2);
  }
  .mobile-sheet-title-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .mobile-sheet-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  [data-theme="light"] .mobile-sheet-title {
    color: #0f172a;
  }
  .mobile-sheet-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  [data-theme="light"] .mobile-sheet-close-btn {
    background: #f1f5f9;
    color: #475569;
  }
  .filter-row-top {
    flex-direction: column;
    gap: 12px;
  }
  .filter-box-date, .filter-box-select, .filter-box-search {
    width: 100%;
    min-width: 100%;
    flex: none !important;
  }
  .preset-btn-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .btn-preset {
    font-size: 0.72rem;
    padding: 6px 2px;
    text-align: center;
  }
  .mobile-filter-apply-bar {
    display: block;
    margin-top: 14px;
    width: 100%;
  }
  .btn-mobile-filter-apply {
    width: 100%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  }

  /* 4. COMPACT 2-COLUMN KPI GRIDS ON MOBILE */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .kpi-card {
    padding: 10px 11px !important;
    border-radius: 10px !important;
  }
  .kpi-title {
    font-size: 0.72rem !important;
    margin-bottom: 3px !important;
  }
  .kpi-val {
    font-size: 1.15rem !important;
    line-height: 1.25 !important;
  }
  .kpi-sub {
    font-size: 0.64rem !important;
    margin-top: 3px !important;
  }

  /* 5. CONVERSION FUNNEL ON MOBILE */
  .funnel-grid-layout {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
  .funnel-card-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .funnel-right-stats {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .funnel-main-num {
    font-size: 1.1rem;
  }

  /* 6. CALENDAR MATRIX: HORIZONTAL SCROLL */
  .calendar-grid-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }
  .calendar-weekdays,
  .calendar-days-grid {
    min-width: 650px;
  }

  /* 7. LEAFLET MAP TOUCH INTERACTION TOGGLE */
  .map-interactive-toggle-btn {
    display: flex;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    background: rgba(13, 19, 33, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 0.73rem;
    font-weight: 700;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
  }
  [data-theme="light"] .map-interactive-toggle-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  .map-interactive-toggle-btn.active {
    background: rgba(59, 130, 246, 0.25);
    border-color: var(--primary);
    color: #60a5fa;
  }
  [data-theme="light"] .map-interactive-toggle-btn.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
  }

  /* 8. HIDE TABLES ON MOBILE & DISPLAY EXPANDABLE CARD VIEWS */
  .desktop-table-container {
    display: none !important;
  }
  .mobile-card-list {
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
  }

  .mobile-data-card {
    background: rgba(13, 19, 33, 0.85);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
  }
  [data-theme="light"] .mobile-data-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }
  .mobile-card-header {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
  [data-theme="light"] .mobile-card-header {
    border-bottom: 1px solid #f1f5f9;
  }
  .mobile-card-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
  }
  .mobile-card-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
  }
  .mobile-creative-thumb-box {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    background: #1e293b;
    flex-shrink: 0;
  }
  .mobile-creative-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .mobile-creative-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 1.1rem;
  }
  .mobile-card-doctor-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  [data-theme="light"] .mobile-card-doctor-name {
    color: #0f172a;
  }
  .mobile-card-spec-tag {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 2px;
  }
  .mobile-card-expand-indicator {
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: transform 0.2s ease;
    padding-left: 8px;
  }
  .mobile-data-card.is-expanded .mobile-card-expand-indicator {
    transform: rotate(180deg);
    color: var(--primary);
  }
  .mobile-card-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
  }
  [data-theme="light"] .mobile-card-summary-grid {
    background: #f8fafc;
  }
  .mobile-summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .mobile-summary-item .lbl {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
  }
  [data-theme="light"] .mobile-summary-item .lbl {
    color: #64748b;
  }
  .mobile-summary-item .val {
    font-size: 0.92rem;
    font-weight: 800;
  }
  .mobile-card-details {
    display: none;
    padding: 10px 14px 14px 14px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
  }
  [data-theme="light"] .mobile-card-details {
    border-top: 1px dashed #e2e8f0;
    background: #fafbfc;
  }
  .mobile-data-card.is-expanded .mobile-card-details {
    display: block;
    animation: fadeIn 0.2s ease;
  }
  .mobile-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.78rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  }
  [data-theme="light"] .mobile-detail-row {
    border-bottom: 1px solid #f1f5f9;
  }
  .mobile-detail-row span {
    color: var(--text-muted);
  }
  [data-theme="light"] .mobile-detail-row span {
    color: #64748b;
  }
  .mobile-detail-row strong {
    color: var(--text-main);
  }
  [data-theme="light"] .mobile-detail-row strong {
    color: #0f172a;
  }

  /* 9. FULLSCREEN MODALS ON MOBILE */
  .customizer-modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
  }
  .customizer-modal-body {
    flex: 1;
    max-height: none !important;
  }
  .customizer-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .customizer-search-box {
    min-width: 100% !important;
  }

  /* Ad Lightbox Modal on Mobile */
  .ad-lightbox-dialog {
    max-width: 100% !important;
    max-height: 94vh !important;
    border-radius: 14px !important;
  }
  .ad-lightbox-meta-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .btn-open-facebook-ad {
    justify-content: center;
    width: 100%;
  }
}

/* ==============================================================================
 * AD CREATIVE LIGHTBOX MODAL PREVIEW
 * ============================================================================== */
.ad-lightbox-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(4, 7, 15, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ad-lightbox-dialog {
  background: #0d1321;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

[data-theme="light"] .ad-lightbox-dialog {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

.ad-lightbox-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .ad-lightbox-header {
  border-bottom-color: #f1f5f9;
  background: #f8fafc;
}

.ad-lightbox-title-group {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.ad-lightbox-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .ad-lightbox-title {
  color: #0f172a;
}

.ad-lightbox-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-lightbox-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ef4444;
}

[data-theme="light"] .ad-lightbox-close-btn:hover {
  background: #f1f5f9;
  color: #ef4444;
}

.ad-lightbox-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.ad-lightbox-media-box {
  width: 100%;
  max-height: 55vh;
  border-radius: 12px;
  overflow: hidden;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.ad-lightbox-img {
  width: 100%;
  height: auto;
  max-height: 55vh;
  object-fit: contain;
  display: block;
}

.ad-lightbox-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ad-lightbox-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ad-lightbox-doc {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fbbf24;
}

[data-theme="light"] .ad-lightbox-doc {
  color: #d97706;
}

.btn-open-facebook-ad {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1877f2;
  color: #ffffff !important;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.btn-open-facebook-ad:hover {
  background: #166fe5;
}
