/* ============================================================
   SiriusEmail — Bright Professional Light Theme
   ============================================================ */

:root {
  /* Core backgrounds */
  --bg-base:     #F0F4FF;
  --bg-surface:  #FFFFFF;
  --bg-elevated: #F8FAFF;
  --bg-input:    #F1F5FB;

  /* Sidebar */
  --sidebar-bg:    #FFFFFF;
  --sidebar-width: 264px;

  /* Brand colors */
  --primary:       #6366F1;
  --primary-hover: #4F46E5;
  --primary-glow:  rgba(99, 102, 241, 0.12);
  --secondary:     #8B5CF6;
  --accent:        #06B6D4;
  --accent-pink:   #EC4899;

  /* Status */
  --success: #10B981;
  --warning: #F59E0B;
  --danger:  #EF4444;
  --info:    #3B82F6;

  /* Text */
  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-tertiary:  #6B7280;
  --text-main:      #0F172A;
  --text-muted:     #64748B;

  /* Borders */
  --border:       rgba(15, 23, 42, 0.08);
  --border-hover: rgba(15, 23, 42, 0.16);
  --border-color: rgba(15, 23, 42, 0.08);
  --glass-border: rgba(15, 23, 42, 0.08);

  /* Compat aliases */
  --glass:   rgba(255, 255, 255, 0.8);
  --bg-card: #FFFFFF;
  --bg-dark: #F0F4FF;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus-visible {
  outline-offset: 3px;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.4); }

/* ============================================================
   BACKGROUND — bright gradient mesh
   ============================================================ */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%,    rgba(99,102,241,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 55% 40% at 100% 0%,   rgba(6,182,212,0.08)  0%, transparent 55%),
    radial-gradient(ellipse 50% 55% at 100% 100%,  rgba(139,92,246,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 0% 100%,    rgba(236,72,153,0.05) 0%, transparent 55%),
    #F0F4FF;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.text-muted         { color: var(--text-muted) !important; }
.text-accent        { color: var(--accent) !important; }
.text-primary-color { color: var(--primary) !important; }
.text-icon-violet   { color: var(--secondary) !important; }
small, .small       { color: var(--text-secondary); font-size: 0.8125rem; }

label {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.4rem;
  display: block;
  font-size: 0.875rem;
}

h1,h2,h3,h4,h5,h6 { letter-spacing: -0.02em; font-weight: 700; color: var(--text-primary); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(99,102,241,0.06);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.5rem 1.5rem 1rem;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

.sidebar-logo span {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 0.375rem 1rem; }

.nav-section-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 1rem 0.25rem 0.4rem;
}

.nav-menu { list-style: none; }
.nav-item  { margin-bottom: 2px; position: relative; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-link .nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem; flex-shrink: 0;
}

.nav-link .nav-badge {
  margin-left: auto;
  background: var(--primary-glow);
  color: var(--primary);
  font-size: 0.625rem; font-weight: 700;
  padding: 1px 6px; border-radius: 20px;
}

.nav-link:hover {
  background: var(--primary-glow);
  color: var(--primary);
  box-shadow: inset 3px 0 0 rgba(99,102,241,0.35);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(139,92,246,0.08));
  color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
  font-weight: 600;
}

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

/* Sidebar footer */
.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

.user-card { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.25rem; }

.user-avatar {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: white;
  flex-shrink: 0; text-transform: uppercase;
}

