/* ════════════════════════════════════════════════════════════
   MailForge App CSS — Dark-Light Hybrid Theme
   Light main content area (#f1f5f9 bg) + dark sidebar
   All components tested for contrast & visibility
   ════════════════════════════════════════════════════════════ */

:root {
  --sidebar-w:        240px;
  --topbar-h:         56px;

  /* Brand */
  --primary:          #2563eb;
  --primary-dark:     #1d4ed8;
  --primary-light:    #eff6ff;
  --success:          #16a34a;
  --danger:           #dc2626;
  --warning:          #d97706;
  --info:             #0ea5e9;

  /* Sidebar (dark) */
  --sidebar-bg:       #0f172a;
  --sidebar-text:     #94a3b8;
  --sidebar-active-bg:rgba(37,99,235,.14);
  --sidebar-active:   #60a5fa;
  --sidebar-border:   rgba(255,255,255,.06);

  /* Page (light) */
  --bg-page:          #f1f5f9;
  --bg-card:          #ffffff;
  --border-color:     #e2e8f0;

  /* Text */
  --text-main:        #1e293b;
  --text-muted:       #64748b;
  --text-subtle:      #94a3b8;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0; background: var(--bg-page);
  color: var(--text-main); font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ───────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: transform .3s ease;
}
.main-content {
  margin-left: var(--sidebar-w); flex: 1;
  display: flex; flex-direction: column; min-height: 100vh;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid var(--sidebar-border);
}
.brand-icon {
  width: 34px; height: 34px; background: var(--primary);
  border-radius: 8px; display: flex; align-items: center;
  justify-content: center; color: #fff; font-size: 17px; flex-shrink: 0;
}
.brand-name { color: #f1f5f9; font-size: 17px; font-weight: 700; }

.sidebar-menu { flex: 1; padding: 10px 0; overflow-y: auto; }
.sidebar-menu::-webkit-scrollbar { width: 3px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); }

.menu-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: #475569;
  padding: 10px 18px 4px;
}
.menu-divider { height: 1px; background: var(--sidebar-border); margin: 6px 14px; }

.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; color: var(--sidebar-text);
  text-decoration: none; font-size: 13.5px; font-weight: 500;
  transition: all .15s; border-right: 2px solid transparent;
}
.menu-item:hover  { color: #e2e8f0; background: rgba(255,255,255,.05); }
.menu-item.active { color: var(--sidebar-active); background: var(--sidebar-active-bg); border-right-color: var(--primary); }
.menu-item i { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

/* Usage meter */
.sidebar-usage { padding: 10px 14px; border-top: 1px solid var(--sidebar-border); }
.su-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; font-size: 11px; color: #475569; }
.su-plan { font-size: 10px; }
.su-bar  { background: rgba(255,255,255,.08); border-radius: 4px; height: 4px; overflow: hidden; margin-bottom: 3px; }
.su-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .5s; }
.su-fill.su-warn   { background: #d97706; }
.su-fill.su-danger { background: #dc2626; }
.su-nums { font-size: 10px; color: #475569; text-align: right; }

/* Sidebar footer */
.sidebar-footer { padding: 10px 12px; border-top: 1px solid var(--sidebar-border); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px; text-decoration: none;
  transition: background .15s;
}
.sidebar-user:hover { background: rgba(255,255,255,.05); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-name { color: #e2e8f0; font-size: 12px; font-weight: 600; line-height: 1.3; }
.user-role { color: #475569; font-size: 11px; }

/* ── Topbar ───────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; padding: 0 20px; gap: 10px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.sidebar-toggle {
  background: none; border: none; font-size: 20px;
  color: var(--text-muted); cursor: pointer; padding: 4px 6px;
  border-radius: 6px; transition: background .15s;
}
.sidebar-toggle:hover { background: var(--bg-page); }
.topbar-title { font-size: 15px; font-weight: 600; flex: 1; color: var(--text-main); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.btn-icon {
  width: 34px; height: 34px; display: flex; align-items: center;
  justify-content: center; border-radius: 8px; color: var(--text-muted);
  text-decoration: none; font-size: 17px; transition: all .15s;
  border: 1px solid transparent;
}
.btn-icon:hover { background: var(--bg-page); color: var(--text-main); border-color: var(--border-color); }

/* ── Page body ────────────────────────────────────── */
.page-body { flex: 1; padding: 20px 24px; }
.flash-container { padding: 0 24px; padding-top: 4px; }
.flash-msg { border-radius: 8px; font-size: 13px; }

/* ── Footer ───────────────────────────────────────── */
.app-footer {
  padding: 12px 24px; border-top: 1px solid var(--border-color);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-muted);
  background: var(--bg-card); flex-wrap: wrap; gap: 8px;
}
.bithost-link { color: var(--primary); font-weight: 600; text-decoration: none; }
.bithost-link:hover { text-decoration: underline; }
.footer-copy { color: var(--text-muted); }

/* ── Auth pages ───────────────────────────────────── */
.auth-body { background: #f1f5f9; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-page { width: 100%; max-width: 440px; padding: 20px; }
.auth-card {
  background: #fff; border-radius: 16px; padding: 36px 40px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08); border: 1px solid var(--border-color);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-icon {
  width: 52px; height: 52px; background: var(--primary); border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; margin-bottom: 12px;
}
.auth-title    { font-size: 22px; font-weight: 700; color: var(--text-main); margin: 0; }
.auth-subtitle { color: var(--text-muted); font-size: 13px; margin: 4px 0 0; }
.auth-footer   { text-align: center; margin-top: 18px; font-size: 12px; color: var(--text-muted); }

/* ── Section header ───────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.section-header h4 { margin: 0; font-weight: 700; font-size: 19px; color: var(--text-main); }

/* ── Cards (white on light bg) ────────────────────── */
.table-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 12px; overflow: hidden;
}
.table-card-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); flex-wrap: wrap; gap: 8px;
}
.table-card-header h6 { margin: 0; font-weight: 600; font-size: 14px; color: var(--text-main); }

.stat-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 18px; transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.07); }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; color: var(--text-main); }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.stat-icon  { font-size: 22px; opacity: .15; }

.kpi-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 10px; padding: 14px; text-align: center;
}
.kpi-value { font-size: 21px; font-weight: 700; color: var(--text-main); }
.kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 3px; }

