/* Outreach Agent — Shared Styles */
/* Dark theme, DM Sans + IBM Plex Mono */

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

:root {
  --bg: #0B0F19;
  --surface: #111827;
  --elevated: #1E293B;
  --border: #334155;
  --text: #F1F5F9;
  --muted: #94A3B8;
  --blue: #3B82F6;
  --green: #10B981;
  --amber: #F59E0B;
  --red: #EF4444;
  --purple: #8B5CF6;
  --cyan: #06B6D4;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', 'JetBrains Mono', 'Consolas', monospace;
  --sidebar-w: 56px;
}

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}

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

/* Layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; flex-shrink: 0;
}
.sidebar-logo {
  width: 30px; height: 30px; background: var(--blue); border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: white; font-weight: 700; font-family: var(--mono); margin-bottom: 12px;
}
.nav-item {
  width: 38px; height: 38px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted); transition: all .15s; text-decoration: none;
}
.nav-item:hover { background: var(--elevated); color: var(--text); }
.nav-item.active { background: rgba(59,130,246,.12); color: var(--blue); }
.nav-item svg { width: 18px; height: 18px; }

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow-y: auto; }

/* Header (flat, no sidebar) */
.header {
  border-bottom: 1px solid var(--border); background: var(--surface);
  padding: 0 40px; height: 56px; display: flex; align-items: center; gap: 16px;
}
.header-logo {
  width: 32px; height: 32px; background: var(--blue); border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: white; font-weight: 700; letter-spacing: -0.5px; font-family: var(--mono);
}
.header-title { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; }
.header-divider { width: 1px; height: 24px; background: var(--border); }
.header-breadcrumb { color: var(--muted); font-size: 13px; font-weight: 500; }
.header-spacer { flex: 1; }
.header-action {
  padding: 6px 14px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--elevated); color: var(--muted); font-size: 12px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; gap: 5px; transition: all .15s; font-family: var(--font);
}
.header-action:hover { border-color: var(--blue); color: var(--text); }

/* Topbar (sidebar layout) */
.topbar {
  height: 52px; padding: 0 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0; background: var(--surface);
}
.topbar-back {
  color: var(--muted); cursor: pointer; display: flex; align-items: center;
  padding: 4px; border-radius: 6px; transition: all .15s; text-decoration: none;
}
.topbar-back:hover { background: var(--elevated); color: var(--text); }
.topbar-back svg { width: 16px; height: 16px; }
.topbar-divider { width: 1px; height: 20px; background: var(--border); }
.topbar-title { font-size: 14px; font-weight: 600; }
.topbar-status {
  font-size: 10px; padding: 2px 8px; border-radius: 99px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px; background: rgba(16,185,129,.12); color: var(--green);
}
.topbar-spacer { flex: 1; }
.topbar-btn {
  padding: 6px 14px; border-radius: 7px; border: none; font-size: 12px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; gap: 5px; transition: all .15s; font-family: var(--font);
}
.topbar-edit { background: var(--elevated); color: var(--muted); border: 1px solid var(--border); }
.topbar-edit:hover { color: var(--text); }

/* Main content */
.main { max-width: 100%; margin: 0 auto; padding: 36px 32px; width: 100%; }
.dashboard { padding: 28px 32px; max-width: 100%; }

.page-top { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 32px; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 4px; }
.page-subtitle { color: var(--muted); font-size: 13px; font-weight: 400; }

/* Buttons */
.btn {
  padding: 9px 18px; border-radius: 8px; border: none; font-size: 13px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: all .15s; font-family: var(--font); letter-spacing: -0.2px;
}
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #2563eb; box-shadow: 0 4px 16px rgba(59,130,246,.3); }
.btn-ghost { background: var(--elevated); color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: rgba(59,130,246,.4); }

/* Stat Cards */
.stats-row { display: flex; gap: 12px; margin-bottom: 32px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 20px; flex: 1; position: relative; overflow: hidden;
}
.stat-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.stat-card.s-blue::after { background: var(--blue); }
.stat-card.s-green::after { background: var(--green); }
.stat-card.s-amber::after { background: var(--amber); }
.stat-card.s-purple::after { background: var(--purple); }
.stat-card.s-red::after { background: var(--red); }
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.stat-value.blue { color: var(--blue); }
.stat-value.green { color: var(--green); }
.stat-value.amber { color: var(--amber); }
.stat-value.purple { color: var(--purple); }