.user-info  { flex: 1; min-width: 0; }
.user-name  { font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.6875rem; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn-logout {
  background: none; border: none;
  color: var(--text-tertiary);
  padding: 0.25rem; cursor: pointer;
  border-radius: 6px; transition: all 0.15s; line-height: 1;
}
.btn-logout:hover { color: var(--danger); background: rgba(239,68,68,0.08); }

/* ============================================================
   MAIN WRAPPER & HEADER
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-width);
  padding: 0 2.5rem 2.5rem;
  min-height: 100vh;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 0.75rem;
  gap: 1rem;
  padding: 1.125rem 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  z-index: 50;
  position: sticky;
  top: 0;
  background: transparent !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.header-left  { display: flex; align-items: center; gap: 0.75rem; }
.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}

.form-select.header-select.header-brand-select {
  min-width: min(10.5rem, 42vw);
  max-width: 100%;
}

.btn-mobile-menu {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-mobile-menu:hover { background: var(--primary-glow); color: var(--primary); }

/* Search */
.header-search { position: relative; }

.header-search input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 0.45rem 0.875rem 0.45rem 2.25rem;
  font-size: 0.8125rem;
  width: 220px;
  transition: all 0.2s;
  outline: none;
  box-shadow: 0 1px 4px rgba(99,102,241,0.06);
}
.header-search input::placeholder { color: var(--text-tertiary); }
.header-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  width: 280px;
}

.header-search .search-icon {
  position: absolute; left: 0.75rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary); font-size: 0.75rem;
  pointer-events: none;
}

/* Mobile header search */
.header-search-mobile {
  position: relative;
  width: 100%;
}

.header-search-mobile input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 0.5rem 0.875rem 0.5rem 2.25rem;
  font-size: 0.875rem;
  width: 100%;
  transition: all 0.2s;
  outline: none;
  box-shadow: 0 1px 4px rgba(99,102,241,0.06);
}

.header-search-mobile input::placeholder { color: var(--text-tertiary); }

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

.header-search-mobile .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.8rem;
  pointer-events: none;
}

/* Brand switcher */
.brand-switcher-wrap { display: flex; align-items: center; gap: 0.5rem; }
.brand-switcher-label { font-size: 0.75rem; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }

/* Notification button */
button.btn-notification {
  appearance: none;
  margin: 0;
  padding: 0;
  font: inherit;
}

.btn-notification {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem;
  cursor: pointer; transition: all 0.15s;
  text-decoration: none; flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(99,102,241,0.06);
}
.btn-notification:hover { background: var(--primary-glow); color: var(--primary); border-color: rgba(99,102,241,0.25); }
.btn-notification .notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid white;
}

/* Header select */
.form-select.header-select {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  border-radius: 10px !important;
  font-size: 0.8125rem;
  padding: 0.4rem 2rem 0.4rem 0.875rem;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(99,102,241,0.06);
}
.form-select.header-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
  outline: none;
}

/* ============================================================
   PAGE TITLES
   ============================================================ */
.page-title    { font-size: 1.625rem; font-weight: 800; letter-spacing: -0.03em; color: var(--text-primary); margin: 0; }
.page-subtitle { font-size: 0.875rem; color: var(--text-secondary); margin: 0.25rem 0 0; }
.breadcrumb-link { color: var(--text-tertiary); text-decoration: none; font-size: 0.8125rem; transition: color 0.15s; }
.breadcrumb-link:hover { color: var(--primary); }

/* ============================================================
   CARDS
   ============================================================ */
.premium-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(99,102,241,0.05), 0 4px 16px rgba(99,102,241,0.04);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
  position: relative;
}

.premium-card:hover {
  box-shadow: 0 4px 20px rgba(99,102,241,0.10), 0 1px 4px rgba(99,102,241,0.06);
  border-color: rgba(99,102,241,0.18);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.375rem 1.5rem;
  box-shadow: 0 1px 3px rgba(99,102,241,0.05), 0 4px 16px rgba(99,102,241,0.04);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

.stat-card:hover {
  box-shadow: 0 4px 20px rgba(99,102,241,0.10);
  border-color: rgba(99,102,241,0.18);
  transform: translateY(-2px);
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem; flex-shrink: 0;
}

/* Bright, vivid icon backgrounds */
.stat-icon-primary   { background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(99,102,241,0.06));   color: var(--primary); }
.stat-icon-success   { background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(16,185,129,0.06));   color: var(--success); }
.stat-icon-warning   { background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(245,158,11,0.06));   color: var(--warning); }
.stat-icon-danger    { background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(239,68,68,0.06));     color: var(--danger); }
.stat-icon-accent    { background: linear-gradient(135deg, rgba(6,182,212,0.15), rgba(6,182,212,0.06));     color: var(--accent); }
.stat-icon-secondary { background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(139,92,246,0.06));  color: var(--secondary); }

