/* admin.css — Sales Intelligence (iMedia Business)
   Dark editorial · Syne display · DM Sans body · accents minimalist */

:root {
  --bg-0: #0a0a0c;
  --bg-1: #111114;
  --bg-2: #16161b;
  --bg-3: #1d1d24;
  --line: #26262f;
  --line-soft: #1c1c23;

  --fg-0: #f5f5f4;
  --fg-1: #c9c9c4;
  --fg-2: #8a8a82;
  --fg-3: #54545b;

  --accent: #d6ff3f;
  --accent-dark: #aacc20;
  --hot: #ff5a3c;
  --warm: #ffb547;
  --cold: #4d8dff;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;

  --font-display: "Syne", sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --transition: 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--fg-2);
}

/* =====================================================
   LOGIN VIEW
   ===================================================== */

.login-view {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg-0);
  overflow: hidden;
  z-index: 100;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(214, 255, 63, 0.08), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(77, 141, 255, 0.06), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(440px, 90vw);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.5);
}

.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--bg-0);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  border-radius: 10px;
}

.brand-eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-2);
  font-weight: 500;
}

.brand-title {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.login-tagline {
  color: var(--fg-1);
  font-size: 15px;
  margin: 0 0 28px;
  max-width: 80%;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-form label > span {
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--fg-2);
  text-transform: uppercase;
  font-weight: 500;
}

.login-form input {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg-0);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color var(--transition);
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-error {
  margin: 4px 0 0;
  color: var(--hot);
  font-size: 13px;
  min-height: 16px;
}

/* =====================================================
   APP LAYOUT
   ===================================================== */

.app-view {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  background: transparent;
  border: 0;
  color: var(--fg-1);
  text-align: left;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
}

.nav-item:hover {
  background: var(--bg-2);
  color: var(--fg-0);
}

.nav-item.active {
  background: var(--bg-2);
  color: var(--fg-0);
  font-weight: 500;
}

.nav-dot {
  width: 5px;
  height: 5px;
  background: var(--fg-3);
  border-radius: 50%;
  transition: all var(--transition);
}

.nav-item.active .nav-dot {
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.sidebar-footer {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-chip {
  font-size: 12px;
  color: var(--fg-2);
  font-family: var(--font-mono);
  word-break: break-all;
}

.btn-link {
  background: transparent;
  border: 0;
  color: var(--fg-2);
  text-align: left;
  padding: 0;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
  transition: color var(--transition);
}

.btn-link:hover {
  color: var(--fg-0);
}

.main {
  padding: 32px 40px 60px;
  max-width: 100%;
  overflow-x: hidden;
}

/* =====================================================
   VIEWS
   ===================================================== */

.view {
  display: none;
  animation: fadeIn 280ms ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.page-eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-2);
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.025em;
  grid-column: 1;
}

/* =====================================================
   BUTTONS
   ===================================================== */

.btn {
  border: 0;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-0);
}

.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--fg-1);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  background: var(--bg-2);
  border-color: var(--fg-3);
}

.btn-danger {
  background: transparent;
  color: var(--hot);
  border: 1px solid rgba(255, 90, 60, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 90, 60, 0.1);
  border-color: var(--hot);
}

/* =====================================================
   KPI GRID
   ===================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

.kpi-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition);
}

.kpi-card:hover {
  border-color: var(--fg-3);
}

.kpi-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-2);
  font-weight: 500;
}

.kpi-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.kpi-card.kpi-accent { border-color: rgba(214, 255, 63, 0.25); }
.kpi-card.kpi-accent .kpi-value { color: var(--accent); }
.kpi-card.kpi-hot { border-color: rgba(255, 90, 60, 0.25); }
.kpi-card.kpi-hot .kpi-value { color: var(--hot); }

/* =====================================================
   PANELS
   ===================================================== */

.panel {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-1);
  font-weight: 500;
}

.panel-body {
  padding: 20px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
}

.action-btn {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg-1);
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  font-size: 14px;
  transition: all var(--transition);
}

.action-btn:hover {
  border-color: var(--accent);
  color: var(--fg-0);
  transform: translateX(2px);
}

.action-num {
  font-family: var(--font-mono);
  color: var(--fg-3);
  font-size: 12px;
}

