/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
  /* Color Palette - HSL Tailored */
  --hue-primary: 255;   /* Indigo/Violet */
  --hue-secondary: 180; /* Teal */
  --hue-success: 142;   /* Emerald */
  --hue-warning: 38;    /* Amber */
  --hue-danger: 355;    /* Crimson */
  --hue-dark: 240;      /* Deep Space Dark */

  /* Semantic Colors */
  --color-bg-base: hsl(var(--hue-dark) 20% 5%);
  --color-bg-card: hsla(var(--hue-dark) 15% 10% / 0.6);
  --color-bg-card-hover: hsla(var(--hue-dark) 15% 15% / 0.8);
  --color-border: hsla(0 0% 100% / 0.08);
  --color-border-hover: hsla(0 0% 100% / 0.18);
  
  --color-text-primary: hsl(var(--hue-dark) 10% 95%);
  --color-text-secondary: hsl(var(--hue-dark) 8% 70%);
  --color-text-muted: hsl(var(--hue-dark) 8% 50%);

  --color-primary: hsl(var(--hue-primary) 85% 65%);
  --color-primary-glow: hsla(var(--hue-primary) 85% 65% / 0.25);
  --color-secondary: hsl(var(--hue-secondary) 80% 50%);
  --color-secondary-glow: hsla(var(--hue-secondary) 80% 50% / 0.25);
  
  --color-success: hsl(var(--hue-success) 70% 55%);
  --color-warning: hsl(var(--hue-warning) 85% 60%);
  --color-danger: hsl(var(--hue-danger) 85% 60%);

  /* Typography */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-fast: all 0.15s ease-out;

  /* Scrollbars stable layout space */
  scrollbar-gutter: stable;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--color-bg-base);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ==========================================================================
   BACKGROUND GLOW SYSTEM
   ========================================================================== */
.glow-sphere {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
}

.glow-1 {
  width: 500px;
  height: 500px;
  top: -100px;
  right: -50px;
  background: radial-gradient(circle, var(--color-primary-glow) 0%, transparent 70%);
  animation: float-slow 35s infinite alternate;
}

.glow-2 {
  width: 600px;
  height: 600px;
  bottom: -200px;
  left: -100px;
  background: radial-gradient(circle, var(--color-secondary-glow) 0%, transparent 70%);
  animation: float-slow 45s infinite alternate-reverse;
}

.glow-3 {
  width: 400px;
  height: 400px;
  top: 40%;
  left: 40%;
  background: radial-gradient(circle, hsla(var(--hue-success) 70% 55% / 0.12) 0%, transparent 70%);
  animation: float-slow 25s infinite alternate;
}

@keyframes float-slow {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, -40px) scale(1.1); }
  100% { transform: translate(-30px, 60px) scale(0.95); }
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  background: rgba(10, 10, 15, 0.5);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--color-border);
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3.5rem;
}

.brand-icon {
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border-radius: 12px;
  display: grid;
  place-content: center;
  font-weight: 800;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: hsl(var(--hue-dark) 20% 5%);
  box-shadow: 0 8px 24px var(--color-primary-glow);
}

