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

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --bg: #1e1e2e;
  --bg-card: #2a2a3e;
  --bg-hover: #33334d;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #3b3b54;
  --sidebar-width: 240px;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  line-height: 1.5;
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.sidebar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar-nav li a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.status-indicator.error {
  background: var(--danger);
}

.status-indicator.warning {
  background: var(--warning);
}

/* === Main Content === */
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px;
  max-width: calc(100vw - var(--sidebar-width));
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
}

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

/* === Buttons === */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

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

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

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

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* === Stats Grid === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
  transition: transform 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.stat-icon.total { background: rgba(99, 102, 241, 0.15); }
.stat-icon.qualified { background: rgba(34, 197, 94, 0.15); }
.stat-icon.sent { background: rgba(59, 130, 246, 0.15); }
.stat-icon.interested { background: rgba(245, 158, 11, 0.15); }
.stat-icon.demo { background: rgba(139, 92, 246, 0.15); }
.stat-icon.closed { background: rgba(16, 185, 129, 0.15); }

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* === Workflow Section === */
.workflow-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 28px;
  border: 1px solid var(--border);
}

.workflow-section h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

.workflow-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.step {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.step:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

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

/* === Charts === */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
}

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

.chart-container {
  min-height: 120px;
}

.chart-bar {
  display: flex;
  align-items: center;
  margin: 6px 0;
  gap: 8px;
}

.chart-bar-label {
  width: 100px;
  font-size: 12px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  color: var(--text-muted);
}

.chart-bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  color: white;
  font-weight: 600;
  min-width: 24px;
}

.placeholder-text {
  color: var(--text-muted);
  text-align: center;
  padding: 40px 0;
}

/* === Table === */
.table-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.recent-section {
  margin-top: 0;
}

.recent-section h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

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