/* =====================================================
   STATUS BADGE
   ===================================================== */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
}

.status-badge.big {
  font-size: 16px;
  padding: 12px 20px;
}

.status-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-3);
}

.status-badge[data-status="connected"] .dot {
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.status-badge[data-status="qr"] .dot,
.status-badge[data-status="connecting"] .dot {
  background: var(--warm);
  animation: pulse 1.6s infinite ease-in-out;
}

.status-badge[data-status="disconnected"] .dot {
  background: var(--hot);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.conn-info {
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
}

.conn-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* =====================================================
   QR CODE
   ===================================================== */

.qr-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.qr-container {
  width: 100%;
  min-height: 240px;
  display: grid;
  place-items: center;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 20px;
}

.qr-container img {
  max-width: 100%;
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.qr-help {
  font-size: 12px;
  text-align: center;
  margin: 0;
  max-width: 320px;
}

.connection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* =====================================================
   CHATS LAYOUT
   ===================================================== */

.chats-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 14px;
  height: calc(100vh - 200px);
  min-height: 600px;
}

.chats-list-pane {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.filter-bar {
  display: flex;
  gap: 6px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.chip {
  background: transparent;
  color: var(--fg-2);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  transition: all var(--transition);
}

.chip:hover {
  color: var(--fg-0);
  border-color: var(--fg-3);
}

.chip.active {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
  font-weight: 500;
}

.chats-list {
  margin: 0;
  padding: 8px;
  list-style: none;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background var(--transition);
  border: 1px solid transparent;
}

.chat-item:hover {
  background: var(--bg-2);
}

.chat-item.active {
  background: var(--bg-2);
  border-color: var(--line);
}

.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.chat-item-name {
  font-weight: 500;
  font-size: 13px;
  color: var(--fg-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-preview {
  font-size: 12px;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.badge-ad {
  background: rgba(214, 255, 63, 0.12);
  color: var(--accent);
  border: 1px solid rgba(214, 255, 63, 0.3);
}

.badge-organic {
  background: var(--bg-3);
  color: var(--fg-2);
  border: 1px solid var(--line);
}

.badge-score {
  background: var(--bg-3);
  color: var(--fg-1);
  border: 1px solid var(--line);
}

.badge-score.hot { color: var(--hot); border-color: rgba(255, 90, 60, 0.3); }
.badge-score.warm { color: var(--warm); border-color: rgba(255, 181, 71, 0.3); }
.badge-score.cold { color: var(--cold); border-color: rgba(77, 141, 255, 0.3); }

/* =====================================================
   CHAT DETAIL
   ===================================================== */

.chat-detail-pane {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.empty-state {
  text-align: center;
  color: var(--fg-2);
  padding: 32px 16px;
  font-size: 13px;
}

.empty-state-large {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 60px 40px;
}

.empty-state-large .eyebrow {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin: 0 0 16px;
}

.empty-state-large h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  max-width: 520px;
}

.chat-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-detail-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.chat-phone {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
}

.chat-name {
  margin: 2px 0 0;
  font-size: 12px;
}

.chat-detail-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.ad-context {
  background: rgba(214, 255, 63, 0.05);
  border-bottom: 1px solid rgba(214, 255, 63, 0.15);
  padding: 14px 22px;
}

.ad-context-label {
  margin: 0 0 4px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.ad-title {
  margin: 0;
  font-weight: 500;
  font-size: 14px;
}

.ad-body {
  margin: 4px 0 0;
  font-size: 12px;
}

.chat-detail-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.messages-pane,
.analysis-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages-pane {
  border-right: 1px solid var(--line);
}

.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-in {
  background: var(--bg-2);
  border: 1px solid var(--line);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.msg-out {
  background: var(--accent);
  color: var(--bg-0);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg-time {
  font-size: 10px;
  font-family: var(--font-mono);
  margin-top: 4px;
  opacity: 0.6;
}

/* =====================================================
   ANALYSIS REPORT
   ===================================================== */

.analysis-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
}

.score-block {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.score-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  position: relative;
}

.score-circle.hot {
  background: rgba(255, 90, 60, 0.12);
  color: var(--hot);
  border: 2px solid var(--hot);
}

.score-circle.warm {
  background: rgba(255, 181, 71, 0.12);
  color: var(--warm);
  border: 2px solid var(--warm);
}

.score-circle.cold {
  background: rgba(77, 141, 255, 0.12);
  color: var(--cold);
  border: 2px solid var(--cold);
}

.score-info {
  flex: 1;
}

.score-info-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin: 0;
}

.score-info-intent {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.1;
  margin: 4px 0 0;
  text-transform: capitalize;
}

.score-info-stage {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--fg-2);
}

.report-section {
  margin-bottom: 18px;
}

.report-section h4 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-2);
  font-weight: 500;
}

.report-section p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--fg-1);
}

.report-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-list li {
  font-size: 13px;
  color: var(--fg-1);
  padding: 8px 12px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--fg-3);
}

.report-list.signals li { border-left-color: var(--accent); }
.report-list.objections li { border-left-color: var(--warm); }
.report-list.flags li { border-left-color: var(--hot); }

.suggested-reply {
  background: var(--bg-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
}

.suggested-reply p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--fg-0);
  white-space: pre-wrap;
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--fg-1);
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 100px;
  font-family: var(--font-mono);
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* =====================================================
   CAMPAIGNS
   ===================================================== */

.campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.campaign-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition);
}