.brand-text h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.version-tag {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.sidebar-nav {
  flex-grow: 1;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.75rem;
}

.nav-btn {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-secondary);
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.nav-btn:hover {
  background: hsla(0 0% 100% / 0.04);
  color: var(--color-text-primary);
}

.nav-btn.active {
  background: hsla(var(--hue-primary) 85% 65% / 0.1);
  border: 1px solid hsla(var(--hue-primary) 85% 65% / 0.2);
  color: var(--color-primary);
}

.nav-icon {
  width: 18px;
  height: 18px;
  transition: var(--transition-fast);
}

.nav-btn.active .nav-icon {
  stroke: var(--color-primary);
}

.sidebar-status {
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.online {
  background-color: var(--color-success);
  box-shadow: 0 0 10px hsla(var(--hue-success) 70% 55% / 0.4);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  padding: 3rem;
  overflow-y: auto;
  max-width: calc(100vw - 280px);
  transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tab Pane System */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

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

/* Header Styles */
.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 3rem;
}

.tab-header h1 {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #fff, var(--color-text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tab-header p {
  color: var(--color-text-secondary);
  font-size: 1rem;
}

.mode-badge {
  background: hsla(var(--hue-warning) 85% 60% / 0.1);
  border: 1px solid hsla(var(--hue-warning) 85% 60% / 0.2);
  color: var(--color-warning);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ==========================================================================
   DASHBOARD STATS CARD GRID
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: var(--transition-smooth);
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-border-hover);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.stat-icon-wrapper {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: grid;
  place-content: center;
}

.stat-icon-wrapper svg {
  width: 22px;
  height: 22px;
}

.scraper-color {
  background: hsla(var(--hue-secondary) 80% 50% / 0.1);
  color: var(--color-secondary);
}

.email-color {
  background: hsla(var(--hue-primary) 85% 65% / 0.1);
  color: var(--color-primary);
}

.ad-color {
  background: hsla(var(--hue-warning) 85% 60% / 0.1);
  color: var(--color-warning);
}

.efficiency-color {
  background: hsla(var(--hue-success) 70% 55% / 0.1);
  color: var(--color-success);
}

.stat-label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

/* ==========================================================================
   PANELS & WORKSPACE LAYOUT
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.dashboard-panel {
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}

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

.panel-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.panel-description {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* Scrollable log output */
.log-container {
  height: 300px;
  overflow-y: auto;
  background: rgba(5, 5, 5, 0.4);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
  font-family: monospace;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scrollbar-width: thin;
}

.log-entry {
  display: flex;
  gap: 0.75rem;
  line-height: 1.4;
}

.log-time {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.log-entry.system .log-message { color: var(--color-text-secondary); }
.log-entry.scraper .log-message { color: var(--color-secondary); }
.log-entry.gmail .log-message { color: var(--color-primary); }
.log-entry.ad .log-message { color: var(--color-warning); }
.log-entry.error .log-message { color: var(--color-danger); font-weight: bold; }

/* Tag list for active cities */
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tag-item {
  background: hsla(0 0% 100% / 0.05);
  border: 1px solid var(--color-border);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================================================
   BUTTONS & INPUT CONTROLS
   ========================================================================== */
.btn {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, hsl(var(--hue-primary) 75% 55%) 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 15px var(--color-primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px hsla(var(--hue-primary) 85% 65% / 0.45);
  opacity: 0.95;
}

.btn-secondary {
  background: hsla(0 0% 100% / 0.06);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: hsla(0 0% 100% / 0.12);
  border-color: var(--color-border-hover);
}

.btn-success {
  background: var(--color-success);
  color: hsl(var(--hue-dark) 20% 5%);
  border: none;
}

.btn-success:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--color-primary);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-icon {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   TABLE SYSTEM
   ========================================================================== */
.control-bar {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.search-box {
  flex-grow: 1;
  max-width: 400px;
  position: relative;
}

.search-box input {
  width: 100%;
  background: hsla(0 0% 100% / 0.05);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border-radius: 12px;
  font-family: var(--font-body);
  transition: var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
}

.select-control {
  background: hsla(0 0% 100% / 0.05);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-family: var(--font-body);
  cursor: pointer;
}

.select-control:focus {
  outline: none;
  border-color: var(--color-primary);
}

.table-container {
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  overflow-x: auto;
  overflow-y: visible;
}

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

.data-table th {
  padding: 1.25rem 1.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: hsla(0 0% 100% / 0.02);
}

.church-info {
  display: flex;
  flex-direction: column;
}

.church-name {
  font-weight: 600;
  color: var(--color-text-primary);
}

.church-url {
  font-size: 0.8rem;
  color: var(--color-primary);
  text-decoration: none;
}

.church-url:hover {
  text-decoration: underline;
}

.table-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: 3rem !important;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-new {
  background: hsla(var(--hue-secondary) 80% 50% / 0.1);
  color: var(--color-secondary);
  border: 1px solid hsla(var(--hue-secondary) 80% 50% / 0.2);
}

.badge-draft {
  background: hsla(var(--hue-primary) 85% 65% / 0.1);
  color: var(--color-primary);
  border: 1px solid hsla(var(--hue-primary) 85% 65% / 0.2);
}

.badge-exported {
  background: hsla(var(--hue-warning) 85% 60% / 0.1);
  color: var(--color-warning);
  border: 1px solid hsla(var(--hue-warning) 85% 60% / 0.2);
}

.badge-sent {
  background: hsla(var(--hue-success) 70% 55% / 0.1);
  color: var(--color-success);
  border: 1px solid hsla(var(--hue-success) 70% 55% / 0.2);
}

.badge-ignored {
  background: hsla(0 0% 100% / 0.05);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

/* ==========================================================================
   AD INTELLIGENCE SPECIFICS
   ========================================================================== */
.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  margin-top: 1rem;
}

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

.campaign-card {
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.campaign-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.campaign-meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.campaign-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.camp-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.camp-stat-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.camp-stat-value.value-warning {
  color: var(--color-warning);
}

.ad-agent-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.panel-subtitle {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.panel-header-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

/* Flagged ads copy elements */
.flagged-ads-list, .creative-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.flagged-ad-item, .creative-suggestion-item {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 1.25rem;
}

.flagged-ad-item {
  border-left: 4px solid var(--color-danger);
}

.flagged-title-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.flagged-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.flagged-reason {
  color: var(--color-danger);
  font-size: 0.8rem;
  font-weight: 600;
}

.flagged-body {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem;
  border-radius: 8px;
}

/* Suggestion cards */
.creative-suggestion-item {
  border-left: 4px solid var(--color-primary);
}

.creative-title-bar {
  margin-bottom: 0.75rem;
}

.creative-meta {
  font-size: 0.75rem;
  color: var(--color-primary);
  font-weight: 700;
}

.creative-text-block {
  margin-bottom: 1rem;
}

.creative-text-block h4 {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.creative-text-block p {
  font-size: 0.9rem;
  color: var(--color-text-primary);
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem;
  border-radius: 8px;
}

.image-prompt-box {
  background: rgba(var(--hue-primary) 85% 65% / 0.05);
  border: 1px dashed hsla(var(--hue-primary) 85% 65% / 0.2);
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* ==========================================================================
   SETTINGS COMPONENT STYLES
   ========================================================================== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.settings-col {
  display: flex;
  flex-direction: column;
}

.settings-card {
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 2rem;
}

.card {
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  transition: var(--transition-smooth);
}

.settings-card h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.card-description {
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.card-divider {
  border: 0;
  height: 1px;
  background: var(--color-border);
  margin: 1.5rem 0;
}

.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea {
  background: hsla(0 0% 100% / 0.04);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.form-group textarea {
  resize: vertical;
  line-height: 1.5;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.form-group-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
}

.form-group-checkbox input[type="checkbox"] {
  margin-top: 0.25rem;
  accent-color: var(--color-primary);
  width: 18px;
  height: 18px;
}

.form-group-checkbox label {
  font-size: 0.9rem;
  color: var(--color-text-primary);
  cursor: pointer;
}

.form-group-checkbox label small {
  color: var(--color-text-muted);
}

/* Settings City Management */
.city-input-group {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.city-input-group input {
  flex-grow: 1;
  background: hsla(0 0% 100% / 0.04);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--color-text-primary);
  font-family: var(--font-body);
}

.settings-city-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  padding: 0.75rem;
  border-radius: 10px;
  background: rgba(0,0,0,0.15);
}

.settings-city-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.75rem;
  background: hsla(0 0% 100% / 0.03);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.settings-city-item button {
  background: transparent;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  font-weight: bold;
}

.mt-4 { margin-top: 1.5rem; }

/* ==========================================================================
   GLASS DIALOG MODAL (NATIVE <dialog>)
   ========================================================================== */
.glass-dialog {
  margin: auto;
  border: 1px solid var(--color-border-hover);
  border-radius: 24px;
  background: hsla(var(--hue-dark) 18% 10% / 0.85);
  backdrop-filter: blur(25px);
  padding: 2rem;
  width: 90%;
  max-width: 680px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  color: var(--color-text-primary);
}

.glass-dialog::backdrop {
  background: rgba(5, 5, 8, 0.75);
  backdrop-filter: blur(6px);
}

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

.dialog-header h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
}

.btn-close-dialog {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-close-dialog:hover {
  color: var(--color-text-primary);
}

.close-icon {
  width: 22px;
  height: 22px;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   INSTAGRAM SCHEDULER & KNOWLEDGE BASE STYLES
   ========================================================================== */
.instagram-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
  align-items: start;
}

.instagram-sidebar-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ig-account-display-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
  margin-top: 0.5rem;
}

.ig-account-avatar-wrapper,
.ig-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ig-account-avatar,
.ig-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  object-fit: cover;
}

.ig-account-meta,
.ig-profile-details {
  display: flex;
  flex-direction: column;
}

.ig-account-name,
.ig-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-primary);
}

.ig-account-handle,
.ig-handle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.instagram-feed {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ig-post-card {
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
}

.ig-post-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ig-post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ig-post-day {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.ig-post-date {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-left: 0.5rem;
}

.ig-post-image-prompt {
  background: rgba(var(--hue-primary) 85% 65% / 0.04);
  border: 1px dashed hsla(var(--hue-primary) 85% 65% / 0.15);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  position: relative;
}

.ig-post-image-prompt:hover {
  border-color: hsla(var(--hue-primary) 85% 65% / 0.5);
  background: rgba(var(--hue-primary) 85% 65% / 0.08);
}

.ig-post-image-prompt:active {
  transform: scale(0.98);
}

.ig-post-image-prompt.copied {
  border-color: var(--color-primary) !important;
  border-style: solid;
  background: rgba(var(--hue-primary) 85% 65% / 0.12);
  box-shadow: 0 0 8px var(--color-primary-glow);
}

.ig-post-image-prompt h4 {
  font-size: 0.75rem;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ig-post-image-prompt p {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
  margin: 0;
}

.ig-post-media-pane {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-left: 1px solid var(--color-border);
  padding-left: 1.5rem;
}

.ig-post-preview-img,
.ig-image-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  object-fit: cover;
  background: rgba(0, 0, 0, 0.4);
}

.ig-post-preview-placeholder,
.ig-image-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px dashed var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  gap: 0.5rem;
  text-align: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
}

.ig-post-footer-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.file-upload-box {
  border: 2px dashed var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.file-upload-box:hover {
  border-color: var(--color-primary);
  background: rgba(var(--hue-primary) 85% 65% / 0.03);
}

.upload-icon {
  width: 28px;
  height: 28px;
  color: var(--color-text-muted);
}

.file-upload-box p {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin: 0;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
  align-items: start;
}

.knowledge-col {
  display: flex;
  flex-direction: column;
}

.kb-file-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.kb-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.kb-file-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.kb-file-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-primary);
}

.kb-file-meta {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.kb-file-actions {
  display: flex;
  gap: 0.5rem;
}

.kb-image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
  max-height: 450px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.kb-image-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.kb-image-card img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-bottom: 1px solid var(--color-border);
}

.kb-image-info {
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.kb-image-name {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-primary);
}

.kb-image-actions {
  display: flex;
  gap: 0.4rem;
}

.btn-mini {
  padding: 0.2rem 0.4rem;
  font-size: 0.65rem;
  border-radius: 4px;
  font-weight: 600;
}

.badge-published {
  background: hsla(var(--hue-success) 70% 55% / 0.1);
  color: var(--color-success);
  border: 1px solid hsla(var(--hue-success) 70% 55% / 0.2);
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.flex {
  display: flex;
}
.flex-column {
  flex-direction: column;
}
.flex-1 {
  flex: 1;
}
.align-center {
  align-items: center;
}
.flex-wrap {
  flex-wrap: wrap;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.justify-end {
  justify-content: flex-end;
}
.font-bold {
  font-weight: 700;
}
.text-muted {
  color: var(--color-text-muted) !important;
}
.text-xs {
  font-size: 0.75rem;
}
.text-success {
  color: var(--color-success) !important;
}
.text-warning {
  color: var(--color-warning) !important;
}
.gap-1 {
  gap: 0.25rem;
}
.gap-2 {
  gap: 0.5rem;
}
.gap-4 {
  gap: 1rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-3 {
  margin-top: 0.75rem;
}
.mt-4 {
  margin-top: 1rem;
}

/* ==========================================================================
   INSTAGRAM POST CARD REGENERATION & LOADING OVERLAY STYLES
   ========================================================================== */
.instagram-post-card {
  position: relative;
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.instagram-post-card:hover {
  border-color: rgba(147, 51, 234, 0.3); /* Glassmorphic glow */
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Card Loading Overlay */
.card-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 15, 0.75);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast) ease-in-out;
}

.instagram-post-card.loading .card-loading-overlay {
  opacity: 1;
  pointer-events: all;
}

.card-loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--color-primary);
  border-radius: 50%;
  animation: card-spin 1s linear infinite;
  margin-bottom: 1rem;
}

.card-loader-text {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--color-text-primary);
  font-weight: 600;
  letter-spacing: 0.5px;
}

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

/* Refinement & Regeneration UI */
.ig-refinement-group {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.ig-refinement-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text-primary);
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.ig-refinement-input:focus {
  border-color: var(--color-primary);
  outline: none;
  background: rgba(0, 0, 0, 0.45);
}

.ig-regen-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.btn-regen-post, .btn-regen-image {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-regen-image {
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
}

.btn-regen-image:hover:not(:disabled) {
  background: rgba(168, 85, 247, 0.2);
  border-color: #a855f7;
  color: #fff;
}

.btn-regen-post {
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  color: #fff;
}

.btn-regen-post:hover:not(:disabled) {
  background: #7c3aed;
  border-color: #7c3aed;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
}

.btn-regen-image:disabled,
.btn-regen-post:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================================================
   POST HISTORY & ANALYTICS STYLES
   ========================================================================== */
:root {
  --accent: var(--color-primary);
  --border-radius: 12px;
}

.history-content-container {
  margin-top: 2rem;
}

.history-feed-header {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.history-feed-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.history-feed {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.history-post-card {
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 1.5rem;
  transition: var(--transition-smooth);
}

.history-post-card:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.history-post-main {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .history-post-main {
    flex-direction: column;
  }
}

.history-post-visual {
  flex-shrink: 0;
  width: 150px;
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.2);
}

.history-post-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.history-post-card:hover .history-post-visual img {
  transform: scale(1.05);
}

.history-post-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.history-post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.day-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.date-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.history-post-caption-box {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  max-height: 120px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  overscroll-behavior: contain;
}

/* Custom scrollbars for caption box fallback */
@supports not (scrollbar-color: auto) {
  .history-post-caption-box::-webkit-scrollbar {
    width: 6px;
  }
  .history-post-caption-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
  }
  .history-post-caption-box::-webkit-scrollbar-track {
    background: transparent;
  }
}

.history-post-caption-box p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
  white-space: pre-wrap;
  margin: 0;
}

.history-post-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  text-align: center;
  border-right: 1px solid var(--color-border);
}

.metric-item:last-child {
  border-right: none;
}

@media (max-width: 600px) {
  .metric-item {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  .metric-item:last-child {
    border-bottom: none;
  }
}

.metric-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.metric-item.highlight {
  background: hsla(var(--hue-primary) 85% 65% / 0.05);
  border-radius: 8px;
  border: 1px solid hsla(var(--hue-primary) 85% 65% / 0.15);
}

.metric-item.highlight .metric-label {
  color: var(--color-primary);
}

.metric-item.highlight .metric-value {
  color: var(--color-primary);
  text-shadow: 0 0 10px var(--color-primary-glow);
}

.history-post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
}

.btn-xs {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 6px;
}

.btn-danger {
  background: hsla(var(--hue-danger) 85% 60% / 0.1);
  border: 1px solid hsla(var(--hue-danger) 85% 60% / 0.2);
  color: var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
  background: hsla(var(--hue-danger) 85% 60% / 0.25);
  border-color: var(--color-danger);
  color: #fff;
}

/* Custom alignment utils */
.ml-2 {
  margin-left: 0.5rem;
}
.gap-2 {
  gap: 0.5rem;
}
.text-xs {
  font-size: 0.75rem;
}

/* Stat Icon / Content styling for History tab */
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: grid;
  place-content: center;
  background: hsla(0 0% 100% / 0.05);
}

.stat-icon svg {
  width: 22px;
  height: 22px;
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-content h3 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   LEAD CRM STYLE MODULE
   ========================================================================== */
.crm-row td {
  vertical-align: top;
  padding: 1rem 1.25rem;
}

.crm-select,
.crm-date-input,
.crm-notes-textarea {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: var(--color-text-primary) !important;
  border-radius: 8px !important;
  padding: 0.5rem 0.75rem !important;
  font-size: 0.85rem !important;
  font-family: var(--font-body) !important;
  transition: var(--transition-fast) !important;
  width: 100% !important;
}

.crm-select:focus,
.crm-date-input:focus,
.crm-notes-textarea:focus {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--color-primary) !important;
  outline: none !important;
  box-shadow: 0 0 0 2px var(--color-primary-glow) !important;
}

.crm-select option {
  background-color: #121216 !important;
  color: var(--color-text-primary) !important;
}

.crm-notes-textarea {
  min-height: 52px;
  resize: vertical;
  line-height: 1.4;
}

.crm-date-input {
  min-height: 38px;
}

.church-email {
  color: var(--color-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.church-email:hover {
  text-decoration: underline;
  color: var(--color-text-primary);
}

/* Sync Status Indicator */
.sync-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: hsla(var(--hue-success) 70% 55% / 0.1);
  border: 1px solid hsla(var(--hue-success) 70% 55% / 0.2);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--color-success);
  font-weight: 500;
  transition: var(--transition-smooth);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* ==========================================================================
   AD INTELLIGENCE & CREATOR WIZARD MODULE
   ========================================================================== */
.ads-performance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.ad-card {
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.ad-card:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.ad-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.ad-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--color-text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.ad-card-visual {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.3);
}

.ad-card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.ad-card:hover .ad-card-visual img {
  transform: scale(1.04);
}

.ad-card-body {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.ad-card-body:hover {
  color: var(--color-text-primary);
}

.ad-card-body.expanded {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.ad-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.18);
  padding: 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.ad-metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.ad-metric-label {
  font-size: 0.6rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.15rem;
}

.ad-metric-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-text-primary);
}

.ad-metric-value.highlight-green {
  color: var(--color-success);
}
.ad-metric-value.highlight-red {
  color: var(--color-danger);
}

/* Custom switch toggle */
.switch-container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 18px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--color-border);
  transition: .25s ease-in-out;
  border-radius: 18px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: #d1d5db;
  transition: .25s ease-in-out;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

input:checked + .slider:before {
  transform: translateX(18px);
  background-color: #fff;
}

input:disabled + .slider {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Campaign filter header elements */
.section-header-inline {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.active-filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: hsla(var(--hue-primary) 85% 65% / 0.12);
  border: 1px solid hsla(var(--hue-primary) 85% 65% / 0.25);
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--color-primary);
  font-weight: 600;
}

.btn-clear-filter {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  transition: var(--transition-fast);
}

.btn-clear-filter:hover {
  color: var(--color-text-primary);
}

/* Wizard Indicators */
.wizard-steps-indicator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-border);
  gap: 0.5rem;
}

.wizard-step {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
  position: relative;
  flex: 1;
  text-align: center;
  transition: var(--transition-fast);
}

.wizard-step.active {
  color: var(--color-primary);
  font-weight: 700;
}

.wizard-step.active::after {
  content: "";
  position: absolute;
  bottom: -21px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary-glow);
}

