/* ============================================
   AutoBook AI — V11 Design System
   Matching landing-v15 aesthetic
   ============================================ */

.dialfuel-sales-brand {
  display: inline-flex;
  width: auto;
  height: auto;
  max-width: none;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  line-height: 1;
}

.dialfuel-sales-brand-main {
  color: #0F172A;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.dialfuel-sales-brand-sub {
  margin-top: 4px;
  color: #64748B;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

:root {
  /* Page */
  --bg: #FAFBFC;
  --bg-elevated: #F1F5F9;
  --bg-hover: #F1F5F9;
  --bg-active: #E2E8F0;

  /* Sidebar */
  --sidebar-bg: #FFFFFF;
  --sidebar-hover: #F1F5F9;
  --sidebar-active: rgba(37, 99, 235, 0.08);
  --sidebar-text: #64748B;
  --sidebar-text-active: #1E3A5F;
  --sidebar-width: 230px;

  /* Card / content */
  --card: #FFFFFF;
  --border: #E2E8F0;
  --border-light: #F1F5F9;

  /* Accent — blue (matching landing-v15) */
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-light: rgba(37, 99, 235, 0.08);
  --accent-lighter: rgba(37, 99, 235, 0.04);

  /* Status colors */
  --success: #22C55E;
  --success-hover: #16A34A;
  --success-light: rgba(34, 197, 94, 0.08);
  --warning: #F59E0B;
  --warning-hover: #D97706;
  --warning-light: rgba(245, 158, 11, 0.08);
  --danger: #EF4444;
  --danger-hover: #DC2626;
  --danger-light: rgba(239, 68, 68, 0.08);

  /* Text */
  --text: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --text-dim: #94A3B8;
  --text-primary: var(--text);

  /* Inputs */
  --input-bg: #FFFFFF;
  --input-border: #E2E8F0;
  --input-focus: #2563EB;

  /* Legacy aliases used across admin surfaces */
  --surface: var(--card);
  --bg-card: var(--card);
  --bg-tertiary: var(--bg-elevated);
  --bg-secondary: var(--bg-elevated);
  --primary: var(--accent);

  /* Typography — Plus Jakarta Sans + DM Sans (matching landing page) */
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Misc */
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.08);
  --transition: 0.15s ease;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  line-height: 1.15;
}

#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
  overflow: hidden;
}

.sidebar-brand {
  padding: 20px 18px 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand-logo {
  display: block;
  width: auto;
  height: 30px;
  max-width: 152px;
}

.sidebar-nav {
  flex: 1;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  position: relative;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--text-secondary);
}
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.45;
}
.nav-item:hover svg { opacity: 0.7; }
.nav-item.active svg { opacity: 1; color: var(--accent); }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.25);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all var(--transition);
}
.sidebar-logout:hover {
  background: rgba(239,68,68,0.06);
  color: var(--danger);
}
.sidebar-logout svg {
  width: 18px;
  height: 18px;
  opacity: 0.45;
}
.sidebar-logout:hover svg { opacity: 1; }

/* Mobile hamburger */
.mobile-header {
  display: none;
  height: 54px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
}
.mobile-header .sidebar-brand-logo-mobile { height: 24px; max-width: 132px; }
.hamburger-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  cursor: pointer;
}
.hamburger-btn svg { width: 22px; height: 22px; }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(4px);
  z-index: 49;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg);
}

.page-header {
  padding: 24px 28px 0;
  flex-shrink: 0;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  font-family: var(--font-display);
}
.page-header-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.page-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.page {
  display: none;
  height: 100%;
  overflow: auto;
}
.page.active { display: flex; flex-direction: column; }

/* ============================================
   BUTTONS
   ============================================ */
button {
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-weight: 600;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2), 0 4px 12px rgba(37, 99, 235, 0.15);
  transform: translateY(-1px);
}
.btn-success { background: var(--success); color: #fff; font-weight: 600; }
.btn-success:hover:not(:disabled) { background: var(--success-hover); transform: translateY(-1px); }
.btn-warning { background: var(--warning); color: #fff; font-weight: 600; }
.btn-warning:hover:not(:disabled) { background: var(--warning-hover); transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; font-weight: 600; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: #CBD5E1;
  color: var(--text);
}
.btn-danger-outline {
  color: var(--danger);
  border-color: rgba(239,68,68,.3);
}
.btn-danger-outline:hover:not(:disabled) {
  background: rgba(239,68,68,.08);
  border-color: rgba(239,68,68,.5);
  color: var(--danger);
}
.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-active);
  border-color: #CBD5E1;
  color: var(--text);
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-icon {
  background: transparent;
  color: var(--text-muted);
  padding: 6px;
  border: none;
}
.btn-icon:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}

/* ============================================
   INPUTS
   ============================================ */
input, select, textarea {
  font-family: var(--font);
  font-size: 13px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
input[type="checkbox"], input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
  border-radius: 3px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
textarea { resize: vertical; min-height: 60px; }
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}
.form-group { margin-bottom: 16px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.settings-notify-events {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.settings-notify-event-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  min-height: 36px;
}
.settings-notify-event-label {
  color: var(--text-muted);
}

/* ============================================
   TOGGLE SWITCH
   ============================================ */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.toggle input { display: none; }
.toggle-track {
  width: 40px;
  height: 22px;
  background: #CBD5E1;
  border-radius: 11px;
  position: relative;
  transition: background var(--transition);
}
.toggle input:checked + .toggle-track { background: var(--accent); box-shadow: 0 1px 6px rgba(37, 99, 235, 0.25); }
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }
.toggle-label { font-size: 13px; color: var(--text-secondary); }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-success { background: rgba(34, 197, 94, 0.12); color: #16A34A; }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: #B45309; }
.badge-violet { background: rgba(139, 92, 246, 0.12); color: #7C3AED; }
.badge-danger { background: rgba(239, 68, 68, 0.10); color: #DC2626; }
.badge-muted { background: var(--bg-hover); color: var(--text-muted); }
.badge-lead-type { background: rgba(20, 184, 166, 0.12); color: #0F766E; border: 1px solid rgba(20, 184, 166, 0.25); }
.badge-demo { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; background: rgba(168, 85, 247, 0.15); color: #a855f7; margin-left: 6px; }
.badge-count {
  background: var(--accent);
  color: #fff;
  min-width: 20px;
  text-align: center;
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 99px;
  margin-left: 6px;
}

/* ============================================
   LOGIN
   ============================================ */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.08), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(20, 184, 166, 0.07), transparent 30%),
    var(--bg);
}
.login-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  animation: loginFadeIn 0.5s ease;
}
@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.5px;
  font-family: var(--font-display);
}
.login-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}
.login-card .form-group { margin-bottom: 20px; }
.login-card button {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  margin-top: 4px;
  font-weight: 700;
}
.login-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 8px;
  min-height: 18px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.login-brand .sidebar-brand-logo {
  width: auto;
  height: auto;
  max-width: none;
}

/* ============================================
   LOADING / SPINNER
   ============================================ */
.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  flex: 1;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  flex: 1;
}

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-page {
  padding: 24px 28px;
  overflow-y: auto;
}

/* Dashboard filter bar */
.dash-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.dash-filter-client-wrap {
  position: relative;
}
.dash-filter-client-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.dash-filter-client-btn:hover { border-color: var(--accent); }
.dash-filter-client-drop {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  margin-top: 4px;
  min-width: 220px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px 0;
}
.dash-filter-client-drop.open { display: block; }
.dash-filter-client-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.dash-filter-client-opt:hover { background: var(--bg); }
.dash-filter-client-opt input { margin: 0; }
.dash-filter-clear {
  display: block;
  width: 100%;
  text-align: center;
  padding: 6px;
  border: none;
  border-top: 1px solid var(--border);
  background: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
}
.dash-filter-range-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.dash-filter-range-btn {
  padding: 7px 12px;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.dash-filter-range-btn:last-child { border-right: none; }
.dash-filter-range-btn:hover { color: var(--text); background: var(--bg); }
.dash-filter-range-btn.active { background: var(--accent); color: #fff; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.dashboard-stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stat-card:hover {
  border-color: #CBD5E1;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.stat-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-card-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
  font-family: var(--font-display);
}
.stat-card-sub {
  font-size: 12px;
  color: var(--text-dim);
}
.stat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.stat-card-icon svg { width: 18px; height: 18px; }
.stat-card-icon.blue { background: var(--accent-light); color: var(--accent); }
.stat-card-icon.green { background: var(--success-light); color: var(--success); }
.stat-card-icon.amber { background: var(--warning-light); color: var(--warning); }
.stat-card-icon.red { background: var(--danger-light); color: var(--danger); }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.dashboard-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.dashboard-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
}
.dashboard-card-body {
  padding: 14px 18px;
}

.dashboard-card-body-analytics {
  padding: 16px;
}
.dashboard-card-body-compact {
  padding: 12px 16px;
}

.analytics-section-spacer {
  margin-top: 16px;
}
.analytics-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.analytics-header-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.analytics-header-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}
.analytics-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.analytics-scroll {
  overflow-x: auto;
}
.analytics-table-wide {
  min-width: 760px;
}
.analytics-rule-text-cell {
  max-width: 420px;
  white-space: normal;
  word-break: break-word;
}
.analytics-detail-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}
.analytics-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
}
.analytics-detail-label {
  color: var(--text-muted);
}
.analytics-detail-value {
  font-weight: 600;
}
.analytics-detail-value.success {
  color: var(--success);
}
.analytics-detail-value.emphasis {
  font-size: 18px;
  font-weight: 700;
}