.campaign-card:hover {
  border-color: var(--accent);
}

.campaign-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
}

.campaign-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  margin: 8px 0;
  letter-spacing: -0.01em;
}

.campaign-meta {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--fg-2);
}

.campaign-meta strong {
  color: var(--fg-0);
  font-weight: 600;
}

/* =====================================================
   TOAST
   ===================================================== */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  color: var(--fg-0);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4);
  animation: slideIn 220ms ease;
}

.toast.error { border-color: var(--hot); }
.toast.success { border-color: var(--accent); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .connection-grid { grid-template-columns: 1fr; }
  .chats-layout { grid-template-columns: 1fr; height: auto; }
  .chat-detail-grid { grid-template-columns: 1fr; }
  .messages-pane { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .app-view { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .main { padding: 20px; }
  .page-title { font-size: 32px; }
}

/* Scrollbars sutiles */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-3); }

/* =====================================================
   COMPOSER (enviar mensajes)
   ===================================================== */

.composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  align-items: flex-end;
}

.composer-input {
  flex: 1;
  background: var(--bg-3);
  color: var(--fg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  resize: none;
  min-height: 38px;
  max-height: 120px;
  outline: none;
  transition: border-color var(--transition);
}

.composer-input:focus {
  border-color: var(--accent);
}

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

.composer-send {
  flex-shrink: 0;
  align-self: stretch;
}

/* =====================================================
   BOT TOGGLE + LEAD BADGE
   ===================================================== */

.btn-bot {
  font-size: 12px;
  padding: 8px 12px;
}

.btn-bot[data-state="on"] {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-bot[data-state="paused"] {
  border-color: rgba(255, 200, 0, 0.45);
  color: #ffc800;
}

.btn-bot[data-state="off"] {
  border-color: var(--line);
  color: var(--fg-3);
}

.badge-lead {
  background: rgba(255, 90, 60, 0.18);
  color: #ff9374;
  border: 1px solid rgba(255, 90, 60, 0.45);
  font-weight: 600;
}

/* =====================================================
   VISTA BOT (config del system prompt)
   ===================================================== */

.bot-config-panel {
  max-width: 960px;
}

.bot-config-help {
  margin-bottom: 16px;
  font-size: 13px;
}

.bot-config-help small {
  display: inline-block;
  margin-top: 6px;
  opacity: 0.7;
}

.bot-prompt-input {
  width: 100%;
  background: var(--bg-3);
  color: var(--fg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  resize: vertical;
  min-height: 320px;
  outline: none;
  transition: border-color var(--transition);
}

.bot-prompt-input:focus {
  border-color: var(--accent);
}

.bot-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.bot-save-status {
  font-size: 12px;
}

.bot-char-count {
  font-size: 11px;
  font-family: var(--font-mono);
  margin-left: auto;
  opacity: 0.6;
}

/* Switch para activar/desactivar */
.bot-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.bot-switch input {
  display: none;
}

.bot-switch-track {
  position: relative;
  width: 38px;
  height: 22px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 100px;
  transition: all var(--transition);
}

.bot-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--fg-3);
  border-radius: 50%;
  transition: all var(--transition);
}

.bot-switch input:checked + .bot-switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.bot-switch input:checked + .bot-switch-track::after {
  left: 18px;
  background: var(--bg-0);
}

.bot-switch-label {
  font-size: 12px;
  color: var(--fg-2);
  letter-spacing: 0.02em;
}

/* Link wa.me en la cabecera del chat */
.phone-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed var(--line);
  transition: all var(--transition);
}