.wizard-step-pane h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.step-description {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
}

/* Wizard Review Layout & Mock Ad Preview */
.wizard-review-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 680px) {
  .wizard-review-layout {
    grid-template-columns: 1fr;
  }
}

.wizard-summary-col {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.summary-item {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.summary-item strong {
  color: var(--color-text-primary);
}

.badge-paused {
  background: hsla(35, 90%, 55%, 0.1);
  color: #f59e0b;
  border: 1px solid hsla(35, 90%, 55%, 0.2);
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Facebook Dark Mock Ad Card Style */
.meta-mock-ad-card {
  background: #18191a;
  border: 1px solid #3e4042;
  border-radius: 8px;
  color: #e4e6eb;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13.5px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.mock-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}

.mock-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #242526;
  border: 1px solid #4e4f50;
  color: var(--color-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.mock-header-text {
  display: flex;
  flex-direction: column;
}

.mock-page-name {
  font-weight: 600;
  font-size: 12.5px;
  color: #e4e6eb;
}

.mock-sponsored-tag {
  font-size: 10.5px;
  color: #b0b3b8;
}

.mock-ad-body {
  padding: 4px 12px 10px 12px;
  color: #e4e6eb;
  line-height: 1.4;
  white-space: pre-wrap;
  font-size: 12.5px;
}

.mock-ad-media-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #242526;
  border-top: 1px solid #2f3031;
  border-bottom: 1px solid #2f3031;
  overflow: hidden;
}

.mock-ad-media-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mock-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #242526;
  padding: 8px 10px;
  gap: 6px;
}

.mock-footer-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.mock-url-domain {
  font-size: 10px;
  color: #b0b3b8;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mock-headline {
  font-weight: 600;
  font-size: 12px;
  color: #e4e6eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.mock-cta-button {
  background: #3a3b3c;
  border: none;
  border-radius: 6px;
  color: #e4e6eb;
  font-weight: 600;
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.mock-cta-button:hover {
  background: #4e4f50;
}

.wizard-footer {
  margin-top: 1.5rem;
}

/* Warning/Alert Banners */
.alert-banner {
  background: hsla(var(--hue-warning) 85% 60% / 0.1);
  border: 1px solid hsla(var(--hue-warning) 85% 60% / 0.25);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  color: var(--color-warning);
}

.alert-banner-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--color-warning);
}

.alert-banner-content {
  flex-grow: 1;
}

.alert-banner-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  color: var(--color-warning);
}

.alert-banner-message {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.alert-banner-message code {
  background: rgba(0,0,0,0.3);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-family: monospace;
  color: var(--color-warning);
}

/* ==========================================================================
   CRM AUTOPILOT SCANNER STYLES
   ========================================================================== */

.crm-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.inbox-autopilot-panel {
  background: var(--glass-bg);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 1.25rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  margin-top: 0;
}

.autopilot-controls-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.autopilot-logs-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

@media (max-width: 1024px) {
  .inbox-autopilot-panel {
    grid-template-columns: 1fr;
  }
}

.autopilot-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.75rem;
}

.autopilot-status-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text-primary);
}

