/* =====================================================================
   RysUpAudio Hub — Unified Dashboard (Support + Email Marketing)
   ===================================================================== */

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

:root {
  --bg: #050510;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: 1px solid rgba(255, 255, 255, 0.15);
  --glass-radius: 16px;
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --accent: #CE2C2C;
  --accent-glow: #ff6b6b;
  --text: rgba(255, 255, 255, 0.92);
  --text-muted: rgba(255, 255, 255, 0.65);
  --text-dim: rgba(255, 255, 255, 0.4);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --nav-height: 56px;
  --content-max: 1400px;
  --sidebar-width: 380px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }

/* =====================================================================
   SCROLLBAR
   ===================================================================== */
.scrollbar-thin { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.1) transparent; }
.scrollbar-thin::-webkit-scrollbar { width: 4px; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }

/* =====================================================================
   ANIMATIONS
   ===================================================================== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

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

@keyframes urgent-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

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

/* =====================================================================
   APP SHELL
   ===================================================================== */
.app {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease;
}

/* =====================================================================
   NAVIGATION BAR (BEM: .nav-bar)
   ===================================================================== */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(5, 5, 16, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 50;
}

.nav-bar__brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-right: 40px;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-bar__brand span {
  color: var(--accent);
}

.nav-bar__links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-bar__links::-webkit-scrollbar { display: none; }

.nav-link {
  position: relative;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

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

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.nav-bar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Hamburger menu button (mobile only) */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
  transition: color 0.15s;
}

.nav-hamburger:hover {
  color: var(--text);
}

/* Mobile slide-out menu */
.nav-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.nav-mobile-overlay.open {
  display: block;
}

.nav-mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 260px;
  background: rgba(10, 10, 28, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.nav-mobile-drawer.open {
  transform: translateX(0);
}

.nav-mobile-drawer__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  align-self: flex-end;
  padding: 4px;
  margin-bottom: 16px;
}

.nav-mobile-drawer .nav-link {
  display: block;
  padding: 12px 16px;
  font-size: 15px;
  border-radius: 10px;
}

.nav-mobile-drawer .nav-link.active::after {
  display: none;
}

.nav-mobile-drawer .nav-link.active {
  background: rgba(206, 44, 44, 0.12);
  color: var(--accent-glow);
}

/* =====================================================================
   CONTENT AREA
   ===================================================================== */
.content {
  margin-top: var(--nav-height);
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.content::-webkit-scrollbar { width: 4px; }
.content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }
.content::-webkit-scrollbar-track { background: transparent; }

.content-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  animation: fadeIn 0.25s ease;
}

/* Page header (title + action button row) */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.page-header h1 span {
  color: var(--accent);
}

.page-header__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* =====================================================================
   CARDS
   ===================================================================== */
.card {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  padding: 20px;
  margin-bottom: 16px;
}

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

.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.card-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.card-header__actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.card-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.card-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.card-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* =====================================================================
   STAT CARDS
   ===================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