.data-table thead {
  background: var(--bg);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

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

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table tr:last-child td {
  border-bottom: none;
}

.loading-cell {
  text-align: center;
  padding: 40px !important;
  color: var(--text-muted);
}

/* === Status Badges === */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-new { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.status-analyzed { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.status-qualified_for_outreach { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.status-outreach_sent { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.status-replied { background: rgba(139, 92, 246, 0.15); color: #c084fc; }
.status-demo_generated { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.status-not_interested { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.status-failed { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.status-closed_won { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.status-default { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

/* === Score Bar === */
.score-bar {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-right: 6px;
  vertical-align: middle;
}

.score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

/* === Filter Group === */
.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

select, input[type="text"] {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

select:focus, input[type="text"]:focus {
  border-color: var(--primary);
}

/* === Modal === */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 640px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
}

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

.modal-section {
  margin-bottom: 16px;
}

.modal-section h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--primary);
}

.modal-section p {
  margin: 4px 0;
  font-size: 14px;
}

.issue-list {
  list-style: none;
  padding: 0;
}

.issue-list li {
  padding: 4px 0;
  font-size: 13px;
}

.issue-list li::before {
  content: "⚠ ";
  color: var(--warning);
}

/* === Pagination === */
.pagination {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.info { border-color: var(--info); }

/* === Responsive === */
@media (max-width: 768px) {
  /* Off-canvas sidebar: slides in via the injected hamburger (see app.js setupMobileNav). */
  .sidebar {
    width: 78%;
    max-width: 300px;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .content {
    margin-left: 0;
    max-width: 100vw;
    padding: 72px 16px 24px; /* top padding clears the fixed hamburger */
  }
  .page-header { align-items: flex-start; }
  .page-header h1 { font-size: 23px; }
  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1 1 auto; justify-content: center; }
  .filter-group { width: 100%; }
  .filter-group select, .filter-group input[type="text"] { flex: 1 1 140px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 16px; gap: 12px; }
  .stat-icon { width: 40px; height: 40px; font-size: 22px; }
  .stat-value { font-size: 24px; }
  .charts-grid { grid-template-columns: 1fr; }
  .auto-grid { grid-template-columns: 1fr 1fr; }
  .live-next { grid-template-columns: 1fr; }
  /* Larger touch targets */
  .btn { padding: 10px 16px; }
  select, input[type="text"] { padding: 10px 12px; font-size: 14px; }
  .modal-content { width: 94%; padding: 20px; }
}

@media (max-width: 420px) {
  .stats-grid, .auto-grid { grid-template-columns: 1fr; }
}

/* Desktop: never show the mobile chrome. */
.nav-toggle, .nav-backdrop { display: none; }

@media (max-width: 768px) {
  /* Hamburger button (injected) */
  .nav-toggle {
    display: flex;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 250;
    width: 44px;
    height: 44px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    box-shadow: var(--shadow);
  }
  .nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
  }
  body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  /* Backdrop behind the open drawer */
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    z-index: 90;
  }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
}
/* ── Email page (Phase 5: DSH-01/02/03) ───────────────────────────── */
.email-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.estat {
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.estat-num { font-size: 1.6rem; font-weight: 700; color: #e2e8f0; }
.estat-label { font-size: 0.8rem; color: #94a3b8; }
.muted { color: #64748b; }
.small { font-size: 0.75rem; }
.cell-strong { font-weight: 600; color: #e2e8f0; }
.reply-snippet {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #cbd5e1;
}
.demo-link {
  color: #34d399;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.demo-link:hover { text-decoration: underline; }
.cap-dot { font-size: 0.85rem; }

@media (max-width: 760px) {
  .email-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ════════════════════════════════════════════════════════════════════
   v1.1 VISUAL POLISH  (appended — overrides win by source order)
   ════════════════════════════════════════════════════════════════════ */
:root{
  --primary:#7c5cff;
  --primary-hover:#6a47ff;
  --bg:#0d0f17;
  --bg-card:#161a26;
  --bg-hover:#1f2433;
  --text:#e8ebf5;
  --text-muted:#8b93a7;
  --border:#252a3a;
  --radius:14px;
  --accent:linear-gradient(135deg,#7c5cff 0%,#4f7cff 100%);
  --shadow:0 10px 30px -12px rgba(0,0,0,.55);
}
body{
  background:
    radial-gradient(1100px 600px at 78% -8%, rgba(124,92,255,.10), transparent 60%),
    radial-gradient(900px 500px at -5% 110%, rgba(79,124,255,.08), transparent 55%),
    var(--bg);
  background-attachment:fixed;
  -webkit-font-smoothing:antialiased;
}

/* Sidebar */
.sidebar{ background:linear-gradient(180deg,#13161f, #0f1219); border-right:1px solid var(--border); }
.sidebar-header h2{
  background:var(--accent); -webkit-background-clip:text; background-clip:text;
  -webkit-text-fill-color:transparent; letter-spacing:-.3px; font-size:21px;
}
.sidebar-nav li a{ margin:2px 10px; border-radius:10px; border-left:0; padding:11px 14px; gap:10px; font-weight:500; }
.sidebar-nav li a:hover{ background:var(--bg-hover); }
.sidebar-nav li a.active{
  background:var(--accent); color:#fff; box-shadow:0 6px 18px -8px rgba(124,92,255,.7);
}
.status-indicator{ box-shadow:0 0 0 4px rgba(34,197,94,.12); }

/* Headings */
.page-header h1{ letter-spacing:-.5px; }
.workflow-section h2, .recent-section h2, .chart-card h3{ letter-spacing:-.2px; }

/* Cards: depth + subtle gradient + top accent */
.stat-card, .chart-card, .workflow-section, .table-wrapper, .estat{
  background:linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0)) , var(--bg-card);
  box-shadow:var(--shadow);
}
.stat-card{ position:relative; overflow:hidden; }
.stat-card::before{ content:""; position:absolute; inset:0 0 auto 0; height:3px; background:var(--accent); opacity:.85; }
.stat-card:hover{ transform:translateY(-3px); border-color:#33405f; }
.stat-value{ font-size:30px; letter-spacing:-1px; }
.stat-icon{ border:1px solid var(--border); }

/* Buttons */
.btn-primary{ background:var(--accent); box-shadow:0 8px 20px -10px rgba(124,92,255,.8); }
.btn{ border-radius:10px; font-weight:600; }
.btn:hover{ transform:translateY(-1px); opacity:1; filter:brightness(1.08); }

/* Workflow steps */
.step{ border-radius:12px; }
.step:hover{ box-shadow:0 8px 20px -12px rgba(124,92,255,.6); }
.step-number{ background:var(--accent); }

/* Empty states */
.placeholder-text{ font-size:14px; }

/* Pills already good; soften table header */
.data-table thead{ background:rgba(255,255,255,.02); }

/* ── Notifications page ── */
.section-title{ font-size:18px; font-weight:700; margin:26px 0 14px; letter-spacing:-.2px; }
.info-card{ background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:20px 22px; box-shadow:var(--shadow); }
.info-card .muted{ line-height:1.6; }
.timeline{ position:relative; padding-left:26px; }
.timeline::before{ content:""; position:absolute; left:9px; top:4px; bottom:4px; width:2px; background:var(--border); }
.tl-item{ position:relative; padding:12px 0 12px 4px; }
.tl-item::before{ content:""; position:absolute; left:-21px; top:18px; width:12px; height:12px; border-radius:50%; background:var(--primary); box-shadow:0 0 0 4px rgba(124,92,255,.15); }
.tl-item.reply::before{ background:#c084fc; box-shadow:0 0 0 4px rgba(192,132,252,.15); }
.tl-item.interested::before{ background:#4ade80; box-shadow:0 0 0 4px rgba(74,222,128,.15); }
.tl-item.demo::before{ background:#34d399; box-shadow:0 0 0 4px rgba(52,211,153,.15); }
.tl-title{ font-weight:600; }
.tl-meta{ font-size:12px; color:var(--text-muted); margin-top:2px; }
.tl-emoji{ margin-right:6px; }

/* ── Automation page ── */
.auto-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:16px; margin-bottom:22px; }
.auto-card{ background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:20px; box-shadow:var(--shadow); }
.auto-card .k{ font-size:12px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; }
.auto-card .v{ font-size:22px; font-weight:700; margin-top:6px; letter-spacing:-.5px; }
.pulse{ display:inline-block; width:9px; height:9px; border-radius:50%; background:#22c55e; box-shadow:0 0 0 0 rgba(34,197,94,.6); animation:pulse 2s infinite; margin-right:8px; vertical-align:middle; }
@keyframes pulse{ 0%{box-shadow:0 0 0 0 rgba(34,197,94,.5)} 70%{box-shadow:0 0 0 10px rgba(34,197,94,0)} 100%{box-shadow:0 0 0 0 rgba(34,197,94,0)} }
.flow{ display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.flow .node{ background:var(--bg-hover); border:1px solid var(--border); border-radius:10px; padding:10px 14px; font-size:13px; }
.flow .arrow{ color:var(--text-muted); }
.ext-link{ color:var(--primary); text-decoration:none; font-weight:600; }
.ext-link:hover{ text-decoration:underline; }

/* The dashboard pipeline steps are informational (the pipeline runs on a schedule),
   so they should not look like clickable buttons. */
.workflow-steps .step{ cursor:default; }
.workflow-steps .step:hover{ box-shadow:none; border-color:var(--border); background:var(--bg-hover); }

/* ── Notifications: push setup ── */
.push-setup{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.push-setup input[type="text"]{ flex:1 1 240px; min-width:0; }
code{ background:rgba(124,92,255,.12); color:#c4b5fd; padding:1px 6px; border-radius:6px; font-size:.85em; }
.notif-state{ display:flex; align-items:center; gap:10px; font-size:15px; font-weight:600; }
.notif-dot{ width:11px; height:11px; border-radius:50%; flex:0 0 auto; background:#64748b; box-shadow:0 0 0 4px rgba(100,116,139,.12); }
.notif-dot.on{ background:#22c55e; box-shadow:0 0 0 4px rgba(34,197,94,.15); }
.notif-dot.off{ background:#64748b; box-shadow:0 0 0 4px rgba(100,116,139,.12); }

/* ── Automation: "happening now" live view ── */
.live-card .live-head{ display:flex; align-items:center; gap:10px; font-size:15px; font-weight:600; }
.live-dot{ width:11px; height:11px; border-radius:50%; background:var(--text-muted); flex:0 0 auto; }
.live-dot.running{ background:#22c55e; box-shadow:0 0 0 0 rgba(34,197,94,.6); animation:pulse 1.6s infinite; }
.live-dot.idle{ background:#64748b; box-shadow:0 0 0 4px rgba(100,116,139,.12); }
.live-next{ display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:16px; }
.live-next .v{ font-variant-numeric:tabular-nums; }
.run-row{ display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); }
.run-row:last-child{ border-bottom:0; }
.run-ic{ flex:0 0 auto; }
.run-name{ color:var(--text); text-decoration:none; font-weight:600; }
.run-name:hover{ color:var(--primary); text-decoration:underline; }
.run-meta{ margin-left:auto; text-align:right; }

/* ── Automation: control panel ── */
.ctrl-row{ display:flex; align-items:center; flex-wrap:wrap; gap:12px; padding:14px 0; border-top:1px solid var(--border); }
.ctrl-row:first-of-type{ border-top:0; padding-top:0; }
.ctrl-label{ min-width:150px; font-weight:600; font-size:14px; }
.ctrl-btns{ display:flex; flex-wrap:wrap; gap:8px; flex:1; }
.ctrl-row.danger{ border-top-color:rgba(239,68,68,.25); }
.btn-danger{ background:rgba(239,68,68,.14); color:#f87171; border:1px solid rgba(239,68,68,.4); }
.btn-danger:hover{ background:rgba(239,68,68,.22); filter:none; }
.btn:disabled{ opacity:.45; cursor:not-allowed; transform:none; filter:none; }
@media (max-width:768px){
  .ctrl-label{ min-width:0; width:100%; }
  .ctrl-btns .btn{ flex:1 1 calc(50% - 8px); justify-content:center; }
}

/* ── Leads: contact tracking + email preview (quick 260702-7lw) ── */
.flag-cb{ width:18px; height:18px; accent-color:var(--primary); cursor:pointer; }
.flag-label{ display:inline-flex; align-items:center; gap:8px; margin-right:20px; cursor:pointer; }
.btn-row{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px; }
.email-preview{ border:1px solid var(--border); border-radius:8px; padding:12px; margin-top:8px; }
.email-preview pre{ white-space:pre-wrap; word-break:break-word; font-family:inherit; font-size:13px; color:var(--text-muted); margin-top:8px; max-height:320px; overflow-y:auto; }

/* ── Leads: guided text queue bar (quick 260703-1m1) ── */
.text-queue-bar{ position:fixed; left:0; right:0; bottom:0; z-index:900; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; padding:12px 16px; background:#1b1c2e; border-top:1px solid var(--border); box-shadow:0 -4px 16px rgba(0,0,0,.35); }
.text-queue-bar .tq-info{ display:flex; align-items:center; flex-wrap:wrap; gap:10px; min-width:0; }
.text-queue-bar .tq-count{ background:var(--primary); color:#fff; border-radius:999px; padding:2px 10px; font-size:12px; font-weight:600; white-space:nowrap; }
.text-queue-bar .tq-phone{ color:var(--text-muted); font-size:13px; white-space:nowrap; }
.text-queue-bar .tq-actions{ display:flex; gap:8px; margin-left:auto; }
.text-queue-bar .tq-actions .btn{ min-height:42px; min-width:42px; padding:8px 16px; } /* phone-sized tap targets */
@media (min-width:769px){ .text-queue-bar{ left:var(--sidebar-width); } } /* clear the fixed sidebar */