.autopilot-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 50px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.autopilot-badge.active {
  background: hsla(140, 85%, 60%, 0.15);
  color: #4ade80;
  border: 1px solid hsla(140, 85%, 60%, 0.25);
}

.autopilot-badge.paused {
  background: hsla(0, 0%, 50%, 0.15);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

/* Pulsing active dot */
.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  animation: pulse-scanner 1.6s infinite;
}

@keyframes pulse-scanner {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(74, 222, 128, 0);
  }
  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
  }
}

.autopilot-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.scanner-log-container {
  height: 160px;
  overflow-y: auto;
  background: rgba(5, 5, 5, 0.4);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.75rem;
  font-family: monospace;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scrollbar-width: thin;
}

.scanner-log-entry {
  line-height: 1.4;
  word-break: break-word;
}

.scanner-log-entry.info {
  color: var(--color-text-secondary);
}

.scanner-log-entry.success {
  color: #4ade80;
  font-weight: 500;
}

.scanner-log-entry.warning {
  color: var(--color-warning);
}

.scanner-log-entry.error {
  color: var(--color-danger);
  font-weight: bold;
}

.scanner-log-time {
  color: var(--color-text-muted);
  margin-right: 0.4rem;
}

/* ==========================================================================
   TOAST NOTIFICATION SYSTEM
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 380px;
  width: calc(100vw - 3rem);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: hsla(var(--hue-dark) 15% 12% / 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4),
              0 1px 3px rgba(0, 0, 0, 0.2);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease;
  animation: toast-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.toast-exit {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-out {
  to {
    transform: translateY(-20px) scale(0.95);
    opacity: 0;
  }
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.toast-content {
  flex-grow: 1;
}

.toast-message {
  font-size: 0.9rem;
  color: var(--color-text-primary);
  line-height: 1.4;
  font-weight: 500;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.toast-close:hover {
  color: var(--color-text-primary);
}

/* Toast Theme Colors */
.toast-info {
  border-left: 4px solid var(--color-primary);
}
.toast-info .toast-icon {
  color: var(--color-primary);
}