.stat-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.75rem; font-weight: 600;
  padding: 2px 7px; border-radius: 20px;
}
.stat-trend.up   { background: rgba(16,185,129,0.10); color: #059669; }
.stat-trend.down { background: rgba(239,68,68,0.10);  color: var(--danger); }
.stat-trend.flat { background: rgba(100,116,139,0.10); color: var(--text-secondary); }

.stat-value {
  font-size: 1.875rem; font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.1;
  color: var(--text-primary); margin-bottom: 0.25rem;
}

.stat-label { font-size: 0.8125rem; color: var(--text-secondary); font-weight: 500; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-premium {
  background: linear-gradient(135deg, var(--primary) 0%, #818CF8 100%);
  color: white;
  border: none;
  padding: 0.5625rem 1.25rem;
  border-radius: 10px;
  font-weight: 600; font-size: 0.875rem;
  cursor: pointer; transition: all 0.2s;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
  white-space: nowrap;
}
.btn-premium:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(99,102,241,0.42);
  color: white;
  background: linear-gradient(135deg, #4F46E5 0%, var(--primary) 100%);
}
.btn-premium:active { transform: translateY(0); }
.btn-premium-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; border-radius: 8px; }

/* Ghost button */
.btn-ghost {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.5625rem 1.25rem;
  border-radius: 10px;
  font-weight: 500; font-size: 0.875rem;
  cursor: pointer; transition: all 0.15s;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.btn-ghost:hover {
  background: var(--primary-glow);
  border-color: rgba(99,102,241,0.3);
  color: var(--primary);
}

/* Outline compat */
.btn-outline-light {
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  background: var(--bg-surface);
  transition: all 0.15s;
}
.btn-outline-light:hover {
  background: var(--primary-glow) !important;
  border-color: rgba(99,102,241,0.25) !important;
  color: var(--primary) !important;
}

/* Quick action */
.quick-action {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8125rem; font-weight: 500;
  text-decoration: none; transition: all 0.15s;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.quick-action:hover {
  border-color: rgba(99,102,241,0.3);
  color: var(--primary);
  background: rgba(99,102,241,0.05);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.12);
}

.quick-action .qa-icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
}

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.form-control-premium,
input.form-control,
textarea.form-control,
select.form-control {
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  color: var(--text-primary) !important;
  padding: 0.625rem 0.875rem !important;
  transition: all 0.2s;
  width: 100%;
  font-size: 0.9rem;
}

.form-control-premium:focus,
input.form-control:focus,
textarea.form-control:focus,
select.form-control:focus {
  background: var(--bg-surface) !important;
  border-color: var(--primary) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
  color: var(--text-primary) !important;
}

.form-control-premium::placeholder,
input.form-control::placeholder,
textarea.form-control::placeholder { color: var(--text-tertiary) !important; }

select.form-control-premium option,
select.form-control option {
  background: white; color: var(--text-primary);
}

.input-group-text {
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-tertiary) !important;
  border-radius: 10px 0 0 10px !important;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-premium {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 3px;
}

.table-responsive > .table-premium,
.table-responsive > .table,
.table-responsive-custom > .table-premium,
.table-responsive-custom > .table {
  min-width: 700px;
  white-space: nowrap;
}

.table-premium thead tr th {
  color: var(--text-tertiary);
  font-weight: 600; font-size: 0.75rem;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.table-premium tbody tr td {
  padding: 0.875rem 1rem;
  background: rgba(99,102,241,0.015);
  transition: background 0.15s;
  font-size: 0.8875rem;
  vertical-align: middle;
}

.table-premium tbody tr:hover td {
  background: rgba(99,102,241,0.04);
}

.table-premium tbody tr td:first-child { border-radius: 10px 0 0 10px; }
.table-premium tbody tr td:last-child  { border-radius: 0 10px 10px 0; }

/* Table toolbar */
.table-toolbar {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.table-search { position: relative; flex: 1; max-width: 320px; }

.table-search input {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  color: var(--text-primary) !important;
  padding: 0.5rem 0.875rem 0.5rem 2.25rem !important;
  font-size: 0.8125rem; width: 100%;
  transition: all 0.15s; outline: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.table-search input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
}

.table-search .search-icon {
  position: absolute; left: 0.75rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary); font-size: 0.75rem;
  pointer-events: none;
}

/* ============================================================
   BADGES
   ============================================================ */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
}
.status-badge::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%; flex-shrink: 0;
}

.status-badge.sent      { background: rgba(16,185,129,0.10); color: #047857; border: 1px solid rgba(16,185,129,0.2); }
.status-badge.sent::before      { background: var(--success); }
.status-badge.draft     { background: rgba(100,116,139,0.08); color: #475569; border: 1px solid rgba(100,116,139,0.15); }
.status-badge.draft::before     { background: #94A3B8; }
.status-badge.sending   { background: rgba(99,102,241,0.10); color: var(--primary); border: 1px solid rgba(99,102,241,0.2); }
.status-badge.sending::before   { background: var(--primary); animation: pulse-dot 1.5s infinite; }
.status-badge.scheduled { background: rgba(245,158,11,0.10); color: #B45309; border: 1px solid rgba(245,158,11,0.2); }
.status-badge.scheduled::before { background: var(--warning); }
.status-badge.failed    { background: rgba(239,68,68,0.10);  color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.status-badge.failed::before    { background: var(--danger); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}

.badge { font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  border-radius: 12px; padding: 0.875rem 1.25rem;
  margin-bottom: 1.5rem; border: 1px solid transparent;
  font-size: 0.875rem;
  display: flex; align-items: center; gap: 0.625rem;
}
.alert-success { background: rgba(16,185,129,0.08) !important; border-color: rgba(16,185,129,0.2) !important; color: #047857 !important; }
.alert-danger  { background: rgba(239,68,68,0.08) !important;  border-color: rgba(239,68,68,0.2)  !important; color: #DC2626 !important; }
.alert-warning { background: rgba(245,158,11,0.08) !important; border-color: rgba(245,158,11,0.2) !important; color: #B45309 !important; }
.alert-info    { background: rgba(59,130,246,0.08) !important; border-color: rgba(59,130,246,0.2) !important; color: #1D4ED8 !important; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 4rem 2rem; text-align: center;
}
.empty-state-icon {
  width: 72px; height: 72px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(139,92,246,0.06));
  color: var(--primary);
}
.empty-state-title { font-size: 1.125rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.5rem; }
.empty-state-desc  { color: var(--text-secondary); font-size: 0.875rem; max-width: 320px; margin: 0 auto 1.5rem; line-height: 1.6; }

/* ============================================================
   ACTIVITY FEED
   ============================================================ */
.activity-list { list-style: none; }
.activity-item {
  display: flex; align-items: flex-start;
  gap: 0.875rem; padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 32px; height: 32px; border-radius: 9px;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; margin-top: 2px;
}
.activity-dot.sent       { background: rgba(16,185,129,0.10); color: var(--success); }
.activity-dot.draft      { background: rgba(100,116,139,0.08); color: var(--text-secondary); }
.activity-dot.subscriber { background: rgba(6,182,212,0.10);  color: var(--accent); }
.activity-dot.warning    { background: rgba(245,158,11,0.10);  color: var(--warning); }

.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 0.8125rem; color: var(--text-primary); font-weight: 500; }
.activity-time { font-size: 0.75rem; color: var(--text-tertiary); margin-top: 1px; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress {
  background: rgba(99,102,241,0.08) !important;
  border-radius: 99px; overflow: hidden;
}
.progress-bar { border-radius: 99px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }
.progress-bar.bg-primary { background: linear-gradient(90deg, var(--primary), #818CF8) !important; }
.progress-bar.bg-success { background: linear-gradient(90deg, var(--success), #34D399) !important; }
.progress-bar.bg-warning { background: linear-gradient(90deg, var(--warning), #FCD34D) !important; }
.progress-bar.bg-danger  { background: linear-gradient(90deg, var(--danger),  #F87171) !important; }

/* ============================================================
   BRAND CARDS
   ============================================================ */
.brand-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 1.5rem;
  display: flex; flex-direction: column; height: 100%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(99,102,241,0.04);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
.brand-card:hover {
  box-shadow: 0 8px 28px rgba(99,102,241,0.12);
  border-color: rgba(99,102,241,0.2);
  transform: translateY(-2px);
}

.brand-logo {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; color: white; flex-shrink: 0;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

/* ============================================================
   CHART CONTAINERS
   ============================================================ */
.chart-container { position: relative; width: 100%; height: 260px; }
.chart-placeholder {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 260px;
  border: 1px dashed rgba(99,102,241,0.2);
  border-radius: 12px;
  background: rgba(99,102,241,0.02);
  color: var(--text-tertiary);
}

/* ============================================================
   FILTER TABS
   ============================================================ */
.filter-tabs {
  display: flex; gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 4px;
}
.filter-tab {
  padding: 0.375rem 0.875rem; border-radius: 7px;
  font-size: 0.8125rem; font-weight: 500;
  color: var(--text-secondary); background: none;
  border: none; cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.filter-tab:hover { color: var(--primary); }
.filter-tab.active {
  background: var(--bg-surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* ============================================================
   CARD HELPERS
   ============================================================ */
.card-title      { font-size: 0.9375rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.card-subtitle   { font-size: 0.8rem; color: var(--text-tertiary); margin-top: 2px; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; gap: 0.5rem; }
.divider         { height: 1px; background: var(--border); margin: 1.25rem 0; }

/* ============================================================
   LINKS
   ============================================================ */
a { color: inherit; }
a.link-primary { color: var(--primary) !important; text-decoration: none; font-weight: 500; }
a.link-primary:hover { color: var(--primary-hover) !important; text-decoration: underline; }

.hover-text-danger:hover { color: var(--danger) !important; }

/* ============================================================
   MOBILE OVERLAY
   ============================================================ */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.4);
  z-index: 99;               /* just below sidebar z-index:100 */
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: none;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; }
.animate-fade-in > * { animation: fadeIn 0.4s ease-out both; }
.animate-fade-in > *:nth-child(1) { animation-delay: 0.04s; }
.animate-fade-in > *:nth-child(2) { animation-delay: 0.08s; }
.animate-fade-in > *:nth-child(3) { animation-delay: 0.12s; }
.animate-fade-in > *:nth-child(4) { animation-delay: 0.16s; }

@keyframes pulse {
  0%, 100% { opacity: 0.6; } 50% { opacity: 1; }
}
.animate-pulse { animation: pulse 1.5s cubic-bezier(0.4,0,0.6,1) infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   LOGIN PAGE (standalone layout)
   ============================================================ */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: var(--bg-base);
}

.login-wrap {
  display: flex;
  width: 100%;
  max-width: 900px;
  min-height: 560px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(99,102,241,0.12);
  box-shadow: 0 20px 60px rgba(99,102,241,0.12), 0 4px 16px rgba(0,0,0,0.06);
  position: relative;
  z-index: 10;
}

.login-branding {
  flex: 1;
  padding: 3rem;
  background: linear-gradient(145deg, #6366F1 0%, #8B5CF6 55%, #06B6D4 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-branding-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: white;
  text-decoration: none;
}

.login-branding-logo .logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.login-branding-logo span {
  color: white;
  -webkit-text-fill-color: white;
}

.login-branding-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
  color: white;
}

.login-branding-lead {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.92);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.login-branding-footer {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.65);
}

.login-feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-feature-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.92);
}

.login-feature-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.22);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.login-form-panel {
  width: 400px;
  max-width: 100%;
  padding: 3rem;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-form-panel .login-heading {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.375rem;
}

.login-form-panel .login-sub {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.login-form-panel .form-label-compact {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-form-panel .input-group-text {
  background: #F1F5FB !important;
  border: 1px solid rgba(15,23,42,0.1) !important;
  border-right: none !important;
  color: var(--text-tertiary) !important;
  border-radius: 10px 0 0 10px !important;
}

.login-form-panel .input-group .form-control {
  border-left: none !important;
  border-radius: 0 10px 10px 0 !important;
  padding-left: 0.5rem !important;
}

.login-form-panel .input-group .form-control:focus {
  border-left-color: transparent !important;
}

.login-form-panel .input-group .btn-toggle-password {
  cursor: pointer;
  border-radius: 0 10px 10px 0 !important;
}

.login-form-panel .form-check-input {
  background-color: #F1F5FB !important;
  border-color: rgba(15,23,42,0.15) !important;
}

.login-form-panel .form-check-input:checked {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.login-form-panel .form-check-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.login-form-panel .validation-msg {
  font-size: 0.78rem;
  margin-top: 4px;
  display: block;
}

.login-form-panel .icon-input {
  font-size: 0.8rem;
}

.login-form-panel .footer-rule {
  border-top: 1px solid var(--border);
}

.login-form-panel .footer-note {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin: 0;
}

/* ============================================================
   PUBLIC SUBSCRIBE LAYOUT
   ============================================================ */
body.public-subscribe-layout {
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  padding: 1.5rem;
}

body.public-subscribe-layout .bg-mesh {
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%, rgba(99,102,241,0.18) 0%, transparent 55%),
    radial-gradient(ellipse 50% 45% at 100% 100%, rgba(139,92,246,0.12) 0%, transparent 50%),
    #0f172a;
}

.subscribe-card {
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: clamp(1.75rem, 4vw, 3rem) clamp(1.5rem, 4vw, 2.5rem);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.45);
}

.public-subscribe-layout .brand-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #A5B4FC;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================================
   RESPONSIVE — TABLET
   ============================================================ */
@media (max-width: 992px) {
  .main-wrapper {
    padding: 0 1.5rem 2rem;
  }
}

/* ============================================================
   BODY SCROLL LOCK — prevents background scroll when sidebar is open on mobile
   ============================================================ */
body.sidebar-open {
  overflow: hidden;
  /* keep page in place so content doesn't jump */
  position: fixed;
  width: 100%;
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  /* Sidebar slides in from left */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    width: 280px;
    box-shadow: 8px 0 32px rgba(99,102,241,0.12);
    /* Sidebar itself must scroll independently */
    overflow-y: auto;
    overflow-x: hidden;
  }
  .sidebar.show { transform: translateX(0); }

  .main-wrapper  { margin-left: 0; padding: 0 1rem 2rem; }
  .btn-mobile-menu { display: flex; }
  .header-search { display: none; }
  .brand-switcher-label { display: none; }
  .premium-card, .stat-card { padding: 1.125rem; border-radius: 14px; }
  .stat-value { font-size: 1.5rem; }
  .page-title { font-size: 1.375rem; }
  .filter-tabs { overflow-x: auto; }

  /* ── Mobile header — single clean row ── */
  .site-header {
    flex-wrap: nowrap;           /* never wrap to second row */
    padding: 0.75rem 0;
    gap: 0.5rem;
    row-gap: 0;
  }
  .header-left  { flex: 0 0 auto; gap: 0.5rem; }
  .header-right { flex: 1 1 auto; gap: 0.375rem; justify-content: flex-end; }

  /* Brand select: shrink to fit, never overflow */
  .form-select.header-select.header-brand-select {
    min-width: 0;
    max-width: 44vw;
    font-size: 0.8125rem;
    padding-left: 0.625rem;
    padding-right: 1.75rem;     /* keep the arrow */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Hide "New Campaign" button on mobile (already hidden via d-none d-md-inline-flex) */
  .table-responsive-custom {
    display: block; width: 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .main-wrapper { padding: 0 0.75rem 1.5rem; }
  .stat-value { font-size: 1.375rem; }
  .empty-state { padding: 2.5rem 1rem; }

  /* Even tighter brand select on very small screens */
  .form-select.header-select.header-brand-select {
    max-width: 36vw;
    font-size: 0.75rem;
  }
}

/* ============================================================
   LISTS — Subscriber details (search + table)
   ============================================================ */
.list-details-page-header {
  padding-bottom: 0.5rem;
}

.list-details-page-header .breadcrumb-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.125rem;
}

.list-details-hero {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

@media (min-width: 992px) {
  .list-details-hero {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.75rem;
  }
}

.list-details-title-block {
  flex: 1 1 auto;
  min-width: 0;
}

.list-details-title-block .page-title {
  font-size: clamp(1.375rem, 2.2vw, 1.75rem);
  line-height: 1.28;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

.list-details-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.375rem;
}

.list-details-meta-total {
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--text-secondary);
  margin: 0;
}

.list-details-meta-page {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-tertiary);
  margin: 0;
}

.list-details-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  width: 100%;
  flex-shrink: 0;
}

@media (min-width: 992px) {
  .list-details-header-actions {
    width: auto;
    justify-content: flex-end;
    padding-top: 0.2rem;
  }
}

.list-details-page {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 0;
  padding-right: 0;
}

@media (max-width: 991px) {
  .list-details-page {
    padding-left: 0;
    padding-right: 0;
  }
}

.list-details-filter-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.list-details-filter-actions {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.list-details-filter-actions .btn-premium,
.list-details-filter-actions .btn-ghost {
  flex: 1;
}

@media (min-width: 768px) {
  .list-details-filter-toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
  }
  .list-details-filter-grow {
    flex: 1 1 240px;
    min-width: min(100%, 220px);
  }
  .list-details-filter-status {
    flex: 0 1 220px;
    min-width: min(100%, 180px);
  }
  .list-details-filter-actions {
    flex: 0 0 auto;
    width: auto;
  }
  .list-details-filter-actions .btn-premium,
  .list-details-filter-actions .btn-ghost {
    flex: none;
  }
}

.list-details-search {
  position: relative;
}

.list-details-search .search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 2;
}

.list-details-search input {
  padding-left: 2.35rem !important;
  border-radius: 10px !important;
}

.list-details-table-scroll {
  max-height: min(70vh, 680px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.list-details-table-scroll .table-premium thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--bg-surface);
  box-shadow: 0 1px 0 var(--border);
}

.list-details-pagination-bar {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}

.list-details-pagination-bar .pagination {
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
}

@media (min-width: 768px) {
  .list-details-pagination-bar .pagination {
    justify-content: flex-end;
  }
}

.list-details-pagination-bar .page-link {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  min-width: 2.25rem;
  text-align: center;
}

.list-details-pagination-bar .page-item.active .page-link {
  background: linear-gradient(135deg, var(--primary) 0%, #818CF8 100%);
  border-color: transparent;
  color: #fff;
}

.list-details-pagination-bar .page-item:not(.active):not(.disabled) .page-link:hover {
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--primary);
  background: var(--primary-glow);
}

.list-details-pagination-bar .page-item.disabled .page-link {
  opacity: 0.45;
  pointer-events: none;
}

.list-details-sub-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.list-details-modal .modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text-primary);
}

.list-details-modal .modal-header {
  border-bottom-color: var(--border);
}

.list-details-modal .btn-close {
  filter: none;
  opacity: 0.5;
}

@media (max-width: 640px) {
  .login-branding { display: none; }
  .login-form-panel { width: 100%; padding: 2rem 1.5rem; }
  .login-wrap { max-width: 420px; min-height: auto; }
}