/* Status Pills */
.status-pill {
  font-size: 10px; padding: 2px 8px; border-radius: 99px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
}
.status-active { background: rgba(16,185,129,.12); color: var(--green); }
.status-draft { background: rgba(245,158,11,.12); color: var(--amber); }
.status-paused { background: rgba(148,163,184,.12); color: var(--muted); }
.status-completed { background: rgba(59,130,246,.12); color: var(--blue); }

/* Campaign Cards */
.campaigns-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.campaign-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 0; cursor: pointer; transition: all .2s; position: relative; overflow: hidden;
  display: grid; grid-template-columns: 4px 1fr;
}
.campaign-card:hover { border-color: rgba(59,130,246,.4); box-shadow: 0 4px 24px rgba(0,0,0,.3); }
.card-accent { border-radius: 12px 0 0 12px; }
.card-accent.green { background: var(--green); }
.card-accent.amber { background: var(--amber); }
.card-accent.blue { background: var(--blue); }
.card-accent.muted { background: var(--muted); }
.card-inner { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.card-row-top { display: flex; align-items: center; gap: 14px; }
.card-icon {
  width: 40px; height: 40px; background: var(--elevated); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.card-info { flex: 1; min-width: 0; }
.card-name { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; display: flex; align-items: center; gap: 10px; }
.card-meta { color: var(--muted); font-size: 12px; margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.card-meta-sep { color: var(--border); }

/* Stage pipeline mini indicator */
.card-stages { display: flex; align-items: center; gap: 0; }
.stage-node { display: flex; align-items: center; gap: 0; }
.stage-dot {
  width: 28px; height: 28px; border-radius: 7px; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--elevated); border: 1px solid var(--border); position: relative;
}
.stage-dot.configured { border-color: rgba(59,130,246,.3); background: rgba(59,130,246,.08); color: var(--blue); }
.stage-dot.complete { border-color: var(--green); background: rgba(16,185,129,.12); color: var(--green); }
.stage-dot.running { border-color: var(--blue); background: rgba(59,130,246,.15); color: var(--blue); animation: stage-pulse 2s infinite; }
.stage-dot.empty { opacity: .35; }
.stage-connector { width: 16px; height: 1px; background: var(--border); }
.stage-label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  font-size: 9px; color: var(--muted); white-space: nowrap; margin-top: 4px;
  font-weight: 500; letter-spacing: .3px; text-transform: uppercase;
}
@keyframes stage-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,.3); }
  50% { box-shadow: 0 0 0 4px rgba(59,130,246,.1); }
}