.toast-success {
  border-left: 4px solid var(--color-success);
}
.toast-success .toast-icon {
  color: var(--color-success);
}

.toast-warning {
  border-left: 4px solid var(--color-warning);
}
.toast-warning .toast-icon {
  color: var(--color-warning);
}

.toast-error {
  border-left: 4px solid var(--color-danger);
}
.toast-error .toast-icon {
  color: var(--color-danger);
}

/* ==========================================================================
   LIGHT MODE STYLING
   ========================================================================== */
body.light-theme {
  --color-bg-base: hsl(var(--hue-dark) 20% 96%);
  --color-bg-card: hsla(var(--hue-dark) 20% 100% / 0.7);
  --color-bg-card-hover: hsla(var(--hue-dark) 20% 95% / 0.8);
  --color-border: hsla(var(--hue-dark) 20% 10% / 0.07);
  --color-border-hover: hsla(var(--hue-dark) 20% 10% / 0.15);
  
  --color-text-primary: hsl(var(--hue-dark) 20% 15%);
  --color-text-secondary: hsl(var(--hue-dark) 15% 40%);
  --color-text-muted: hsl(var(--hue-dark) 10% 58%);

  --color-primary: hsl(var(--hue-primary) 80% 54%);
  --color-primary-glow: hsla(var(--hue-primary) 80% 54% / 0.12);
  --color-secondary: hsl(var(--hue-secondary) 85% 35%);
  --color-secondary-glow: hsla(var(--hue-secondary) 85% 35% / 0.12);
}

body.light-theme .sidebar {
  background: rgba(240, 240, 245, 0.65);
}

body.light-theme .log-container,
body.light-theme .scanner-log-container {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--color-border);
}

body.light-theme .log-entry.system .log-message,
body.light-theme .scanner-log-entry.info {
  color: var(--color-text-secondary);
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
  background: rgba(255, 255, 255, 0.8) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: var(--color-text-primary) !important;
}

body.light-theme input:focus,
body.light-theme select:focus,
body.light-theme textarea:focus {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px var(--color-primary-glow) !important;
}

body.light-theme .btn-secondary {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--color-text-primary);
}

body.light-theme .btn-secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

body.light-theme .tag-item {
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-text-primary);
}

body.light-theme .glass-dialog {
  background: hsla(var(--hue-dark) 20% 98% / 0.9);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

body.light-theme .glass-dialog::backdrop {
  background: rgba(240, 240, 245, 0.5);
}

body.light-theme .data-table th {
  background: rgba(0, 0, 0, 0.02);
}

body.light-theme .data-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.015);
}

/* Facebook Light Mock Ad Card Style */
body.light-theme .meta-mock-ad-card {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  color: #050505;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}
body.light-theme .mock-avatar {
  background: #f0f2f5;
  border-color: #ced0d4;
  color: var(--color-primary);
}
body.light-theme .mock-page-name {
  color: #050505;
}
body.light-theme .mock-sponsored-tag {
  color: #65676b;
}
body.light-theme .mock-ad-body {
  color: #050505;
}
body.light-theme .mock-card-footer {
  background: #f0f2f5;
  border-top: 1px solid #e5e5e5;
}
body.light-theme .mock-url-domain {
  color: #65676b;
}
body.light-theme .mock-headline {
  color: #050505;
}
body.light-theme .mock-cta-button {
  background: #e4e6eb;
  border-color: #ced0d4;
  color: #050505;
}
body.light-theme .mock-cta-button:hover {
  background: #d8dadf;
}


/* Light mode readability overrides */
body.light-theme .tab-header h1 {
  background: linear-gradient(to right, var(--color-text-primary), var(--color-text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light-theme .ig-account-display-box {
  background: rgba(0, 0, 0, 0.03);
  border-color: var(--color-border);
}

body.light-theme .btn-regen-image {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.3);
  color: #7c3aed;
}

body.light-theme .btn-regen-image:hover:not(:disabled) {
  background: rgba(168, 85, 247, 0.15);
  border-color: #7c3aed;
  color: #ffffff;
}

/* CRM Table Enhancements - Sorting, Checkboxes & Bulk Delete */

.sortable-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: var(--transition-fast);
}

.sortable-header:hover {
  background: hsla(0, 0%, 100%, 0.05) !important;
}

body.light-theme .sortable-header:hover {
  background: rgba(0, 0, 0, 0.04) !important;
}

.sortable-header::after {
  content: ' ↕';
  opacity: 0.3;
  margin-left: 6px;
  font-size: 0.75rem;
  display: inline-block;
  vertical-align: middle;
}

.sortable-header.asc::after {
  content: ' ↑';
  opacity: 1;
  color: var(--color-primary);
}

.sortable-header.desc::after {
  content: ' ↓';
  opacity: 1;
  color: var(--color-primary);
}

.crm-select-checkbox,
.crm-row-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.bulk-actions-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  border: 1px dashed var(--color-primary);
  border-radius: 12px;
  margin-bottom: 1rem;
  transition: var(--transition-smooth);
}

body.light-theme .bulk-actions-bar {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--color-primary);
}

.btn-danger-solid {
  background: var(--color-danger);
  border: 1px solid var(--color-danger);
  color: #ffffff !important;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

.btn-danger-solid:hover:not(:disabled) {
  background: hsl(var(--hue-danger) 85% 50%);
  border-color: hsl(var(--hue-danger) 85% 50%);
  color: #ffffff !important;
}

.btn-danger-solid:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-purple {
  background: #7c3aed;
  border: 1px solid #7c3aed;
  color: #ffffff !important;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

.btn-purple:hover:not(:disabled) {
  background: #6d28d9;
  border-color: #6d28d9;
  color: #ffffff !important;
}

.btn-purple:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Warmup Dashboard Styles */
.warmup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.warmup-card {
  background: var(--color-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition-fast);
}

.warmup-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #7c3aed;
}

.warmup-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: #7c3aed; /* Purple indicator stripe */
}

.warmup-card.disabled::before {
  background: var(--border-color);
}

.warmup-domain-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-color);
  word-break: break-all;
}

.warmup-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.03);
  padding: 0.75rem;
  border-radius: 8px;
}

[data-theme="dark"] .warmup-metrics {
  background: rgba(255, 255, 255, 0.03);
}

.warmup-metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.warmup-metric-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-color);
}

.warmup-metric-lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.warmup-health-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.warmup-health-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 500;
}

.warmup-health-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

[data-theme="dark"] .warmup-health-bar {
  background: rgba(255, 255, 255, 0.08);
}

.warmup-health-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #ec4899);
  border-radius: 3px;
  transition: width 0.5s ease-out;
}

/* AI Ad Optimization Alert Banner */
.optimization-alert-banner {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12) 0%, rgba(236, 72, 153, 0.05) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.4s ease-out;
}

.optimization-alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.75rem;
}

.optimization-alert-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #c084fc; /* light violet */
  font-size: 1.1rem;
}

.optimization-alert-title svg {
  width: 1.25rem;
  height: 1.25rem;
  color: #c084fc;
  fill: none;
}

