/* ==============================================================================
   DESIGN SYSTEM & CSS TOKENS (Light & Dark Themes)
   SaaS-grade, accessible, WCAG AA compliant, responsive layout
   ============================================================================== */

:root {
  /* Brand & Primary */
  --primary-50: #f0f9ff;
  --primary-100: #e0f2fe;
  --primary-200: #bae6fd;
  --primary-300: #7dd3fc;
  --primary-400: #38bdf8;
  --primary-500: #0ea5e9;
  --primary-600: #0284c7;
  --primary-700: #0369a1;
  --primary-800: #075985;
  --primary-900: #0c4a6e;

  /* Neutrals (Light Mode) */
  --bg-app: #f8fafc;
  --bg-sidebar: #0f172a;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --text-inverse: #ffffff;

  /* Semantics */
  --success-bg: #ecfdf5;
  --success-text: #065f46;
  --success-border: #a7f3d0;
  --warning-bg: #fffbeb;
  --warning-text: #92400e;
  --warning-border: #fde68a;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;
  --danger-border: #fecaca;
  --info-bg: #eff6ff;
  --info-text: #1e40af;
  --info-border: #bfdbfe;
  --purple-bg: #f5f3ff;
  --purple-text: #5b21b6;
  --purple-border: #ddd6fe;

  /* Status Colors */
  --status-imported: #64748b;
  --status-needs-review: #d97706;
  --status-drafted: #7c3aed;
  --status-approved: #2563eb;
  --status-queued: #0284c7;
  --status-sending: #0891b2;
  --status-sent: #059669;
  --status-retry: #ea580c;
  --status-failed: #dc2626;
  --status-skipped: #94a3b8;

  /* Layout & Spacing */
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-sidebar: #060911;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-input: #172033;
  --bg-hover: #1f2937;
  --border-subtle: #1f293d;
  --border-strong: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.5);

  --success-bg: rgba(6, 95, 70, 0.25);
  --success-text: #34d399;
  --success-border: #065f46;
  --warning-bg: rgba(146, 64, 14, 0.25);
  --warning-text: #fbbf24;
  --warning-border: #78350f;
  --danger-bg: rgba(153, 27, 27, 0.25);
  --danger-text: #f87171;
  --danger-border: #991b1b;
  --info-bg: rgba(30, 64, 175, 0.25);
  --info-text: #60a5fa;
  --info-border: #1e40af;
  --purple-bg: rgba(91, 33, 182, 0.25);
  --purple-text: #c084fc;
  --purple-border: #5b21b6;
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary-600);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* App Shell Layout */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform var(--transition-normal);
  z-index: 100;
}

.sidebar-header {
  padding: 20px 20px 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
}

.brand-info h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1.2;
}

.brand-info span {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 14px 20px 8px 20px;
  padding: 6px 12px;
  background: rgba(2, 132, 199, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-full);
  font-size: 11px;
  color: #38bdf8;
  font-weight: 600;
}

.mode-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: #0284c7;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.nav-item .nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  background: #334155;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}

.user-meta .user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
}

.user-meta .user-role {
  font-size: 11px;
  color: #94a3b8;
}

.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #e2e8f0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-app);
}

.top-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
  z-index: 10;
}

.header-title-box h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.header-title-box span {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Page Containers */
.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.2s ease;
}

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

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