/* Also support the support-dashboard name */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.stat-card {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: 12px;
  padding: 16px 14px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.stat-card__value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-card__label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card__change {
  font-size: 11px;
  margin-top: 4px;
  font-weight: 600;
}

.stat-card__change--up { color: #22c55e; }
.stat-card__change--down { color: #ef4444; }
.stat-card__change--neutral { color: var(--text-dim); }

.stat-card--accent .stat-card__value { color: var(--accent-glow); }
.stat-card--alert .stat-card__value { color: var(--accent-glow); }
.stat-card--green .stat-card__value { color: #22c55e; }
.stat-card--blue .stat-card__value { color: #3b82f6; }
.stat-card--draft { border-color: rgba(255, 193, 7, 0.3); }
.stat-card--draft .stat-card__value { color: #ffc107; }

/* Compact stat cards (support sidebar) */
.stats-grid .stat-card {
  padding: 10px 8px;
  border-radius: 10px;
}

.stats-grid .stat-card__value {
  font-size: 22px;
}

.stats-grid .stat-card__label {
  font-size: 10px;
  margin-top: 3px;
  letter-spacing: 0.4px;
}

/* =====================================================================
   TABLES
   ===================================================================== */
.table-card {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

.table-card__header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.table-card__header h2 {
  font-size: 15px;
  font-weight: 600;
}

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

.table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.table tbody tr {
  transition: background 0.15s, border-color 0.15s;
}

.table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

.table tbody tr.clickable {
  cursor: pointer;
}

.table tbody tr.clickable:hover {
  border-left: 3px solid var(--accent);
}

.table tbody tr.clickable:hover td:first-child {
  padding-left: 13px;
}

.table--compact td,
.table--compact th {
  padding: 8px 12px;
}

.table__empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-dim);
  font-size: 14px;
}

/* Sortable column header */
.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable:hover {
  color: var(--text-muted);
}

.table th.sortable::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.3;
}

.table th.sortable.sort-asc::after {
  border-top: none;
  border-bottom: 4px solid currentColor;
  opacity: 0.7;
}

.table th.sortable.sort-desc::after {
  opacity: 0.7;
}

/* Email-specific table (legacy) */
.email-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.email-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.email-table td {
  padding: 8px 12px;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.email-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* =====================================================================
   FORMS
   ===================================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

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

.input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: rgba(206, 44, 44, 0.5);
  box-shadow: 0 0 0 3px rgba(206, 44, 44, 0.1);
}

.input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.input--error {
  border-color: rgba(239, 68, 68, 0.5);
}

.input--error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.select {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.4)' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.select:focus {
  border-color: rgba(206, 44, 44, 0.5);
  box-shadow: 0 0 0 3px rgba(206, 44, 44, 0.1);
}

.select option {
  background: #1a1a2e;
  color: var(--text);
}

.textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.textarea:focus {
  border-color: rgba(206, 44, 44, 0.5);
  box-shadow: 0 0 0 3px rgba(206, 44, 44, 0.1);
}

.textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* Inline form row */
.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-row label {
  font-size: 14px;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  margin: 0;
}

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: background 0.2s;
}

.toggle-switch .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .slider {
  background: var(--accent);
}

.toggle-switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}

.checkbox-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.checkbox-label input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Primary */
.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: #e03333; }

.btn-primary:focus-visible {
  box-shadow: 0 0 0 3px rgba(206, 44, 44, 0.3);
}

/* Secondary */
.btn-secondary {
  background: var(--glass-bg);
  border: var(--glass-border);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Danger */
.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 12px;
}

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

/* Outline */
.btn-outline {
  background: transparent;
  border: var(--glass-border);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

/* Small */
.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;
}

/* Icon button */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Button group */
.btn-group {
  display: flex;
  gap: 6px;
}

/* Support-specific action buttons */
.btn-approve {
  background: #4caf50;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-approve:hover { background: #43a047; }

.btn-edit-draft {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
  border: 1px solid rgba(255, 193, 7, 0.3);
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-edit-draft:hover { background: rgba(255, 193, 7, 0.3); }

.btn-reject {
  background: rgba(206, 44, 44, 0.2);
  color: #ef5350;
  border: 1px solid rgba(206, 44, 44, 0.3);
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-reject:hover { background: rgba(206, 44, 44, 0.3); }

/* Legacy nav-btn (support sidebar) */
.nav-btn {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: 8px;
  color: var(--text-muted);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.15s, border-color 0.15s;
}

.nav-btn:hover, .nav-btn.active {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.25);
}

/* =====================================================================
   BADGES
   ===================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Support status badges */
.badge-resolved { background: rgba(50, 200, 100, 0.15); color: #32c864; }
.badge-open { background: rgba(255, 160, 64, 0.15); color: #ffa040; }
.badge-escalated { background: rgba(255, 107, 107, 0.2); color: #ff6b6b; }
.badge-awaiting_reply { background: rgba(255, 200, 50, 0.15); color: #ffc832; }
.badge-awaiting-reply { background: rgba(255, 200, 50, 0.15); color: #ffc832; }
.badge-auto-resolved { background: rgba(100, 140, 255, 0.15); color: #648cff; }
.badge-auto_resolved { background: rgba(100, 140, 255, 0.15); color: #648cff; }
.badge-closed { background: rgba(136, 136, 136, 0.15); color: #888; }
.badge-urgent {
  background: rgba(255, 50, 50, 0.3);
  color: #ff4444;
  animation: urgent-pulse 2s ease-in-out infinite;
}

/* Campaign status badges */
.badge-draft { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.badge-scheduled { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-sending { background: rgba(234, 179, 8, 0.15); color: #fbbf24; animation: pulse 2s ease-in-out infinite; }
.badge-sent { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.badge-paused { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.badge-cancelled { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-active { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.badge-inactive { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

/* Spend tier badges */
.badge-none { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.badge-low { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-mid { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.badge-high { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.badge-vip { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

/* DAW badges */
.badge-daw {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}

/* Flow trigger type badges */
.badge-post_purchase { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.badge-win_back { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.badge-review_request { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-new_product { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.badge-welcome { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.badge-abandoned_cart { background: rgba(234, 179, 8, 0.15); color: #fbbf24; }

/* Inline conversation item badge (support) */
.conv-item__badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* =====================================================================
   SUPPORT INBOX — SPLIT-PANEL LAYOUT
   ===================================================================== */
.inbox-layout {
  display: flex;
  height: 100%;
}

.inbox-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.inbox-sidebar::-webkit-scrollbar { width: 4px; }
.inbox-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

.inbox-detail {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.inbox-detail::-webkit-scrollbar { width: 4px; }
.inbox-detail::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

/* Empty state for right panel */
.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  gap: 12px;
}

.detail-empty__icon {
  font-size: 48px;
  opacity: 0.3;
}

.detail-empty__text {
  font-size: 15px;
}

/* Sidebar header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 16px;
  flex-shrink: 0;
}

.app-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.app-header h1 span {
  color: var(--accent);
}

.app-header nav {
  display: flex;
  gap: 6px;
}

/* Filter tabs (support sidebar) */
.filter-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.filter-tab {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  color: var(--text-dim);
  padding: 5px 12px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}

.filter-tab:hover { color: var(--text-muted); border-color: rgba(255, 255, 255, 0.15); }
.filter-tab.active { color: var(--text); background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); }

/* =====================================================================
   CONVERSATION LIST (Support Sidebar)
   ===================================================================== */
.conv-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.conv-list::-webkit-scrollbar { width: 4px; }
.conv-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

.conv-item {
  background: var(--glass-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
}

.conv-item:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
}

.conv-item--active {
  border-color: rgba(206, 44, 44, 0.4);
  background: rgba(206, 44, 44, 0.08);
}

.conv-item--active:hover {
  border-color: rgba(206, 44, 44, 0.5);
  background: rgba(206, 44, 44, 0.1);
}

.conv-item__body {
  min-width: 0;
  flex: 1;
}

.conv-item__email {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item__preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.conv-item__meta {
  text-align: right;
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
  white-space: nowrap;
}

/* =====================================================================
   CONVERSATION DETAIL (Support Right Panel)
   ===================================================================== */
.conv-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 720px;
  height: 100%;
}

.conv-detail__back {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  font-family: var(--font);
  padding: 0;
  transition: color 0.15s;
  align-self: flex-start;
}

.conv-detail__back:hover { color: var(--text); }

.conv-detail__info {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.conv-detail__info-text {
  font-size: 14px;
}

.conv-detail__info-text span {
  color: var(--text-muted);
  font-size: 12px;
}

.conv-detail__actions {
  display: flex;
  gap: 6px;
}

/* =====================================================================
   ORDER HISTORY (Support Detail)
   ===================================================================== */
.order-history {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: 12px;
  padding: 14px 16px;
  flex-shrink: 0;
}

.order-history h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.order-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
}

.order-card:last-child { margin-bottom: 0; }

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

.order-card__number {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.order-card__link {
  color: #64b5f6;
  text-decoration: none;
  cursor: pointer;
}

.order-card__link:hover {
  text-decoration: underline;
  color: #90caf9;
}

.order-card__total {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-glow);
}

.order-card__meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.order-card__items {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 6px;
}

.order-card__item {
  font-size: 12px;
  color: var(--text);
  padding: 1px 0;
}

.order-card__variant {
  color: var(--text-muted);
  font-size: 11px;
}

.order-card__empty {
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 0;
}

/* =====================================================================
   MESSAGE THREAD (Support Detail)
   ===================================================================== */
.msg-thread {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--glass-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.msg-thread::-webkit-scrollbar { width: 4px; }
.msg-thread::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

.msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.msg-bubble a { color: var(--accent-glow); }

/* Customer messages: left-aligned, dark glass */
.msg-bubble--customer {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* Admin/Claude messages: right-aligned, accent tint */
.msg-bubble--auto,
.msg-bubble--claude,
.msg-bubble--admin {
  align-self: flex-end;
  background: rgba(206, 44, 44, 0.15);
  border: 1px solid rgba(206, 44, 44, 0.25);
  color: var(--text);
}

.msg-bubble__meta {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
}

.msg-bubble__meta .show-original-link {
  color: var(--accent-glow);
  text-decoration: none;
  cursor: pointer;
}

.msg-bubble__original {
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(206, 44, 44, 0.1);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  font-style: italic;
}

.lang-badge {
  background: rgba(206, 44, 44, 0.2);
  color: var(--accent-glow);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* =====================================================================
   REPLY BOX (Support Detail)
   ===================================================================== */
.reply-box {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.reply-box textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  resize: none;
  min-height: 48px;
  max-height: 120px;
}

.reply-box textarea:focus {
  border-color: rgba(255, 255, 255, 0.25);
}

.reply-box textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* =====================================================================
   DRAFT BANNER (Support Detail)
   ===================================================================== */
.draft-banner {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 12px;
  padding: 14px;
  flex-shrink: 0;
}

.draft-banner__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ffc107;
}

.draft-banner__message {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text);
}

.draft-banner__edit {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  display: none;
}

.draft-banner__actions {
  display: flex;
  gap: 8px;
}

/* =====================================================================
   DRAFTS QUEUE (Support Sidebar)
   ===================================================================== */
.drafts-section {
  margin-bottom: 16px;
  flex-shrink: 0;
}

.drafts-section__title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ffc107;
  margin-bottom: 8px;
}

.draft-item {
  background: rgba(255, 193, 7, 0.05);
  border: 1px solid rgba(255, 193, 7, 0.15);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.draft-item:hover {
  border-color: rgba(255, 193, 7, 0.4);
}

.draft-item__email {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.draft-item__preview {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =====================================================================
   PROGRESS BAR
   ===================================================================== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-glow));
  transition: width 0.4s ease;
}

.progress-bar--sm {
  height: 4px;
}

.progress-bar--lg {
  height: 12px;
  border-radius: 6px;
}

.progress-bar--lg .progress-bar__fill {
  border-radius: 6px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* =====================================================================
   CHARTS (CSS Only)
   ===================================================================== */
.chart-container {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.chart-container__title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.chart-bar-group {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding-bottom: 32px;
}

.chart-bar-group--horizontal {
  flex-direction: column;
  height: auto;
  align-items: stretch;
  gap: 10px;
  padding-bottom: 0;
}

.chart-bar-col {
  flex: 1;
  min-width: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  max-width: 36px;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.4s ease;
  position: relative;
}

.chart-bar--accent { background: rgba(206, 44, 44, 0.4); }
.chart-bar--blue { background: rgba(59, 130, 246, 0.4); }
.chart-bar--green { background: rgba(34, 197, 94, 0.4); }
.chart-bar--purple { background: rgba(168, 85, 247, 0.4); }
.chart-bar--orange { background: rgba(249, 115, 22, 0.4); }
.chart-bar--yellow { background: rgba(234, 179, 8, 0.4); }

.chart-bar:hover {
  filter: brightness(1.3);
}

.chart-bar__tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: var(--text);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  margin-bottom: 4px;
  pointer-events: none;
}

.chart-bar:hover .chart-bar__tooltip {
  display: block;
}

.chart-bar-label {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 6px;
  white-space: nowrap;
  text-align: center;
  max-width: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-bar-value {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

/* Horizontal bar */
.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-bar-row__label {
  font-size: 13px;
  color: var(--text);
  width: 120px;
  flex-shrink: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.chart-bar-row__track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.chart-bar-row__fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.chart-bar-row__value {
  font-size: 12px;
  color: var(--text-muted);
  width: 60px;
  text-align: right;
  flex-shrink: 0;
}

/* Legend */
.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.chart-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-legend__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-legend__dot--accent { background: rgba(206, 44, 44, 0.7); }
.chart-legend__dot--blue { background: rgba(59, 130, 246, 0.7); }
.chart-legend__dot--green { background: rgba(34, 197, 94, 0.7); }
.chart-legend__dot--purple { background: rgba(168, 85, 247, 0.7); }
.chart-legend__dot--orange { background: rgba(249, 115, 22, 0.7); }
.chart-legend__dot--yellow { background: rgba(234, 179, 8, 0.7); }

/* Support analytics bar charts (legacy) */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding-bottom: 28px;
  overflow-x: auto;
}

.bar-chart__col {
  flex: 1;
  min-width: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.bar-chart__bar {
  width: 100%;
  max-width: 32px;
  border-radius: 4px 4px 0 0;
  background: rgba(100, 140, 255, 0.25);
  position: relative;
  overflow: hidden;
  min-height: 4px;
}

.bar-chart__seg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
}

.bar-chart__seg--auto { background: rgba(50, 200, 100, 0.5); }
.bar-chart__seg--esc { background: rgba(255, 200, 50, 0.5); }
.bar-chart__seg--urgent { background: rgba(255, 50, 50, 0.6); }

.bar-chart__label {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 4px;
  white-space: nowrap;
}

.bar-chart__count {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 600;
}

.bar-chart__legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.legend-dot--auto { background: rgba(50, 200, 100, 0.7); }
.legend-dot--esc { background: rgba(255, 200, 50, 0.7); }
.legend-dot--urgent { background: rgba(255, 50, 50, 0.7); }

/* Category breakdown (support analytics) */
.cat-row {
  display: grid;
  grid-template-columns: 120px 1fr 80px;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.cat-row__label {
  font-size: 13px;
  color: var(--text);
  text-transform: capitalize;
}

.cat-row__bar-wrap {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.cat-row__bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s;
}

.cat-row__value {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

/* =====================================================================
   EMAIL ANALYTICS
   ===================================================================== */
.email-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
  overflow-y: auto;
  padding-bottom: 40px;
}

.email-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

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

@media (min-width: 600px) {
  .email-stats-grid { grid-template-columns: repeat(6, 1fr); }
}

.email-stat--good .stat-card__value { color: #4caf50; }

.email-bar--open {
  background: rgba(100, 180, 255, 0.3);
  border-radius: 4px 4px 0 0;
}

.email-bar--click {
  background: #7b2ff7;
  border-radius: 4px;
}

.email-seg--click {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(123, 47, 247, 0.6);
}

.email-dot--open { background: rgba(100, 180, 255, 0.7); }
.email-dot--click { background: rgba(123, 47, 247, 0.7); }

.email-chart--wide {
  min-height: 180px;
}

.email-url-label {
  font-size: 12px !important;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Email preview button */
.email-preview-btn {
  padding: 4px 12px !important;
  font-size: 11px !important;
}

/* Email list cleanup */
.cleanup-rule {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
}

.cleanup-rule__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.cleanup-rule__desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.cleanup-rule__actions {
  margin-bottom: 12px;
}

.cleanup-preview {
  background: rgba(229, 57, 53, 0.08);
  border: 1px solid rgba(229, 57, 53, 0.2);
  border-radius: 10px;
  padding: 14px;
  margin-top: 12px;
}

.cleanup-preview__count {
  font-size: 18px;
  font-weight: 700;
  color: #ef5350;
}

.cleanup-preview__detail {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

.cleanup-result--good {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.3);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  color: #4caf50;
  margin-top: 12px;
}

.cleanup-result--error {
  background: rgba(229, 57, 53, 0.1);
  border: 1px solid rgba(229, 57, 53, 0.3);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  color: #ef5350;
  margin-top: 12px;
}

/* =====================================================================
   EMAIL PREVIEW MODAL
   ===================================================================== */
.email-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-preview-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.email-preview-modal__content {
  position: relative;
  width: 90%;
  max-width: 750px;
  height: 85vh;
  background: var(--bg);
  border: var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.email-preview-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.email-preview-iframe {
  flex: 1;
  border: none;
  background: #fff;
  border-radius: 0 0 var(--glass-radius) var(--glass-radius);
}

/* =====================================================================
   MODAL
   ===================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  background: rgba(10, 10, 28, 0.98);
  border: var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

.modal--wide {
  max-width: 900px;
}

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

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}

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

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

/* =====================================================================
   SEGMENT BUILDER
   ===================================================================== */
.rule-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--glass-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.rule-row .select,
.rule-row .input {
  width: auto;
  flex: 1;
  min-width: 120px;
  padding: 8px 12px;
  font-size: 13px;
}

.rule-row .select {
  min-width: 140px;
}

.rule-row__remove {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}

.rule-row__remove:hover {
  color: #ef4444;
}

.rule-connector {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  text-align: center;
  padding: 4px 0;
}

.add-rule-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font);
  padding: 10px 16px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  width: 100%;
  justify-content: center;
}

.add-rule-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text);
}

.segment-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(206, 44, 44, 0.08);
  border: 1px solid rgba(206, 44, 44, 0.2);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text);
  margin-top: 12px;
}

.segment-count__number {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-glow);
}

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

.segment-count .loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* =====================================================================
   FLOW EDITOR / TIMELINE
   ===================================================================== */
.flow-timeline {
  position: relative;
  padding-left: 32px;
}

.flow-timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.flow-step {
  position: relative;
  margin-bottom: 16px;
}

.flow-step__marker {
  position: absolute;
  left: -32px;
  top: 16px;
  width: 28px;
  height: 28px;
  background: rgba(206, 44, 44, 0.15);
  border: 2px solid rgba(206, 44, 44, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-glow);
  z-index: 1;
}

.flow-step__card {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: 12px;
  padding: 16px;
  transition: border-color 0.15s;
}

.flow-step__card:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

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

.flow-step__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.flow-step__type {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.flow-step__body {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.flow-step__actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

/* Delay badge between steps */
.flow-delay {
  position: relative;
  margin: 8px 0;
  padding-left: 0;
  text-align: center;
}

.flow-delay__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #60a5fa;
}

.flow-add-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--font);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  width: 100%;
}

.flow-add-step:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-muted);
}

/* =====================================================================
   TABS
   ===================================================================== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--text);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px 1px 0 0;
}

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

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

/* Pill tabs (alternate style) */
.tabs-pills {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-pill {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  color: var(--text-dim);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}

.tab-pill:hover {
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.15);
}

.tab-pill.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

/* =====================================================================
   SEARCH BAR
   ===================================================================== */
.search-bar {
  position: relative;
  margin-bottom: 16px;
}

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

.search-bar .input {
  padding-left: 40px;
}

.search-bar--inline {
  margin-bottom: 0;
}

.search-bar--sm .input {
  padding: 8px 12px 8px 36px;
  font-size: 13px;
}

.search-bar--sm .search-bar__icon {
  left: 12px;
  font-size: 13px;
}

/* =====================================================================
   PAGINATION
   ===================================================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0;
}

.pagination__btn {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font);
  padding: 8px 16px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.pagination__btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.25);
}

.pagination__btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination__info {
  font-size: 13px;
  color: var(--text-dim);
}

.pagination__info strong {
  color: var(--text);
}

/* =====================================================================
   FILTER ROW
   ===================================================================== */
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-row .select {
  width: auto;
  min-width: 140px;
  padding: 8px 36px 8px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(206, 44, 44, 0.1);
  border: 1px solid rgba(206, 44, 44, 0.2);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--accent-glow);
}

.filter-pill__remove {
  background: none;
  border: none;
  color: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.filter-pill__remove:hover {
  opacity: 1;
}

.filter-row__clear {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s;
}

.filter-row__clear:hover {
  color: var(--text-muted);
}

/* Date range picker */
.date-range-picker {
  display: flex;
  gap: 6px;
}

/* =====================================================================
   EMPTY STATE
   ===================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  color: var(--text-dim);
}

.empty-state__icon {
  font-size: 48px;
  opacity: 0.25;
  margin-bottom: 16px;
}

.empty-state__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.empty-state__text {
  font-size: 14px;
  color: var(--text-dim);
  max-width: 360px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.empty-state__action {
  margin-top: 4px;
}

/* =====================================================================
   LOGIN CARD
   ===================================================================== */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  padding: 24px;
}

.login-card {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  padding: 40px 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  animation: slideUp 0.3s ease;
}

.login-card__logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.login-card__logo span {
  color: var(--accent);
}

.login-card__subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.login-card h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.login-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.login-card .form-group {
  text-align: left;
}

.login-card .btn {
  width: 100%;
  margin-top: 16px;
}

.login-card__error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  color: #f87171;
  margin-top: 12px;
}

/* =====================================================================
   TOAST NOTIFICATIONS
   ===================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 10, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  animation: slideInRight 0.3s ease;
  max-width: 380px;
}

.toast--dismiss {
  animation: slideOutRight 0.25s ease forwards;
}

.toast__icon {
  font-size: 16px;
  flex-shrink: 0;
}

.toast__message {
  flex: 1;
  line-height: 1.4;
}

.toast__close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
  transition: color 0.15s;
}

.toast__close:hover {
  color: var(--text);
}

.toast--success { border-color: rgba(34, 197, 94, 0.3); }
.toast--success .toast__icon { color: #22c55e; }

.toast--error { border-color: rgba(239, 68, 68, 0.3); }
.toast--error .toast__icon { color: #ef4444; }

.toast--info { border-color: rgba(59, 130, 246, 0.3); }
.toast--info .toast__icon { color: #3b82f6; }

.toast--warning { border-color: rgba(234, 179, 8, 0.3); }
.toast--warning .toast__icon { color: #eab308; }

/* =====================================================================
   CAMPAIGN EDITOR SPECIFIC
   ===================================================================== */
.email-editor-wrapper {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
}

.email-editor-sidebar {
  position: sticky;
  top: 0;
}

.email-preview-frame {
  width: 100%;
  min-height: 500px;
  border: none;
  background: #fff;
  border-radius: 10px;
}

.subject-line-input {
  font-size: 18px;
  font-weight: 600;
  padding: 16px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: var(--text);
  width: 100%;
  outline: none;
  font-family: var(--font);
  transition: border-color 0.15s;
}

.subject-line-input:focus {
  border-color: rgba(206, 44, 44, 0.4);
}

.subject-line-input::placeholder {
  color: var(--text-dim);
}

/* Send schedule picker */
.schedule-picker {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: 12px;
  padding: 16px;
}

.schedule-picker__option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.schedule-picker__option:hover {
  background: rgba(255, 255, 255, 0.04);
}

.schedule-picker__option.active {
  background: rgba(206, 44, 44, 0.08);
  border: 1px solid rgba(206, 44, 44, 0.2);
}

.schedule-picker__option input[type="radio"] {
  accent-color: var(--accent);
}

/* =====================================================================
   SUBSCRIBER DETAIL PANEL
   ===================================================================== */
.subscriber-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.subscriber-detail__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(206, 44, 44, 0.15);
  border: 2px solid rgba(206, 44, 44, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-glow);
  flex-shrink: 0;
}

.subscriber-detail__info h2 {
  font-size: 16px;
  font-weight: 600;
}

.subscriber-detail__info p {
  font-size: 13px;
  color: var(--text-muted);
}

.subscriber-detail__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.meta-item {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

.meta-item__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.meta-item__value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* =====================================================================
   ANALYTICS SPECIFIC
   ===================================================================== */
.analytics-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.analytics-section {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--glass-radius);
  padding: 20px;
}

.analytics-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.analytics-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.analytics-grid--full {
  grid-template-columns: 1fr;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-row__label {
  font-size: 13px;
  color: var(--text-muted);
}

.metric-row__value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* =====================================================================
   SETTINGS
   ===================================================================== */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-nav__link {
  background: none;
  border: none;
  text-align: left;
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--font);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.settings-nav__link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.settings-nav__link.active {
  color: var(--text);
  background: rgba(206, 44, 44, 0.08);
}

.settings-panel {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  padding: 24px;
}

.settings-panel h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.settings-panel p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.settings-section {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.settings-section__title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Legacy settings-card (support) */
.settings-card {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--glass-radius);
  padding: 24px;
  max-width: 600px;
  margin: 0 auto;
}

.settings-card h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.settings-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* =====================================================================
   LOADING & SPINNER
   ===================================================================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-dim);
  font-size: 14px;
  gap: 10px;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.loading-spinner--sm {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

.loading-spinner--lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 6px;
}

.skeleton--text { height: 14px; width: 80%; margin-bottom: 8px; }
.skeleton--text-sm { height: 10px; width: 60%; margin-bottom: 6px; }
.skeleton--heading { height: 22px; width: 40%; margin-bottom: 12px; }
.skeleton--stat { height: 32px; width: 50%; margin-bottom: 6px; }
.skeleton--avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton--card { height: 120px; width: 100%; margin-bottom: 12px; }

/* =====================================================================
   UTILITY CLASSES
   ===================================================================== */
.text-accent { color: var(--accent-glow); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-green { color: #22c55e; }
.text-red { color: #ef4444; }
.text-blue { color: #3b82f6; }
.text-orange { color: #f97316; }
.text-purple { color: #a855f7; }
.text-yellow { color: #eab308; }

.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 18px; }
.text-bold { font-weight: 700; }
.text-mono { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.5px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.p-0 { padding: 0; }
.p-8 { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none; }
.block { display: block; }
.inline-flex { display: inline-flex; }

.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.no-shrink { flex-shrink: 0; }

.border-bottom {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 16px 0;
}

/* =====================================================================
   GRID LAYOUTS
   ===================================================================== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* =====================================================================
   RESPONSIVE — TABLET (768px - 1024px)
   ===================================================================== */
@media (max-width: 1024px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .analytics-grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .email-editor-wrapper {
    grid-template-columns: 1fr;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 4px;
    margin-bottom: 8px;
  }

  .settings-nav::-webkit-scrollbar { display: none; }

  .settings-nav__link {
    white-space: nowrap;
  }

  .card { padding: 16px; }
  .content { padding: 16px; }
  .nav-bar { padding: 0 16px; }
}

/* =====================================================================
   RESPONSIVE — MOBILE (< 768px)
   ===================================================================== */
@media (max-width: 768px) {
  /* Nav */
  .nav-bar__links {
    display: none;
  }

  .nav-hamburger {
    display: block;
  }

  .nav-bar__brand {
    margin-right: auto;
  }

  /* Content */
  .content {
    padding: 12px;
    margin-top: var(--nav-height);
  }

  .content-inner {
    max-width: 100%;
  }

  /* Page header */
  .page-header {
    margin-bottom: 16px;
  }

  .page-header h1 {
    font-size: 18px;
  }

  .page-header__actions {
    width: 100%;
  }

  .page-header__actions .btn {
    flex: 1;
  }

  /* Stat grids */
  .stat-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 12px 14px;
  }

  .stat-card__value {
    font-size: 24px;
    order: 2;
  }

  .stat-card__label {
    margin-top: 0;
    order: 1;
  }

  .stats-grid { grid-template-columns: repeat(3, 1fr); }

  /* Tables scroll horizontally */
  .table-card {
    overflow-x: auto;
  }

  .table {
    min-width: 600px;
  }

  /* Cards full bleed */
  .card {
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
  }

  /* Grids collapse */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .analytics-grid,
  .analytics-grid--3 {
    grid-template-columns: 1fr;
  }

  /* Forms */
  .form-row {
    flex-direction: column;
  }

  .rule-row {
    flex-direction: column;
    align-items: stretch;
  }

  .rule-row .select,
  .rule-row .input {
    width: 100%;
    min-width: 0;
  }

  .rule-row__remove {
    align-self: flex-end;
  }

  /* Filter row wraps */
  .filter-row {
    gap: 6px;
  }

  .filter-row .select {
    flex: 1;
    min-width: 100px;
  }

  /* Modal full screen on mobile */
  .modal-overlay {
    padding: 0;
  }

  .modal {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
  }

  /* Tabs scroll */
  .tabs {
    gap: 0;
  }

  .tab {
    padding: 10px 12px;
    font-size: 12px;
  }

  /* Settings layout */
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
  }

  /* Flow timeline */
  .flow-timeline {
    padding-left: 28px;
  }

  .flow-step__marker {
    width: 24px;
    height: 24px;
    font-size: 10px;
    left: -28px;
  }

  /* Subscriber detail */
  .subscriber-detail__meta {
    grid-template-columns: 1fr;
  }

  /* Email editor */
  .email-editor-wrapper {
    grid-template-columns: 1fr;
  }

  /* Input size fix for iOS zoom prevention */
  .input,
  .select,
  .textarea,
  .subject-line-input,
  .reply-box textarea,
  #login-token {
    font-size: 16px;
  }

  /* Toast bottom-center on mobile */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    max-width: 100%;
  }

  /* Pagination compact */
  .pagination {
    gap: 8px;
  }

  .pagination__btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  /* Chart container */
  .chart-bar-group {
    height: 140px;
  }

  .chart-bar-row__label {
    width: 80px;
    font-size: 12px;
  }

  /* Support inbox mobile: full-width sidebar, overlay detail */
  .inbox-layout {
    position: relative;
  }

  .inbox-sidebar {
    width: 100%;
    min-width: 100%;
  }

  .inbox-detail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    z-index: 10;
    display: none;
    padding: 16px;
  }

  .inbox-detail--open {
    display: block;
  }

  .conv-detail__back {
    display: block;
    margin-bottom: 8px;
  }

  .conv-detail__info { flex-direction: column; align-items: flex-start; }
}

/* =====================================================================
   STANDALONE PWA
   ===================================================================== */
@media all and (display-mode: standalone) {
  .nav-bar {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(var(--nav-height) + env(safe-area-inset-top, 0px));
  }

  .content {
    margin-top: calc(var(--nav-height) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  }

  .inbox-sidebar {
    padding-top: calc(env(safe-area-inset-top, 0px) + 44px);
  }

  .inbox-detail {
    padding-top: calc(env(safe-area-inset-top, 0px) + 44px);
  }

  .toast-container {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  }

  .nav-mobile-drawer {
    padding-top: calc(env(safe-area-inset-top, 0px) + 24px);
  }
}

/* =====================================================================
   PRINT
   ===================================================================== */
@media print {
  .nav-bar,
  .toast-container,
  .nav-mobile-overlay,
  .nav-mobile-drawer { display: none; }

  .content { margin-top: 0; }

  body { background: #fff; color: #000; }

  .card,
  .table-card,
  .chart-container,
  .settings-panel {
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: none;
  }
}