/* Pipeline bar chart */
.pipeline-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}
.pipeline-bar-label {
  font-size: 12px;
  color: var(--text-secondary);
  width: 80px;
  flex-shrink: 0;
}
.pipeline-bar-track {
  flex: 1;
  min-width: 0;
  height: 26px;
  background: var(--bg-hover);
  border-radius: 6px;
  overflow: hidden;
}
.pipeline-bar-track.stage-new { background: #F0FDF4; }
.pipeline-bar-track.stage-contacted { background: #C7D2FE; }
.pipeline-bar-track.stage-greeting { background: #BAE6FD; }
.pipeline-bar-track.stage-qualifying { background: #FEF3C7; }
.pipeline-bar-track.stage-booking { background: #EDE9FE; }
.pipeline-bar-track.stage-follow_up { background: #FEF3C7; }
.pipeline-bar-track.stage-booked,
.pipeline-bar-track.stage-showed { background: #DCFCE7; }
.pipeline-bar-track.stage-no_show { background: #FFEDD5; }
.pipeline-bar-track.stage-reactivation { background: #DBEAFE; }
.pipeline-bar-track.stage-not_contacted_yet { background: #F3F4F6; }
.pipeline-bar-track.stage-dead { background: #FEE2E2; }
.pipeline-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  min-width: 2px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.pipeline-bar-fill.has-count {
  min-width: 34px;
  justify-content: center;
  padding: 0 10px;
}
.pipeline-bar-fill.green { background: var(--success); color: #fff; }
.pipeline-bar-fill.amber { background: var(--warning); color: #fff; }
.pipeline-bar-fill.red { background: var(--danger); color: #fff; }

/* Today's appointments list */
.today-appt-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.today-appt-item:last-child { border-bottom: none; }
.today-appt-time {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  width: 65px;
  flex-shrink: 0;
}
.today-appt-info {
  flex: 1;
  min-width: 0;
}
.today-appt-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.today-appt-client {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================
   KANBAN (Pipeline)
   ============================================ */
.kanban {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  overflow-x: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.kanban-col {
  min-width: 270px;
  max-width: 320px;
  flex: 1 0 270px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}
.kanban-col:hover {
  border-color: #CBD5E1;
}
.kanban.kanban-pipeline .kanban-col {
  min-width: 240px;
  max-width: none;
  flex: 1 0 240px;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kanban-col-count {
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  flex-shrink: 0;
}
.kanban-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  min-height: 80px;
  transition: background var(--transition);
}
.kanban-col-body.drag-over {
  background: var(--accent-lighter);
  box-shadow: inset 0 0 0 1px var(--accent);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.lead-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 6px;
  cursor: grab;
  transition: all var(--transition);
  user-select: none;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.lead-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.1), var(--shadow-md);
  transform: translateY(-2px);
}
.lead-card.dragging {
  opacity: 0.4;
  transform: scale(0.96) rotate(1deg);
}
.lead-card-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  overflow: hidden;
  min-width: 0;
}
.lead-card-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.lead-card-call-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  cursor: pointer;
  transition: all var(--transition);
}
.lead-card-call-btn svg {
  width: 14px;
  height: 14px;
}
.lead-card-call-btn:hover {
  border-color: var(--success);
  background: var(--success-light, #ecfdf3);
  color: var(--success);
}
.lead-card-phone {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.phone-link { color: inherit; text-decoration: none; }
.phone-link:hover { text-decoration: underline; }
.lead-card-preview {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 8px;
}
.lead-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  min-width: 0;
}
.lead-card-meta > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.lead-card-urgency {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lead-card-urgency.hot {
  background: var(--success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
  animation: urgencyPulse 2s ease-in-out infinite;
}
.lead-card-urgency.warm {
  background: var(--warning);
  box-shadow: 0 0 4px rgba(245, 158, 11, 0.3);
}
.lead-card-urgency.cold { background: var(--text-dim); }

@keyframes urgencyPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 10px rgba(34, 197, 94, 0.6); }
}

.pipeline-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 28px 12px;
}
.pipeline-client-filter {
  position: relative;
}
.pipeline-client-filter summary {
  list-style: none;
}
.pipeline-client-filter summary::-webkit-details-marker {
  display: none;
}
.pipeline-filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.pipeline-filter-caret {
  color: var(--text-dim);
  font-size: 11px;
}
.pipeline-filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: min(320px, calc(100vw - 56px));
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.pipeline-client-checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.pipeline-client-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  min-height: 36px;
  cursor: pointer;
}
.pipeline-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.pipeline-filter-empty {
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 4px;
}
.pipeline-date-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pipeline-date-pill {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.pipeline-date-pill.active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  border-color: rgba(37, 99, 235, 0.24);
}
.pipeline-date-pill:focus-visible,
.pipeline-filter-trigger:focus-visible {
  outline: 2px solid #2563EB;
  outline-offset: 2px;
}
.pipeline-custom-range {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.pipeline-custom-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}
.pipeline-custom-field span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.pipeline-custom-field input {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
.pipeline-custom-field input:focus {
  outline: none;
  border-color: var(--accent);
}

@media (min-width: 1200px) {
  .kanban.kanban-pipeline .kanban-col {
    min-width: 0;
    flex-basis: calc((100% - 40px) / 5);
  }
}

/* ============================================
   SLIDE-OVER PANEL
   ============================================ */
.slideover-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.slideover-backdrop.open { opacity: 1; visibility: visible; }

.slideover {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 100vw;
  background: #FFFFFF;
  border-left: 1px solid var(--border);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 30px rgba(0,0,0,0.06);
}
.slideover.open { transform: translateX(0); }

.slideover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.slideover-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.slideover-details {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  background: #FFFFFF;
}
.slideover-details .detail-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.slideover-details .detail-label { font-weight: 600; color: var(--text-dim); }
.slideover-details.collapsed,
.inline-lead-detail.collapsed {
  display: none;
}

/* Collapse toggle button for lead details */
.detail-collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dim);
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: transform 0.2s, color 0.15s;
}
.detail-collapse-btn:hover { color: var(--text); }
.detail-collapse-btn.collapsed { transform: rotate(-90deg); }

/* Inline lead detail strip (conversations page) */
.inline-lead-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-secondary);
  background: #FFFFFF;
  flex-shrink: 0;
  animation: msgFadeIn 0.15s ease;
}
.inline-lead-detail .detail-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.inline-lead-detail .detail-label { font-weight: 600; color: var(--text-dim); }

.slideover-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
}
.slideover-input {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  align-items: flex-end;
  background: #FFFFFF;
}
.slideover-input input { flex: 1; }
.slideover-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  background: #FFFFFF;
}

/* ============================================
   CONVERSATIONS (Inbox)
   ============================================ */
.inbox-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.inbox-list-panel {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #FFFFFF;
}
.inbox-search {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.inbox-search input {
  flex: 1 0 100%;
  min-width: 0;
}
.inbox-search select {
  flex: 1 1 140px;
  min-width: 140px;
  width: auto;
}
.inbox-list {
  flex: 1;
  overflow-y: auto;
}
.inbox-item {
  display: flex;
  flex-direction: column;
  padding: 14px 16px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.inbox-item:hover { background: var(--bg-hover); }
.inbox-item:focus-visible {
  outline: none;
  background: var(--accent-lighter);
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.16);
}
.inbox-item.active {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
}
.inbox-item-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  width: 100%;
}
.inbox-item-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}
.inbox-item-content {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}
.inbox-item-top {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  column-gap: 12px;
  row-gap: 4px;
  width: 100%;
  min-width: 0;
}
.inbox-item-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 3px;
}
.inbox-item-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.inbox-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-unread-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #2563EB;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.24);
}
.inbox-item-subline {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-item-time {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}
.inbox-item-preview {
  width: 100%;
  max-width: none;
  min-width: 0;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.inbox-item-badges {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
}
.inbox-item-badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  max-height: 24px;
  overflow: hidden;
}
.inbox-ai-toggle {
  margin-left: auto;
  padding-left: 8px;
  flex-shrink: 0;
}
.inbox-ai-toggle .toggle-track {
  width: 34px;
  height: 20px;
}
.inbox-ai-toggle .toggle-track::after {
  width: 14px;
  height: 14px;
}
.inbox-ai-toggle input:checked + .toggle-track::after { transform: translateX(14px); }
.inbox-ai-toggle .toggle-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.inbox-ai-toggle.paused .toggle-label { color: var(--danger); }
.inbox-ai-toggle:focus-visible {
  outline: none;
}
.inbox-ai-toggle:focus-visible .toggle-track {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.chat-timeline-marker {
  text-align: center;
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
  padding: 12px 0 4px;
}
.inbox-chat-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}
.inbox-chat-header {
  display: flex;
  align-items: center;
  min-height: 56px;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: #FFFFFF;
}
.inbox-chat-header-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.inbox-chat-header-lead {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.inbox-chat-header-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.inbox-chat-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  min-width: 0;
}
.inbox-chat-header-phone {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  flex: 0 0 auto;
}
.inbox-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inbox-chat-header-actions .sidebar-toggle-btn {
  position: static;
  top: auto;
  right: auto;
}
.voice-call-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.voice-call-btn svg {
  width: 14px;
  height: 14px;
}
.inbox-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inbox-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: #FFFFFF;
  align-items: flex-end;
}
.inbox-chat-input input { flex: 1; }
.inbox-chat-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  background: #FFFFFF;
}

/* Chat sidebar */
.inbox-layout-with-sidebar {
  display: grid;
  grid-template-columns: minmax(340px, 0.85fr) minmax(420px, 1.35fr) minmax(280px, 0.7fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
/* ---- Master Leads: Premium SaaS ---- */
.master-leads-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 0 20px;
  align-items: center;
}
.master-leads-toolbar input[type="search"] {
  flex: 1 1 280px;
  min-width: 220px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.master-leads-toolbar input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
  outline: none;
}
.master-leads-toolbar select,
.master-leads-toolbar .analytics-filter-select {
  padding: 9px 32px 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 160px;
  max-width: 260px;
  flex: 0 1 auto;
}
.master-leads-toolbar select:focus,
.master-leads-toolbar .analytics-filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
  outline: none;
}
.master-leads-layout {
  --master-leads-panel-transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  grid-template-columns: minmax(0, 1fr) 0 0;
  align-items: stretch;
  transition: grid-template-columns var(--master-leads-panel-transition);
}
.master-leads-layout.master-leads-layout--detail-open {
  grid-template-columns: minmax(560px, 1.6fr) minmax(360px, 1fr) 280px;
}
@media (max-width: 1199px) and (min-width: 981px) {
  .master-leads-layout.master-leads-layout--detail-open {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 260px;
  }
}
/* Hide low-priority columns only while the detail panels are open */
.master-leads-layout.master-leads-layout--detail-open .master-leads-table th:nth-child(6),
.master-leads-layout.master-leads-layout--detail-open .master-leads-table td:nth-child(6),
.master-leads-layout.master-leads-layout--detail-open .master-leads-table th:nth-child(8),
.master-leads-layout.master-leads-layout--detail-open .master-leads-table td:nth-child(8),
.master-leads-layout.master-leads-layout--detail-open .master-leads-table th:nth-child(9),
.master-leads-layout.master-leads-layout--detail-open .master-leads-table td:nth-child(9),
.master-leads-layout.master-leads-layout--detail-open .master-leads-table th:nth-child(10),
.master-leads-layout.master-leads-layout--detail-open .master-leads-table td:nth-child(10) {
  display: none;
}
/* Show Email + State on wide screens */
@media (min-width: 1600px) {
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table th:nth-child(6),
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table td:nth-child(6),
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table th:nth-child(9),
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table td:nth-child(9) {
    display: table-cell;
  }
}
/* Show all columns on very wide screens */
@media (min-width: 1920px) {
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table th:nth-child(8),
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table td:nth-child(8),
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table th:nth-child(10),
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table td:nth-child(10) {
    display: table-cell;
  }
}
.master-leads-panel {
  min-width: 0;
  min-height: 0;
  background: #FFFFFF;
  border-radius: 10px;
  transition: border-radius var(--master-leads-panel-transition);
}
.master-leads-layout.master-leads-layout--detail-open .master-leads-panel {
  border-radius: 10px 0 0 10px;
}
.master-leads-detail-panel {
  min-width: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(20px);
  transition:
    opacity var(--master-leads-panel-transition),
    transform var(--master-leads-panel-transition),
    border-color var(--master-leads-panel-transition);
}
.master-leads-detail-panel--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}
.master-leads-chat-panel {
  border-left: 1px solid transparent;
  background: #FFFFFF;
}
.master-leads-layout.master-leads-layout--detail-open .master-leads-chat-panel {
  border-left-color: var(--border);
}
.master-leads-sidebar-panel {
  border-radius: 0 10px 10px 0;
}
.master-leads-table-wrap {
  flex: 1;
  overflow: auto;
}
.master-leads-table {
  min-width: 100%;
  border-spacing: 0;
}
.master-leads-table th:nth-child(1),
.master-leads-table td:nth-child(1) {
  width: 44px;
}
.master-leads-table th:nth-child(2),
.master-leads-table td:nth-child(2) {
  width: 150px;
}
.master-leads-table th:nth-child(3),
.master-leads-table td:nth-child(3) {
  width: 140px;
}
.master-leads-table th:nth-child(4),
.master-leads-table td:nth-child(4) {
  width: 160px;
}
.master-leads-table th:nth-child(5),
.master-leads-table td:nth-child(5) {
  white-space: nowrap;
  min-width: 140px;
}
.master-leads-table th:nth-child(7),
.master-leads-table td:nth-child(7) {
  white-space: nowrap;
  min-width: 110px;
}
.master-leads-checkbox-col {
  width: 44px;
  text-align: center;
}
.master-leads-row-select,
.master-leads-select-all {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}
.master-leads-table th {
  position: sticky;
  top: 0;
  background: #EDF2F7;
  z-index: 1;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 2px solid var(--border);
}
.master-leads-table td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  transition: background-color 150ms ease;
}
.master-leads-bulk-delete {
  margin: 12px 16px 0;
  align-self: flex-start;
}
.master-leads-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  transition: color 0.15s;
}
.master-leads-sort:hover {
  color: var(--text-secondary);
}
.master-leads-sort.active {
  color: var(--text);
}
.master-leads-sort-arrow {
  font-size: 11px;
  color: var(--text-dim);
}
.master-leads-row {
  cursor: pointer;
  transition: background 0.12s;
}
.master-leads-row:hover td {
  background: rgba(37, 99, 235, 0.07);
}
.master-leads-row.active td {
  background: var(--accent-light);
}
.master-leads-row.active td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}
.master-leads-name-cell {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}
.master-leads-lead-type-cell {
  min-width: 150px;
}
.master-leads-secondary {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}
.master-leads-client-link {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 500;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: color 0.12s;
}
.master-leads-client-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
.master-leads-empty td {
  padding: 40px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.master-leads-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: #FFFFFF;
}
.master-leads-pagination-summary,
.master-leads-pagination-page {
  font-size: 12px;
  color: var(--text-muted);
}
.master-leads-pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Quick actions overlay on row hover */
.master-leads-actions {
  display: none;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  gap: 4px;
  align-items: center;
  z-index: 2;
}
.master-leads-row:hover .master-leads-actions {
  display: flex;
}
.master-leads-row { position: relative; }
.master-leads-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.12s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.master-leads-action-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}
.master-leads-action-btn.danger:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}
/* Stage badge in table — slightly larger */
.master-leads-table .badge {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: visible;
  max-width: none;
}
.inbox-sidebar {
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-secondary, #f8f9fb);
}
.inbox-sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 100%;
  padding: 18px 6px;
}
.inbox-sidebar-empty .empty-state-icon {
  margin-bottom: 10px;
}
.inbox-sidebar-empty h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.inbox-sidebar-empty p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.sidebar-message-card {
  padding: 0;
  overflow: hidden;
}
.sidebar-message-card .sidebar-card-header {
  margin: 0 14px;
  padding: 14px 0 8px;
}
.sidebar-message-card .chat-status-banner {
  border-bottom: 1px solid var(--border-light);
  white-space: normal;
}
.sidebar-message-input-row {
  padding-left: 14px;
  padding-right: 14px;
  background: transparent;
  border-top: none;
}
.sidebar-message-controls {
  padding-left: 14px;
  padding-right: 14px;
  background: transparent;
}
.sidebar-message-send {
  min-width: 40px;
  padding-left: 12px;
  padding-right: 12px;
}
.sidebar-message-send svg {
  width: 14px;
  height: 14px;
}
.sidebar-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.sidebar-card-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-lead-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.sidebar-section h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 10px;
  font-weight: 600;
}
.sidebar-field {
  margin-bottom: 8px;
}
.sidebar-field label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.sidebar-value {
  font-size: 13px;
  color: var(--text);
}
.sidebar-subvalue {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
}
.sidebar-value-editable {
  cursor: pointer;
  border-bottom: 1px dashed var(--border);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-value-editable:hover { border-color: var(--accent); }
.sidebar-edit-icon {
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.sidebar-field-editable:hover .sidebar-edit-icon { opacity: 1; }
.sidebar-edit-input {
  font-size: 13px;
  padding: 2px 6px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
  min-width: 0;
}
.sidebar-saved-indicator {
  font-size: 10px;
  color: var(--success, #16a34a);
  font-weight: 600;
  flex-shrink: 0;
  animation: fadeInOut 1.5s ease;
}
@keyframes fadeInOut { 0% { opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
.sidebar-empty {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}
.sidebar-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg, #fff);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.sidebar-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}
.sidebar-notes {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
}
.sidebar-notes:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}
.sidebar-kv {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-kv:last-child { border-bottom: none; }
.sidebar-kv-key { color: var(--text-dim); }
.sidebar-kv-val { color: var(--text); font-weight: 500; }
.sidebar-toggle-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
}

/* ---- Chat bubbles ---- */
.msg-message-group {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  max-width: 80%;
}
.msg-bubble-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.msg-message-group-outbound {
  align-self: flex-end;
}
.msg-message-group-outbound .msg-bubble-col {
  align-items: flex-end;
}
.msg-message-group-inbound {
  align-self: flex-start;
}
.msg-message-group-inbound .msg-bubble-col {
  align-items: flex-start;
}
.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  line-height: 1;
}
.msg-avatar-outbound {
  background: #2563EB;
  color: #fff;
}
.msg-avatar-inbound {
  background: #E2E8F0;
  color: #334155;
}
.msg-bubble {
  position: relative;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
  animation: msgFadeIn 0.25s ease;
}
.msg-bubble-has-actions { padding-right: 84px; }
@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.msg-outbound {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}
.msg-inbound {
  align-self: flex-start;
  background: var(--border-light);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-meta {
  font-size: 10px;
  color: rgba(255,255,255,0.65);
  margin-top: 4px;
  display: flex;
  gap: 6px;
}
.msg-inbound .msg-meta { color: var(--text-dim); }
.msg-sender-tag {
  font-weight: 600;
  font-size: 10px;
}
.msg-demo-badge {
  display: inline-block;
  background: var(--warning);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}
.msg-status-line {
  font-size: 11px;
  line-height: 1.2;
  color: #9CA3AF;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.msg-status-line.is-failed { color: #EF4444; }
.msg-status-line.is-blocked { color: #F59E0B; }
.msg-status-line.is-pending { font-style: italic; }
.msg-status-time { color: inherit; }
.voice-message-card {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.06);
}
.msg-outbound .voice-message-card {
  background: rgba(255, 255, 255, 0.14);
}
.voice-message-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.voice-outcome-badge,
.voice-meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.voice-meta-pill {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text-muted);
}
.msg-outbound .voice-meta-pill {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255,255,255,0.88);
}
.voice-outcome-badge.is-booked {
  background: rgba(34, 197, 94, 0.14);
  color: #15803D;
}
.voice-outcome-badge.is-qualified {
  background: rgba(37, 99, 235, 0.14);
  color: #1D4ED8;
}
.voice-outcome-badge.is-missed {
  background: rgba(245, 158, 11, 0.16);
  color: #B45309;
}
.voice-outcome-badge.is-general {
  background: rgba(100, 116, 139, 0.16);
  color: #475569;
}
.voice-message-summary {
  font-size: 13px;
  line-height: 1.5;
  color: inherit;
}
.voice-message-audio {
  width: 100%;
  min-width: 220px;
}
.voice-message-transcript {
  margin-bottom: 2px;
  white-space: pre-wrap;
}
.voice-client-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(100, 116, 139, 0.10);
  border: 1px solid rgba(100, 116, 139, 0.18);
  color: #475569;
}
.voice-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.voice-transcript-block,
.voice-recording-block {
  display: grid;
  gap: 10px;
}
.voice-transcript {
  display: grid;
  gap: 10px;
}
.voice-transcript-turn {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.05);
}
.voice-transcript-speaker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.voice-transcript-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
}
.voice-transcript-toggle {
  justify-self: flex-start;
}