/* KPI Metric Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

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

/* Custom KPI Themes */
.kpi-card.blue .kpi-icon { background: #e0f2fe; color: #0284c7; }
.kpi-card.green .kpi-icon { background: #d1fae5; color: #059669; }
.kpi-card.amber .kpi-icon { background: #fef3c7; color: #d97706; }
.kpi-card.purple .kpi-icon { background: #ede9fe; color: #7c3aed; }

/* Action Banner */
.action-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}

.banner-content h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.banner-content p {
  font-size: 13.5px;
  color: #94a3b8;
  max-width: 600px;
}

.banner-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Funnel Progress */
.funnel-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

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

.funnel-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.funnel-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
}

.funnel-step {
  flex: 1;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.funnel-step.completed {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.funnel-step-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.funnel-step-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

/* Card Panel */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.panel-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.panel-body {
  padding: 20px 22px;
}

/* Filter Bar & Search */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.status-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.tab-btn.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  font-weight: 600;
}

.search-input-box {
  position: relative;
  min-width: 260px;
}

.search-input-box input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-input-box input:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 14px;
  pointer-events: none;
}

/* Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  background: var(--bg-hover);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-IMPORTED { background: #f1f5f9; color: #475569; }
.badge-NEEDS_REVIEW { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }
.badge-DRAFTED { background: var(--purple-bg); color: var(--purple-text); border: 1px solid var(--purple-border); }
.badge-APPROVED { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-QUEUED { background: #cffafe; color: #0e7490; border: 1px solid #a5f3fc; }
.badge-SENDING { background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }
.badge-SENT { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.badge-RETRY { background: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.badge-FAILED { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.badge-SKIPPED { background: #f1f5f9; color: #94a3b8; }

/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25);
}

.btn-primary {
  background: #0284c7;
  color: #ffffff;
}
.btn-primary:hover {
  background: #0369a1;
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-success {
  background: #059669;
  color: #ffffff;
}
.btn-success:hover {
  background: #047857;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
}
.btn-danger:hover {
  background: #b91c1c;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-control:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
}
.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-hover);
}

/* HTML Email Preview Frame */
.email-preview-frame {
  width: 100%;
  min-height: 400px;
  height: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: #ffffff;
}

/* Compose & Preview Modal Enhancements */
.modal-card.modal-lg {
  max-width: 1050px;
  width: 95%;
}

.modal-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.view-mode-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-hover);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.view-tab-btn {
  padding: 7px 15px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.view-tab-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .view-tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.view-tab-btn.active {
  background: var(--bg-surface);
  color: var(--primary-600);
  box-shadow: var(--shadow-sm);
}

/* Composer Toolbar */
.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.toolbar-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toolbar-btn:hover {
  background: var(--primary-50);
  border-color: var(--primary-300);
  color: var(--primary-600);
}

[data-theme="dark"] .toolbar-btn:hover {
  background: rgba(14, 165, 233, 0.15);
  border-color: var(--primary-600);
  color: var(--primary-300);
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  margin: 0 4px;
}

.variable-pill {
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px dashed var(--primary-400);
  border-radius: var(--radius-full);
  color: var(--primary-700);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.variable-pill:hover {
  background: var(--primary-600);
  color: #ffffff;
  border-style: solid;
  transform: translateY(-1px);
}

/* Rich Compose Canvas */
.compose-editor-box {
  min-height: 320px;
  max-height: 440px;
  overflow-y: auto;
  padding: 16px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.7;
  outline: none;
  transition: border-color var(--transition-fast);
}

.compose-editor-box:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.12);
}

.compose-editor-box p {
  margin-top: 0;
  margin-bottom: 12px;
}

.compose-editor-box ul,
.compose-editor-box ol {
  padding-left: 24px;
  margin-bottom: 12px;
}

.compose-editor-box blockquote {
  border-left: 3px solid var(--primary-500);
  margin: 12px 0;
  padding-left: 12px;
  color: var(--text-muted);
}

/* Split View Grid */
.split-view-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 420px;
}

@media (max-width: 900px) {
  .split-view-container {
    grid-template-columns: 1fr;
  }
}

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

.split-col-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}


/* Live Dispatch Monitor Progress Bar */
.send-monitor-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.progress-track {
  width: 100%;
  height: 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 16px 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7 0%, #06b6d4 100%);
  width: 0%;
  transition: width 0.3s ease;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main);
  animation: toastIn 0.25s ease;
  min-width: 280px;
}

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

.toast.success { border-left: 4px solid #059669; }
.toast.error { border-left: 4px solid #dc2626; }
.toast.warning { border-left: 4px solid #d97706; }
.toast.info { border-left: 4px solid #0284c7; }

/* Empty States */
.empty-state {
  text-align: center;
  padding: 48px 20px;
}

.empty-icon {
  font-size: 40px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto 16px auto;
}

/* Responsive Media Queries */
@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    height: 100%;
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .action-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

/* ==============================================================================
   RESUME & ATTACHMENT MANAGEMENT COMPONENTS
   ============================================================================== */
.resume-hub-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.resume-showcase-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.06) 0%, rgba(99, 102, 241, 0.04) 100%);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 18px;
  transition: all var(--transition-normal);
}

.resume-showcase-card:hover {
  border-color: var(--primary-500);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.12);
}

.resume-showcase-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.resume-icon-badge {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.3);
  flex-shrink: 0;
}

.resume-meta-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.resume-meta-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.resume-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.resume-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-hover);
  transition: all var(--transition-normal);
  margin-bottom: 16px;
}

.resume-dropzone:hover,
.resume-dropzone.dragover {
  border-color: var(--primary-500);
  background: rgba(14, 165, 233, 0.08);
  transform: translateY(-1px);
}

.resume-dropzone-icon {
  font-size: 28px;
  margin-bottom: 6px;
  color: var(--primary-600);
}

.resume-dropzone-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
}

.resume-dropzone-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.resume-files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.resume-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  transition: background var(--transition-fast);
}

.resume-file-item:hover {
  background: var(--bg-hover);
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}

.attachment-chip:hover {
  border-color: var(--primary-400);
}

.attachment-chip-icon {
  font-size: 15px;
}

.attachment-chip-size {
  font-size: 11.5px;
  color: var(--text-muted);
}

.attachment-chip-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.attachment-chip-remove:hover {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.preflight-attachment-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(6, 182, 212, 0.05) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-top: 14px;
}

.preflight-attachment-card.warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(239, 68, 68, 0.05) 100%);
  border-color: rgba(245, 158, 11, 0.35);
}