.phone-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* =====================================================
   BULK CAMPAIGNS
   ===================================================== */

.bulk-warning {
  background: rgba(255, 177, 61, 0.08);
  border: 1px solid rgba(255, 177, 61, 0.25);
  color: #ffb13d;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.bulk-campaigns-list {
  display: grid;
  gap: 12px;
}

.bulk-camp-card {
  background: var(--bg-1);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.bulk-camp-card:hover {
  border-color: var(--accent);
}
.bulk-camp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.bulk-camp-name {
  font-size: 16px;
  margin: 0 0 4px;
}
.bulk-camp-meta {
  margin: 0;
  font-size: 12px;
}
.bulk-progress {
  height: 6px;
  background: var(--bg-3);
  border-radius: 999px;
  margin: 10px 0 12px;
  overflow: hidden;
}
.bulk-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}
.bulk-camp-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-2, #8b96a8);
  margin-bottom: 12px;
}
.bulk-camp-stats strong {
  color: var(--text-1, #e6edf3);
  font-weight: 600;
}
.bulk-camp-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge-success { background: rgba(61, 255, 192, 0.15); color: #3dffc0; }
.badge-warning { background: rgba(255, 177, 61, 0.15); color: #ffb13d; }
.badge-danger  { background: rgba(255, 84, 112, 0.15); color: #ff5470; }
.badge-muted   { background: rgba(255, 255, 255, 0.08); color: var(--text-2, #8b96a8); }

/* Detalle de campaña (inline expand) */
.bulk-detail-root { margin-top: 24px; }
.bulk-detail {
  background: var(--bg-1);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  padding: 22px;
}
.bulk-template-preview {
  background: var(--bg-2);
  padding: 12px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 8px 0 16px;
}
.bulk-recipients-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13px;
}
.bulk-recipients-table th,
.bulk-recipients-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.06));
}
.bulk-recipients-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3, #4f5969);
  font-weight: 600;
}

/* =====================================================
   WIZARD (modal Nueva campaña)
   ===================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 18px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-wide { max-width: 720px; }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 26px 12px;
}
.modal-title { margin: 0; font-size: 18px; }
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-2, #8b96a8);
  font-size: 18px;
  cursor: pointer;
}
.modal-close:hover { color: var(--text-1, #e6edf3); }

.wizard-steps {
  display: flex;
  gap: 8px;
  padding: 0 26px 16px;
}
.wizard-step {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--text-2, #8b96a8);
  font-size: 12px;
  font-weight: 600;
}
.wizard-step.active {
  background: var(--accent);
  color: #050505;
}
.wizard-step.done {
  background: rgba(214, 255, 63, 0.2);
  color: var(--accent);
}

.wizard-content {
  padding: 0 26px;
  overflow-y: auto;
  flex: 1;
}
.wizard-content h4 {
  margin: 0 0 12px;
  font-size: 16px;
}
.wiz-field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}
.wiz-field span {
  font-size: 12px;
  color: var(--text-2, #8b96a8);
  font-weight: 600;
}
.wiz-template {
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 13px;
}
.wiz-checkbox {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 10px 0;
  font-size: 13px;
  color: var(--text-2, #8b96a8);
}
.wiz-preview-card {
  background: var(--bg-2);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.06));
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.wiz-preview-msg {
  white-space: pre-wrap;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.wiz-warning {
  background: rgba(255, 177, 61, 0.08);
  border: 1px solid rgba(255, 177, 61, 0.25);
  color: #ffb13d;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  margin-top: 14px;
}

.wizard-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 26px 22px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.06));
  margin-top: 12px;
}

.btn-sm { padding: 6px 10px; font-size: 12px; }
.empty-state { color: var(--text-3, #4f5969); padding: 24px 0; text-align: center; }

/* =====================================================
   WIZARD — tabs CSV / Google Sheets
   ===================================================== */

.wiz-source-tabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 16px;
  padding: 4px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  width: fit-content;
}