/* ============================================
   APPOINTMENTS
   ============================================ */
.appointments-page { padding: 20px 28px; }
.appointments-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.appointments-filters input,
.appointments-filters select { width: auto; min-width: 140px; }
.appointments-table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  color: var(--text-secondary);
}
.data-table tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table .row-today {
  border-left: 3px solid var(--accent);
  background: var(--accent-lighter);
}
.data-table .row-actions {
  display: flex;
  gap: 6px;
}

/* ============================================
   CLIENTS
   ============================================ */
.clients-page { padding: 20px 28px; }
.clients-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.clients-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
}
.clients-header-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.clients-header-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}
.clients-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.client-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.client-row.is-paused {
  opacity: 0.72;
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.32);
}
.client-row:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08), var(--shadow-md);
  transform: translateY(-1px);
}
.client-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.client-info { display: flex; flex-direction: column; gap: 2px; }
.client-name { font-size: 14px; font-weight: 600; color: var(--text); }
.client-biz { font-size: 12px; color: var(--text-muted); }
.client-paused-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #B45309;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.24);
}
.client-stats {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: var(--text-muted);
  align-items: center;
}
.client-stat-num {
  font-weight: 700;
  color: var(--text);
  margin-right: 3px;
}

/* Client SMS status indicator */
.client-sms-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}
.client-sms-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.client-sms-dot.connected {
  background: var(--success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.35);
}
.client-sms-dot.demo { background: var(--warning); }
.voice-client-settings-card {
  background: var(--bg-raised, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.voice-client-settings-grid {
  display: grid;
  gap: 12px;
}
.voice-client-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.voice-client-setting-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.voice-client-setting-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.voice-client-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.voice-client-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
}
.voice-client-status-dot.is-live {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.35);
}
.voice-client-status-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.clients-search {
  width: 100%; padding: 10px 14px; font-size: 14px; font-family: inherit;
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px; outline: none;
  transition: border-color var(--transition);
}
.clients-search:focus { border-color: var(--accent); }
.client-avatar {
  width: 40px; height: 40px; min-width: 40px; border-radius: 50%;
  background: var(--accent); color: white; display: flex;
  align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.client-chevron {
  font-size: 20px; color: var(--text-dim); flex-shrink: 0;
  margin-left: 8px; transition: color var(--transition);
}
.client-row:hover .client-chevron { color: var(--accent); }
.client-automation-toggle {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.client-automation-toggle-glyph {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.client-automation-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.client-automation-toggle.is-paused {
  color: #15803D;
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.08);
}
.sidebar-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sidebar-danger-zone {
  border-color: rgba(220, 38, 38, 0.18);
}
.sidebar-danger-copy {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.sidebar-danger-button {
  width: 100%;
  justify-content: center;
}
@media (max-width: 640px) {
  .client-row { flex-wrap: wrap; gap: 10px; }
  .client-stats { width: 100%; justify-content: flex-start; flex-wrap: wrap; gap: 10px; }
  .clients-header-actions { width: 100%; }
}

.wizard-modal {
  width: 640px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}
.wizard-progress {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 16px 20px 0;
}
.wizard-progress-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  transition: color 0.3s;
}
.wizard-progress-step.active { color: var(--accent, #BF5B2E); }
.wizard-progress-step.done { color: var(--success, #22c55e); }
.wizard-progress-step .step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid var(--border);
  background: transparent;
  transition: all 0.3s;
}
.wizard-progress-step.active .step-num {
  border-color: var(--accent, #BF5B2E);
  background: var(--accent, #BF5B2E);
  color: #fff;
}
.wizard-progress-step.done .step-num {
  border-color: var(--success, #22c55e);
  background: var(--success, #22c55e);
  color: #fff;
}
.wizard-progress-step .step-label {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.wizard-progress-step .label-short { display: none; }
.wizard-progress-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  transition: background 0.3s;
}
.wizard-progress-line.done { background: var(--success, #22c55e); }
.wizard-bar {
  height: 3px;
  background: var(--border);
  margin: 12px 20px 0;
  border-radius: 2px;
  overflow: hidden;
}
.wizard-bar-fill {
  height: 100%;
  background: var(--accent, #BF5B2E);
  transition: width 0.4s ease;
  border-radius: 2px;
}
.wizard-body {
  padding: 20px;
  min-height: 260px;
  position: relative;
  overflow: hidden;
}
.wizard-step {
  display: none;
  animation: wizardSlideIn 0.3s ease;
}
.wizard-step.active { display: block; }
@keyframes wizardSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.wizard-footer {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}
.wizard-step h4 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.wizard-step .form-group { margin-bottom: 12px; }
.wizard-step .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.wizard-step input,
.wizard-step select,
.wizard-step textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg, rgba(255,255,255,0.05));
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.wizard-step textarea {
  min-height: 72px;
  resize: vertical;
}
.wizard-step .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.wizard-step .form-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.wizard-step .radio-group,
.wizard-step .checkbox-group,
.wizard-step .day-checks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wizard-step .radio-pill,
.wizard-step .check-pill,
.wizard-step .day-check {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.wizard-step .radio-pill,
.wizard-step .check-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
}
.wizard-step .day-check {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.wizard-step .radio-pill:hover,
.wizard-step .check-pill:hover,
.wizard-step .day-check:hover {
  border-color: var(--accent, #BF5B2E);
}
.wizard-step .radio-pill.selected,
.wizard-step .check-pill.selected,
.wizard-step .day-check.selected {
  border-color: var(--accent, #BF5B2E);
  background: rgba(191,91,46,0.15);
  color: var(--accent, #BF5B2E);
  font-weight: 600;
}
.wizard-step .radio-pill:focus-visible,
.wizard-step .check-pill:focus-visible,
.wizard-step .day-check:focus-visible {
  outline: 2px solid var(--accent, #BF5B2E);
  outline-offset: 2px;
}
.wizard-step .prompt-preview {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-alt, rgba(255,255,255,0.03));
  color: var(--text-dim);
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  line-height: 1.5;
  white-space: pre-wrap;
  resize: vertical;
}

/* Prospects page */
.prospects-page { padding: 0; height: 100%; display: flex; flex-direction: column; }
.prospects-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.prospects-header h2 { margin: 0; font-size: 18px; font-weight: 600; }
.prospects-summary { display: flex; gap: 16px; font-size: 13px; color: var(--text-dim); }
.prospects-summary span { display: flex; align-items: center; gap: 4px; }
.prospects-summary .count { font-weight: 600; color: var(--text); }
.prospects-page .kanban-board { display: flex; gap: 12px; padding: 16px; overflow-x: auto; flex: 1; min-height: 0; }
.prospects-page .kanban-column { flex: 1; min-width: 240px; max-width: 320px; background: var(--surface-alt, rgba(255,255,255,0.03)); border-radius: 10px; display: flex; flex-direction: column; border: 1px solid var(--border); }
.prospects-page .kanban-column.drag-over { border-color: var(--accent); background: rgba(191,91,46,0.08); }
.prospects-page .kanban-col-header { padding: 12px 14px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); color: var(--text-dim); }
.prospects-page .kanban-col-count { background: var(--surface); border-radius: 10px; padding: 1px 8px; font-size: 12px; font-weight: 600; color: var(--text); min-width: 20px; text-align: center; }
.prospects-page .kanban-col-body { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.prospect-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; cursor: grab; transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s; }
.prospect-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.prospect-card.dragging { opacity: 0.5; transform: scale(0.97); }
.prospect-card-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prospect-card-biz { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prospect-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prospect-card-industry { font-size: 11px; padding: 2px 7px; border-radius: 4px; background: rgba(191,91,46,0.15); color: #e8824a; font-weight: 500; }
.prospect-card-phone { font-size: 11px; color: var(--text-dim); }
.prospect-card-time { font-size: 11px; color: var(--text-dim); margin-left: auto; }
.prospect-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.prospect-modal { background: var(--surface); border-radius: 12px; width: 520px; max-width: 95vw; max-height: 90vh; overflow-y: auto; border: 1px solid var(--border); }
.prospect-modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.prospect-modal-header h3 { margin: 0; font-size: 16px; }
.prospect-modal-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 20px; padding: 4px 8px; border-radius: 4px; }
.prospect-modal-close:hover { background: var(--surface-alt, rgba(255,255,255,0.05)); }
.prospect-modal-body { padding: 20px; }
.prospect-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.prospect-detail-item label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); display: block; margin-bottom: 2px; }
.prospect-detail-item span { font-size: 14px; }
.prospect-detail-full { grid-column: 1 / -1; }
.prospect-detail-full .prospect-message-text { font-size: 13px; color: var(--text-dim); background: var(--surface-alt, rgba(255,255,255,0.03)); padding: 10px 12px; border-radius: 6px; line-height: 1.5; white-space: pre-wrap; }
.prospect-notes-section { margin-top: 16px; }
.prospect-notes-section label { font-size: 12px; font-weight: 600; display: block; margin-bottom: 6px; }
.prospect-notes-section textarea { width: 100%; min-height: 80px; background: var(--input-bg, var(--surface-alt, rgba(255,255,255,0.05))); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 10px; font-size: 13px; resize: vertical; font-family: inherit; }
.prospect-notes-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.prospect-status-select { background: var(--input-bg, var(--surface-alt, rgba(255,255,255,0.05))); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 6px 10px; font-size: 13px; }
.prospect-history { margin-top: 16px; }
.prospect-history h4 { font-size: 12px; font-weight: 600; margin-bottom: 8px; color: var(--text-dim); }
.prospect-history-timeline { border-left: 2px solid var(--border); padding-left: 14px; }
.prospect-history-item { position: relative; padding-bottom: 10px; font-size: 12px; }
.prospect-history-item::before { content: ''; position: absolute; left: -19px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.prospect-history-status { font-weight: 600; text-transform: capitalize; }
.prospect-history-time { color: var(--text-dim); margin-left: 6px; }
.prospect-timestamps { margin-top: 16px; display: flex; gap: 16px; font-size: 11px; color: var(--text-dim); }
.prospect-modal-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.prospect-modal-actions .btn-primary { margin-left: auto; }
@media (max-width: 768px) {
  .prospects-header { flex-wrap: wrap; gap: 12px; align-items: flex-start; }
  .prospects-summary { flex-wrap: wrap; gap: 10px; }
  .prospects-page .kanban-board { padding: 12px; gap: 10px; }
  .prospects-page .kanban-column { min-width: 280px; }
  .prospect-modal { width: calc(100vw - 24px); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .prospect-modal-header { padding: 14px 16px; }
  .prospect-modal-body { padding: 16px; }
  .prospect-detail-grid { grid-template-columns: 1fr; gap: 10px; }
  .prospect-notes-actions,
  .prospect-modal-actions,
  .prospect-timestamps { flex-wrap: wrap; }
  .prospect-status-select { width: 100%; }
  .prospect-modal-actions .btn-primary { margin-left: 0; }
}

/* Simulator page */
.sim-layout { display: flex; height: 100%; overflow: hidden; }
.sim-sidebar { width: 280px; min-width: 280px; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--bg-card); }
.sim-sidebar-header { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.sim-sidebar-header h3 { margin: 0 0 10px 0; font-size: 14px; font-weight: 600; }
.sim-new-chat-btn { width: 100%; padding: 8px 12px; border-radius: 6px; background: var(--accent); color: #fff; border: none; cursor: pointer; font-size: 13px; font-weight: 600; }
.sim-new-chat-btn:hover { opacity: 0.9; }
.sim-conv-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.sim-conv-item { padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.15s; }
.sim-conv-item:hover { background: rgba(191,91,46,0.06); }
.sim-conv-item.active { background: rgba(191,91,46,0.12); border-left: 3px solid var(--accent); }
.sim-conv-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-conv-meta { font-size: 11px; color: var(--text-dim); margin-bottom: 2px; text-transform: capitalize; }
.sim-conv-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-conv-time { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.sim-conv-actions { display: flex; gap: 4px; margin-top: 4px; }
.sim-conv-delete { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.sim-conv-delete:hover { background: rgba(239,68,68,0.15); color: #ef4444; }
.sim-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.sim-topbar { padding: 10px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sim-topbar label { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.sim-topbar select, .sim-topbar input { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--input-bg, var(--bg-card)); color: var(--text); font-size: 13px; }
.sim-topbar select { min-width: 180px; }
.sim-topbar input { min-width: 140px; }
.sim-topbar-group { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sim-topbar-group label { margin: 0; white-space: nowrap; }
.sim-topbar-group select, .sim-topbar-group input { flex: 1 1 auto; min-width: 0; }
.sim-topbar-group--industry { flex: 1 1 220px; }
.sim-topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.sim-run-btn { padding: 8px 14px; border-radius: 8px; background: var(--accent); color: #fff; border: none; cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; }
.sim-run-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.sim-session-meta { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.sim-meta-pill { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; background: rgba(37,99,235,0.12); border: 1px solid rgba(37,99,235,0.24); color: var(--text); font-size: 12px; font-weight: 600; }
.sim-topbar-note { padding: 0 16px 10px; font-size: 12px; color: var(--text-dim); }
.sim-chat-area { flex: 1; overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.sim-empty-state { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 14px; text-align: center; padding: 40px; }
.sim-bubble-row { display: flex; align-items: flex-start; gap: 8px; max-width: 75%; }
.sim-bubble-row.user { margin-left: auto; flex-direction: row-reverse; }
.sim-bubble-row.ai { margin-right: auto; }
.sim-bubble-stack { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sim-bubble-stack.has-breaks { gap: 10px; }
.sim-bubble { padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; word-break: break-word; position: relative; }
.sim-bubble.user { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.sim-bubble.ai { background: var(--surface-alt, rgba(255,255,255,0.06)); color: var(--text); border-bottom-left-radius: 4px; border: 1px solid var(--border); }
.sim-bubble-break { margin-top: 2px; }
.sim-bubble-time { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.sim-bubble-time.user { text-align: right; }
.sim-feedback-trigger { position: absolute; top: 4px; right: -28px; background: none; border: none; cursor: pointer; color: var(--text-dim); opacity: 0; transition: opacity 0.15s; padding: 2px; border-radius: 4px; font-size: 16px; }
.sim-bubble-row.ai:hover .sim-feedback-trigger { opacity: 1; }
.sim-feedback-trigger:hover { background: rgba(239,68,68,0.15); color: #ef4444; }
.sim-system-row { display: flex; justify-content: center; }
.sim-system-note { padding: 7px 12px; border-radius: 999px; background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.28); color: #4ade80; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.sim-feedback-panel { margin-top: 8px; padding: 10px 12px; background: var(--surface-alt, rgba(255,255,255,0.03)); border: 1px solid var(--border); border-radius: 8px; }
.sim-feedback-panel label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--text-dim); }
.sim-feedback-panel textarea { width: 100%; min-height: 50px; background: var(--input-bg, var(--bg-card)); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 8px; font-size: 13px; resize: vertical; font-family: inherit; margin-bottom: 8px; }
.sim-feedback-panel .sim-fb-actions { display: flex; gap: 8px; align-items: center; }
.sim-feedback-panel .sim-fb-save { padding: 6px 14px; border-radius: 6px; background: var(--accent); color: #fff; border: none; cursor: pointer; font-size: 12px; font-weight: 600; }
.sim-feedback-panel .sim-fb-cancel { padding: 6px 14px; border-radius: 6px; background: none; color: var(--text-dim); border: 1px solid var(--border); cursor: pointer; font-size: 12px; }
.sim-feedback-saved { font-size: 11px; color: #22c55e; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.sim-input-bar { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: flex-end; }
.sim-input-bar textarea { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg, var(--bg-card)); color: var(--text); font-size: 14px; resize: none; font-family: inherit; min-height: 42px; max-height: 120px; }
.sim-send-btn { padding: 10px 20px; border-radius: 8px; background: var(--accent); color: #fff; border: none; cursor: pointer; font-size: 14px; font-weight: 600; white-space: nowrap; }
.sim-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.sim-send-btn:hover:not(:disabled) { opacity: 0.9; }
.sim-typing { display: flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--text-dim); font-size: 13px; font-style: italic; }
.sim-typing-dots span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); animation: sim-dot-bounce 1.4s infinite ease-in-out both; }
.sim-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.sim-typing-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes sim-dot-bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }
@media (max-width: 768px) {
  .sim-sidebar { width: 100%; min-width: unset; max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
  .sim-layout { flex-direction: column; }
  .sim-bubble-row { max-width: 90%; }
}
@media (max-width: 480px) {
  .sim-topbar { gap: 8px; }
  .sim-topbar-group--client,
  .sim-topbar-group--persona { display: none; }
  .sim-topbar-group--industry { flex: 1 1 0; min-width: 0; }
  .sim-topbar select,
  .sim-topbar input { min-width: 0; }
  .sim-topbar-actions { margin-left: 0; }
  .sim-session-meta { flex: 1 1 100%; width: 100%; }
}

/* ============================================
   SETTINGS
   ============================================ */
.settings-page {
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  max-width: 680px;
  overflow-y: auto;
}
.admin-settings-page {
  max-width: none;
  overflow-y: visible;
  padding-bottom: 32px;
}
.settings-page-header {
  padding: 0 0 4px;
  border-bottom: 1px solid var(--border);
}
.settings-page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.settings-page-sub {
  max-width: 780px;
  margin-top: 8px;
  line-height: 1.6;
}
.settings-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.settings-nav {
  position: sticky;
  top: 20px;
  z-index: 5;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: padding 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.settings-nav-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.settings-nav-head-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.settings-nav-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.settings-nav-copy {
  margin: 6px 0 14px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: break-word;
  max-height: 600px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.25s ease-out, opacity 0.25s ease-out;
}
.settings-nav-current {
  display: none;
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}
.settings-nav-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 999px;
  padding: 10px 14px;
  min-height: 44px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.settings-nav-toggle:hover {
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.32);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.12);
}
.settings-nav-toggle:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}
.settings-nav-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.settings-nav-toggle[aria-expanded="true"] .settings-nav-toggle-icon {
  transform: rotate(90deg);
}
.settings-nav-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  max-height: 600px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.25s ease-out, opacity 0.25s ease-out;
}
.settings-nav-item {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  flex-direction: column;
  gap: 3px;
  min-height: 76px;
}
.settings-nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}
.settings-nav-item.active {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.16);
  color: var(--text);
}
.settings-nav-item-label {
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
}
.settings-nav-item-copy {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-dim);
  overflow-wrap: break-word;
}
.settings-nav--collapsed {
  padding: 12px 16px;
}
.settings-nav--collapsed .settings-nav-copy {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
.settings-nav--collapsed .settings-nav-current {
  display: block;
}
.settings-nav--collapsed .settings-nav-list {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
.settings-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
  min-width: 0;
  width: 100%;
  max-width: none;
}
.settings-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: var(--settings-scroll-margin-top, 420px);
  width: 100%;
  min-width: 0;
}
.settings-section--wide { grid-column: 1 / -1; }
.settings-section--active {
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.10);
}
.settings-section-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}
.settings-section-head--toggle {
  cursor: pointer;
}
.settings-section-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.settings-section-head-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.settings-section-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.settings-section h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  padding: 0;
  border-bottom: none;
  color: var(--text);
  letter-spacing: -0.2px;
}
.settings-section-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: break-word;
}
.settings-section-collapse-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.settings-section-collapse-btn:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.24);
}
.settings-section-collapse-btn:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}
.settings-section-collapse-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.settings-section-collapse-btn[aria-expanded="false"] .settings-section-collapse-icon {
  transform: rotate(-90deg);
}
.settings-section--collapsed > :not(.settings-section-head) {
  display: none;
}
.settings-section--collapsed .settings-section-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.sms-provider-status {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
}
.sms-provider-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: max-height 0.2s ease-out, opacity 0.2s ease-out, transform 0.2s ease-out;
}
.sms-provider-panel.is-active {
  max-height: 520px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.signalhouse-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.signalhouse-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 14px;
  margin-bottom: 16px;
}
.signalhouse-summary-card,
.signalhouse-summary-detail {
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
}
.signalhouse-summary-label,
.signalhouse-summary-detail-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.signalhouse-summary-detail-value {
  font-size: 13px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.signalhouse-alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.22);
  background: rgba(245, 158, 11, 0.12);
  color: #FCD34D;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.signalhouse-alert[data-tone="danger"] {
  border-color: rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.12);
  color: #FCA5A5;
}
.signalhouse-toolbar-wrap {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}
.signalhouse-toolbar-wrap--stacked {
  grid-template-columns: 1fr;
}
.signalhouse-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.signalhouse-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.signalhouse-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}
.signalhouse-checkbox-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.signalhouse-checkbox-main {
  display: flex;
  align-items: center;
  gap: 10px;
}
.signalhouse-checkbox-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.signalhouse-checkbox-hint {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
}
.signalhouse-inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}
.signalhouse-number-search-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.signalhouse-number-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.signalhouse-subheading {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
}
.signalhouse-number-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.signalhouse-number-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
}
.signalhouse-number-card.selected {
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.08);
}
.signalhouse-number-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
}
.signalhouse-number-card--owned {
  align-items: flex-start;
}
.signalhouse-number-phone {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.signalhouse-number-meta {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
}
.signalhouse-number-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--accent);
  vertical-align: middle;
}
.settings-icon svg {
  display: block;
}
.settings-section-kicker .settings-icon {
  margin-right: 5px;
}
.settings-nav-item-label .settings-icon {
  margin-right: 6px;
  opacity: 0.7;
}
.settings-nav-item.active .settings-nav-item-label .settings-icon,
.settings-nav-item:hover .settings-nav-item-label .settings-icon {
  opacity: 1;
}
.settings-nav-group {
  grid-column: 1 / -1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 12px 14px 4px;
  margin-top: 4px;
}
.settings-nav-group:first-child {
  margin-top: 0;
  padding-top: 4px;
}
.settings-sensitive-input {
  position: relative;
}
.settings-sensitive-input input {
  padding-right: 68px;
}
.settings-sensitive-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
}
.settings-sensitive-toggle:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.04);
}
.settings-inline-note {
  margin: 12px 0 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.55;
}
.settings-template-variables-card {
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
}
.settings-template-variables-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-template-variables-summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.template-variable-reference {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.template-variable-reference.is-compact {
  gap: 10px;
}
.template-variable-group {
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
}
.template-variable-reference.is-compact .template-variable-group {
  padding: 12px;
}
.template-variable-group-title {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.template-variable-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}
.template-variable-row:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}
.template-variable-copy-block,
.template-variable-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.template-variable-token,
.template-variable-inline {
  font-family: 'SFMono-Regular', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--primary);
}
.template-variable-description {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}
.template-variable-example,
.template-variable-note,
.template-variable-empty {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
}
.template-variable-copy-btn {
  flex-shrink: 0;
}
.template-variable-note {
  border-top: 1px dashed rgba(148, 163, 184, 0.22);
  padding-top: 12px;
}
.template-variable-host {
  position: relative;
}
.template-variable-autocomplete {
  position: absolute;
  z-index: 40;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  padding: 10px;
}
.template-variable-autocomplete.is-hidden {
  display: none;
}
.template-variable-autocomplete-group-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 10px 6px;
}
.template-variable-autocomplete-item {
  width: 100%;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 10px;
  cursor: pointer;
}
.template-variable-autocomplete-item:hover,
.template-variable-autocomplete-item.is-active {
  background: rgba(37, 99, 235, 0.08);
}
.template-variable-autocomplete-token {
  font-family: 'SFMono-Regular', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--primary);
}
.template-variable-autocomplete-copy {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}
.template-variable-autocomplete-example {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-dim);
}
.template-variable-autocomplete-empty {
  padding: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.settings-password-strength {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.settings-password-strength-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-input, #F1F5F9);
  overflow: hidden;
}
.settings-password-strength-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--border);
  transition: width 0.18s ease, background-color 0.18s ease;
}
.settings-password-strength[data-strength="weak"] .settings-password-strength-fill {
  background: #ef4444;
}
.settings-password-strength[data-strength="fair"] .settings-password-strength-fill {
  background: #f59e0b;
}
.settings-password-strength[data-strength="good"] .settings-password-strength-fill {
  background: #3b82f6;
}
.settings-password-strength[data-strength="strong"] .settings-password-strength-fill {
  background: #22c55e;
}
.settings-password-strength-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.settings-password-strength-hint {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-dim);
}
@keyframes settings-section-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-config-editor {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-config-section-copy {
  margin: -4px 0 16px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.ai-config-status {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.ai-config-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.ai-config-kv-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr) auto;
  gap: 10px;
  align-items: start;
}

.ai-config-row-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-config-field {
  width: 100%;
}

.ai-config-empty {
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 13px;
}

.ai-config-page {
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-config-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.ai-config-page-header > :first-child {
  flex: 1 1 420px;
  min-width: 0;
}

.ai-config-selector-inline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}

.ai-config-selector-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: min(320px, 100%);
  min-width: 220px;
}