/* ── Tables ───────────────────────────────────────── */
.table > :not(caption) > * > * { padding: 11px 14px; }
.table thead th {
  background: #f8fafc; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); border-bottom: 2px solid var(--border-color);
}
.table tbody tr:hover td { background: #fafbfc; }
.table-hover > tbody > tr:hover > * { background-color: #f9fafb; }

/* ── Status badges ────────────────────────────────── */
.badge-draft     { background: #f1f5f9; color: #475569;  font-weight: 600; }
.badge-scheduled { background: #eff6ff; color: #1d4ed8;  font-weight: 600; }
.badge-sending   { background: #fefce8; color: #a16207;  font-weight: 600; }
.badge-sent      { background: #f0fdf4; color: #15803d;  font-weight: 600; }
.badge-paused    { background: #faf5ff; color: #7c3aed;  font-weight: 600; }
.badge-cancelled { background: #fff1f2; color: #be123c;  font-weight: 600; }

/* ── Settings sidebar ─────────────────────────────── */
/* Override Bootstrap list-group white bg for our theme */
.list-group-item {
  background: var(--bg-card) !important;
  color: var(--text-main) !important;
  border-color: var(--border-color) !important;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}
.list-group-item-action:hover,
.list-group-item-action:focus {
  background: #f8fafc !important;
  color: var(--primary) !important;
}
.list-group-item-action.active,
.list-group-item.active {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
  border-left: 3px solid var(--primary) !important;
  font-weight: 600;
}

/* ── Forms ────────────────────────────────────────── */
.form-control, .form-select {
  background: #fff; color: var(--text-main);
  border-color: var(--border-color); font-size: 13.5px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  background: #fff; color: var(--text-main);
}
.form-control::placeholder { color: #c0c8d6; }
.form-control:disabled, .form-control[readonly] {
  background: #f8fafc; color: var(--text-muted);
}
.form-label { font-weight: 600; font-size: 13px; color: var(--text-main); margin-bottom: 5px; }
.form-text  { font-size: 12px; color: var(--text-muted); }
.form-check-label { font-size: 13.5px; color: var(--text-main); }
.input-group-text {
  background: #f8fafc; color: var(--text-muted);
  border-color: var(--border-color); font-size: 14px;
}

/* ── Nav tabs ─────────────────────────────────────── */
.nav-tabs .nav-link {
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  border-color: transparent; padding: 9px 16px;
}
.nav-tabs .nav-link:hover { color: var(--primary); border-color: transparent; }
.nav-tabs .nav-link.active {
  color: var(--primary); font-weight: 600;
  border-bottom: 2px solid var(--primary);
  background: transparent;
}
.nav-tabs { border-bottom: 1px solid var(--border-color); }

/* Tab content */
.tab-content { background: var(--bg-card); }

/* ── Rate bars ────────────────────────────────────── */
.rate-bar { background: #e2e8f0; border-radius: 4px; height: 5px; overflow: hidden; }
.rate-bar-fill { height: 100%; border-radius: 4px; background: var(--primary); transition: width .4s; }

/* ── Wizard steps ─────────────────────────────────── */
.wizard-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin-bottom: 28px; flex-wrap: wrap;
}
.wizard-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
}
.wizard-step.active  { color: var(--primary); font-weight: 600; }
.wizard-step.done    { color: var(--success); }
.wizard-step-num {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; background: #fff; flex-shrink: 0;
}
.wizard-step.active .wizard-step-num { background: var(--primary); color: #fff; border-color: var(--primary); }
.wizard-step.done   .wizard-step-num { background: var(--success); color: #fff; border-color: var(--success); }
.wizard-connector { width: 40px; height: 2px; background: var(--border-color); flex-shrink: 0; }
.wizard-connector.done { background: var(--success); }

/* ── Template cards ───────────────────────────────── */
.template-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 12px; overflow: hidden; transition: all .2s; cursor: pointer;
}
.template-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); border-color: var(--primary); transform: translateY(-2px); }
.template-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.template-thumb {
  height: 140px; background: linear-gradient(135deg,#f8fafc,#e2e8f0);
  display: flex; align-items: center; justify-content: center; font-size: 32px;
}
.template-info { padding: 12px 14px; }
.template-name { font-size: 13px; font-weight: 600; color: var(--text-main); margin-bottom: 4px; }
.template-meta { font-size: 11px; color: var(--text-muted); }

/* ── Block buttons (template editor) ─────────────── */
.block-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: #f8fafc; border: 1px solid var(--border-color);
  border-radius: 7px; padding: 7px 10px; font-size: 12px;
  color: var(--text-main); cursor: pointer; margin-bottom: 5px;
  text-align: left; transition: all .15s;
}
.block-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.block-btn i { font-size: 13px; width: 16px; text-align: center; flex-shrink: 0; }

/* ── AI drawer ────────────────────────────────────── */
.ai-drawer {
  position: fixed; right: -500px; top: 0; width: 480px; height: 100vh;
  background: #fff; border-left: 1px solid var(--border-color);
  z-index: 1050; transition: right .3s ease;
  overflow-y: auto; box-shadow: -6px 0 28px rgba(0,0,0,.12);
}
.ai-drawer.open { right: 0; }
.ai-drawer-header {
  padding: 18px 20px; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg,#0f172a,#1e1b4b);
  position: sticky; top: 0; z-index: 1;
}
.ai-drawer-title { color: #fff; font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.ai-badge { background: linear-gradient(135deg,#2563eb,#7c3aed); color: #fff; padding: 2px 8px; border-radius: 12px; font-size: 10px; font-weight: 700; }
.ai-drawer-body { padding: 20px; }
.ai-result-box { background: #f8fafc; border: 1px solid var(--border-color); border-radius: 10px; padding: 14px; margin-top: 14px; }
.ai-result-box .lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 700; margin-bottom: 5px; }
.ai-result-box .val { font-size: 13px; color: var(--text-main); font-weight: 500; }

/* ── Billing page ─────────────────────────────────── */
/* Billing uses dark plan cards embedded in light page — needs special treatment */
.plan-cards-dark-wrap {
  background: #0f0f1e; border-radius: 16px;
  padding: 28px; margin: -4px;
}

/* Ensure billing toggle labels are readable */
.toggle-label-text { font-size: 14px; color: var(--text-main); font-weight: 500; }
.billing-yearly-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: #dcfce7; color: #15803d;
  font-size: 12px; font-weight: 700;
  padding: 4px 12px; border-radius: 20px; border: 1px solid #bbf7d0;
}
/* Billing toggle switch */
.billing-toggle-outer {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; padding: 16px; background: #f8fafc;
  border: 1px solid var(--border-color); border-radius: 12px;
  margin-bottom: 28px;
}
.b-toggle {
  position: relative; width: 52px; height: 28px; cursor: pointer; display: inline-block; flex-shrink: 0;
}
.b-toggle input { opacity: 0; width: 0; height: 0; }
.b-slider {
  position: absolute; inset: 0;
  background: var(--border-color); border-radius: 28px;
  border: 1px solid #cbd5e1; transition: .3s;
}
.b-slider::before {
  content: ''; position: absolute; width: 20px; height: 20px;
  left: 3px; top: 3px; background: var(--primary);
  border-radius: 50%; transition: .3s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.b-toggle input:checked + .b-slider { background: #dbeafe; border-color: var(--primary); }
.b-toggle input:checked + .b-slider::before { transform: translateX(24px); }

/* Plan card in dark container */
.plan-card-dark {
  background: #16172a; border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px; padding: 24px 20px; display: flex; flex-direction: column;
  position: relative; transition: transform .25s, border-color .25s;
  color: #e2e8f0;
}
.plan-card-dark:hover { transform: translateY(-3px); border-color: rgba(79,70,229,.5); }
.plan-card-dark.featured { border-color: rgba(79,70,229,.6); background: linear-gradient(160deg,rgba(79,70,229,.18),rgba(124,58,237,.08)); }
.plan-card-dark.current { border-color: rgba(22,163,74,.5); background: rgba(22,163,74,.06); }

.pcd-pop { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg,#4f46e5,#7c3aed); color: #fff; font-size: 10px; font-weight: 700; padding: 3px 14px; border-radius: 20px; white-space: nowrap; }
.pcd-curr { position: absolute; top: -11px; right: 14px; background: #16a34a; color: #fff; font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }

.pcd-tier { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 4px; }
.pcd-tagline { font-size: 12px; color: #94a3b8; margin-bottom: 18px; min-height: 30px; }
.pcd-price { font-size: 34px; font-weight: 900; color: #fff; letter-spacing: -1px; line-height: 1; }
.pcd-period { font-size: 13px; color: #64748b; font-weight: 400; }
.pcd-billing-note { font-size: 12px; color: #475569; margin-top: 5px; }
.pcd-yearly-save { font-size: 12px; color: #4ade80; font-weight: 600; margin-top: 4px; }
.pcd-divider { border: none; border-top: 1px solid rgba(255,255,255,.08); margin: 16px 0; }
.pcd-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.pcd-meta-box { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); border-radius: 8px; padding: 10px 8px; text-align: center; }
.pcd-meta-val { font-size: 15px; font-weight: 800; color: #818cf8; }
.pcd-meta-lbl { font-size: 10px; color: #64748b; text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
.pcd-features { flex: 1; list-style: none; padding: 0; margin-bottom: 20px; }
.pcd-features li { font-size: 12.5px; color: rgba(255,255,255,.8); padding: 6px 0; display: flex; align-items: flex-start; gap: 8px; border-bottom: 1px solid rgba(255,255,255,.04); }
.pcd-features li:last-child { border-bottom: none; }
.pcd-features li i { color: #4ade80; font-size: 13px; flex-shrink: 0; margin-top: 2px; }

.pcd-btn {
  display: block; width: 100%; padding: 12px; border-radius: 10px;
  font-weight: 700; font-size: 13px; border: none; cursor: pointer;
  text-decoration: none; text-align: center; transition: all .25s; line-height: 1.4;
}
.pcd-btn-outline { background: transparent; color: #e2e8f0; border: 1px solid rgba(255,255,255,.2); }
.pcd-btn-outline:hover { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.4); }
.pcd-btn-primary { background: linear-gradient(135deg,#4f46e5,#7c3aed); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,.3); }
.pcd-btn-primary:hover { color: #fff; box-shadow: 0 6px 22px rgba(79,70,229,.5); }
.pcd-btn-current { background: rgba(22,163,74,.1); color: #4ade80; border: 1px solid rgba(22,163,74,.3); cursor: default; }

/* Usage bars in billing */
.usage-row { margin-bottom: 16px; }
.usage-row:last-child { margin-bottom: 0; }
.usage-row-header { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 6px; }
.usage-row-header .lbl { color: var(--text-muted); }
.usage-row-header .val { font-weight: 600; color: var(--text-main); }
.usage-prog { background: #e2e8f0; border-radius: 6px; height: 7px; overflow: hidden; }
.usage-prog-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg,var(--primary),#7c3aed); transition: width .5s; }
.usage-prog-fill.warn  { background: linear-gradient(90deg,#d97706,#ef4444); }
.usage-sub { font-size: 11px; color: var(--text-subtle); margin-top: 3px; }

/* SMTP status card */
.smtp-status-box { background: #f8fafc; border: 1px solid var(--border-color); border-radius: 10px; padding: 14px; }
.smtp-status-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.smtp-status-row:last-child { margin-bottom: 0; }
.smtp-status-row i { font-size: 14px; flex-shrink: 0; }

/* ── Superadmin ────────────────────────────────────── */
.sa-stat { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; }
.sa-stat .v { font-size: 24px; font-weight: 800; color: var(--text-main); }
.sa-stat .l { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Code blocks ──────────────────────────────────── */
.code-snippet {
  background: #0f172a; border-radius: 8px; padding: 14px 16px;
  font-size: 12px; color: #e2e8f0; font-family: 'Fira Code', monospace;
  overflow-x: auto; line-height: 1.7;
}

/* ── Confirm modal ────────────────────────────────── */
.modal-content { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 14px; }
.modal-header { border-bottom: 1px solid var(--border-color); }
.modal-footer { border-top: 1px solid var(--border-color); }

/* ── Dropdown ─────────────────────────────────────── */
.dropdown-menu {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.1);
  font-size: 13px;
}
.dropdown-item { color: var(--text-main); padding: 8px 14px; }
.dropdown-item:hover { background: #f8fafc; color: var(--primary); }
.dropdown-divider { border-color: var(--border-color); }

/* ── Alerts ───────────────────────────────────────── */
.alert { border-radius: 10px; font-size: 13px; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-danger  { background: #fff1f2; border-color: #fecdd3; color: #be123c; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #a16207; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ── Pagination ───────────────────────────────────── */
.page-link { color: var(--primary); border-color: var(--border-color); font-size: 13px; padding: 6px 12px; }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }
.page-item.disabled .page-link { color: var(--text-muted); }

/* ── Progress bars ────────────────────────────────── */
.progress { background: #e2e8f0; }

/* ── Responsive ───────────────────────────────────── */
@media(max-width:768px){
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: 14px 16px; }
  .flash-container { padding: 0 16px; }
  .section-header { flex-direction: column; align-items: flex-start; }
}

/* ── Additional production polish ─────────────────────── */

/* Better focus states */
.form-control:focus, .form-select:focus, .btn:focus {
  outline: none;
}

/* Smooth transitions on cards */
.table-card, .stat-card, .kpi-card {
  transition: box-shadow .15s ease;
}

/* Better empty states */
.empty-state {
  text-align:center; padding:48px 24px; color:var(--text-muted);
}
.empty-state-icon {
  font-size:48px; color:var(--border-color);
  margin-bottom:16px; display:block;
}
.empty-state h5 { color:var(--text-main); margin-bottom:8px; }
.empty-state p  { font-size:14px; max-width:360px; margin:0 auto 20px; }

/* Status dot indicators */
.status-dot {
  width:8px; height:8px; border-radius:50%; display:inline-block;
  flex-shrink:0;
}
.status-dot.active   { background:#16a34a; box-shadow:0 0 0 3px rgba(22,163,74,.2); }
.status-dot.inactive { background:#94a3b8; }
.status-dot.warning  { background:#d97706; }
.status-dot.danger   { background:#dc2626; }

/* Code inline */
code {
  background:#f1f5f9; color:#dc2626; padding:2px 6px;
  border-radius:4px; font-size:87%; font-family:'Fira Code',monospace;
}

/* Truncated text */
.text-truncate-2 {
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden;
}

/* Better badge sizes */
.badge { font-size:11px; font-weight:600; }

/* Rate bar colors for analytics */
.rate-bar-fill.green  { background:#16a34a; }
.rate-bar-fill.amber  { background:#d97706; }
.rate-bar-fill.red    { background:#dc2626; }
.rate-bar-fill.blue   { background:var(--primary); }
.rate-bar-fill.purple { background:#7c3aed; }

/* Sidebar active indicator */
.menu-item.active::before {
  content:''; position:absolute; left:0; top:4px; bottom:4px;
  width:3px; background:var(--primary); border-radius:0 3px 3px 0;
}
.menu-item { position:relative; }

/* Plan badge colors for dark billing cards */
.plan-tier-starter  { color:#818cf8; }
.plan-tier-growth   { color:#a5b4fc; }
.plan-tier-business { color:#c084fc; }
.plan-tier-enterprise { color:#fbbf24; }

/* Loading skeleton animation */
.skeleton {
  background:linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size:200% 100%;
  animation:skeleton-load 1.5s infinite;
  border-radius:4px;
}
@keyframes skeleton-load {
  0%   { background-position:200% 0; }
  100% { background-position:-200% 0; }
}

/* ── Mobile sidebar overlay ───────────────────────────── */
.sidebar-overlay {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,.5);
  z-index:99;
}
.sidebar-overlay.show { display:block; }

/* ── Responsive improvements for app ─────────────────── */
@media(max-width:768px) {
  .stat-value { font-size:22px; }
  .kpi-value  { font-size:18px; }
  .section-header { gap:8px; }
  .topbar-title { font-size:14px; }
  .table-responsive { font-size:13px; }
  .page-body { padding:12px 14px; }
  /* Billing cards on mobile */
  .plan-dark { padding:18px 14px; }
  .pcd-price { font-size:26px; }
  /* Campaign wizard */
  .wizard-steps { gap:4px; }
  .wizard-step { font-size:11px; }
  .wizard-step-num { width:22px; height:22px; font-size:10px; }
  .wizard-connector { width:20px; }
}

/* ═══════════════════════════════════════════════════════════
   APP RESPONSIVE — Full Bootstrap-compatible breakpoints
   ═══════════════════════════════════════════════════════════ */

/* Sidebar on mobile */
@media(max-width:768px){
  .app-layout { flex-direction: column; }
  
  /* Sidebar collapses off-screen left */
  .sidebar {
    position: fixed; left: -260px; top: 0; bottom: 0;
    width: 240px; z-index: 200;
    transition: left .3s ease;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0,0,0,.1);
  }
  .sidebar.open { left: 0; }
  
  /* Main area takes full width */
  .main-area { width: 100% !important; margin-left: 0 !important; }
  
  /* Topbar */
  .topbar { padding: 12px 16px; }
  .topbar-title { font-size: 15px; }
  .topbar-actions .btn { padding: 6px 12px; font-size: 13px; }
  
  /* Page body */
  .page-body { padding: 16px 14px; }
  
  /* Stat cards - 2 per row */
  .row .col-6.col-md-4.col-xl-2 { flex: 0 0 50%; max-width: 50%; }
  
  /* Tables scroll */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  
  /* Section header stacks */
  .section-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
  .section-header .d-flex { flex-wrap: wrap; }
  
  /* Campaign wizard steps - compress */
  .wizard-steps { gap: 4px; overflow-x: auto; padding-bottom: 4px; }
  .wizard-step span { display: none; }
  .wizard-connector { min-width: 16px; }
  
  /* KPI cards - 2 per row */
  .col-6.col-md-3.col-xl-2 { flex: 0 0 50%; max-width: 50%; }
  
  /* Analytics rows */
  .col-lg-8, .col-lg-4 { flex: 0 0 100%; max-width: 100%; }
  
  /* Forms full width */
  .col-md-6, .col-md-4, .col-md-3 { margin-bottom: 0; }

  /* Billing plan cards - 1 per row */
  .col-md-6.col-xl-3 { flex: 0 0 100%; max-width: 100%; }
  
  /* Table card header stacks */
  .table-card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }
}

/* Tablet ≤ 992px */
@media(max-width:992px){
  .page-body { padding: 18px 16px; }
  .col-lg-8 { flex: 0 0 100%; max-width: 100%; }
  .col-lg-4 { flex: 0 0 100%; max-width: 100%; }
  .col-lg-5, .col-lg-7 { flex: 0 0 100%; max-width: 100%; }
}

/* Large tablet ≤ 1200px */
@media(max-width:1200px){
  .sidebar { width: 200px; }
  .main-area { margin-left: 200px; }
  .menu-item span { font-size: 13px; }
}

/* Very small screens */
@media(max-width:380px){
  .page-body { padding: 12px 10px; }
  .stat-value { font-size: 20px; }
  .kpi-value  { font-size: 16px; }
  .table th, .table td { font-size: 12px; padding: 8px 6px; }
  .btn { font-size: 13px; }
  .wizard-step-num { width: 20px; height: 20px; font-size: 10px; }
}