.wiz-source-tab {
  background: transparent;
  border: 0;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
  cursor: pointer;
  transition: all var(--transition);
}

.wiz-source-tab:hover {
  color: var(--fg-1);
}

.wiz-source-tab.active {
  background: var(--bg-1);
  color: var(--accent);
  box-shadow: 0 1px 0 var(--line);
}

/* =====================================================
   CRM (vista unificada de contactos)
   ===================================================== */

.crm-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.crm-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.crm-filter-row .input {
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--fg-1);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  flex: 1;
  min-width: 140px;
  max-width: 260px;
}

.crm-mini-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
}

.crm-mini-field > span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-3);
}

.crm-mini-field .input {
  min-width: 0;
  width: 100%;
}

.crm-summary {
  margin: 8px 4px;
  font-size: 12px;
}

.crm-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
}

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

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

.crm-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-3);
  border-bottom: 1px solid var(--line);
}

.crm-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.crm-table tbody tr:hover {
  background: var(--bg-2);
}

.crm-name {
  font-weight: 500;
  color: var(--fg-1);
}

.crm-sub {
  font-size: 11px;
  margin-top: 2px;
}

.crm-web-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 16px;
}

.crm-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--fg-2);
}

.crm-status.stat-pending { background: rgba(80, 100, 130, 0.18); color: #9bb0c8; border-color: rgba(80, 100, 130, 0.35); }
.crm-status.stat-sent    { background: rgba(80, 200, 120, 0.15); color: #6bd590; border-color: rgba(80, 200, 120, 0.4); }
.crm-status.stat-resp    { background: rgba(214, 255, 63, 0.18); color: var(--accent); border-color: rgba(214, 255, 63, 0.5); font-weight: 600; }
.crm-status.stat-opt     { background: rgba(255, 90, 60, 0.15); color: #ff9374; border-color: rgba(255, 90, 60, 0.4); }
.crm-status.stat-fail    { background: rgba(255, 80, 100, 0.15); color: #ff708a; border-color: rgba(255, 80, 100, 0.4); }
.crm-status.stat-contacted { background: rgba(120, 180, 255, 0.15); color: #8fb8f1; border-color: rgba(120, 180, 255, 0.4); }
.crm-status.stat-disc    { background: rgba(100, 100, 100, 0.18); color: var(--fg-3); border-color: var(--line); }

.crm-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: nowrap;
}

.crm-action {
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--fg-2);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  transition: all var(--transition);
}

.crm-action:hover {
  background: var(--bg-1);
  border-color: var(--accent);
  color: var(--accent);
}

.crm-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.crm-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
}

/* ===== GENERATOR IA ===== */

.gen-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.gen-tab {
  background: transparent;
  border: 0;
  color: var(--fg-2);
  padding: 10px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}

.gen-tab:hover {
  color: var(--fg-1);
}

.gen-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.gen-pane {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.gen-pane.active {
  display: flex;
}

.gen-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gen-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.gen-form-row > * {
  min-width: 0;
}

.gen-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gen-field > span {
  font-size: 12px;
  color: var(--fg-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gen-style-helpers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.gen-style-btn {
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--fg-2);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.gen-style-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.gen-style-btn.active {
  background: var(--accent);
  color: var(--bg-1);
  border-color: var(--accent);
  font-weight: 600;
}

.gen-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 8px;
}

.gen-cost-hint {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}

.gen-model-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 100px;
  border: 1px solid var(--line);
  margin-left: 8px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
}

.gen-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gen-results-empty {
  text-align: center;
  padding: 32px;
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

/* Copy variants */

.gen-copy-variant {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition);
}

.gen-copy-variant:hover {
  border-color: rgba(214, 255, 63, 0.4);
}

.gen-copy-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.gen-copy-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  font-weight: 600;
}

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

.gen-copy-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-3);
  border-radius: 8px;
  border-left: 2px solid var(--line);
}