.ai-config-selector-stack .ai-config-selector-label {
  align-self: flex-end;
}

.ai-config-selector-stack .ai-config-client-select,
.ai-config-selector-stack .ai-config-page-status {
  width: 100%;
}

.ai-config-selector-label {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.ai-config-client-select {
  width: min(280px, 100%);
  min-width: 220px;
}

.ai-config-page-status {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 420px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  text-align: right;
}

.ai-config-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ai-config-main,
.ai-config-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-config-main {
  grid-area: main;
}

.ai-config-group {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
}

.ai-config-group[open] {
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.ai-config-group-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(241, 245, 249, 0.92) 100%);
  color: var(--text);
}

.ai-config-group-summary::-webkit-details-marker {
  display: none;
}

.ai-config-group-summary::marker {
  content: '';
}

.ai-config-group-summary::after {
  content: '';
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease, border-color 0.18s ease;
  flex-shrink: 0;
  margin-top: -3px;
}

.ai-config-group[open] > .ai-config-group-summary {
  border-bottom: 1px solid var(--border-light);
}

.ai-config-group[open] > .ai-config-group-summary::after {
  transform: rotate(-135deg);
  border-color: var(--accent);
  margin-top: 3px;
}

.ai-config-group-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ai-config-group-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px 20px;
}

.ai-config-group-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.ai-config-preview-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  grid-area: preview;
  position: sticky;
  top: 20px;
}

.ai-config-card,
.ai-config-preview-card,
.ai-config-collapsible {
  margin-bottom: 0;
}