.btn-dismiss-alert {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.btn-dismiss-alert:hover {
  color: #ef4444;
}

.optimization-alert-body {
  font-size: 0.9rem;
  color: var(--color-text-primary);
  line-height: 1.5;
}

.optimization-alert-details {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  background: rgba(0, 0, 0, 0.25);
  padding: 0.75rem;
  border-radius: 8px;
  border-left: 3px solid #7c3aed;
  margin-top: 0.25rem;
  font-family: inherit;
  line-height: 1.45;
}

.optimization-alert-footer {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 0.5rem;
}

.optimization-alert-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* API Telemetry & Usage Tracker styles */
.usage-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

[data-theme="light"] .usage-metric-row {
  background: rgba(0, 0, 0, 0.02);
}

.usage-metric-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.usage-metric-info strong {
  font-size: 0.85rem;
  color: var(--color-text-primary);
}

.usage-limit-info {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.usage-metric-stats {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
}

/* ==========================================================================
   EMAIL CAMPAIGNS & TEMPLATES STYLES
   ========================================================================== */

/* Campaign Layout */
.campaign-layout {
  display: flex;
  gap: 1.5rem;
  width: 100%;
  align-items: flex-start;
}

.campaign-sidebar {
  flex: 1;
  min-width: 320px;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.campaign-main {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 480px;
}

/* Card Headers */
.campaign-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.25rem;
  min-height: 42px;
}

.campaign-card-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text-primary);
}

.campaign-builder-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  color: var(--color-text-primary);
  letter-spacing: -0.3px;
}