.gen-copy-block.is-primary {
  border-left-color: var(--accent);
}

.gen-copy-block-label {
  font-size: 10px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

.gen-copy-block-value {
  font-size: 14px;
  color: var(--fg-1);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.gen-copy-block-value.is-hashtags {
  color: #8fb8f1;
  font-size: 13px;
}

.gen-copy-block-value.is-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

.gen-copy-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--fg-3);
  font-family: 'JetBrains Mono', monospace;
  flex-wrap: wrap;
}

/* Image grid */

.gen-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.gen-img-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition);
}

.gen-img-card:hover {
  border-color: rgba(214, 255, 63, 0.4);
}

.gen-img-thumb {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--bg-3);
}

.gen-img-card.is-vertical .gen-img-thumb {
  aspect-ratio: 2 / 3;
}

.gen-img-card.is-horizontal .gen-img-thumb {
  aspect-ratio: 3 / 2;
}

.gen-img-meta {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gen-img-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.gen-img-prompt {
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Loading state shared */

.gen-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--fg-2);
}

.gen-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gen-spin 0.7s linear infinite;
}

@keyframes gen-spin {
  to { transform: rotate(360deg); }
}

/* History */

.gen-history-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
}

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

.gen-history-item {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 48px 1fr auto auto;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: border-color var(--transition);
}

.gen-history-item:hover {
  border-color: rgba(214, 255, 63, 0.5);
}

.gen-history-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.gen-history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.gen-history-info {
  min-width: 0;
}

.gen-history-title {
  font-size: 13px;
  color: var(--fg-1);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gen-history-sub {
  font-size: 11px;
  color: var(--fg-3);
  font-family: 'JetBrains Mono', monospace;
}

.gen-history-cost {
  font-size: 12px;
  color: var(--fg-2);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

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

@media (max-width: 768px) {
  .gen-form-row {
    grid-template-columns: 1fr;
  }
  .gen-img-grid {
    grid-template-columns: 1fr;
  }
  .gen-history-item {
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
  }
  .gen-history-cost,
  .gen-history-actions {
    grid-column: 2;
  }
}

/* ===== WIZARD (Crear Campaña con IA) ===== */

.nav-item-cta {
  background: linear-gradient(135deg, rgba(214, 255, 63, 0.15), rgba(214, 255, 63, 0.05));
  border-left: 2px solid var(--accent);
}

.nav-item-cta:hover {
  background: linear-gradient(135deg, rgba(214, 255, 63, 0.25), rgba(214, 255, 63, 0.1));
}

.nav-item-cta.active {
  background: linear-gradient(135deg, rgba(214, 255, 63, 0.3), rgba(214, 255, 63, 0.1));
}

.wizard-shell {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.wizard-stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  position: relative;
  padding: 8px 0 24px;
  border-bottom: 1px solid var(--line);
}

/* Scope todo bajo .wizard-shell para no colisionar con el wizard de bulk-campaigns */

.wizard-shell .wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  text-align: center;
  opacity: 0.4;
  transition: opacity var(--transition);
  width: auto;
  height: auto;
  background: transparent;
  border-radius: 0;
}

.wizard-shell .wizard-step.is-active,
.wizard-shell .wizard-step.is-done {
  opacity: 1;
}

.wizard-shell .wizard-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  height: 1px;
  background: var(--line);
  z-index: 0;
}

.wizard-shell .wizard-step.is-done:not(:last-child)::after {
  background: var(--accent);
}

.wizard-shell .wizard-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--fg-2);
  position: relative;
  z-index: 1;
  transition: all var(--transition);
}

.wizard-shell .wizard-step.is-active .wizard-step-num {
  background: var(--accent);
  color: var(--bg-1);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(214, 255, 63, 0.2);
}