.card-stats-row { display: flex; gap: 20px; padding-top: 12px; border-top: 1px solid rgba(51,65,85,.5); }
.card-stat { display: flex; align-items: baseline; gap: 5px; }
.card-stat-val { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-stat-label { font-size: 11px; color: var(--muted); font-weight: 400; }
.card-arrow {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  color: var(--border); font-size: 16px; transition: all .2s;
}
.campaign-card:hover .card-arrow { color: var(--blue); right: 16px; }

.create-card {
  background: transparent; border: 1px dashed var(--border); border-radius: 12px;
  padding: 32px; display: flex; align-items: center; justify-content: center;
  gap: 10px; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; transition: all .2s;
}
.create-card:hover { border-color: var(--blue); color: var(--blue); background: rgba(59,130,246,.04); }
.create-card svg { opacity: .6; }
.create-card:hover svg { opacity: 1; }

/* Tables */
.results-section { margin-bottom: 32px; }
.results-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.results-title { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.results-count {
  font-size: 11px; color: var(--muted); background: var(--elevated);
  padding: 2px 8px; border-radius: 4px; font-weight: 500;
}
.results-spacer { flex: 1; }
.results-filter {
  padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--elevated); color: var(--muted); font-size: 12px;
  font-family: var(--font); cursor: pointer; display: flex; align-items: center; gap: 5px;
}

.results-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.results-table th {
  text-align: left; padding: 10px 14px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 600;
}
.results-table td {
  padding: 12px 14px; border-bottom: 1px solid rgba(51,65,85,.4); font-size: 13px; vertical-align: middle;
}
.results-table tr:last-child td { border-bottom: none; }
.results-table tr:hover td { background: rgba(255,255,255,.02); }

.company-name { font-weight: 600; }
.company-url { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Badges */
.badge-wp { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; background: rgba(59,130,246,.12); color: var(--blue); }
.badge-pain { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 500; background: rgba(239,68,68,.1); color: var(--red); margin-right: 3px; }
.badge-strategy { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 500; background: rgba(245,158,11,.1); color: var(--amber); }
.badge-email { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 500; background: rgba(16,185,129,.1); color: var(--green); }

/* Progress Dots */
.progress-dots { display: flex; gap: 3px; }
.progress-dot { width: 8px; height: 8px; border-radius: 50%; }
.progress-dot.done { background: var(--green); }
.progress-dot.pending { background: var(--border); }
.progress-dot.active { background: var(--blue); animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0% { opacity: 1; } 50% { opacity: .4; } 100% { opacity: 1; } }

/* Status Select */
.status-select {
  appearance: none; -webkit-appearance: none;
  background: var(--elevated); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 24px 4px 8px; font-size: 11px; font-weight: 600;
  font-family: var(--font); cursor: pointer; transition: all .15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' 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 6px center;
}
.status-select:hover { border-color: var(--blue); }
.status-select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(59,130,246,.15); }
.status-select.status-active { color: var(--green); border-color: rgba(16,185,129,.3); }
.status-select.status-paused { color: var(--amber); border-color: rgba(245,158,11,.3); }
.status-select.status-optout { color: var(--red); border-color: rgba(239,68,68,.3); }

tr.row-paused td { opacity: .5; }
tr.row-paused td:last-child, tr.row-paused td:nth-last-child(2) { opacity: 1; }
tr.row-optout td { opacity: .35; }
tr.row-optout td:last-child, tr.row-optout td:nth-last-child(2) { opacity: 1; }

/* Form Controls */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); margin-bottom: 6px;
}
.form-input, .form-textarea, .form-select {
  width: 100%; background: var(--elevated); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; color: var(--text); font-size: 13px; font-family: var(--font); transition: border-color .15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(59,130,246,.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-input::placeholder, .form-textarea::placeholder { color: rgba(148,163,184,.4); }

/* Keyword Chips */
.keyword-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.keyword-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--elevated); border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 8px; font-size: 12px; color: var(--text);
}
.keyword-chip-remove {
  cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1;
  border: none; background: none; padding: 0 2px;
}
.keyword-chip-remove:hover { color: var(--red); }

/* Section Labels */
.section-label {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 14px;
}

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: 8px;
  font-size: 13px; font-weight: 500; z-index: 9999; animation: toast-in .3s ease-out;
}
.toast-success { background: var(--green); color: white; }
.toast-error { background: var(--red); color: white; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* Loading */
.loading-placeholder { color: var(--muted); text-align: center; padding: 48px; font-size: 13px; }
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty State */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state-icon { font-size: 32px; margin-bottom: 12px; opacity: .5; }
.empty-state-text { font-size: 14px; margin-bottom: 4px; }
.empty-state-hint { font-size: 12px; color: rgba(148,163,184,.6); }

/* History Section */
.history-section { margin-bottom: 32px; }
.history-title {
  font-size: 16px; font-weight: 700; letter-spacing: -0.2px; margin-bottom: 14px;
}
.history-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 6px; transition: background .15s;
}
.history-item:hover { background: var(--elevated); }
.history-stage {
  font-size: 10px; padding: 3px 8px; border-radius: 6px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px; flex-shrink: 0;
}
.history-desc {
  flex: 1; font-size: 13px; color: var(--text); min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-time {
  font-size: 12px; color: var(--muted); font-family: var(--mono);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.history-status {
  font-size: 10px; padding: 2px 7px; border-radius: 99px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px; flex-shrink: 0;
}

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 0; margin-top: 8px;
}
.pagination-btn {
  padding: 6px 14px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--elevated); color: var(--muted); font-size: 12px;
  font-weight: 600; font-family: var(--font); cursor: pointer; transition: all .15s;
}
.pagination-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.pagination-btn:disabled { opacity: .35; cursor: not-allowed; }
.pagination-info { font-size: 12px; color: var(--muted); font-weight: 500; }

/* Search Input */
.search-input {
  background: var(--elevated); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 12px; color: var(--text); font-size: 12px; font-family: var(--font);
  transition: border-color .15s; width: 200px;
}
.search-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(59,130,246,.1); }
.search-input::placeholder { color: rgba(148,163,184,.4); }
