:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --success: #10b981;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 13px;
  user-select: none;
  min-height: 100vh;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Utility Helpers */
.mb-1 {
  margin-bottom: 4px;
}
.mb-2 {
  margin-bottom: 8px;
}
.mb-3 {
  margin-bottom: 12px;
}
.mt-2 {
  margin-top: 8px;
}
.mt-3 {
  margin-top: 12px;
}
.align-center {
  align-items: center;
}
.flex-gap-2 {
  display: flex;
  gap: 8px;
}
.text-hint {
  font-size: 10.5px;
  color: var(--text-muted);
}
.text-xs {
  font-size: 11px;
}
.text-muted {
  color: var(--text-muted);
}
.text-center {
  text-align: center;
}
.py-3 {
  padding-top: 12px;
  padding-bottom: 12px;
}

/* Header */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

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

.brand-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.brand-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 9999px;
  border: 1px solid var(--primary-border);
}

/* Status Card */
.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot-success {
  background-color: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.status-dot-warning {
  background-color: var(--warning);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.status-dot-danger {
  background-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.status-label {
  color: var(--text-muted);
  font-weight: 500;
}

.status-value {
  font-weight: 600;
  color: var(--text-main);
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 6px;
  gap: 2px;
}

.nav-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 4px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Main Content */
.app-main {
  flex: 1;
  padding: 12px;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.tab-panel.active {
  display: flex;
}

/* Section Card */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  margin-bottom: 12px;
}

.card-header.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

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

.card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

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

.empty-icon {
  margin-bottom: 10px;
}

.empty-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  max-width: 260px;
  margin: 0 auto 14px auto;
  line-height: 1.4;
}

/* Dropzone */
.upload-dropzone {
  border: 2px dashed var(--primary-border);
  background: var(--primary-light);
  border-radius: var(--radius-md);
  padding: 24px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.upload-dropzone:hover {
  border-color: var(--primary);
  background: #e0f2fe;
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  margin-bottom: 6px;
}

.upload-text {
  font-size: 12.5px;
  color: var(--text-main);
}

.upload-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}

.feature-pill {
  font-size: 10.5px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  padding: 3px 7px;
  border-radius: 9999px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Loaded File Bar */
.loaded-file-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.file-icon {
  font-size: 18px;
}

.file-sub {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Forms, Inputs & Selects */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.required {
  color: var(--danger);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  color: var(--text-main);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.form-input-sm {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  text-align: center;
}

/* Variable Toolbar & Chips */
.variable-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.var-toolbar-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.var-chips-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.var-badge,
.var-chip-btn {
  font-family: monospace;
  font-size: 11px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.var-chip-btn:hover {
  background: #dbeafe;
  border-color: var(--primary);
}

/* Rich Text Editor Toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 6px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tool-btn {
  background: transparent;
  border: none;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

.tool-btn:hover {
  background: var(--border-light);
  color: var(--text-main);
}

.tool-divider {
  width: 1px;
  height: 14px;
  background: var(--border);
  margin: 0 4px;
}

.rich-editor {
  min-height: 120px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--bg-card);
  font-size: 12.5px;
  line-height: 1.5;
  outline: none;
  user-select: text;
}

.rich-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.rich-editor:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  white-space: pre-wrap;
}

/* Attachments Block */
.attachments-block {
  padding: 8px 10px;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.attachment-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
}

.btn-remove-attachment {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0 4px;
  font-size: 12px;
}

/* Delay Settings Block */
.delay-settings-block {
  padding: 10px;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.delay-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.delay-inputs-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  padding-left: 20px;
}

/* Modal Overlay & Review Card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 12px;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.modal-title {
  font-size: 13.5px;
  font-weight: 700;
}

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

.modal-body {
  padding: 12px 14px;
  overflow-y: auto;
}

.modal-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-app);
}

/* Review Envelope & Stats */
.review-summary-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
}

.review-stat-label {
  display: block;
  font-size: 9.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.recipient-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: var(--bg-app);
  border-radius: var(--radius-sm);
}

.switcher-info {
  font-size: 11px;
  font-weight: 600;
}

.preview-envelope {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}

.envelope-row {
  display: flex;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 11.5px;
}

.envelope-label {
  font-weight: 600;
  color: var(--text-muted);
  width: 50px;
}

.envelope-val {
  font-weight: 500;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.envelope-body {
  padding-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  max-height: 140px;
  overflow-y: auto;
  user-select: text;
}

/* Template Cards Grid */
.templates-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-card {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
}

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

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

.template-subject {
  font-size: 11.5px;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 4px;
}

.template-body-preview {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 8px;
}

.template-actions {
  display: flex;
  gap: 6px;
}

/* Alert Boxes */
.alert-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  margin-bottom: 12px;
}

.alert-success {
  background: var(--success-light);
  border: 1px solid var(--success-border);
  color: #065f46;
}

.alert-icon {
  font-weight: bold;
}

.alert-content {
  flex: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}
.btn-xs {
  padding: 3px 6px;
  font-size: 10px;
}
.btn-block {
  width: 100%;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--bg-app);
}

.btn-link {
  background: transparent;
  color: var(--primary);
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

.card-actions {
  margin-top: 12px;
}

/* Filter Tabs & Stats */
.filter-tabs {
  display: flex;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.filter-btn {
  border: none;
  background: transparent;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
}

.filter-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
}

.stat-success {
  background: var(--success-light);
  border-color: var(--success-border);
}
.stat-warning {
  background: var(--warning-light);
  border-color: var(--warning-border);
}
.stat-danger {
  background: var(--danger-light);
  border-color: var(--danger-border);
}

.stat-num {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

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

/* Preview Table */
.table-container {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

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

.preview-table th {
  position: sticky;
  top: 0;
  background: var(--bg-app);
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  z-index: 1;
}

.preview-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.table-footer {
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

/* Info Card */
.info-card {
  display: flex;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-secondary);
}

.info-icon {
  font-size: 13px;
  flex-shrink: 0;
}

/* Footer */
.app-footer {
  margin-top: auto;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text-muted);
}

.footer-dot {
  color: #cbd5e1;
}

/* ==========================================================================
   Header layout & theme toggle
   ========================================================================== */
.brand-row {
  justify-content: space-between;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  flex-shrink: 0;
}

.brand-info {
  min-width: 0;
  flex-wrap: wrap;
  row-gap: 2px;
}

.brand-title {
  white-space: nowrap;
}

.theme-toggle-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--bg-app);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--primary-border);
  background: var(--primary-light);
}

.quota-indicator {
  color: var(--text-muted);
  white-space: nowrap;
}

.quota-indicator strong {
  color: var(--text-main);
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.mt-1 {
  margin-top: 4px;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Contacts import
   ========================================================================== */
.import-method-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.import-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.import-tab-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  border-color: var(--border-light);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.sheet-import-box {
  padding: 12px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.upload-dropzone.drag-over {
  border-color: var(--primary);
  border-style: solid;
}

.sample-csv-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.sample-csv-text {
  display: flex;
  flex-direction: column;
  font-size: 11.5px;
  color: var(--text-main);
  min-width: 0;
}

.sample-csv-text span {
  font-size: 10.5px;
  color: var(--text-muted);
}

.sample-csv-box .btn {
  flex-shrink: 0;
}

.toggle-option {
  padding: 8px 10px;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-label input,
.radio-label input,
.mode-radio-label input {
  accent-color: var(--primary);
  cursor: pointer;
}

.variables-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.var-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.var-pill,
.var-chip {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10.5px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.var-chip {
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* ==========================================================================
   Composer
   ========================================================================== */
.recipients-banner {
  justify-content: space-between;
  margin-bottom: 0;
}

.sending-mode-block {
  margin-bottom: 8px;
}

.mode-radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.mode-radio-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-radio-label input {
  margin-top: 2px;
}

.mode-radio-label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.mode-radio-desc {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 400;
}

.spam-quality-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.spam-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 9999px;
  border: 1px solid transparent;
}

.spam-safe {
  background: var(--success-light);
  color: var(--success-text);
  border-color: var(--success-border);
}

.spam-moderate {
  background: var(--warning-light);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

.spam-danger {
  background: var(--danger-light);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
}

.att-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.att-remove {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0 4px;
  font-size: 12px;
}

.form-input-sm {
  background: var(--bg-card);
  color: var(--text-main);
}

.form-textarea {
  resize: vertical;
  user-select: text;
}

/* ==========================================================================
   Buttons & badges
   ========================================================================== */
.btn-warning {
  background-color: var(--warning);
  color: #fff;
}

.btn-warning:hover {
  background-color: #d97706;
}

.btn-danger {
  background-color: var(--danger);
  color: #fff;
}

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

.btn {
  white-space: nowrap;
}

.btn-block {
  white-space: normal;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-running {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.badge-paused {
  background: var(--warning-light);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

.badge-completed {
  background: var(--success-light);
  color: var(--success-text);
  border-color: var(--success-border);
}

.badge-stopped {
  background: var(--danger-light);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

/* ==========================================================================
   Live campaign
   ========================================================================== */
.live-campaign-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.live-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.live-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.live-title {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-container {
  margin-bottom: 12px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.progress-track {
  height: 8px;
  background: var(--border-light);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.progress-fill.completed {
  background: var(--success);
}

.live-current-recipient {
  padding: 10px;
  margin-bottom: 12px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.current-rec-header {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.current-rec-header #live-action-status {
  text-transform: none;
}

.current-rec-email {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-rec-meta {
  font-size: 11px;
  color: var(--text-muted);
}

#live-countdown-container {
  margin-top: 6px;
}

.countdown-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--warning-light);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.live-controls-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.live-controls-row .btn {
  flex: 1;
}

.activity-log-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.log-header {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-app);
  border-bottom: 1px solid var(--border);
}

.log-stream {
  max-height: 200px;
  overflow-y: auto;
  padding: 6px 10px;
  background: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.6;
  user-select: text;
}

.log-line {
  color: #cbd5e1;
  word-break: break-word;
}

.log-time {
  color: #64748b;
}

.log-sent {
  color: #4ade80;
}

.log-error {
  color: #f87171;
}

.log-delay {
  color: #fbbf24;
}

/* ==========================================================================
   Modals, templates, history
   ========================================================================== */
.review-stat strong {
  font-size: 12px;
}

.template-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-select-list .template-card:hover {
  border-color: var(--primary);
}

.history-controls-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.history-search-wrapper {
  position: relative;
  width: 100%;
}

.history-search-input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  font-size: 11.5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-app);
  color: var(--text);
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.history-search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.history-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 12px;
  opacity: 0.7;
}

.history-filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.history-filter-chips::-webkit-scrollbar { display: none; }

.history-chip {
  background: var(--bg-app);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.history-chip:hover {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--text-muted);
}

.history-chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.25);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item-card {
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.history-item-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}

.history-item-card.border-success { border-left-color: #10b981; }
.history-item-card.border-warning { border-left-color: #f59e0b; }
.history-item-card.border-danger { border-left-color: #ef4444; }
.history-item-card.border-draft { border-left-color: #0284c7; }

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.history-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.history-mode-pill {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: inline-block;
  margin-left: 4px;
}

.history-item-date {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Delivery Progress Bar */
.history-progress-wrapper {
  margin: 8px 0;
}

.history-progress-track {
  width: 100%;
  height: 5px;
  background: var(--bg-app);
  border-radius: 9999px;
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border-light, #f1f5f9);
}

.history-progress-sent {
  background: linear-gradient(90deg, #10b981, #059669);
  height: 100%;
  transition: width 0.3s ease;
}

.history-progress-failed {
  background: #ef4444;
  height: 100%;
  transition: width 0.3s ease;
}

/* Metric Chips */
.history-item-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.history-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bg-app);
  color: var(--text);
  border: 1px solid var(--border);
}

.history-stat-pill.stat-success {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.history-stat-pill.stat-danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.history-stat-pill.stat-primary {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

/* Quick Accordion Drawer */
.history-accordion-toggle {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.history-accordion-toggle:hover {
  text-decoration: underline;
}

.history-accordion-content {
  display: none;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
  margin-bottom: 10px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.history-accordion-content.open {
  display: block;
}

/* Actions Button Group */
.history-item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.btn-pdf-history {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

.btn-pdf-history:hover {
  opacity: 0.92;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

/* ==========================================================================
   Manual email entry
   ========================================================================== */
.import-method-tabs {
  grid-template-columns: repeat(3, 1fr);
}

.import-tab-btn {
  padding: 6px 4px;
  white-space: nowrap;
}

.manual-count {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 1px 8px;
  border-radius: 9999px;
}

.quick-domain-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.quick-domain-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.btn-domain-chip {
  background: var(--bg-app);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.btn-domain-chip:hover {
  background: var(--primary-light, #eff6ff);
  color: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
}

.btn-domain-chip.btn-domain-action {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
  margin-left: auto;
}

.btn-domain-chip.btn-domain-action:hover {
  background: #dcfce7;
  border-color: #86efac;
}

.manual-textarea {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  min-height: 130px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  background: var(--border-light);
  padding: 0 4px;
  border-radius: 3px;
}

/* ==========================================================================
   Files & photos
   ========================================================================== */
.attachment-item {
  gap: 8px;
  padding: 4px 6px;
}

.att-thumb {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 4px;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
}

.att-name {
  flex: 1;
  min-width: 0;
}

.att-size {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.attachment-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* ==========================================================================
   Test email & review extras
   ========================================================================== */
.test-email-block {
  padding: 8px 10px;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.test-email-row {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.test-email-row .btn {
  flex-shrink: 0;
}

.envelope-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.envelope-attachments:not(:empty) {
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
}

.preview-att-chip {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-inline-img {
  display: block;
  max-width: 100%;
  max-height: 160px;
  margin-top: 8px;
  border-radius: 4px;
}

.quota-warning {
  font-size: 11px;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--warning-light);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}

/* ==========================================================================
   Template library
   ========================================================================== */
.section-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.category-chip {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.category-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.template-header {
  gap: 8px;
}

.template-category-tag {
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  white-space: nowrap;
}

.template-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.envelope-body-tall {
  max-height: 300px;
  color: var(--text-main);
}

.placeholder-mark {
  background: var(--warning-light);
  color: var(--warning-text);
  border-radius: 3px;
  padding: 0 2px;
}

/* ==========================================================================
   Sent email viewer
   ========================================================================== */
.current-rec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.current-rec-info {
  min-width: 0;
}

.email-view-nav-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.email-view-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.email-view-meta.is-error {
  color: var(--danger-text);
}

/* ==========================================================================
   Header actions, settings & shared rows
   ========================================================================== */
.header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

#btn-open-settings {
  color: var(--text-secondary);
}

.inline-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inline-input-row .form-select,
.inline-input-row .form-input {
  flex: 1;
  min-width: 0;
}

.setting-number {
  width: 80px;
}

.card-actions.flex-gap-2 .btn-block {
  flex: 1;
}

.suppression-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.suppression-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-app);
}

.suppression-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.suppression-email {
  font-size: 11.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shortcut-table {
  width: 100%;
  font-size: 11.5px;
  border-collapse: collapse;
}

.shortcut-table td {
  padding: 4px 0;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.shortcut-table td:first-child {
  white-space: nowrap;
  padding-right: 10px;
}

kbd {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-app);
  color: var(--text-main);
}

/* ==========================================================================
   Saved contact lists
   ========================================================================== */
.saved-lists-block {
  margin-bottom: 10px;
}

.saved-lists {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.saved-list-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--primary-border);
  background: var(--primary-light);
  border-radius: 9999px;
  overflow: hidden;
}

.saved-list-load {
  border: none;
  background: transparent;
  color: var(--primary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 4px 3px 10px;
  cursor: pointer;
}

.saved-list-count {
  font-size: 10px;
  padding: 0 5px;
  border-radius: 9999px;
  background: var(--bg-card);
  color: var(--text-secondary);
}

.saved-list-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  padding: 3px 8px 3px 4px;
  cursor: pointer;
}

.saved-list-remove:hover {
  color: var(--danger);
}

/* ==========================================================================
   Follow-ups & scheduling
   ========================================================================== */
.followup-block {
  padding: 8px 10px;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.followup-step {
  margin-top: 8px;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.followup-step-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.followup-step-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.followup-step-head .att-remove {
  margin-left: auto;
}

.followup-delay {
  width: 48px;
}

.followup-body {
  font-size: 11.5px;
}

.review-notes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--text-secondary);
}

.review-notes:empty {
  display: none;
}

.schedule-block {
  padding: 8px 10px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.schedule-options {
  display: flex;
  gap: 14px;
  margin-top: 4px;
}

.reply-box {
  font-size: 11.5px;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--success-light);
  border: 1px solid var(--success-border);
  color: var(--success-text);
  user-select: text;
}

/* ==========================================================================
   Dashboard: KPI tiles, column chart, tables, upcoming
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.kpi-tile {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.kpi-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
}

.kpi-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.chart-block {
  margin-top: 12px;
}

.chart-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.column-chart {
  --chart-bar: #2563eb;
  --chart-grid: var(--border-light);
}

body.dark-theme .column-chart {
  --chart-bar: #3b82f6;
}

.cc-plot {
  position: relative;
  height: 110px;
  margin-top: 14px;
  margin-left: 22px;
  border-bottom: 1px solid var(--border);
}

.cc-grid {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--chart-grid);
}

.cc-grid span {
  position: absolute;
  left: -24px;
  top: -7px;
  width: 20px;
  text-align: right;
  font-size: 9.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.cc-grid-top {
  top: 0;
}

.cc-grid-mid {
  top: 50%;
}

.cc-cols {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
}

.cc-col {
  position: relative;
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: default;
  outline: none;
}

.cc-bar {
  width: min(16px, calc(100% - 2px));
  background: var(--chart-bar);
  border-radius: 4px 4px 0 0;
  transition: filter 0.1s ease;
}

.cc-col.is-active .cc-bar,
.cc-col:focus-visible .cc-bar {
  filter: brightness(1.15);
}

.cc-col:focus-visible {
  box-shadow: inset 0 0 0 2px var(--primary-border);
  border-radius: 4px;
}

.cc-cap {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-main);
}

.cc-tooltip {
  position: absolute;
  top: -6px;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}

.cc-tooltip[hidden] {
  display: none;
}

.cc-tooltip strong {
  color: var(--text-main);
}

.cc-tooltip span {
  color: var(--text-muted);
  font-size: 10px;
}

.cc-axis {
  display: flex;
  margin-left: 22px;
  margin-top: 3px;
}

.cc-axis span {
  flex: 1;
  font-size: 9.5px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}

.cc-axis span:first-child {
  text-align: left;
}

.cc-axis span:last-child {
  text-align: right;
}

.chart-table-toggle {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.chart-table-toggle summary {
  cursor: pointer;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 4px;
}

.data-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.data-table td:first-child {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upcoming-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-app);
}

.upcoming-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 12px;
}

.upcoming-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Runner tab (scheduled sends / follow-ups open as a normal tab) */
body.runner-mode .app-container {
  max-width: 480px;
  margin: 0 auto;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 200;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

body.dark-theme .toast {
  background: #e5e7eb;
  color: #0f172a;
}

/* ==========================================================================
   Semantic text tokens + dark theme
   ========================================================================== */
:root {
  --success-text: #047857;
  --warning-text: #b45309;
  --danger-text: #b91c1c;
}

.alert-success {
  color: var(--success-text);
}

.upload-dropzone:hover {
  background: var(--primary-light);
}

.preview-envelope,
.info-card {
  background: var(--bg-card);
}

body.dark-theme {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.12);
  --primary-border: rgba(59, 130, 246, 0.35);
  --bg-app: #0b1120;
  --bg-card: #111827;
  --text-main: #e5e7eb;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #1f2937;
  --border-light: #1a2332;
  --success-light: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.35);
  --success-text: #6ee7b7;
  --warning-light: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.35);
  --warning-text: #fcd34d;
  --danger-light: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.35);
  --danger-text: #fca5a5;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

body.dark-theme .log-stream {
  background: #020617;
}

body.dark-theme .footer-dot {
  color: var(--border);
}

body.dark-theme .rich-editor:empty:before {
  color: #64748b;
}

/* --- Theme: Warm Sepia (Eye-Care) --- */
body.theme-sepia {
  --primary: #c25e00;
  --primary-hover: #9a4900;
  --primary-light: rgba(194, 94, 0, 0.12);
  --primary-border: rgba(194, 94, 0, 0.35);
  --bg-app: #f7f1e5;
  --bg-card: #fffdf8;
  --text-main: #3d3124;
  --text-secondary: #635240;
  --text-muted: #8c7864;
  --border: #e3d7c3;
  --border-light: #ece3d3;
  --success: #2e7d32;
  --success-light: #e8f5e9;
  --success-border: #c8e6c9;
  --warning: #b26a00;
  --warning-light: #fff8e1;
  --warning-border: #ffe082;
  --danger: #c62828;
  --danger-light: #ffebee;
  --danger-border: #ffcdd2;
  --shadow-sm: 0 1px 3px rgba(61, 49, 36, 0.08);
  color-scheme: light;
}
body.theme-sepia .log-stream { background: #ede2cf; color: #3d3124; }
body.theme-sepia .log-stream .log-time { color: #8c7864; }

/* --- Theme: Cyber Midnight OLED --- */
body.theme-midnight {
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-light: rgba(56, 189, 248, 0.12);
  --primary-border: rgba(56, 189, 248, 0.35);
  --bg-app: #030712;
  --bg-card: #0b0f19;
  --text-main: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border: #1f293d;
  --border-light: #111827;
  --success: #34d399;
  --success-light: rgba(52, 211, 153, 0.12);
  --success-border: rgba(52, 211, 153, 0.35);
  --warning: #fbbf24;
  --warning-light: rgba(251, 191, 36, 0.12);
  --warning-border: rgba(251, 191, 36, 0.35);
  --danger: #f87171;
  --danger-light: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}
body.theme-midnight .log-stream { background: #010409; }

/* --- Theme: Emerald Forest --- */
body.theme-forest {
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: rgba(16, 185, 129, 0.14);
  --primary-border: rgba(16, 185, 129, 0.38);
  --bg-app: #051a14;
  --bg-card: #0c271f;
  --text-main: #ecfdf5;
  --text-secondary: #a7f3d0;
  --text-muted: #6ee7b7;
  --border: #154636;
  --border-light: #0d3326;
  --success: #34d399;
  --success-light: rgba(52, 211, 153, 0.15);
  --success-border: rgba(52, 211, 153, 0.35);
  --warning: #fbbf24;
  --warning-light: rgba(251, 191, 36, 0.15);
  --warning-border: rgba(251, 191, 36, 0.35);
  --danger: #f87171;
  --danger-light: rgba(248, 113, 113, 0.15);
  --danger-border: rgba(248, 113, 113, 0.35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
body.theme-forest .log-stream { background: #03110d; }

/* --- Theme: High Contrast Studio --- */
body.theme-contrast {
  --primary: #ffd600;
  --primary-hover: #ffea00;
  --primary-light: #212121;
  --primary-border: #ffffff;
  --bg-app: #000000;
  --bg-card: #0a0a0a;
  --text-main: #ffffff;
  --text-secondary: #f5f5f5;
  --text-muted: #d4d4d4;
  --border: #404040;
  --border-light: #262626;
  --success: #00e676;
  --success-light: #003300;
  --success-border: #00e676;
  --warning: #ffab00;
  --warning-light: #332200;
  --warning-border: #ffab00;
  --danger: #ff1744;
  --danger-light: #330000;
  --danger-border: #ff1744;
  --shadow-sm: 0 0 0 1px #525252;
  color-scheme: dark;
}
body.theme-contrast .btn-primary {
  background: #ffd600;
  color: #000000;
  font-weight: 700;
}
body.theme-contrast .log-stream { background: #000000; border: 1px solid #404040; }

/* ==========================================================================
   Executive Contacts Section & Dropzone Upgrade
   ========================================================================== */
.upload-dropzone {
  position: relative;
  border: 2px dashed rgba(37, 99, 235, 0.4);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.02) 0%, rgba(37, 99, 235, 0.07) 100%);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-dropzone:hover {
  border-color: var(--primary);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.06) 0%, rgba(37, 99, 235, 0.12) 100%);
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.14);
  transform: translateY(-1px);
}

.upload-dropzone.drag-over {
  border-color: var(--primary);
  border-style: solid;
  background: rgba(37, 99, 235, 0.15);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25);
  transform: scale(1.01);
}

.dropzone-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.25);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  transition: transform 0.25s ease;
}

.upload-dropzone:hover .dropzone-icon-circle {
  transform: scale(1.08) translateY(-2px);
  background: rgba(37, 99, 235, 0.16);
}

.dropzone-main-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.btn-dropzone-browse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #ffffff;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
  pointer-events: none;
}

.dropzone-sub-or {
  font-size: 11px;
  color: var(--text-muted);
}

.dropzone-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.file-format-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 4px;
}

.file-format-badge.badge-xlsx {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.file-format-badge.badge-csv {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.3);
}

.file-format-badge.badge-xls {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Sample Toolkit Box */
.sample-toolkit-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease;
}

.sample-toolkit-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sample-toolkit-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
}

.sample-toolkit-subtitle {
  font-size: 10.5px;
  color: var(--text-muted);
}

.sample-toolkit-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-primary-soft {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.3);
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary-soft:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* Loaded File Bar Upgrade */
.loaded-file-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.file-meta-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.file-meta-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.file-meta-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.loaded-name-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

/* Column Mapping Tags & Previews */
.mapping-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 4px;
}

.mapping-badge.required-badge {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.mapping-badge.optional-badge {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.mapping-preview-note {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  font-style: italic;
  min-height: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mapping-preview-note.has-value {
  color: var(--primary);
  font-weight: 500;
  font-style: normal;
}

/* Cleaner Box Pro Badge */
.cleaner-box {
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

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

.cleaner-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
}

.cleaner-badge {
  font-size: 9.5px;
  font-weight: 700;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 9999px;
}

/* Preview Table & Search */
.preview-search-wrap {
  position: relative;
  width: 100%;
}

.preview-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.3px;
}

.recipient-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
}

.badge-table-status {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 9999px;
  text-align: center;
  white-space: nowrap;
}

.badge-table-status.status-valid {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-table-status.status-dupe {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-table-status.status-invalid {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   List Deliverability Health Meter
   ========================================================================== */
.list-health-meter {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.health-meter-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.health-meter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-main);
}

.health-shield-icon {
  font-size: 14px;
}

.health-rating-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  letter-spacing: 0.3px;
}

.health-rating-badge.badge-excellent {
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.health-rating-badge.badge-good {
  background: rgba(37, 99, 235, 0.14);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.health-rating-badge.badge-warning {
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.health-hint {
  font-size: 10.5px;
  color: var(--text-muted);
}

.health-progress-bar {
  height: 6px;
  width: 100%;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.15);
  display: flex;
  overflow: hidden;
  gap: 2px;
}

.health-bar-fill {
  height: 100%;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.health-bar-valid {
  background: linear-gradient(90deg, #10b981, #059669);
}

.health-bar-warning {
  background: #f59e0b;
}

.health-bar-danger {
  background: #ef4444;
}

.health-breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dot-success { background: #10b981; }
.dot-warning { background: #f59e0b; }
.dot-danger { background: #ef4444; }

/* ==========================================================================
   Modern iOS / Linear Switch Toggles
   ========================================================================== */
.cleaner-options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.switch-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 6px;
  position: relative;
  user-select: none;
  transition: background 0.15s ease;
}

.switch-toggle-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.switch-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  padding-right: 12px;
}

.switch-toggle-info strong {
  font-size: 11.5px;
  color: var(--text-main);
  font-weight: 600;
}

.switch-toggle-info span {
  font-size: 10px;
  color: var(--text-muted);
}

.switch-toggle-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.ios-switch {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.switch-slider {
  display: inline-block !important;
  width: 36px !important;
  height: 20px !important;
  background-color: #cbd5e1 !important;
  border-radius: 9999px !important;
  position: relative !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
}

.switch-slider::before {
  content: "" !important;
  position: absolute !important;
  height: 16px !important;
  width: 16px !important;
  left: 2px !important;
  top: 2px !important;
  background-color: #ffffff !important;
  border-radius: 50% !important;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) !important;
}

.ios-switch:checked + .switch-slider {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%) !important;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.35) !important;
}

.ios-switch:checked + .switch-slider::before {
  transform: translateX(16px) !important;
}

/* ==========================================================================
   Table Toolbar & Search Icon
   ========================================================================== */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.search-with-icon {
  padding-left: 28px !important;
  padding-right: 22px !important;
}

.search-icon-svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.btn-clear-search {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s ease;
}

.btn-clear-search:hover {
  color: var(--text-main);
}

/* Domain Chips in Table */
.domain-chip {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: 0.2px;
}

.domain-chip.chip-gmail {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.domain-chip.chip-outlook {
  background: rgba(2, 132, 199, 0.08);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.25);
}

.domain-chip.chip-yahoo {
  background: rgba(147, 51, 234, 0.08);
  color: #9333ea;
  border: 1px solid rgba(147, 51, 234, 0.25);
}

.domain-chip.chip-work {
  background: rgba(79, 70, 229, 0.08);
  color: #4f46e5;
  border: 1px solid rgba(79, 70, 229, 0.25);
}

/* Row Action Buttons */
.btn-row-action {
  background: none;
  border: none;
  padding: 3px;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0.5;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.preview-table tr:hover .btn-row-action {
  opacity: 1;
}

.btn-row-action:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  transform: scale(1.1);
}

/* ==========================================================================
   Campaign Tab Motion, Animations & Executive UX
   ========================================================================== */

/* 1. Stepper Pipeline */
.campaign-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: 9999px;
  width: fit-content;
  margin: 0 auto 16px auto;
}

.step-pill {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.step-pill.step-active {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.35);
}

.step-arrow {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* 2. Hero Icon Pulse Animation */
.empty-icon-pulse {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.25);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
  animation: pulseGlow 2.8s infinite;
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(37, 99, 235, 0);
    transform: scale(1.04);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    transform: scale(1);
  }
}

/* 3. Executive Audience Banner */
.audience-status-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(240, 253, 244, 0.9) 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 2px 10px -2px rgba(16, 185, 129, 0.12);
  transition: all 0.2s ease;
}

.audience-status-card:hover {
  box-shadow: 0 4px 14px -1px rgba(16, 185, 129, 0.18);
}

.pulse-indicator-emerald {
  width: 9px;
  height: 9px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: emeraldPulse 2s infinite;
  flex-shrink: 0;
}

@keyframes emeraldPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.audience-status-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-main);
}

.audience-status-sub {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Workspace Bar & Template Actions */
.workspace-bar {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1.5px solid var(--border-light, #e2e8f0);
  border-radius: 9px;
  padding: 8px 10px;
}

.workspace-bar .form-select {
  background-color: #ffffff;
  border: 1px solid var(--border-medium, #cbd5e1);
  border-radius: 6px;
  padding: 6px 10px;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.workspace-bar .form-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.template-actions .btn {
  border-radius: 6px;
  font-weight: 600;
  padding: 4px 8px;
  transition: all 0.18s ease;
}

.template-actions .btn:hover {
  transform: translateY(-1px);
}

/* 4. Sending Mode Cards (Executive Tier) */
.mode-radio-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border: 1.5px solid var(--border-light, #e2e8f0);
  border-radius: 10px;
  background: var(--bg-card, #ffffff);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.mode-radio-card input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #94a3b8;
  border-radius: 50%;
  outline: none;
  display: grid;
  place-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  background: #ffffff;
  flex-shrink: 0;
  margin-top: 2px;
}

.mode-radio-card input[type="radio"]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: scale(0);
  transition: 0.18s transform cubic-bezier(0.16, 1, 0.3, 1);
  background: #2563eb;
}

.mode-radio-card:hover {
  border-color: rgba(37, 99, 235, 0.4);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.mode-radio-card:hover input[type="radio"] {
  border-color: #2563eb;
}

.mode-radio-card:has(input[type="radio"]:checked) {
  border-color: #2563eb;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(239, 246, 255, 0.8) 100%);
  box-shadow: 0 0 0 1px #2563eb, 0 4px 16px -2px rgba(37, 99, 235, 0.18);
}

.mode-radio-card:has(input[type="radio"]:checked) input[type="radio"] {
  border-color: #2563eb;
  background: #eff6ff;
}

.mode-radio-card:has(input[type="radio"]:checked) input[type="radio"]::before {
  transform: scale(1);
}

.mode-card-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mode-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-main, #0f172a);
}

.mode-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1.5px 6px;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted, #64748b);
  letter-spacing: 0.2px;
}

.mode-badge.badge-primary {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.mode-badge.badge-popular {
  background: rgba(139, 92, 246, 0.15);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.mode-radio-desc {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

/* Dynamic Tags Toolbar & Chips */
.variable-toolbar {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 8px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.var-toolbar-label {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.var-chips-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

.var-chips-scroll::-webkit-scrollbar {
  height: 4px;
}

.var-chips-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.var-chips-scroll::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.25);
  border-radius: 9999px;
}

.var-chips-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}

.var-chip {
  background: #ffffff;
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #4f46e5;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.var-chip:hover {
  background: #4f46e5;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.25);
}

.var-chip:active {
  transform: translateY(0);
}

/* Editor Toolbar & Box */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1.5px solid var(--border-light, #e2e8f0);
  border-bottom: 1px solid var(--border-light, #e2e8f0);
  border-radius: 8px 8px 0 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.editor-toolbar::-webkit-scrollbar {
  display: none;
}

.editor-toolbar .tool-btn {
  border: none;
  background: transparent;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.editor-toolbar .tool-btn:hover {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.editor-toolbar .tool-divider {
  width: 1px;
  height: 14px;
  background: var(--border-medium, #cbd5e1);
  margin: 0 3px;
}

.rich-editor {
  border-radius: 0 0 8px 8px;
  border: 1.5px solid var(--border-light, #e2e8f0);
  border-top: none;
  padding: 12px 14px;
  min-height: 120px;
  font-size: 13px;
  line-height: 1.6;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  background: #ffffff;
}

.rich-editor:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Executive Grouped Options Card (Apple iOS Settings Style) */
.composer-options-group {
  background: var(--bg-card, #ffffff);
  border: 1.5px solid var(--border-light, #e2e8f0);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.composer-options-group:hover {
  border-color: rgba(37, 99, 235, 0.3);
}

.composer-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
  gap: 12px;
}

.composer-option-row:hover {
  background: rgba(248, 250, 252, 0.85);
}

.option-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.option-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.option-text {
  display: flex;
  flex-direction: column;
  gap: 1.5px;
  min-width: 0;
}

.option-text strong {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  line-height: 1.3;
}

.option-text span {
  font-size: 10px;
  color: var(--text-muted, #64748b);
  line-height: 1.3;
}

.option-divider {
  height: 1px;
  background: var(--border-light, #e2e8f0);
  margin: 0 14px;
}

.signature-dropdown-area {
  padding: 0 14px 12px 14px;
  animation: fadeInDown 0.2s ease;
}

.signature-inner-box {
  background: #f8fafc;
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 8px;
  padding: 8px 10px;
}

.signature-box-label {
  font-size: 10.5px;
  font-weight: 600;
  color: #475569;
}

.signature-textarea {
  background: #ffffff !important;
  border: 1px solid var(--border-medium, #cbd5e1) !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  padding: 8px !important;
  width: 100% !important;
  resize: vertical !important;
  min-height: 60px !important;
}

.signature-textarea:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12) !important;
}

/* Pacing & Delays Cards */
.delay-settings-block {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1.5px solid var(--border-light, #e2e8f0);
  border-radius: 10px;
  padding: 12px 14px;
}

.pacing-segmented-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pacing-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1.5px solid var(--border-light, #e2e8f0);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pacing-card input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid #94a3b8;
  border-radius: 50%;
  outline: none;
  display: grid;
  place-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
  background: #ffffff;
  flex-shrink: 0;
  margin-top: 2px;
}

.pacing-card input[type="radio"]::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: scale(0);
  transition: 0.15s transform ease;
  background: #2563eb;
}

.pacing-card:hover {
  border-color: rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.pacing-card:has(input[type="radio"]:checked) {
  border-color: #2563eb;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04) 0%, rgba(239, 246, 255, 0.7) 100%);
  box-shadow: 0 0 0 1px #2563eb;
}

.pacing-card:has(input[type="radio"]:checked) input[type="radio"] {
  border-color: #2563eb;
  background: #eff6ff;
}

.pacing-card:has(input[type="radio"]:checked) input[type="radio"]::before {
  transform: scale(1);
}

.pacing-card-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

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

.pacing-card-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main, #0f172a);
}

.pacing-rec-pill {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.pacing-card-sub {
  font-size: 10px;
  color: var(--text-muted, #64748b);
}

.pacing-input-pill {
  display: inline-flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-medium, #cbd5e1);
  border-radius: 6px;
  padding: 2px 6px;
  gap: 4px;
}

.form-input-pill {
  width: 44px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  text-align: center;
  outline: none;
  padding: 2px 0;
}

.pacing-unit {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
}

.pacing-label {
  font-size: 11px;
  color: #475569;
}

/* Follow-up Sequences Card */
.followup-card {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.04) 0%, rgba(245, 243, 255, 0.7) 100%);
  border: 1.5px solid rgba(139, 92, 246, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
}

/* Test Email Card */
.test-email-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1.5px solid var(--border-light, #e2e8f0);
  border-radius: 10px;
  padding: 10px 14px;
}

.test-email-input-group {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.test-input {
  flex: 1;
  border-radius: 8px !important;
  font-size: 12px !important;
}

.test-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  font-size: 11.5px !important;
  padding: 6px 14px !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25) !important;
}

.test-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35) !important;
}

/* Executive Campaign Launch CTA */
.btn-campaign-launch {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  padding: 12px 18px !important;
  border-radius: 10px !important;
  border: none !important;
  box-shadow: 0 4px 14px -1px rgba(37, 99, 235, 0.4), 0 2px 4px -1px rgba(37, 99, 235, 0.2) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  position: relative !important;
  overflow: hidden !important;
  cursor: pointer !important;
}

.btn-campaign-launch:hover {
  transform: translateY(-1.5px) !important;
  box-shadow: 0 6px 20px -2px rgba(37, 99, 235, 0.5) !important;
}

.btn-campaign-launch:hover .btn-arrow-icon {
  transform: translateX(4px) !important;
}

.btn-arrow-icon {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  font-size: 15px !important;
}

/* 5. Deliverability Meter Track in Composer */
.spam-meter-track {
  height: 4px;
  width: 100%;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.spam-meter-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.35s ease, background 0.35s ease;
}

/* 6. Live Runner Shimmer & Radar Ping */
.live-radar-ping {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: radarPing 1.8s infinite;
  flex-shrink: 0;
}

@keyframes radarPing {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.progress-track {
  position: relative;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.progress-fill {
  background: linear-gradient(90deg, #2563eb 0%, #60a5fa 50%, #2563eb 100%);
  background-size: 200% 100%;
  animation: shimmerProgress 2s infinite linear;
}

@keyframes shimmerProgress {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.progress-fill.completed {
  background: #10b981 !important;
  animation: none;
}

.live-eta-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.25);
  padding: 1px 7px;
  border-radius: 9999px;
}

/* 7. macOS Terminal Stream in Live Runner */
.terminal-dots {
  display: flex;
  align-items: center;
}

.terminal-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.terminal-dot.dot-red { background: #ff5f56; }
.terminal-dot.dot-yellow { background: #ffbd2e; }
.terminal-dot.dot-green { background: #27c93f; }

.terminal-title {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.log-counter-pill {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

.current-rec-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.rec-header-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--primary);
}