.campaign-details-meta {
  margin: 0.25rem 0 0 0;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

/* Lists */
.campaigns-list,
.templates-list {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.25rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.campaign-empty-text {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-align: center;
  margin: 1.5rem 0;
}

/* Inputs & Form Styling */
.campaign-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.campaign-form .form-group {
  margin-bottom: 0;
}

.campaign-form-row {
  display: flex;
  gap: 1rem;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.input-control,
.select-control {
  background: hsla(0, 0%, 100%, 0.04);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  height: 44px;
  padding: 0 1rem;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-fast);
  width: 100%;
}

.textarea-control {
  background: hsla(0, 0%, 100%, 0.04);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-fast);
  width: 100%;
}

.input-control:focus,
.select-control:focus,
.textarea-control:focus {
  outline: none;
  border-color: var(--color-primary); /* Brand Violet focus */
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.textarea-control.campaign-body-textarea,
.textarea-control.template-body-textarea {
  height: 240px;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.55;
  resize: vertical;
}

.form-help {
  display: block;
  margin-top: 0.25rem;
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

/* Light Theme Inputs Overrides */
body.light-theme .input-control,
body.light-theme .select-control,
body.light-theme .textarea-control {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: #111111 !important;
}

body.light-theme .input-control:focus,
body.light-theme .select-control:focus,
body.light-theme .textarea-control:focus {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px var(--color-primary-glow) !important;
}

/* Template and Campaign Cards */
.template-item,
.campaign-item {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
}

.template-item:hover,
.campaign-item:hover {
  background: var(--color-bg-card-hover);
  border-color: var(--color-primary); /* Violet glow highlight */
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.template-item-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.template-click-area {
  flex: 1;
  overflow: hidden;
}

.template-item h4,
.campaign-item h4 {
  color: var(--color-text-primary) !important;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.template-subject-preview,
.campaign-item-meta-text {
  color: var(--color-text-secondary) !important;
  font-size: 0.78rem;
  margin: 0.25rem 0 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.template-actions,
.campaign-item-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
  align-items: center;
}

.template-item .edit-tpl-btn,
.template-item .delete-tpl-btn {
  background: transparent !important;
  border: none !important;
  color: var(--color-text-muted) !important;
  padding: 6px !important;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px !important;
  height: 28px !important;
  box-sizing: border-box;
}

.template-item .edit-tpl-btn:hover {
  color: var(--color-primary) !important;
  background: var(--color-primary-glow) !important;
}

.template-item .delete-tpl-btn:hover {
  color: var(--color-danger) !important;
  background: hsla(var(--hue-danger), 85%, 60%, 0.12) !important;
}

body.light-theme .template-item .edit-tpl-btn:hover {
  background: var(--color-primary-glow) !important;
}

body.light-theme .template-item .delete-tpl-btn:hover {
  background: hsla(var(--hue-danger), 85%, 60%, 0.08) !important;
}

/* Light Theme Card Overrides */
body.light-theme .template-item,
body.light-theme .campaign-item {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

body.light-theme .template-item:hover,
body.light-theme .campaign-item:hover {
  background: #fafafc !important;
  border-color: var(--color-primary) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.04);
}

body.light-theme .template-item h4,
body.light-theme .campaign-item h4 {
  color: #111111 !important;
}

body.light-theme .template-subject-preview,
body.light-theme .campaign-item-meta-text {
  color: #555566 !important;
}

/* Form Label Row Alignment */
.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  width: 100%;
}

.form-label-row label {
  margin-bottom: 0 !important;
}

/* Audience Live Matches Badge */
.audience-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-secondary);
  background: var(--color-secondary-glow);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  border: 1px solid hsla(var(--hue-secondary), 80%, 50%, 0.15);
  transition: var(--transition-fast);
}

body.light-theme .audience-badge {
  color: var(--color-secondary);
  background: var(--color-secondary-glow);
  border-color: hsla(var(--hue-secondary), 85%, 35%, 0.15);
}

/* Horizontal Merge Tags Layout */
.email-body-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
}

.email-body-header label {
  margin-bottom: 0 !important;
}

.horizontal-merge-tags {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.merge-tags-label {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-weight: 700;
  margin-right: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-btn {
  font-family: monospace;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  background: var(--color-primary-glow) !important;
  border: 1px dashed hsla(var(--hue-primary), 85%, 65%, 0.15) !important;
  color: var(--color-primary) !important;
  padding: 0.25rem 0.5rem !important;
  border-radius: 6px;
  transition: var(--transition-fast) !important;
  cursor: pointer;
  width: auto !important;
  display: inline-block;
}

.tag-btn:hover {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

body.light-theme .tag-btn {
  background: var(--color-primary-glow) !important;
  border-color: hsla(var(--hue-primary), 80%, 54%, 0.15) !important;
  color: var(--color-primary) !important;
}

body.light-theme .tag-btn:hover {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 3px 8px var(--color-primary-glow);
}

/* Schedule Toggle Card */
.schedule-config-card {
  background: hsla(0, 0%, 100%, 0.02);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  margin: 0.25rem 0;
}

body.light-theme .schedule-config-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

.schedule-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.schedule-config-header h4 {
  color: var(--color-text-primary) !important;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0;
}

.schedule-config-header p {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  margin: 0.15rem 0 0 0;
}

.schedule-config-header .toggle-group {
  display: flex;
  background: hsla(0, 0%, 100%, 0.04);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  align-items: center;
}

body.light-theme .toggle-group {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

.schedule-radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: 0.45rem 1rem;
  border-radius: 8px;
  transition: var(--transition-fast);
  user-select: none;
}

body.light-theme .schedule-radio-label {
  color: #555566;
}

.schedule-radio-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.schedule-radio-label:has(input[type="radio"]:checked),
.schedule-radio-label.active {
  background: var(--color-primary);
  color: #ffffff !important;
  box-shadow: 0 4px 12px var(--color-primary-glow);
}

.scheduled-time-input-group {
  margin-top: 1rem;
  display: none;
  border-top: 1px solid var(--color-border);
  padding-top: 0.75rem;
  animation: fadeIn 0.3s ease-out;
}

.scheduled-time-input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  display: block;
  margin-bottom: 0.35rem;
}

.scheduled-date-input {
  width: 250px !important;
}

/* Action Bar & Buttons */
.campaign-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Primary Campaign Submit Button Alignment */
.btn-submit-campaign {
  height: 44px;
  padding: 0 1.75rem !important;
}

/* Unified Test Email input group box style */
.campaign-test-email-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: hsla(0, 0%, 100%, 0.03);
  border: 1px solid var(--color-border);
  padding: 3px;
  border-radius: 10px;
  transition: var(--transition-fast);
  height: 44px;
  box-sizing: border-box;
}

.campaign-test-email-group:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

body.light-theme .campaign-test-email-group {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
}

body.light-theme .campaign-test-email-group:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.test-email-input {
  width: 190px !important;
  height: 100% !important;
  margin-bottom: 0;
  border: none !important;
  background: transparent !important;
  padding: 0 0.75rem !important;
  box-shadow: none !important;
  outline: none !important;
  color: var(--color-text-primary) !important;
}

body.light-theme .test-email-input {
  color: #111111 !important;
}

.btn-test-send {
  height: 100% !important;
  white-space: nowrap;
  padding: 0 1rem !important;
  font-size: 0.85rem !important;
  border-radius: 8px !important;
  box-sizing: border-box;
}

/* Badges System */
.badge {
  font-weight: 700;
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  width: fit-content;
  display: inline-block;
}

.badge-status-scheduled {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-status-processing {
  background: hsla(var(--hue-primary), 85%, 65%, 0.15) !important;
  color: var(--color-primary) !important;
  border: 1px solid hsla(var(--hue-primary), 85%, 65%, 0.3);
  animation: pulse-violet 2s infinite alternate;
}

.badge-status-completed {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status-failed {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

@keyframes pulse-violet {
  0% { box-shadow: 0 0 0 0 hsla(var(--hue-primary), 85%, 65%, 0.3); }
  100% { box-shadow: 0 0 8px 2px hsla(var(--hue-primary), 85%, 65%, 0.15); }
}

/* Progress bar system */
.campaign-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  width: 100%;
}

.campaign-item-title-wrapper {
  flex: 1;
  overflow: hidden;
}

.campaign-progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  margin-top: 0.6rem;
}

.campaign-progress-track {
  width: 100%;
  height: 5px;
  background: var(--color-border);
  border-radius: 3px;
  margin-top: 0.25rem;
  overflow: hidden;
}

body.light-theme .campaign-progress-track {
  background: rgba(0, 0, 0, 0.08);
}

.campaign-progress-fill {
  height: 100%;
  transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.progress-status-scheduled { background: #3b82f6; }
.progress-status-processing { background: var(--color-primary); }
.progress-status-completed { background: #10b981; }
.progress-status-failed { background: #ef4444; }

.campaign-item-status-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.campaign-item .delete-camp-btn {
  background: transparent !important;
  border: none !important;
  color: var(--color-text-muted) !important;
  padding: 4px !important;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.campaign-item .delete-camp-btn:hover {
  color: var(--color-danger) !important;
  background: hsla(var(--hue-danger), 85%, 60%, 0.12) !important;
}

/* Light Theme Badge / Status Overrides */
body.light-theme .badge-status-scheduled {
  background: rgba(59, 130, 246, 0.1) !important;
  color: #2563eb !important;
}

body.light-theme .badge-status-processing {
  background: hsla(var(--hue-primary), 80%, 54%, 0.1) !important;
  color: var(--color-primary) !important;
}

body.light-theme .badge-status-completed {
  background: rgba(16, 185, 129, 0.1) !important;
  color: #059669 !important;
}

body.light-theme .badge-status-failed {
  background: rgba(239, 68, 68, 0.1) !important;
  color: #dc2626 !important;
}

/* Details Analytics Card with top stripes */
.campaign-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.25rem 0;
}

.metric-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.1rem;
  text-align: center;
  transition: var(--transition-smooth);
}

.campaign-metrics-grid .metric-card:nth-child(1) { border-top: 4px solid var(--color-primary); }
.campaign-metrics-grid .metric-card:nth-child(2) { border-top: 4px solid var(--color-secondary); }
.campaign-metrics-grid .metric-card:nth-child(3) { border-top: 4px solid var(--color-success); }
.campaign-metrics-grid .metric-card:nth-child(4) { border-top: 4px solid var(--color-danger); }

body.light-theme .metric-card {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.metric-card-title {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
}

body.light-theme .metric-card-title {
  color: #777788;
}

.metric-card-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text-primary);
  margin-top: 0.35rem;
  font-family: var(--font-display);
}

.metric-card-value.status-scheduled { color: var(--color-text-secondary) !important; }
.metric-card-value.status-processing { color: var(--color-primary) !important; }
.metric-card-value.status-completed { color: var(--color-success) !important; }
.metric-card-value.status-failed { color: var(--color-danger) !important; }

body.light-theme .metric-card-value {
  color: #111111;
}

.metric-sent-value {
  color: var(--color-success) !important;
}

body.light-theme .metric-sent-value {
  color: #059669 !important;
}

.metric-failed-value {
  color: var(--color-danger) !important;
}

body.light-theme .metric-failed-value {
  color: #dc2626 !important;
}

/* Delivery Status Log Table */
.campaign-recipients-title {
  margin-top: 1.5rem;
  font-size: 1.05rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 0.65rem;
}

body.light-theme .campaign-recipients-title {
  color: #111111;
}

.campaign-recipients-wrapper {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: hsla(0, 0%, 100%, 0.01);
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

body.light-theme .campaign-recipients-wrapper {
  border-color: rgba(0, 0, 0, 0.1);
  background: #ffffff;
}

.campaign-recipients-table {
  margin-bottom: 0;
  width: 100%;
  border-collapse: collapse;
}

.campaign-recipients-table th {
  padding: 0.75rem 1rem !important;
  font-size: 0.8rem !important;
}

.recipient-row td {
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

body.light-theme .recipient-row td {
  border-bottom-color: rgba(0, 0, 0, 0.05);
}

.recipient-name {
  font-weight: 600;
  color: var(--color-text-primary);
}

body.light-theme .recipient-name {
  color: #111111;
}

.recipient-email {
  color: var(--color-text-secondary);
}

body.light-theme .recipient-email {
  color: #555566;
}

.recipient-leader {
  color: var(--color-text-muted);
}

body.light-theme .recipient-leader {
  color: #777788;
}

.recipient-time-error {
  font-size: 0.78rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipient-time-error.status-sent {
  color: var(--color-text-secondary);
}

body.light-theme .recipient-time-error.status-sent {
  color: #555566;
}

.recipient-time-error.status-failed {
  color: var(--color-danger);
}

body.light-theme .recipient-time-error.status-failed {
  color: #dc2626;
}

.recipient-empty-cell {
  text-align: center;
  color: var(--color-text-secondary);
  padding: 2rem !important;
  font-size: 0.85rem;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(5, 5, 8, 0.8) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

body.light-theme .modal {
  background-color: rgba(240, 240, 245, 0.6) !important;
}

.template-modal-card {
  max-width: 580px;
  width: 90%;
  padding: 1.75rem;
  border-radius: 16px;
  background: var(--color-bg-base) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--color-border);
}

body.light-theme .template-modal-card {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}

.template-help-box {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.01);
  line-height: 1.5;
  margin-top: 0.5rem;
}

body.light-theme .template-help-box {
  background: rgba(0, 0, 0, 0.01);
  border-color: rgba(0, 0, 0, 0.1);
  color: #555566;
}

.template-help-box code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-family: monospace;
}

body.light-theme .template-help-box code {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-primary);
}

.template-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* --- Added Spacing & Layout Cleanup for Email Campaigns --- */
.campaign-sidebar .card {
  padding: 1.5rem;
}

.campaign-main .card {
  padding: 1.75rem;
}

.campaigns-list::-webkit-scrollbar,
.templates-list::-webkit-scrollbar,
.campaign-recipients-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.campaigns-list::-webkit-scrollbar-track,
.templates-list::-webkit-scrollbar-track,
.campaign-recipients-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.campaigns-list::-webkit-scrollbar-thumb,
.templates-list::-webkit-scrollbar-thumb,
.campaign-recipients-wrapper::-webkit-scrollbar-thumb {
  background: var(--color-primary-glow);
  border-radius: 3px;
}
.campaigns-list::-webkit-scrollbar-thumb:hover,
.templates-list::-webkit-scrollbar-thumb:hover,
.campaign-recipients-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* ==========================================================================
   LEAD DETAIL TIMELINE STYLES
   ========================================================================== */
.lead-detail-dialog {
  max-width: 800px !important;
}

.timeline-container {
  display: flex;
  flex-direction: column;
  position: relative;
  margin-top: 1rem;
}

.timeline-container::before {
  content: '';
  position: absolute;
  left: 1.25rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--color-border-hover);
}

.timeline-item {
  display: flex;
  gap: 1.5rem;
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-badge-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border-hover);
  flex-shrink: 0;
  z-index: 1;
}

.timeline-badge-icon.campaign {
  background: hsla(270, 70%, 50%, 0.25);
  border-color: hsla(270, 70%, 50%, 0.5);
  color: #bf80ff;
}

.timeline-badge-icon.reply {
  background: hsla(180, 70%, 40%, 0.25);
  border-color: hsla(180, 70%, 40%, 0.5);
  color: #33ccff;
}

.timeline-badge-icon.click {
  background: hsla(330, 80%, 50%, 0.25);
  border-color: hsla(330, 80%, 50%, 0.5);
  color: #ff66b2;
}

.timeline-badge-icon.update {
  background: hsla(40, 80%, 50%, 0.25);
  border-color: hsla(40, 80%, 50%, 0.5);
  color: #ffb366;
}

.timeline-badge-icon.custom {
  background: hsla(120, 60%, 45%, 0.25);
  border-color: hsla(120, 60%, 45%, 0.5);
  color: #66ff66;
}

.timeline-badge-icon svg {
  width: 16px;
  height: 16px;
}

.timeline-body {
  flex: 1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1rem;
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.timeline-title {
  font-weight: 600;
  color: var(--color-text-primary);
  font-size: 0.95rem;
}

.timeline-time {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.timeline-details {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

/* Underline link effect for lead name in CRM */
.lead-name-link {
  color: var(--color-primary) !important;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-fast);
}

.lead-name-link:hover {
  color: var(--color-primary-accent) !important;
}

/* ==========================================================================
   COLLAPSABLE SIDEBAR & FLOATING TOGGLE
   ========================================================================== */
.btn-sidebar-collapse {
  position: absolute;
  top: 2rem;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.btn-sidebar-collapse:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary-glow);
}

.btn-sidebar-collapse svg {
  transition: transform 0.3s ease;
  width: 14px;
  height: 14px;
}

/* Collapsed Sidebar */
.sidebar.collapsed {
  width: 80px;
  padding: 2.5rem 0.5rem;
}

.sidebar.collapsed .btn-sidebar-collapse svg {
  transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-brand {
  margin-bottom: 2.5rem;
  justify-content: center;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .version-tag,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .theme-toggle-text,
.sidebar.collapsed .sidebar-status {
  display: none !important;
}

.sidebar.collapsed .nav-btn {
  justify-content: center;
  padding: 0.75rem 0;
  gap: 0;
}

.sidebar.collapsed .theme-toggle-btn {
  justify-content: center;
  padding: 0.75rem 0;
}

.sidebar.collapsed .sidebar-theme-item {
  display: flex;
  justify-content: center;
}

/* Sibling selector to adjust main-content max-width dynamically */
.sidebar.collapsed ~ .main-content {
  max-width: calc(100vw - 80px);
}

/* ==========================================================================
   SCROLLABLE TABLE MIN-WIDTHS & CUSTOM SCROLLBARS
   ========================================================================== */
#crm-table {
  min-width: 1750px;
}

#finder-table {
  min-width: 1000px;
}

/* Premium horizontal scrollbar styling */
.table-container::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 0 0 20px 20px;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* ==========================================================================
   GLASSMORPHISM LOGIN OVERLAY
   ========================================================================== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.login-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 3rem;
  border-radius: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.05);
  text-align: center;
  animation: loginFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.login-logo-container {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  padding: 3px;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(255, 204, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-svg {
  width: 60px;
  height: 60px;
}

.login-card h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, #fff, #b0b0c0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.input-group {
  text-align: left;
  margin-bottom: 1.5rem;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 12px rgba(255, 204, 0, 0.2);
  background: rgba(0, 0, 0, 0.4);
}

.btn-login {
  width: 100%;
  padding: 0.9rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 204, 0, 0.2);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(255, 204, 0, 0.3);
}

.login-error-msg {
  margin-top: 1.25rem;
  padding: 0.75rem;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-size: 0.85rem;
  font-weight: 500;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-google-login {
  width: 100%;
  padding: 0.9rem;
  border-radius: 12px;
  background: #ffffff;
  color: #1f1f1f;
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid #dadce0;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-google-login:hover {
  background: #f8f9fa;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.google-icon {
  width: 20px;
  height: 20px;
}

/* Global utility class for hiding elements */
.hidden {
  display: none !important;
}

/* Table Column Resizing */
.data-table th {
  position: relative; /* Essential for absolute positioning of the handle */
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -5px; /* Center the grab area on the header border boundary */
  width: 10px; /* Wider grab area for easier mouse targeting */
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Subtle default vertical border indicator */
.col-resizer::after {
  content: '';
  width: 1px;
  height: 40%;
  background-color: var(--color-border);
  opacity: 0.6;
  transition: all 0.2s ease;
}

.col-resizer:hover::after,
.col-resizer.resizing::after {
  width: 3px;
  height: 100%;
  background-color: var(--color-primary);
  opacity: 1;
}