.wizard-shell .wizard-step.is-done .wizard-step-num {
  background: rgba(214, 255, 63, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.wizard-shell .wizard-step-label {
  font-size: 12px;
  color: var(--fg-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wizard-shell .wizard-step.is-active .wizard-step-label {
  color: var(--fg-1);
}

.wizard-pane {
  display: none;
  flex-direction: column;
  gap: 24px;
  animation: wizard-fade 0.25s ease-out;
}

.wizard-pane.is-active {
  display: flex;
}

@keyframes wizard-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.wizard-title {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--fg-1);
  margin: 0;
}

.wizard-sub {
  color: var(--fg-2);
  font-size: 14px;
  margin: 0;
}

.wizard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.wizard-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  position: relative;
  color: var(--fg-1);
  overflow: hidden;
}

.wizard-card:hover {
  border-color: rgba(214, 255, 63, 0.4);
  transform: translateY(-2px);
}

.wizard-card.is-selected {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--bg-2), rgba(214, 255, 63, 0.08));
  box-shadow: 0 0 0 1px var(--accent);
}

.wizard-card-icon {
  font-size: 36px;
  line-height: 1;
}

.wizard-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-1);
  line-height: 1.3;
}

.wizard-card-desc {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.5;
}

.wizard-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent);
  color: var(--bg-1);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 100px;
  letter-spacing: 0.3px;
}

.wizard-card-badge-soon {
  background: var(--bg-3);
  color: var(--fg-2);
  border: 1px solid var(--line);
}

.wizard-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wizard-actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.wizard-cost-hint {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* RESULT (paso 4) */

.wizard-result {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.wizard-result-hero {
  background: linear-gradient(135deg, rgba(214, 255, 63, 0.12), rgba(214, 255, 63, 0.02));
  border: 1px solid rgba(214, 255, 63, 0.3);
  border-radius: 14px;
  padding: 24px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  align-items: start;
}

.wizard-result-img {
  width: 100%;
  border-radius: 10px;
  display: block;
  background: var(--bg-3);
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.wizard-result-info h4 {
  margin: 0 0 8px;
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  color: var(--fg-1);
}

.wizard-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.wizard-result-chip {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--fg-2);
  font-family: 'JetBrains Mono', monospace;
}

.wizard-result-budget {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wizard-result-budget-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--fg-3);
  font-weight: 600;
}

.wizard-result-budget-value {
  font-family: 'Syne', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.wizard-result-budget-note {
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.5;
}

.wizard-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 768px) {
  .wizard-stepper {
    overflow-x: auto;
  }
  .wizard-step-label {
    font-size: 10px;
  }
  .wizard-result-hero {
    grid-template-columns: 1fr;
  }
  .wizard-actions {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .wizard-cost-hint {
    grid-column: 1 / -1;
  }
}

/* ===== INTEGRACIONES DEL BOT ===== */

.bot-secondary-toggle {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bot-help-small {
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

.bot-integrations-panel {
  margin-top: 20px;
  max-width: 960px;
}
.bot-reactivation-panel {
  margin-top: 20px;
  max-width: 960px;
}

/* Los textareas secundarios usan el MISMO look que el prompt principal
   pero con altura menor porque son guías, no el prompt raíz. */
.bot-prompt-input-sm {
  width: 100%;
  background: var(--bg-3);
  color: var(--fg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  resize: vertical;
  min-height: 120px;
  outline: none;
  transition: border-color var(--transition);
}

.bot-prompt-input-sm:focus {
  border-color: var(--accent);
}

.reactivation-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reactivation-toggle-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reactivation-block-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--fg-3);
  font-weight: 600;
  margin: 12px 0 4px;
}

.reactivation-hours {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 200px;
}

.reactivation-hours-select {
  width: 100%;
  background: var(--bg-3);
  color: var(--fg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  outline: none;
  transition: border-color var(--transition);
  cursor: pointer;
}

.reactivation-hours-select:focus {
  border-color: var(--accent);
}

.reactivation-divider {
  height: 1px;
  background: var(--line);
  margin: 22px 0 4px;
}

.integration-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.integration-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}

.integration-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-1);
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.integration-pill {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 8px;
  border-radius: 100px;
  background: rgba(214, 255, 63, 0.15);
  color: var(--accent);
  border: 1px solid rgba(214, 255, 63, 0.3);
}

.integration-desc {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.integration-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.integration-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.integration-test-result {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}

.integration-test-result.is-ok {
  color: #6bd590;
}

.integration-test-result.is-error {
  color: #ff708a;
}