.ai-config-card-head h3,
.ai-config-preview-card h3 {
  margin-bottom: 8px;
}

.ai-config-question {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 8px;
}

.ai-config-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.ai-config-grid {
  display: grid;
  gap: 12px;
}

.ai-config-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-config-card-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.ai-config-inline-preview {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-config-inline-preview-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-config-inline-preview-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.ai-config-inline-preview-copy {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.ai-config-inline-status {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}

.ai-config-inline-status.dirty {
  color: #d97706;
}

.ai-config-inline-status.is-rewriting {
  color: var(--accent);
  animation: ai-config-status-pulse 1.2s ease-in-out infinite;
}

.ai-config-inline-status.is-rewriting::before {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  flex: 0 0 auto;
  animation: spin 0.6s linear infinite;
}

@keyframes ai-config-status-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.ai-config-url-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 0 0 12px;
}

.ai-config-collapsible summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.ai-config-preview-header {
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.ai-config-prompt-lock-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.ai-config-prompt-edit-area {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #FFFFFF;
  color: var(--text);
}
.ai-config-original-hint {
  margin-top: 8px;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  background: #F8FAFC;
  font-size: 13px;
}
.ai-config-original-hint summary {
  padding: 6px 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
}
.ai-config-original-hint summary::before {
  content: '▸ ';
}
.ai-config-original-hint[open] summary::before {
  content: '▾ ';
}
.ai-config-original-text {
  padding: 8px 12px 10px;
  border-top: 1px solid #E2E8F0;
  color: var(--text-dim);
  white-space: pre-wrap;
  line-height: 1.5;
}

.ai-config-section-marker {
  padding: 2px 2px 4px;
}

.ai-config-section-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.ai-config-preview-textarea {
  width: 100%;
  min-height: 620px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  background: var(--bg-tertiary);
  color: var(--text);
}

.ai-config-preview-document {
  min-height: 720px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #F8FAFC;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
  overflow-wrap: break-word;
}

.ai-config-inline-preview-document {
  min-height: 0;
  max-height: 320px;
  padding: 16px;
  overflow: auto;
}

.ai-config-full-preview-document {
  min-height: 360px;
  max-height: 760px;
  overflow: auto;
}

.ai-config-preview-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 12px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  overflow-wrap: break-word;
}

.ai-config-preview-document > .ai-config-preview-heading:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.ai-config-preview-heading-sub {
  font-size: 13px;
  margin: 24px 0 10px;
  padding-top: 0;
  border-top: none;
}

.ai-config-preview-paragraph {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.ai-config-preview-list {
  margin: 0 0 14px 18px;
  padding: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: break-word;
}

.ai-config-preview-list li + li {
  margin-top: 6px;
}

.ai-config-preview-dynamic {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  border: 1px dashed var(--border);
  color: var(--text-muted);
}

.ai-config-preview-dynamic-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.ai-config-preview-dynamic-line + .ai-config-preview-dynamic-line {
  margin-top: 6px;
}

.ai-config-version-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-config-version-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
}

.ai-config-version-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ai-config-version-copy strong,
.ai-config-version-copy span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-config-version-copy span {
  font-size: 12px;
  color: var(--text-muted);
}

.ai-config-version-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-config-empty-state {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.ai-config-version-modal {
  width: min(900px, 92vw);
}

.ai-config-version-document {
  min-height: 520px;
  max-height: 70vh;
  overflow: auto;
}

.ai-config-add-btn {
  margin-top: 12px;
}

.ai-config-preview-expand {
  display: none;
}

.ai-config-example-list,
.ai-config-rule-list,
.ai-config-feedback-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-config-example-item,
.ai-config-rule-item,
.ai-config-feedback-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
}

.ai-config-example-head,
.ai-config-feedback-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ai-config-rule-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.ai-config-rule-copy {
  flex: 1;
  min-width: 0;
}

.ai-config-rule-body {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.ai-config-rule-meta,
.ai-config-feedback-date {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.ai-config-rule-actions,
.ai-config-feedback-actions,
.ai-config-feedback-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-config-feedback-filters {
  margin-bottom: 12px;
}

.ai-config-feedback-filters .btn-ghost.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.ai-config-feedback-message {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-config-feedback-meta {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.ai-config-feedback-rewrite {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}

.ai-config-feedback-rewrite strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-config-feedback-rewrite p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.ai-config-feedback-rating {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.ai-config-feedback-rating.positive {
  background: rgba(22, 163, 74, 0.1);
}

.ai-config-feedback-rating.negative {
  background: rgba(220, 38, 38, 0.1);
}

.ai-config-approve-btn {
  border-color: rgba(22, 163, 74, 0.3);
  color: var(--success);
}

.ai-config-advanced summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.ai-config-advanced[open] summary {
  margin-bottom: 12px;
}

.ai-config-savebar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ai-config-global-prompt {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

/* ============================================
   MODAL
   ============================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateX(30px) scale(0.97);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.3s ease;
}
.modal-backdrop.open .modal { transform: translateX(0) scale(1); opacity: 1; }
.modal.modal-xl { max-width: 1100px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* Copy field */
.copy-field {
  display: flex;
  gap: 6px;
  align-items: center;
}
.copy-field input {
  flex: 1;
  font-size: 12px;
  font-family: var(--font-mono);
  background: var(--bg);
}
.copy-field button { flex-shrink: 0; }
.integration-guide {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
.integration-guide-head strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}
.integration-guide-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}
.integration-guide-alert {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}
.integration-guide-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.integration-guide-card {
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.integration-guide-step,
.integration-guide-copy-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.integration-guide-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.integration-guide-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}
.integration-guide-list--nested {
  margin-top: 0;
}
.integration-guide-list ul {
  margin-top: 8px;
  padding-left: 18px;
}
.integration-guide-subsection {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.integration-guide-url input {
  font-size: 12px;
}
.integration-guide-table {
  border: 1px solid var(--border-light);
  border-radius: 10px;
}
.integration-field-table td:first-child {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.integration-guide-note {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.toast.toast-out { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--accent); }
.toast-warning { border-left: 3px solid var(--warning); }

/* ============================================
   CONFIRM DIALOG
   ============================================ */
.confirm-text { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

/* ============================================
   CALENDAR VIEW (Appointments)
   ============================================ */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.calendar-nav-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-width: 200px;
  letter-spacing: -0.3px;
}
.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: calSlideIn 0.25s ease;
}
@keyframes calSlideIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
.calendar-day-header {
  background: var(--bg);
  padding: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.calendar-day {
  background: var(--card);
  min-height: 120px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.calendar-day-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.calendar-day.today .calendar-day-num {
  color: var(--accent);
}
.calendar-day.today {
  background: var(--accent-lighter);
}
.calendar-event {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all var(--transition);
  border-left: 2px solid var(--accent);
}
.calendar-event:hover {
  background: rgba(37, 99, 235, 0.12);
  transform: translateX(1px);
}
.calendar-event.completed {
  background: var(--success-light);
  color: var(--success);
  border-left-color: var(--success);
}
.calendar-event.confirmed {
  background: rgba(22, 163, 74, 0.10);
  color: var(--success);
  border-left-color: var(--success);
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.25);
}
.calendar-event.no-show {
  background: var(--danger-light);
  color: var(--danger);
  border-left-color: var(--danger);
}
.calendar-event.canceled {
  background: var(--bg-hover);
  color: var(--text-dim);
  border-left-color: var(--text-dim);
  text-decoration: line-through;
}

/* ============================================
   PAGE TRANSITIONS
   ============================================ */
.page.active {
  animation: pageFadeIn 0.3s ease;
}
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   LOADING SKELETON / SHIMMER
   ============================================ */
.skeleton {
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.skeleton-card {
  height: 120px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}
.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-row {
  height: 16px;
  background: var(--bg-hover);
  border-radius: 4px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}
.skeleton-row::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-row.short { width: 60%; }
.skeleton-row.medium { width: 80%; }
.skeleton-circle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-hover);
  position: relative;
  overflow: hidden;
}
.skeleton-circle::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ============================================
   ENHANCED EMPTY STATES
   ============================================ */
.empty-state-rich {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  flex: 1;
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  position: relative;
}
.empty-state-icon::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 20px;
  background: var(--accent-lighter);
  z-index: -1;
}
.empty-state-icon svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
}
.empty-state-rich h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.empty-state-rich p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.empty-state-rich button {
  margin-top: 4px;
}

/* ============================================
   CONVERSATION DATE SEPARATORS
   ============================================ */
.msg-date-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  margin: 4px 0;
}
.msg-date-separator::before,
.msg-date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.msg-date-separator span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ============================================
   MODAL SLIDE-IN FROM RIGHT
   ============================================ */
.modal-backdrop.open .modal {
  animation: modalSlideIn 0.3s cubic-bezier(0.4,0,0.2,1);
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateX(30px) scale(0.97); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

/* ============================================
   STAT CARD CLICKABLE
   ============================================ */
.stat-card.clickable {
  cursor: pointer;
}

/* ============================================
   ONBOARDING WIZARD
   ============================================ */
body.app-onboarding-open {
  overflow: hidden;
}

.app-onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.app-onboarding-shell {
  width: min(1120px, 100%);
  max-height: min(900px, calc(100dvh - 32px));
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  background: #FFFFFF;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.app-onboarding-sidebar {
  padding: 32px 24px;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 42%),
    linear-gradient(180deg, #0F172A 0%, #111827 100%);
  color: #E5EEF9;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.app-onboarding-eyebrow,
.app-onboarding-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.app-onboarding-eyebrow {
  color: #93C5FD;
  margin-bottom: 10px;
}

.app-onboarding-brand h2 {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.05;
  color: #F8FAFC;
  letter-spacing: -0.04em;
}

.app-onboarding-brand p {
  margin: 0;
  color: rgba(226, 232, 240, 0.86);
  line-height: 1.6;
}

.app-onboarding-progress {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 16px;
}

.app-onboarding-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

.app-onboarding-progress-row strong {
  color: #FFFFFF;
}

.app-onboarding-progress-row span {
  color: rgba(226, 232, 240, 0.78);
}

.app-onboarding-progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.app-onboarding-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #60A5FA 0%, #3B82F6 100%);
  transition: width 0.28s ease;
}

.app-onboarding-checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-onboarding-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.app-onboarding-checklist-item.current {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(59, 130, 246, 0.14);
  transform: translateX(4px);
}

.app-onboarding-checklist-item.done {
  border-color: rgba(74, 222, 128, 0.26);
}

.app-onboarding-step-pill {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 800;
}

.app-onboarding-checklist-item.done .app-onboarding-step-pill {
  background: rgba(34, 197, 94, 0.2);
  color: #86EFAC;
}

.app-onboarding-checklist-item.current .app-onboarding-step-pill {
  background: #60A5FA;
  color: #0F172A;
}

.app-onboarding-step-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-onboarding-step-copy strong {
  color: #F8FAFC;
  font-size: 14px;
}

.app-onboarding-step-copy span {
  color: rgba(226, 232, 240, 0.7);
  font-size: 12px;
  line-height: 1.45;
}

.app-onboarding-skip {
  margin-top: auto;
  align-self: flex-start;
  color: #E2E8F0;
  border-color: rgba(255, 255, 255, 0.16);
}

.app-onboarding-body {
  padding: 32px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-onboarding-header h3 {
  margin: 6px 0 10px;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.app-onboarding-header p {
  margin: 0;
  color: var(--text-secondary);
  max-width: 720px;
  line-height: 1.65;
}

.app-onboarding-kicker {
  color: var(--accent);
}

.app-onboarding-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 4px 16px 0;
}

.app-onboarding-grid {
  display: grid;
  gap: 16px;
}

.app-onboarding-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-onboarding-grid.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.app-onboarding-grid .full {
  grid-column: 1 / -1;
}

.app-onboarding-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
}

.app-onboarding-content .form-group {
  margin-bottom: 0;
}

.app-onboarding-content input,
.app-onboarding-content select,
.app-onboarding-content textarea {
  width: 100%;
}

.app-onboarding-pill-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.app-onboarding-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.app-onboarding-pill.active {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.1);
  color: #1D4ED8;
}

.app-onboarding-preview,
.app-onboarding-tip,
.app-onboarding-test-result,
.app-onboarding-complete-card,
.app-onboarding-test-card,
.app-onboarding-integration-card {
  border: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.8);
  border-radius: 20px;
  padding: 18px 20px;
}

.app-onboarding-tip,
.app-onboarding-preview p,
.app-onboarding-test-card p,
.app-onboarding-integration-card p {
  color: var(--text-secondary);
}
@media (max-width: 720px) {
  .integration-guide-steps {
    grid-template-columns: 1fr;
  }
}

.app-onboarding-preview {
  margin-top: 18px;
}

.app-onboarding-time-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.app-onboarding-days {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.app-onboarding-day-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  background: #FFFFFF;
}

.app-onboarding-day-card.disabled {
  opacity: 0.62;
}

.app-onboarding-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.app-onboarding-day-label {
  font-size: 14px;
  font-weight: 700;
}

.app-onboarding-day-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.app-onboarding-day-times {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.app-onboarding-time-sep {
  color: var(--text-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.app-onboarding-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app-onboarding-integration-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.app-onboarding-status-badge {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.app-onboarding-status-badge.success {
  color: #166534;
  background: rgba(34, 197, 94, 0.12);
}

.app-onboarding-status-badge.pending {
  color: #92400E;
  background: rgba(245, 158, 11, 0.12);
}

.app-onboarding-status-badge.muted {
  color: #475569;
  background: rgba(148, 163, 184, 0.14);
}

.app-onboarding-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.app-onboarding-test-card pre {
  margin: 14px 0 0;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.app-onboarding-complete-card {
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}

.app-onboarding-complete-mark {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
  font-size: 28px;
  font-weight: 900;
}

.app-onboarding-next-steps {
  text-align: left;
  margin: 18px auto 0;
  max-width: 520px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.app-onboarding-footer {
  border-top: 1px solid var(--border);
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.app-onboarding-footer-left,
.app-onboarding-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 980px) {
  .app-onboarding-shell {
    grid-template-columns: 1fr;
  }

  .app-onboarding-sidebar {
    padding: 24px 20px 20px;
  }

  .app-onboarding-checklist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-onboarding-skip {
    margin-top: 0;
  }

  .app-onboarding-body {
    padding: 24px 20px;
  }

  .ai-config-layout {
    gap: 14px;
  }
}

@media (max-width: 768px) {
  .app-onboarding-overlay {
    padding: 12px;
  }

  .app-onboarding-shell {
    max-height: calc(100dvh - 24px);
    border-radius: 22px;
  }

  .app-onboarding-sidebar {
    gap: 18px;
  }

  .app-onboarding-brand h2,
  .app-onboarding-header h3 {
    font-size: 24px;
  }

  .app-onboarding-checklist {
    grid-template-columns: 1fr;
  }

  .app-onboarding-grid.two-up,
  .app-onboarding-grid.three-up,
  .app-onboarding-time-range,
  .app-onboarding-days {
    grid-template-columns: 1fr;
  }

  .app-onboarding-integration-head,
  .app-onboarding-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .app-onboarding-footer-left,
  .app-onboarding-footer-right {
    width: 100%;
    justify-content: space-between;
  }

  .app-onboarding-footer-right .btn-primary,
  .app-onboarding-footer-right .btn-ghost,
  .app-onboarding-actions .btn-primary,
  .app-onboarding-actions .btn-ghost {
    width: 100%;
  }
}

/* ── New 3-step industry onboarding ──────────────────── */
.app-onboarding-shell--compact {
  display: flex;
  flex-direction: column;
  max-width: 640px;
  width: 94vw;
  max-height: 90vh;
  border-radius: 16px;
  background: var(--bg-card, #fff);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow-y: auto;
  padding: 32px 36px 24px;
}

.app-onboarding-steps {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 24px;
}

.app-onboarding-step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
  transition: opacity .15s;
}

.app-onboarding-step-dot.active,
.app-onboarding-step-dot.done {
  opacity: 1;
}

.app-onboarding-dot-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  border: 2px solid var(--border, #ddd);
  color: var(--text-secondary, #666);
  transition: all .15s;
}

.app-onboarding-step-dot.active .app-onboarding-dot-num {
  background: var(--primary, #4f46e5);
  color: #fff;
  border-color: var(--primary, #4f46e5);
}

.app-onboarding-step-dot.done .app-onboarding-dot-num {
  background: var(--success, #22c55e);
  color: #fff;
  border-color: var(--success, #22c55e);
}

.app-onboarding-dot-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #666);
}

.app-onboarding-step-dot.active .app-onboarding-dot-label {
  color: var(--text-primary, #111);
  font-weight: 600;
}

.app-onboarding-shell--compact .app-onboarding-header-text {
  text-align: center;
  margin-bottom: 24px;
}

.app-onboarding-shell--compact .app-onboarding-header-text h3 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text-primary, #111);
}

.app-onboarding-shell--compact .app-onboarding-header-text p {
  font-size: 14px;
  color: var(--text-secondary, #666);
  margin: 0;
}

.app-onboarding-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.app-onboarding-pick-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border: 2px solid var(--border, #e5e7eb);
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s;
  background: var(--bg-card, #fff);
}

.app-onboarding-pick-card:hover {
  border-color: var(--primary, #4f46e5);
  background: var(--bg-hover, #f9fafb);
}

.app-onboarding-pick-card.selected {
  border-color: var(--primary, #4f46e5);
  background: rgba(79, 70, 229, 0.06);
}

.app-onboarding-pick-card strong {
  font-size: 15px;
  font-weight: 600;
}

.app-onboarding-pick-check {
  font-size: 18px;
  color: var(--primary, #4f46e5);
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.app-onboarding-config-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.app-onboarding-hint {
  font-size: 12px;
  color: var(--text-muted, #999);
  line-height: 1.4;
}

.app-onboarding-config-form input,
.app-onboarding-config-form textarea {
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-input, #fff);
  color: var(--text-primary, #111);
  resize: vertical;
}

.app-onboarding-config-form textarea {
  min-height: 60px;
}

.app-onboarding-loading {
  text-align: center;
  padding: 40px 0;
  color: var(--text-secondary, #666);
  font-size: 14px;
}

.app-onboarding-shell--compact .app-onboarding-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #e5e7eb);
}

.app-onboarding-shell--compact .app-onboarding-footer-left,
.app-onboarding-shell--compact .app-onboarding-footer-right {
  display: flex;
  gap: 8px;
}

@media (max-width: 768px) {
  .app-onboarding-shell--compact {
    padding: 20px 18px 16px;
    max-width: 100vw;
    width: 100vw;
    border-radius: 0;
    max-height: 100vh;
  }

  .app-onboarding-steps {
    gap: 16px;
  }

  .app-onboarding-card-grid {
    grid-template-columns: 1fr;
  }

  .ai-config-row,
  .ai-config-kv-row {
    grid-template-columns: 1fr;
  }

  .page-header-sub {
    font-size: 15px;
    line-height: 1.5;
  }

  .ai-config-page {
    gap: 12px;
  }

  .ai-config-page-header,
  .ai-config-selector-inline,
  .ai-config-selector-stack {
    align-items: stretch;
  }

  .ai-config-page-header {
    gap: 12px;
    padding-bottom: 14px;
  }

  .ai-config-selector-stack .ai-config-selector-label {
    align-self: stretch;
  }

  .ai-config-selector-inline,
  .ai-config-selector-stack {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .ai-config-client-select,
  .ai-config-page-status {
    max-width: none;
    width: 100%;
  }

  .ai-config-page-status {
    text-align: left;
    font-size: 14px;
  }

  .ai-config-selector-stack {
    min-width: 0;
  }

  .ai-config-group-summary {
    padding: 16px;
  }

  .ai-config-group-body {
    padding: 16px;
    min-width: 0;
    overflow-x: hidden;
  }

  .ai-config-hint,
  .ai-config-inline-status {
    font-size: 14px;
  }

  .ai-config-grid.two-up {
    grid-template-columns: 1fr;
  }

  .ai-config-inline-preview-copy {
    font-size: 14px;
  }

  .ai-config-section-kicker {
    font-size: 12px;
  }

  .ai-config-sidebar,
  .ai-config-preview-column {
    position: static;
  }

  .ai-config-card-actions,
  .ai-config-version-row,
  .ai-config-url-tool,
  .ai-config-rule-item {
    flex-direction: column;
    align-items: stretch;
  }

  .ai-config-url-tool {
    grid-template-columns: 1fr;
  }

  .ai-config-preview-document {
    min-height: 0;
    padding: 16px;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .ai-config-inline-preview-document {
    max-height: 260px;
  }

  .ai-config-full-preview-document {
    max-height: 520px;
  }

  .wizard-modal {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  .wizard-progress {
    padding: 14px 14px 0;
    align-items: flex-start;
  }

  .wizard-progress-step {
    gap: 4px;
    flex: 1;
    justify-content: center;
    text-align: center;
  }

  .wizard-progress-step .label-full { display: none; }
  .wizard-progress-step .label-short { display: inline; }

  .wizard-progress-step .step-num {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }

  .wizard-progress-line { margin: 10px 2px 0; }
  .wizard-bar { margin: 10px 14px 0; }

  .wizard-body {
    padding: 16px 14px;
    min-height: 0;
  }

  .wizard-footer {
    padding: 12px 14px 14px;
    gap: 10px;
  }

  .wizard-step .form-row { grid-template-columns: 1fr; gap: 10px; }
}

/* Simulate reply section */
.inbox-chat-simulate {
  border-top: 1px solid var(--border);
  padding: 8px 12px 12px;
  background: #FFFFFF;
}
.simulate-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

/* ============================================
   PASSWORD CHANGE BANNER
   ============================================ */
.password-change-banner {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.06), rgba(37, 99, 235, 0.03));
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 24px 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================
   IMPORT RESULTS
   ============================================ */
.import-results {
  margin-top: 16px;
}
.import-stat {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.import-status {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ============================================
   TABLET RESPONSIVE (inbox grid intermediate)
   ============================================ */
@media (max-width: 980px) and (min-width: 769px) {
  .inbox-layout-with-sidebar {
    grid-template-columns: 240px 1fr;
  }
  .master-leads-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .master-leads-layout.master-leads-layout--detail-open {
    grid-template-columns: minmax(0, 1fr) minmax(350px, 1fr);
  }
  /* Hide low-priority columns at tablet */
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table th:nth-child(8),
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table td:nth-child(8),
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table th:nth-child(9),
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table td:nth-child(9),
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table th:nth-child(10),
  .master-leads-layout.master-leads-layout--detail-open .master-leads-table td:nth-child(10) {
    display: none;
  }
  .inbox-sidebar {
    display: none;
  }
  .inbox-sidebar.mobile-active {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 11;
    background: var(--bg-secondary, #f8f9fb);
  }
  .inbox-sidebar.mobile-active .mobile-back-btn {
    display: inline-flex !important;
  }
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }
  .mobile-header { display: flex; }
  #app { flex-direction: column; }
  .main-content { width: 100%; }

  .kanban { padding: 12px; gap: 8px; }
  .kanban-col { min-width: 260px; flex: 1 0 260px; }

  .inbox-layout, .inbox-layout-with-sidebar {
    grid-template-columns: 1fr;
  }
  .master-leads-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .master-leads-layout.master-leads-layout--detail-open {
    grid-template-columns: minmax(0, 1fr);
  }
  .inbox-list-panel {
    border-right: none;
  }
  .master-leads-toolbar {
    padding: 12px 0;
  }
  .master-leads-toolbar input,
  .master-leads-toolbar select {
    width: 100%;
    max-width: none;
  }
  /* Scrollable table container on mobile */
  .master-leads-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .master-leads-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }
  .master-leads-table th,
  .master-leads-table td {
    padding: 8px 4px;
  }
  /* Hide Lead Type + low-priority columns on mobile */
  .master-leads-table th:nth-child(2),
  .master-leads-table td:nth-child(2),
  .master-leads-table th:nth-child(6),
  .master-leads-table td:nth-child(6),
  .master-leads-table th:nth-child(8),
  .master-leads-table td:nth-child(8),
  .master-leads-table th:nth-child(9),
  .master-leads-table td:nth-child(9),
  .master-leads-table th:nth-child(10),
  .master-leads-table td:nth-child(10),
  .master-leads-table th:nth-child(11),
  .master-leads-table td:nth-child(11),
  .master-leads-table th:nth-child(12),
  .master-leads-table td:nth-child(12) {
    display: none;
  }
  .master-leads-table th:nth-child(3),
  .master-leads-table td:nth-child(3),
  .master-leads-table th:nth-child(4),
  .master-leads-table td:nth-child(4),
  .master-leads-table th:nth-child(5),
  .master-leads-table td:nth-child(5),
  .master-leads-table th:nth-child(7),
  .master-leads-table td:nth-child(7) {
    width: auto;
    min-width: 0;
  }
  .master-leads-client-link {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .master-leads-table td:nth-child(4),
  .master-leads-table td:nth-child(5) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .master-leads-table .badge {
    padding: 2px 6px;
    font-size: 10px;
  }
  /* 44px minimum touch targets for checkboxes */
  .master-leads-row-select,
  .master-leads-select-all {
    width: 20px;
    height: 20px;
    min-width: 44px;
    min-height: 44px;
    padding: 12px;
  }
  .master-leads-checkbox-col {
    width: 36px;
  }
  .master-leads-pagination {
    flex-direction: column;
    align-items: stretch;
  }
  .master-leads-pagination-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .inbox-chat-panel { display: none; }
  .inbox-chat-panel.mobile-active {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 10;
    background: var(--bg);
  }
  .inbox-sidebar {
    display: none;
  }
  .inbox-sidebar.mobile-active {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 11;
    background: var(--bg-secondary, #f8f9fb);
  }
  .mobile-back-btn { display: inline-flex !important; }

  .slideover { width: 100vw; }

  .dashboard-page, .appointments-page, .clients-page, .settings-page, .admin-settings-page, .ai-config-page { padding: 16px; }
  .settings-shell {
    max-width: 100%;
    overflow-x: hidden;
  }
  .settings-nav {
    position: static;
    top: auto;
    overflow: hidden;
  }
  .settings-nav-head {
    align-items: center;
  }
  .settings-content {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
  .settings-nav-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .settings-nav-item {
    min-width: 180px;
    flex: 0 0 auto;
  }
  .settings-nav-group {
    display: none;
  }
  .settings-section {
    padding: 16px;
  }
  .settings-section p {
    padding-right: 4px;
  }
  .signalhouse-toolbar-wrap,
  .signalhouse-number-columns,
  .signalhouse-form-grid,
  .signalhouse-number-search-grid {
    grid-template-columns: 1fr;
  }
  .ai-config-section-copy, .page-header-sub {
    font-size: 14px;
    line-height: 1.5;
  }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row { grid-template-columns: 1fr; }
  .page-header { padding: 16px 16px 0; }
  .pipeline-filter-row { padding: 0 16px 12px; }
  .pipeline-custom-range { width: 100%; }
  .pipeline-custom-field { min-width: 0; flex: 1 1 140px; }
}

/* ============================================
   ANALYTICS PAGES
   ============================================ */

.analytics-filter-select {
  min-width: 140px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: var(--card);
  color: var(--text);
  font-family: var(--font);
}

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

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.analytics-table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.analytics-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.analytics-table tbody tr:hover {
  background: var(--bg-hover);
}
.analytics-table tbody tr:last-child td {
  border-bottom: none;
}

.ab-test-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Make skeleton cards animate */
.skeleton-card {
  height: 80px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@media (max-width: 768px) {
  .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .analytics-table { font-size: 12px; }
  .analytics-table th, .analytics-table td { padding: 6px 8px; }
}

@media (min-width: 769px) {
  .mobile-back-btn { display: none !important; }
  .mobile-header { display: none !important; }
}

/* ============================================
   MESSAGE FEEDBACK
   ============================================ */
.msg-feedback-dot {
  position: absolute;
  top: 14px;
  right: 76px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
}

/* ---- Prompt Viewer ---- */
.prompt-viewer-panel {
  align-self: flex-end;
  width: 90%;
  max-width: 720px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: -4px;
  margin-bottom: 4px;
  animation: msgFadeIn 0.2s ease;
}
.prompt-section { margin-bottom: 10px; }
.prompt-section:last-child { margin-bottom: 0; }
.prompt-section-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.prompt-section-body {
  font-family: var(--font-mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}
.prompt-meta-row {
  font-size: 10px;
  color: var(--text-dim);
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* Message action buttons row (prompt, thumbs up/down) */
.msg-actions-row {
  display: flex;
  gap: 4px;
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.msg-bubble:hover .msg-actions-row,
.msg-bubble:focus-within .msg-actions-row {
  opacity: 1;
  pointer-events: auto;
}
.msg-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: rgba(255,255,255,0.78);
  opacity: 0.4;
  transition: opacity 0.15s ease, color 0.15s ease;
  line-height: 1;
}
.msg-action-btn svg {
  width: 16px;
  height: 16px;
}
.msg-action-btn:hover,
.msg-action-btn:focus-visible {
  opacity: 1;
  color: #fff;
  outline: none;
}
.msg-inbound .msg-action-btn {
  color: var(--text-muted);
}
.msg-inbound .msg-action-btn:hover,
.msg-inbound .msg-action-btn:focus-visible {
  color: var(--text);
}

@media (max-width: 768px) {
  .inbox-chat-header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .inbox-chat-header-main {
    width: 100%;
    align-items: flex-start;
  }
  .inbox-chat-header-lead {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .inbox-chat-header-title-row {
    flex-wrap: wrap;
    width: 100%;
  }
  .inbox-chat-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .voice-page {
    padding: 16px;
  }

  .voice-filters input,
  .voice-filters select {
    min-width: 0;
    width: 100%;
  }

  .voice-log-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .voice-log-summary-meta,
  .voice-pagination {
    justify-content: flex-start;
  }

  .voice-log-lead-type {
    display: none;
  }

  .voice-client-setting-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .msg-bubble-has-actions {
    padding-right: 14px;
  }

  .msg-bubble-has-actions .msg-actions-row {
    position: static;
    margin-top: 8px;
    justify-content: flex-end;
    opacity: 1;
    pointer-events: auto;
  }

  .msg-bubble-has-actions .msg-action-btn {
    width: 22px;
    height: 22px;
    opacity: 0.78;
  }

  .msg-feedback-dot {
    right: 4px;
  }
}

/* Inline feedback panel (thumbs up/down) */
.msg-feedback-inline {
  align-self: flex-end;
  width: 80%;
  max-width: 500px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  margin-top: -2px;
  margin-bottom: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  animation: msgFadeIn 0.15s ease;
}
.msg-feedback-inline input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}
.msg-feedback-inline.positive { border-left: 3px solid var(--success, #22c55e); }
.msg-feedback-inline.negative { border-left: 3px solid var(--danger, #ef4444); }
.voice-page {
  padding: 20px 28px;
  display: grid;
  gap: 18px;
}
.voice-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.voice-page-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.voice-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.voice-filters input,
.voice-filters select {
  min-width: 150px;
  width: auto;
}
.voice-log-list {
  display: grid;
  gap: 12px;
}
.voice-log-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}
.voice-log-summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.voice-log-summary::-webkit-details-marker {
  display: none;
}
.voice-log-summary-main {
  min-width: 0;
}
.voice-log-caller {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.voice-log-subline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 13px;
}
.voice-log-phone {
  display: inline-flex;
  align-items: center;
}
.voice-log-lead-type {
  font-size: 11px;
}
.voice-log-summary-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.voice-log-body {
  border-top: 1px solid var(--border);
  padding: 16px 18px 18px;
  display: grid;
  gap: 12px;
}
.voice-log-muted {
  color: var(--text-muted);
  font-size: 13px;
}
.voice-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.voice-pagination-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Chat status banner (AI vs manual) */
.chat-status-banner {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.chat-mode-copy {
  min-width: 0;
}
.chat-mode-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.chat-mode-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.chat-mode-heading {
  font-size: 12px;
  font-weight: 700;
}
.chat-mode-body {
  font-size: 12px;
  line-height: 1.45;
}
.chat-mode-toggle {
  flex-shrink: 0;
}
.chat-mode-toggle .toggle-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.chat-status-banner.ai {
  background: rgba(34, 197, 94, 0.08);
  color: #16a34a;
  border-bottom: 1px solid rgba(34, 197, 94, 0.15);
}
.chat-status-banner.ai .chat-mode-badge {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}
.chat-status-banner.manual {
  background: rgba(245, 158, 11, 0.08);
  color: #d97706;
  border-bottom: 1px solid rgba(245, 158, 11, 0.15);
}
.chat-status-banner.manual .chat-mode-badge {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}
@media (max-width: 768px) {
  .chat-status-banner {
    align-items: flex-start;
    flex-direction: column;
  }
}
.btn-warning {
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}
.btn-warning:hover { background: #d97706; }
.btn-xs { padding: 4px 10px; font-size: 11px; }

/* Sidebar upcoming messages */
.sidebar-upcoming-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-secondary);
}
.sidebar-upcoming-item:last-child { border-bottom: none; }

/* Workflow timeline */
.sidebar-card-toggle { display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.wf-chevron { display: inline-flex; align-items: center; color: var(--text-dim); transition: transform 0.25s ease-out; }
.wf-chevron-open { transform: rotate(90deg); }
.wf-timeline-body { max-height: 0; overflow: hidden; transition: max-height 0.25s ease-out, padding 0.25s ease-out; padding-top: 0; }
.wf-timeline-body.wf-open { max-height: 600px; padding-top: 8px; }
.wf-timeline-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.wf-status { font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.wf-status-active { background: #DCFCE7; color: #166534; }
.wf-status-completed { background: #DBEAFE; color: #1E40AF; }
.wf-status-stopped { background: #FEE2E2; color: #991B1B; }
.wf-stopped-reason { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; font-style: italic; }
.wf-timeline { display: flex; flex-direction: column; gap: 0; }
.wf-step { display: flex; gap: 8px; padding: 6px 0; border-left: 2px solid var(--border-light); margin-left: 8px; padding-left: 12px; position: relative; }
.wf-step::before { content: ''; position: absolute; left: -5px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--border-light); }
.wf-step:first-child { padding-top: 0; }
.wf-step:last-child { border-left-color: transparent; }
.wf-step-next { background: #F0FDF4; border-radius: 6px; padding: 8px 8px 8px 12px; margin-left: 6px; border-left: 3px solid #22C55E; }
.wf-step-next::before { background: #22C55E; left: -7px; }
.wf-step-icon { font-size: 14px; flex-shrink: 0; line-height: 1; }
.wf-step-content { flex: 1; min-width: 0; }
.wf-step-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.wf-step-preview { font-size: 12px; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 1px; }
.wf-step-time { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* TCPA reference table */
.tcpa-federal { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; padding: 8px 12px; background: #F0F9FF; border: 1px solid #BAE6FD; border-radius: 8px; }
.tcpa-ref-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tcpa-ref-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 8px 10px; border-bottom: 2px solid var(--border); font-weight: 700; }
.tcpa-ref-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); }
.tcpa-ref-table tr:hover { background: var(--bg-hover, #F8FAFC); }
.tcpa-stricter { background: #FFFBEB; }
.tcpa-stricter:hover { background: #FEF3C7 !important; }
.tcpa-badge { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: #FEF3C7; color: #92400E; font-weight: 600; letter-spacing: 0.02em; vertical-align: middle; }
.tcpa-blocked { color: #DC2626; font-weight: 600; font-size: 12px; }
.tcpa-table-wrap { max-height: 600px; overflow-y: auto; overflow-x: auto; border: 1px solid var(--border-light); border-radius: 8px; -webkit-overflow-scrolling: touch; }
.tcpa-table-wrap .tcpa-federal { margin: 12px; }
@media (max-width: 480px) {
  .tcpa-ref-table { font-size: 11px; min-width: 420px; }
  .tcpa-ref-table th, .tcpa-ref-table td { padding: 4px 6px; }
}

/* Smart scheduling recommendations */
.smart-recs { display: flex; flex-direction: column; gap: 6px; }
.smart-rec-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: #F0FDF4; border: 1px solid #BBF7D0; border-radius: 8px; font-size: 12px; }
.smart-rec-desc { color: var(--text-secondary); flex: 1; }
.smart-rec-lift { font-weight: 700; color: #166534; white-space: nowrap; }
.heatmap-table td { min-width: 48px; }

/* Scrollable table wrappers with scroll affordance */
.table-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
}
.table-scroll-wrapper::-webkit-scrollbar { height: 6px; }
.table-scroll-wrapper::-webkit-scrollbar-track { background: transparent; }
.table-scroll-wrapper::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }

@media (max-width: 480px) {
  .heatmap-table td { min-width: 32px; padding: 4px 2px; font-size: 10px; }
  .heatmap-table th { padding: 4px 2px; font-size: 9px; }
  .analytics-table th, .analytics-table td { padding: 4px 6px; font-size: 11px; }
}

.feedback-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.feedback-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.feedback-modal-header {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}
.feedback-msg-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 14px;
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.5;
}
.feedback-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.feedback-radio-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.15s;
}
.feedback-radio-label:has(input:checked) {
  border-color: var(--accent);
  background: rgba(59,130,246,0.08);
}
.feedback-radio-label input { display: none; }
.feedback-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  min-height: 60px;
  margin-bottom: 12px;
  font-family: inherit;
}
.feedback-textarea:focus { outline: none; border-color: var(--accent); }
.feedback-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}
.feedback-select:focus { outline: none; border-color: var(--accent); }
.feedback-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ---- Notification Bell & Panel ---- */
.content-topbar {
  display: flex;
  align-items: center;
  padding: 8px 24px 0;
  justify-content: flex-end;
}
@media (max-width: 768px) {
  .content-topbar { display: none; }
}
.notif-wrapper {
  position: relative;
}
.notif-bell-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.notif-bell-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.notif-bell-btn svg {
  width: 22px;
  height: 22px;
}
.notif-badge {
  position: absolute;
  top: 2px;
  right: 0;
  background: #DC2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  padding: 0 4px;
  pointer-events: none;
}
.mobile-header .notif-bell-btn {
  margin-left: auto;
}
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  max-height: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  z-index: 1000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@media (max-width: 480px) {
  .notif-panel {
    width: calc(100vw - 24px);
    right: -12px;
  }
}
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-panel-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}
.notif-mark-all {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.notif-mark-all:hover {
  background: var(--accent-light);
}
.notif-list {
  overflow-y: auto;
  max-height: 420px;
  flex: 1;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}
.notif-item:hover {
  background: var(--bg-hover);
}
.notif-item:last-child {
  border-bottom: none;
}
.notif-item.unread {
  background: var(--accent-lighter, rgba(37,99,235,0.03));
}
.notif-item.unread .notif-message {
  font-weight: 600;
}
.notif-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-hover);
  margin-top: 2px;
}
.notif-body {
  flex: 1;
  min-width: 0;
}
.notif-message {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.notif-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.notif-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.notif-panel-mobile {
  display: none;
  position: fixed;
  top: 54px;
  left: 12px;
  right: 12px;
  width: auto;
  max-height: calc(100dvh - 70px);
  z-index: 1001;
}

.automations-builder-page {
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.automations-context-card {
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at top right, rgba(37,99,235,.12), transparent 34%),
    linear-gradient(180deg, rgba(37,99,235,.06) 0%, rgba(255,255,255,.99) 100%);
  border-radius: 20px;
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.automations-context-card.is-global {
  border-color: rgba(124,58,237,.35);
  background:
    radial-gradient(circle at top right, rgba(124,58,237,.35), transparent 38%),
    radial-gradient(circle at bottom left, rgba(139,92,246,.18), transparent 42%),
    linear-gradient(180deg, rgba(124,58,237,.12) 0%, rgba(255,255,255,.99) 100%);
  box-shadow: 0 18px 42px rgba(124,58,237,.18);
}
.automations-context-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}
.automations-context-copy {
  min-width: 0;
}
.automations-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}
.automations-header-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.automations-builder-subtitle {
  margin: 8px 0 0;
  color: var(--text-secondary);
  max-width: 720px;
  line-height: 1.55;
}
.automations-eyebrow,
.automations-section-kicker,
.automations-context-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.automations-eyebrow {
  color: var(--primary);
}
.automations-context-copy h2,
.automations-rail-header h3 {
  margin: 6px 0 0;
}
.automations-client-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  font-size: 13px;
  color: var(--text-muted);
}
.automations-context-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.automations-context-spotlight {
  margin-top: 16px;
  border: 1px solid rgba(37,99,235,.12);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255,255,255,.78);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.automations-context-badge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.automations-client-badge,
.automations-context-note {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}
.automations-client-badge {
  background: rgba(15,23,42,.06);
  color: var(--text-primary);
}
.automations-context-note {
  background: rgba(37,99,235,.10);
  color: var(--primary);
}
.automations-context-summary {
  margin: 0;
  max-width: 780px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}
.automations-context-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.automations-context-stat {
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 14px;
  padding: 18px 20px;
  background: rgba(255,255,255,.82);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
.automations-context-label {
  color: var(--text-muted);
}
.automations-context-empty {
  margin-top: 14px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}
.automations-client-select,
.automations-name-input,
.automations-step-controls select,
.automations-step-controls input,
.automations-message-input {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 10px;
}
.automations-client-select,
.automations-name-input,
.automations-step-controls select,
.automations-step-controls input {
  height: 40px;
  padding: 0 12px;
}
.automations-builder-layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.automations-sequence-rail,
.automations-editor-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.automations-sequence-rail {
  position: sticky;
  top: 20px;
}
.automations-rail-header,
.automations-editor-header,
.automations-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.automations-section-kicker {
  color: var(--text-muted);
}
.automations-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(148,163,184,.1);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.automations-rail-header p,
.automations-card-copy {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}
.automations-sequence-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.automations-sequence-card,
.automations-empty-card,
.automations-card,
.automations-step-card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.automations-sequence-card {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease, opacity .15s ease;
  border-left: 3px solid transparent;
}
.automations-sequence-card.is-enabled {
  border-left-color: var(--success);
  background: rgba(16,185,129,.04);
}
.automations-sequence-card.is-disabled {
  opacity: .65;
}
.automations-sequence-card:hover,
.automations-sequence-card.selected {
  border-color: rgba(37,99,235,.55);
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(15,23,42,.08);
}
.automations-sequence-card.selected.is-enabled {
  border-left-color: var(--success);
}
.automations-sequence-card-top,
.automations-timeline-top,
.automations-step-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.automations-sequence-card-copy,
.automations-sequence-card-meta,
.automations-step-summary,
.automations-timeline-preview {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}
.automations-sequence-card-copy {
  margin-top: 8px;
}
.automations-preview-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.automations-sequence-card-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.automations-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(148,163,184,.14);
  color: var(--text-muted);
  border: 1px solid transparent;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}
.automations-status-pill.is-enabled {
  background: rgba(16,185,129,.12);
  color: var(--success);
  border-color: rgba(16,185,129,.38);
  gap: 6px;
}
.automations-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
.automations-status-pill.is-disabled {
  background: rgba(148,163,184,.16);
  color: var(--text-muted);
  border-color: rgba(148,163,184,.36);
}
.automations-status-pill.is-draft {
  background: rgba(245,158,11,.12);
  color: #b45309;
  border-color: rgba(245,158,11,.4);
}
.automations-empty-card,
.automations-card {
  padding: 18px;
}
.automations-empty-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.automations-empty-card h3,
.automations-empty-card h4 {
  margin-bottom: 6px;
}
.automations-empty-card--sequence-rail {
  min-height: 180px;
  justify-content: center;
}
.automations-empty-note {
  margin: 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.55;
}
.automations-empty-actions,
.automations-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.automations-editor-title {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.automations-name-input {
  width: min(100%, 420px);
  font-size: 18px;
  font-weight: 600;
  height: 46px;
}
.automations-editor-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.automations-editor-meta-copy {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}
.automations-toggle-row,
.automations-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  min-height: 36px;
  padding: 4px 0;
}
.automations-toggle-row {
  width: 100%;
}
.automations-toggle-row--lead-type {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}
.automations-toggle-row--toggles {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px 14px;
}
.automations-field-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.automations-field-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.automations-field-help,
.automations-inline-help {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.automations-inline-help {
  flex: 1 1 260px;
  min-width: 220px;
}
.automations-target-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(37,99,235,.09);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.automations-inline-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border, #D1D5DB);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.automations-inline-check input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.automations-inline-check input[type="checkbox"]:checked {
  background: var(--primary, #3B82F6);
}
.automations-inline-check input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}
@media (max-width: 480px) {
  .automations-toggle-row { flex-wrap: wrap; gap: 4px; }
  .automations-inline-check { display: flex; min-height: 44px; gap: 10px; }
}
.automations-step-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.automations-step-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  position: relative;
}
.automations-step-connector-line {
  width: 2px;
  height: 14px;
  background: rgba(37,99,235,.25);
}
.automations-step-connector-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  flex-shrink: 0;
}
.automations-step-connector-delay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(37,99,235,.07);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  margin: 2px 0;
}
.automations-step-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.automations-step-card.drag-over {
  border-color: rgba(37,99,235,.65);
  background: rgba(37,99,235,.04);
}
.automations-step-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.automations-step-summary-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.automations-step-handle {
  cursor: grab;
  color: var(--text-muted);
  letter-spacing: 1px;
}
.automations-step-preview {
  color: var(--text-primary);
  line-height: 1.5;
}
.automations-step-timing {
  color: var(--text-secondary);
  font-size: 13px;
}
.automations-step-live-example {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(37,99,235,.14);
  background: rgba(37,99,235,.05);
}
.automations-step-live-example-label {
  font-size: 11px;
  line-height: 1.2;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.automations-step-live-example-copy {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
}
.automations-step-actions {
  display: inline-flex;
  gap: 8px;
  align-items: flex-start;
}
.automations-message-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: stretch;
}
.automations-message-field {
  min-width: 0;
}
.automations-single-message-field,
.automations-multi-message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.automations-message-input {
  width: 100%;
  min-height: 124px;
  resize: vertical;
  padding: 12px 14px;
  line-height: 1.45;
}
.automations-message-input--burst {
  min-height: 96px;
}
.automations-burst-toolbar,
.automations-multi-message-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.automations-burst-toolbar-note,
.automations-multi-message-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}
.automations-multi-message-item {
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 14px;
  background: rgba(248,250,252,.72);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.automations-template-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.automations-template-reference {
  min-width: 0;
}
.automations-template-reference-toggle {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  list-style: none;
}
.automations-template-reference-toggle::-webkit-details-marker {
  display: none;
}
.automations-template-reference[open] {
  width: 100%;
}
.automations-template-reference[open] .template-variable-reference {
  margin-top: 10px;
}
.automations-burst-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(37,99,235,.08);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}
.automations-burst-badge::before {
  content: "⚡";
  font-size: 11px;
}
.automations-burst-badge.is-hidden {
  display: none;
}
.automations-sms-preview-card {
  border: 1px solid rgba(37,99,235,.14);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(248,250,252,.98) 0%, rgba(255,255,255,.98) 100%);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.automations-sms-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.automations-sms-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.automations-sms-preview-from {
  font-weight: 700;
  color: var(--text-primary);
}
.automations-sms-preview-shell {
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(226,232,240,.34) 0%, rgba(241,245,249,.62) 100%);
}
.automations-sms-preview-thread {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.automations-sms-preview-bubble {
  max-width: 100%;
  margin-left: auto;
  padding: 12px 14px;
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 10px 22px rgba(37,99,235,.22);
}
.automations-sms-preview-bubble--burst {
  border-radius: 18px;
}
.automations-sms-preview-bubble.is-empty {
  background: rgba(148,163,184,.18);
  color: var(--text-muted);
  box-shadow: none;
}
.automations-sms-preview-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.automations-message-counter {
  min-width: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
}
.automations-message-counter-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.automations-message-counter-label {
  font-size: 11px;
  line-height: 1.2;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.automations-message-counter-value {
  font-size: 13px;
  line-height: 1.2;
  color: var(--text-primary);
}
.automations-message-counter-note {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}
.automations-message-counter.is-warning .automations-message-counter-value,
.automations-message-counter.is-warning .automations-message-counter-note {
  color: #b45309;
}
.automations-message-counter.is-danger .automations-message-counter-value,
.automations-message-counter.is-danger .automations-message-counter-note {
  color: var(--danger);
}
.automations-message-counter.is-empty .automations-message-counter-value,
.automations-message-counter.is-empty .automations-message-counter-note {
  color: var(--text-muted);
}
.automations-step-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(248,250,252,.85);
  border: 1px solid rgba(148,163,184,.15);
  border-radius: 12px;
  padding: 12px 14px;
}
.automations-step-controls-header,
.automations-step-controls-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.automations-step-controls-title strong {
  font-size: 13px;
  line-height: 1.2;
  color: var(--text-primary);
}
.automations-step-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.automations-step-controls label {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.automations-step-controls select {
  min-width: 170px;
}
.automations-step-controls input[type="number"] {
  width: 88px;
}
.automations-step-controls input[type="time"] {
  width: 132px;
}
.automations-time-wrap {
  min-width: 150px;
}
.automations-step-instant {
  min-width: 220px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(37,99,235,.12);
  background: rgba(37,99,235,.06);
}
.automations-step-instant-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.automations-step-instant-copy strong {
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-primary);
}
.automations-step-instant-copy span {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}
.automations-step-warning {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(245,158,11,.18);
  background: rgba(245,158,11,.08);
  color: #92400e;
  font-size: 12px;
  line-height: 1.5;
}
.automations-step-footer {
  justify-content: flex-start;
  margin-top: 16px;
}
.automations-draft-card {
  border-style: dashed;
  background: linear-gradient(180deg, rgba(245,158,11,.08) 0%, rgba(255,255,255,.98) 100%);
}
.automations-support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.automations-support-grid .automations-card {
  height: 100%;
}
.automations-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.automations-summary-block {
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,.72);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.automations-summary-label {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.automations-summary-detail {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.automations-stop-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.automations-condition-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(37,99,235,.08);
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
}
.automations-timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.automations-timeline-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
}
.automations-timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--primary);
  margin-top: 6px;
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}
.automations-timeline-content {
  border-left: 2px solid rgba(148,163,184,.25);
  padding-left: 14px;
}
.automations-timeline-top span {
  font-size: 12px;
  color: var(--text-muted);
}
.automations-timeline-message {
  margin-top: 6px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ── Lead-type tabs ─────────────────────────────────────────── */
.automations-lead-type-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 2px 0;
}
.automations-lead-type-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.automations-lead-type-tab:hover {
  border-color: var(--primary);
  color: var(--text-primary);
  background: rgba(37,99,235,.04);
}
.automations-lead-type-tab.is-active {
  border-color: var(--primary);
  background: rgba(37,99,235,.1);
  color: var(--primary);
  font-weight: 600;
}
.automations-lead-type-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}
.automations-lead-type-tab.is-active .automations-lead-type-tab-count {
  background: rgba(37,99,235,.2);
  color: var(--primary);
}
/* Lead-type locked display in editor */
.automations-lead-type-locked-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-secondary, rgba(0,0,0,.03));
}
.automations-lead-type-locked-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.automations-lead-type-locked-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* Chat phone mockup for timeline preview */
.chat-phone-frame {
  border: 2px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  background: #F8FAFC;
  max-height: 520px;
  display: flex;
  flex-direction: column;
}
.chat-phone-header {
  background: #1E293B;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-phone-header-name {
  font-weight: 700;
  font-size: 14px;
}
.chat-phone-header-sub {
  font-size: 11px;
  color: #94A3B8;
}
.chat-phone-body {
  padding: 16px 12px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-time-divider {
  text-align: center;
  margin: 10px 0 4px;
}
.chat-time-divider span {
  font-size: 10px;
  color: #94A3B8;
  background: #F1F5F9;
  padding: 2px 10px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}
.chat-step-label {
  font-size: 10px;
  color: #94A3B8;
  text-align: right;
  padding-right: 4px;
  margin-top: 4px;
}
.chat-bubble {
  align-self: flex-end;
  background: #2563EB;
  color: #fff;
  padding: 8px 12px;
  border-radius: 16px 16px 4px 16px;
  font-size: 13px;
  line-height: 1.45;
  max-width: 85%;
  word-wrap: break-word;
  white-space: pre-wrap;
  cursor: pointer;
  transition: max-height 0.2s ease;
}
.chat-bubble + .chat-bubble {
  margin-top: 2px;
  border-radius: 16px 4px 4px 16px;
}
.chat-bubble:last-child {
  border-radius: 16px 4px 16px 16px;
}
.chat-bubble-empty {
  background: #CBD5E1;
  color: #64748B;
  font-style: italic;
  cursor: default;
}
@media (max-width: 480px) {
  .chat-phone-frame { border-radius: 16px; max-height: 400px; }
  .chat-bubble { font-size: 12px; max-width: 90%; }
}

@media (max-width: 980px) {
  .automations-builder-page {
    padding: 16px;
    gap: 16px;
  }
  .automations-context-card {
    padding: 18px;
  }
  .automations-header-actions {
    align-items: stretch;
    justify-content: stretch;
  }
  .automations-context-main,
  .automations-builder-header,
  .automations-editor-header,
  .automations-rail-header,
  .automations-card-header {
    flex-direction: column;
    align-items: stretch;
  }
  .automations-builder-layout {
    grid-template-columns: 1fr;
  }
  .automations-sequence-rail {
    position: static;
    top: auto;
  }
  .automations-context-actions {
    align-items: stretch;
    justify-content: stretch;
  }
  .automations-context-actions > * {
    width: 100%;
  }
  .automations-client-picker {
    min-width: 0;
  }
  .automations-context-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .automations-message-compose {
    grid-template-columns: 1fr;
  }
  .automations-burst-toolbar,
  .automations-multi-message-top,
  .automations-template-toolbar {
    align-items: flex-start;
  }
  .automations-support-grid {
    grid-template-columns: 1fr;
  }
  .automations-step-controls {
    gap: 10px;
  }
  .automations-step-controls-row {
    flex-direction: column;
    align-items: stretch;
  }
  .automations-step-controls select,
  .automations-step-controls input[type="number"],
  .automations-step-controls input[type="time"],
  .automations-name-input,
  .automations-client-select,
  .automations-step-instant {
    width: 100%;
    min-width: 0;
  }
  .automations-step-instant {
    align-items: flex-start;
    flex-direction: column;
  }
  .automations-step-actions,
  .automations-editor-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .automations-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .automations-toggle-row--lead-type {
    grid-template-columns: 1fr;
  }
  .automations-target-pill {
    justify-self: flex-start;
  }
}
@media (max-width: 640px) {
  .automations-context-badge-row {
    align-items: stretch;
  }
  .automations-client-badge,
  .automations-context-note {
    justify-content: center;
  }
  .automations-context-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .automations-context-stat {
    padding: 12px;
    gap: 4px;
    border-radius: 12px;
  }
  .automations-context-stat strong {
    font-size: 15px;
    line-height: 1.25;
  }
  .automations-message-counter {
    align-items: flex-start;
    text-align: left;
  }
  .automations-sms-preview-header {
    flex-direction: column;
  }
  .automations-inline-help {
    min-width: 0;
    flex-basis: 100%;
  }
  .automations-sms-preview-card {
    padding: 12px;
  }
  .template-variable-row {
    flex-direction: column;
  }
  .template-variable-copy-btn {
    align-self: flex-start;
  }
}
@media (max-width: 420px) {
  .automations-summary-grid {
    grid-template-columns: 1fr;
  }
}
@media (min-width: 769px) {
  .notif-panel-mobile { display: none !important; }
}
@media (max-width: 768px) {
  .desktop-only-action { display: none !important; }
}

.signalhouse-dialer-shell {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(390px, calc(100vw - 24px));
  height: min(720px, calc(100vh - 36px));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
  z-index: 4000;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.signalhouse-dialer-shell.active {
  display: flex;
}
.signalhouse-dialer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
}
.signalhouse-dialer-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.signalhouse-dialer-title svg {
  width: 15px;
  height: 15px;
  color: var(--success);
}
.signalhouse-dialer-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.signalhouse-dialer-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.signalhouse-dialer-status {
  min-height: 32px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 12px;
}
.signalhouse-dialer-frame {
  width: 100%;
  flex: 1;
  border: 0;
  background: #fff;
}
@media (max-width: 520px) {
  .signalhouse-dialer-shell {
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
    height: min(680px, calc(100vh - 16px));
  }
}
