@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Orbitron:wght@400;600;700&display=swap');

:root {
  --green:       #00ff41;
  --green-dim:   #00cc33;
  --green-dark:  #003b00;
  --green-glow:  rgba(0,255,65,0.18);
  --green-glow2: rgba(0,255,65,0.06);
  --black:       #000000;
  --surface:     #020c02;
  --surface2:    #041204;
  --border:      #0d3b0d;
  --border2:     #145014;
  --muted:       #2a6b2a;
  --text:        #b0ffb0;
  --text-dim:    #4a904a;
  --text-bright: #e0ffe0;
  --red:         #ff4444;
  --red-dim:     #5c1a1a;
  --amber:       #ffaa00;
  --amber-dim:   #3d2a00;
  --blue:        #00ccff;
  --mono:        'Share Tech Mono', 'Courier New', monospace;
  --title:       'Orbitron', monospace;
  /* Semantic aliases used by Usage panel and JS */
  --card:        var(--surface2);
  --accent:      var(--green);
  --accent-blue: var(--blue);
  /* Spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px;
  /* Radius scale */
  --r-sm: 4px; --r-md: 8px; --r-lg: 12px;
}

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

body {
  font-family: var(--mono);
  background: var(--black);
  color: var(--text);
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Matrix rain canvas ── */
#matrix-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.13;
}

#login-screen,
#app {
  position: relative;
  z-index: 1;
}

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Login ── */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; flex-direction: column; gap: 16px;
}

#login-screen h1 {
  font-family: var(--title);
  font-size: 28px;
  color: var(--green);
  text-shadow: 0 0 20px var(--green), 0 0 40px var(--green-dim);
  letter-spacing: 0.12em;
  margin-bottom: 8px;
  animation: flicker 4s infinite;
}

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

@keyframes flicker {
  0%,100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.6; }
  94% { opacity: 1; }
  96% { opacity: 0.8; }
  97% { opacity: 1; }
}

#login-screen input {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 2px;
  font-size: 14px;
  width: 300px;
  font-family: var(--mono);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#login-screen input:focus {
  border-color: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}

#login-screen button {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green);
  padding: 10px 20px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  width: 300px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  transition: background 0.2s, box-shadow 0.2s;
}
#login-screen button:hover {
  background: var(--green-glow);
  box-shadow: 0 0 12px var(--green-glow);
}
#login-error { color: var(--red); font-size: 13px; min-height: 20px; }

/* ── App wrapper ── */
#app { padding: 12px 16px; }

/* ── Header ── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-family: var(--title);
  font-size: 16px;
  color: var(--green);
  text-shadow: 0 0 10px var(--green-glow);
  letter-spacing: 0.1em;
}


/* ── Brand logo ── */
.brand-logo {
  font-family: 'Inter', sans-serif;
  font-size: 20px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: none;
  -webkit-text-fill-color: transparent;
  animation: flicker 4s infinite;
  padding: 0 4px 0 2px;
  margin: 0;
  line-height: 1;
  display: flex;
  align-items: center;
}
/* "Sendro" — italic blue/cyan */
.brand-sendro {
  font-style: italic;
  font-weight: 700;
  background: linear-gradient(90deg, #00cc44 0%, #00ffaa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(0,204,68,0.5));
}
/* "AI" — upright, brighter green */
.brand-ai {
  font-style: normal;
  font-weight: 800;
  background: linear-gradient(90deg, #00ff99 0%, #00ffff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 10px rgba(0,255,200,0.6));
}
/* Login screen logo */
#login-screen .brand-logo {
  font-size: 32px;
  margin-bottom: 8px;
}

#last-refresh { font-size: 11px; color: var(--text-dim); }

#export-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text-dim);
  padding: 4px 12px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--mono);
  transition: border-color 0.15s, color 0.15s;
}
#export-btn:hover { color: var(--green); border-color: var(--green); }
#export-btn:disabled { opacity: 0.5; cursor: default; }
[data-theme="light"] #export-btn { border-color: rgba(180,200,255,0.5); color: #6070a0; border-radius: 8px; }
[data-theme="light"] #export-btn:hover { color: #5b8def; border-color: #5b8def; }

#logout-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text-dim);
  padding: 4px 12px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--mono);
  transition: border-color 0.15s, color 0.15s;
}
#logout-btn:hover { color: var(--red); border-color: var(--red); }

/* ── Status bar ── */
#status-bar {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 6px 4px;
  margin-bottom: 10px;
  font-size: 11px;
  flex-wrap: wrap;
  row-gap: 4px;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
}

.sb-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.sb-label { color: var(--text-dim); font-size: 10px; margin-left: 2px; }

.sb-sep {
  width: 1px; height: 12px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Nav ── */
nav {
  display: flex;
  gap: 0;
  align-items: stretch;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: var(--surface2);
  border-radius: 6px 6px 0 0;
  overflow: hidden;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.nav-group:last-child { border-right: none; }

.nav-group-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  padding: 6px 10px 4px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  opacity: 0.8;
}

.nav-group-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  padding: 3px 4px;
}

.tab {
  background: none;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 5px 11px;
  cursor: pointer;
  font-size: 12px;
  border-radius: 4px;
  font-family: var(--mono);
  letter-spacing: 0.03em;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  margin: 1px;
}
.tab:hover { color: var(--green); background: var(--surface); }
.tab.active {
  color: var(--green);
  border-color: var(--border2);
  background: var(--surface);
  font-weight: 600;
  text-shadow: 0 0 6px var(--green-glow);
}

/* Nav badge for pending counts */
.tab-badge {
  display: inline-block;
  background: var(--amber);
  color: var(--black);
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  padding: 0px 4px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 14px;
}

/* ── Main / Panels ── */
main { padding-top: 12px; }
.panel { display: none; }
.panel.active {
  display: block;
  animation: panel-in 0.18s ease-out;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Typography ── */
h2 {
  font-family: var(--title);
  font-size: 13px;
  margin-bottom: 12px;
  color: var(--green);
  letter-spacing: 0.08em;
  text-shadow: 0 0 6px var(--green-glow);
}

h3 {
  font-family: var(--mono);
  font-size: 12px;
  margin: 16px 0 8px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

small { color: var(--text-dim); }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 12px;
}

th, td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-dim);
  font-weight: 600;
  background: var(--surface2);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.06em;
}

tr:hover { background: var(--surface2); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  font-family: var(--mono);
}

.badge-sent, .badge-completed  { background: #001a00; color: var(--green); border: 1px solid var(--green-dark); }
.badge-failed                  { background: var(--red-dim); color: var(--red); border: 1px solid #5c1a1a; }
.badge-queued                  { background: #001a00; color: #80ffaa; border: 1px solid var(--border2); }
.badge-locked                  { background: var(--amber-dim); color: var(--amber); border: 1px solid #5a3d00; }
.badge-simulated               { background: var(--surface2); color: var(--text-dim); border: 1px solid var(--border); }
.badge-pending_approval        { background: var(--amber-dim); color: var(--amber); border: 1px solid #5a3d00; }
.badge-cancelled               { background: var(--surface); color: var(--text-dim); border: 1px solid var(--border); }
.badge-running                 { background: #001a00; color: #80ffaa; border: 1px solid var(--border2); }
.badge-pending                 { background: var(--amber-dim); color: var(--amber); border: 1px solid #5a3d00; }

/* ── Buttons ── */
.btn {
  border: none;
  padding: 5px 12px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, background 0.2s, transform 0.15s, border-color 0.2s, color 0.2s;
}

/* Ripple layer */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--rx, 50%) var(--ry, 50%), rgba(255,255,255,0.18) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.96); }
.btn:active::after { opacity: 0.35; transition: opacity 0.05s; }

.btn-green {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green-dim);
}
.btn-green:hover {
  background: var(--green-glow);
  box-shadow: 0 0 12px var(--green-glow), 0 2px 8px rgba(0,0,0,0.3);
  transform: translateY(-1px);
  border-color: var(--green);
}
.btn-green:active { transform: translateY(0) scale(0.97); box-shadow: none; }

.btn-red {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
}
.btn-red:hover {
  background: rgba(255,68,68,0.12);
  box-shadow: 0 0 10px rgba(255,68,68,0.25), 0 2px 8px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}
.btn-red:active { transform: translateY(0) scale(0.97); box-shadow: none; }

.btn-blue {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue);
}
.btn-blue:hover {
  background: rgba(0,204,255,0.12);
  box-shadow: 0 0 10px rgba(0,204,255,0.25), 0 2px 8px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}
.btn-blue:active { transform: translateY(0) scale(0.97); box-shadow: none; }

.btn-outline {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text-dim);
}
.btn-outline:hover {
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 8px var(--green-glow2), 0 2px 6px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}
.btn-outline:active { transform: translateY(0) scale(0.97); box-shadow: none; }

.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Forms ── */
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group input,
.form-group textarea,
.form-group select,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input:not([type]),
select,
textarea {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 2px;
  font-size: 12px;
  font-family: var(--mono);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Full-width inside panels/forms, not inline controls */
.form-group input,
.form-group textarea,
.form-group select,
.panel input[type="text"],
.panel input[type="password"],
.panel input[type="number"],
.panel input[type="date"],
.panel input:not([type]),
.panel textarea,
.panel select {
  width: 100%;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input:not([type]):focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 6px var(--green-glow2);
}

.form-group textarea { min-height: 120px; resize: vertical; }
.form-group select option { background: var(--surface2); }

/* ── Loading state ── */
.loading-state {
  display: inline-block;
  font-size: 12px;
  color: var(--text-dim);
  padding: 8px 0;
}
.loading-state::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border2);
  border-top-color: var(--green);
  border-radius: 50%;
  vertical-align: middle;
  margin-left: 8px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toolbar ── */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .ctrl, .toolbar select, .toolbar input { width: auto; }

/* ── Leads sub-nav ── */
.leads-subnav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.leads-subtab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  padding: 6px 18px;
  font-size: 13px;
  font-family: var(--mono);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.leads-subtab:hover { color: var(--text); }
.leads-subtab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }
[data-theme="void"] .leads-subtab,
[data-theme="light"] .leads-subtab { font-family: 'Inter', sans-serif; }
[data-theme="light"] .leads-subtab.active { color: #5b8def; border-bottom-color: #5b8def; }

/* ── Result messages ── */
.result-msg { padding: 7px 12px; border-radius: 2px; margin: 8px 0; font-size: 12px; }
.result-ok  { background: #001a00; color: var(--green); border: 1px solid var(--green-dark); }
.result-err { background: var(--red-dim); color: var(--red); border: 1px solid #5c1a1a; }

/* ── Stats bar ── */
.stats-bar { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 2px;
  text-align: center;
  min-width: 100px;
}
.stat-value { font-size: 20px; font-weight: 700; color: var(--green); text-shadow: 0 0 8px var(--green-glow); }
.stat-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Caps ── */
.caps-summary {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 2px;
  margin-bottom: 12px;
  font-size: 12px;
}

/* ── Scenarios ── */
.scenario-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

#run-checks {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green-dim);
  padding: 7px 16px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
}
#run-checks:hover { background: var(--green-glow); }
#run-checks:disabled { opacity: 0.4; cursor: wait; }

.scenario {
  background: var(--surface2);
  border-left: 3px solid var(--border);
  padding: 9px 14px;
  margin-bottom: 5px;
  border-radius: 0 2px 2px 0;
  font-size: 12px;
}
.scenario-pass { border-left-color: var(--green-dim); }
.scenario-fail { border-left-color: var(--red); }
.scenario-cat {
  float: right; font-size: 10px; color: var(--text-dim);
  background: var(--surface); padding: 1px 6px; border-radius: 8px;
}
.scenario-detail { margin-top: 4px; color: var(--text-dim); font-size: 11px; }
.scenario-group { margin-bottom: 20px; }
.scenario-group h3 { color: var(--text-dim); font-size: 12px; margin-bottom: 8px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.scenario-group h3 small { float: right; font-weight: 400; }

details { margin-top: 8px; }
summary { cursor: pointer; color: var(--green); font-size: 12px; }
.detail-table { margin-top: 6px; font-size: 11px; }
.detail-table th { font-size: 10px; }
.detail-scroll { overflow-x: auto; max-width: 100%; }

/* ── Auto-fix ── */
#auto-fix {
  background: transparent;
  color: var(--amber);
  border: 1px solid var(--amber);
  padding: 7px 16px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
  margin-left: 8px;
}
#auto-fix:hover { background: rgba(255,170,0,0.1); }
#auto-fix:disabled { opacity: 0.4; cursor: wait; }

/* ── Repair ── */
.repair-group { margin-bottom: 16px; }
.repair-group h4 { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.repair-item {
  background: var(--surface2);
  border-left: 3px solid var(--border);
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: 0 2px 2px 0;
  font-size: 12px;
}
.repair-executed .repair-item { border-left-color: var(--green-dim); }
.repair-proposed .repair-item { border-left-color: var(--amber); }
.repair-info .repair-item { border-left-color: var(--text-dim); }
.reasoning-cell { max-width: 400px; font-size: 11px; color: var(--text-dim); word-wrap: break-word; }

/* ── Approval cards ── */
.approval-card {
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--surface2);
  transition: border-color 0.15s;
}
.approval-card:hover { border-color: var(--green-dim); }

.approval-card h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.approval-lead-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.approval-msg-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: flex-start;
}
.approval-msg-wrap textarea {
  min-height: 72px;
  font-size: 12px;
  resize: vertical;
}

.approval-actions {
  display: flex;
  gap: 8px;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 2px;
}
.approval-actions .btn {
  font-size: 12px;
  padding: 6px 14px;
  white-space: nowrap;
}

.approvals-count-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  flex-wrap: wrap;
}
.approvals-count-bar strong { color: var(--text-bright); font-size: 18px; }
.approvals-count-bar .sep { color: var(--border2); }

/* ── Campaign detail ── */
.campaign-detail {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 14px;
  margin-top: 12px;
}
.validation-errors li { color: var(--red); font-size: 12px; margin: 2px 0; }
.sync-pending { color: var(--amber); font-size: 12px; }

/* ── Config ── */
.kv-table td:first-child { color: var(--green); font-family: var(--mono); font-size: 12px; width: 40%; }

/* ── Collapsible ── */
.collapsible-header {
  cursor: pointer; padding: 7px 0; color: var(--green);
  font-size: 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.collapsible-header:hover { color: var(--text-bright); }
.collapsible-body { display: none; }
.collapsible-body.open { display: block; }

/* ── Toggle switch ── */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--surface); border: 1px solid var(--border2); border-radius: 22px; transition: .2s; }
.toggle-slider:before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; bottom: 3px; background: var(--text-dim); border-radius: 50%; transition: .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--green-dark); border-color: var(--green-dim); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); background: var(--green); }

/* ── Suggest box ── */
.suggest-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 10px 14px;
  margin: 8px 0;
  font-size: 12px;
}
.suggest-box code { color: var(--green); font-family: var(--mono); display: block; margin: 6px 0; }

/* ── Terminal ── */
#term-output {
  background: var(--black);
  border: 1px solid var(--border2);
  border-radius: 2px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--green);
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin-bottom: 8px;
  text-shadow: 0 0 4px var(--green-glow);
}
.term-input-row { display: flex; gap: 6px; margin-bottom: 8px; }
.term-input-row input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
.term-input-row input:focus { border-color: var(--green); }
.term-cmd  { color: var(--green); }
.term-err  { color: var(--red); }
.term-info { color: var(--text-dim); font-style: italic; }

/* ── KPI cards (funnel) ── */
.kpi-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.kpi-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 10px 16px;
  min-width: 110px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.kpi-card[style*="cursor:pointer"]::after,
.kpi-card[style*="cursor: pointer"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--rx,50%) var(--ry,50%), rgba(255,255,255,0.12) 0%, transparent 65%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.kpi-card[style*="cursor:pointer"]:hover::after,
.kpi-card[style*="cursor: pointer"]:hover::after { opacity: 1; }
.kpi-card[style*="cursor:pointer"]:hover,
.kpi-card[style*="cursor: pointer"]:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  border-color: var(--green-dim);
}
.kpi-card[style*="cursor:pointer"]:active,
.kpi-card[style*="cursor: pointer"]:active {
  transform: translateY(0) scale(0.97);
  box-shadow: none;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--green-dim);
  box-shadow: 0 0 6px var(--green-glow);
}
.kpi-value { font-size: 22px; font-weight: 700; color: var(--green); text-shadow: 0 0 8px var(--green-glow); }
.kpi-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 2px; }

/* ── Grouped nav (override) ── */
nav { flex-wrap: wrap; }

/* ── Chat UI ── */
#p-messages { padding: 0; overflow: hidden; }

.chat-layout {
  display: flex;
  height: calc(100vh - 150px);
  min-height: 420px;
}

.chat-sidebar {
  width: 270px;
  flex-shrink: 0;
  border-right: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.chat-sidebar-top {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-campaign-sel {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 2px;
  font-size: 11px;
  font-family: var(--mono);
}

.chat-search {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 2px;
  font-size: 11px;
  font-family: var(--mono);
  outline: none;
}
.chat-search:focus { border-color: var(--green); }
.chat-search::placeholder { color: var(--text-dim); }

.chat-lead-list { flex: 1; overflow-y: auto; }

.chat-lead-section-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 6px 10px 3px;
  border-bottom: 1px solid var(--border);
}

.chat-lead-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--surface2);
  transition: background 0.1s;
}
.chat-lead-item:hover { background: var(--surface2); }
.chat-lead-item.selected {
  background: var(--green-dark);
  border-left: 2px solid var(--green);
  padding-left: 8px;
}

.chat-lead-avatar {
  width: 32px; height: 32px;
  border-radius: 2px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  text-shadow: 0 0 6px var(--green-glow);
}
.chat-lead-item.selected .chat-lead-avatar { border-color: var(--green); background: var(--green-dark); }
.chat-lead-item.has-reply .chat-lead-avatar { box-shadow: 0 0 6px var(--green-glow); }

.chat-lead-info { flex: 1; min-width: 0; }
.chat-lead-name { font-size: 12px; color: var(--text-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-lead-meta { font-size: 10px; color: var(--text-dim); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-lead-empty { padding: 16px 12px; font-size: 11px; color: var(--text-dim); }

.chat-reply-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 5px var(--green);
  flex-shrink: 0;
}

.chat-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--black);
}

.chat-pane-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border2);
  background: var(--surface2);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-family: var(--mono);
}
.chat-pane-placeholder { font-size: 12px; color: var(--text-dim); font-weight: 400; }
.chat-header-name { color: var(--green); text-shadow: 0 0 6px var(--green-glow); }
.chat-header-link { color: var(--text-dim); text-decoration: none; font-size: 12px; transition: color 0.15s; }
.chat-header-link:hover { color: var(--green); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chat-loading { font-size: 11px; color: var(--text-dim); text-align: center; padding: 20px; }

.chat-msg-row { display: flex; flex-direction: column; max-width: 74%; }
.chat-msg-row.outgoing { align-self: flex-end; align-items: flex-end; }
.chat-msg-row.incoming { align-self: flex-start; align-items: flex-start; }
.chat-msg-sender { font-size: 10px; color: var(--text-dim); margin-bottom: 2px; padding: 0 4px; }

.chat-bubble {
  padding: 7px 12px;
  border-radius: 2px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
}
.chat-msg-row.outgoing .chat-bubble {
  background: var(--green-dark);
  color: var(--green);
  border: 1px solid var(--green-dim);
  border-bottom-right-radius: 0;
  text-shadow: 0 0 4px var(--green-glow2);
}
.chat-msg-row.incoming .chat-bubble {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border2);
  border-bottom-left-radius: 0;
}
.chat-msg-time {
  display: block;
  font-size: 10px;
  opacity: 0.45;
  margin-top: 3px;
}
.chat-msg-row.outgoing .chat-msg-time { text-align: right; }
.chat-msg-row.incoming .chat-msg-time { text-align: left; }

.chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--border2);
  background: var(--surface2);
}

.chat-input {
  flex: 1;
  background: var(--black);
  border: 1px solid var(--border2);
  border-radius: 2px;
  color: var(--text);
  padding: 7px 12px;
  font-size: 12px;
  font-family: var(--mono);
  resize: none;
  outline: none;
  line-height: 1.4;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.15s;
}
.chat-input:focus { border-color: var(--green); box-shadow: 0 0 5px var(--green-glow2); }
.chat-input::placeholder { color: var(--text-dim); }

.chat-send-btn {
  width: 32px; height: 32px;
  border-radius: 2px;
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green-dim);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, box-shadow 0.15s;
  line-height: 1;
  font-family: var(--mono);
}
.chat-send-btn:hover { background: var(--green-glow); box-shadow: 0 0 8px var(--green-glow); }
.chat-send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ══════════════════════════════════════════════════
   VOID THEME
   ══════════════════════════════════════════════════ */

#void-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  display: none;
}

[data-theme="void"] {
  --green:       #00d4ff;
  --green-dim:   #0088aa;
  --green-dark:  #031824;
  --green-glow:  rgba(0,212,255,0.15);
  --green-glow2: rgba(0,212,255,0.07);
  --black:       #080c14;
  --surface:     #0e1420;
  --surface2:    #131c2e;
  --border:      #1e2d47;
  --border2:     #243554;
  --muted:       #1e4060;
  --text:        #c8d8e8;
  --text-dim:    #4a6080;
  --text-bright: #e8f4ff;
  --red:         #ff4466;
  --amber:       #ffaa00;
  --mono:        'JetBrains Mono', 'Courier New', monospace;
  --title:       'Inter', sans-serif;
  --card:        var(--surface2);
  --accent:      var(--green);
  --accent-blue: var(--blue);
}

/* ── Void brand logo ── */
[data-theme="void"] .brand-logo { animation: none; }
[data-theme="void"] .brand-sendro {
  background: linear-gradient(90deg, #4facf5 0%, #38d0f5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 10px rgba(79,172,245,0.45));
}
[data-theme="void"] .brand-ai {
  background: linear-gradient(90deg, #c084fc 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 10px rgba(167,139,250,0.5));
}

/* ── Light brand logo: exact SendroAI colors ── */
[data-theme="light"] .brand-logo { animation: none; }
[data-theme="light"] .brand-sendro {
  background: linear-gradient(90deg, #4facf5 0%, #38b6ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 6px rgba(79,172,245,0.25));
}
[data-theme="light"] .brand-ai {
  background: linear-gradient(90deg, #9b59f5 0%, #b47cf7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 6px rgba(155,89,245,0.25));
}

/* ══════════════════════════════════════════════
   iOS-STYLE LAYOUT: shared by void + light
══════════════════════════════════════════════ */

/* Nav — flat pill segmented feel, no underline */
[data-theme="void"] nav,
[data-theme="light"] nav {
  gap: 4px;
  border-bottom: none;
  padding: 6px 8px;
  border-radius: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}

[data-theme="void"] .nav-group,
[data-theme="light"] .nav-group {
  flex-direction: row;
  align-items: center;
  gap: 0;
  padding-bottom: 0;
  background: rgba(128,128,128,0.12);
  border-radius: 8px;
  padding: 3px;
}

[data-theme="void"] .nav-group-label,
[data-theme="light"] .nav-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  opacity: 1;
  padding: 4px 8px;
  white-space: nowrap;
}

[data-theme="void"] .nav-group-tabs,
[data-theme="light"] .nav-group-tabs {
  gap: 1px;
}

[data-theme="void"] .tab,
[data-theme="light"] .tab {
  border: none;
  border-radius: 6px;
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  transition: background 0.15s, color 0.15s;
  background: transparent;
}

[data-theme="void"] .tab.active,
[data-theme="light"] .tab.active {
  border: none;
  border-bottom-color: transparent;
  text-shadow: none;
}

[data-theme="void"] nav {
  background: var(--surface2);
  border-radius: 12px 12px 0 0;
}
[data-theme="void"] .nav-group-label {
  background: var(--surface);
}
[data-theme="light"] nav {
  background: rgba(255,255,255,0.7);
  border-radius: 12px 12px 0 0;
  border-bottom-color: #e5e7eb;
}
[data-theme="light"] .nav-group { border-right-color: #e5e7eb; }
[data-theme="light"] .nav-group-label {
  background: rgba(249,250,251,0.9);
  border-bottom-color: #e5e7eb;
  color: #8faad8;
}
[data-theme="light"] .tab { color: #6070a0; }
[data-theme="light"] .tab:hover { color: #3b4f7a; background: rgba(91,141,239,0.08); }
[data-theme="light"] .tab.active {
  background: rgba(255,255,255,0.9);
  color: #5b8def;
  font-weight: 600;
  text-shadow: none;
}
[data-theme="light"] .tab-badge { background: #d97706; }

/* Panels */
[data-theme="void"] .panel.active,
[data-theme="light"] .panel.active {
  border-radius: 14px;
  padding: 20px;
}

/* Cards */
[data-theme="void"] .stat-card,
[data-theme="void"] .kpi-card,
[data-theme="light"] .stat-card,
[data-theme="light"] .kpi-card {
  border-radius: 14px;
  padding: 16px 20px;
}

/* KPI cards */
[data-theme="void"] .kpi-card[style*="cursor:pointer"]:hover,
[data-theme="void"] .kpi-card[style*="cursor: pointer"]:hover {
  box-shadow: 0 8px 24px rgba(0,212,255,0.15), 0 2px 8px rgba(0,0,0,0.3);
  border-color: rgba(0,212,255,0.3);
}
[data-theme="light"] .kpi-card[style*="cursor:pointer"]:hover,
[data-theme="light"] .kpi-card[style*="cursor: pointer"]:hover {
  box-shadow: 0 8px 24px rgba(91,141,239,0.18), 0 2px 8px rgba(0,0,0,0.08);
  border-color: rgba(91,141,239,0.4);
}
[data-theme="void"] .kpi-card[style*="cursor:pointer"],
[data-theme="void"] .kpi-card[style*="cursor: pointer"],
[data-theme="light"] .kpi-card[style*="cursor:pointer"],
[data-theme="light"] .kpi-card[style*="cursor: pointer"] {
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s, border-color 0.2s;
}

/* Buttons */
[data-theme="void"] .btn,
[data-theme="light"] .btn {
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  transition: box-shadow 0.2s, background 0.2s, transform 0.15s cubic-bezier(0.34,1.56,0.64,1), border-color 0.2s, color 0.2s;
}

[data-theme="void"] .btn-green,
[data-theme="light"] .btn-green {
  border: none;
  font-weight: 600;
}

[data-theme="void"] .btn:hover,
[data-theme="light"] .btn:hover {
  transform: translateY(-2px) scale(1.02);
}

[data-theme="void"] .btn:active,
[data-theme="light"] .btn:active {
  transform: translateY(0) scale(0.97);
}

[data-theme="void"] .btn-green:hover {
  background: rgba(0,212,255,0.2);
  box-shadow: 0 4px 16px rgba(0,212,255,0.2), 0 1px 4px rgba(0,0,0,0.3);
}

[data-theme="light"] .btn-green:hover {
  background: #3b6dcc;
  box-shadow: 0 4px 16px rgba(91,141,239,0.35), 0 1px 4px rgba(0,0,0,0.1);
}

[data-theme="void"] .btn-outline:hover {
  border-color: #00d4ff;
  color: #00d4ff;
  box-shadow: 0 4px 14px rgba(0,212,255,0.15), 0 1px 4px rgba(0,0,0,0.2);
}

[data-theme="light"] .btn-outline:hover {
  border-color: #5b8def;
  color: #5b8def;
  box-shadow: 0 4px 14px rgba(91,141,239,0.15), 0 1px 4px rgba(0,0,0,0.08);
}

[data-theme="void"] .btn-outline,
[data-theme="light"] .btn-outline {
  border-radius: 8px;
}

/* Forms */
[data-theme="void"] .form-group label,
[data-theme="light"] .form-group label {
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

[data-theme="void"] .form-group input,
[data-theme="void"] .form-group textarea,
[data-theme="void"] .form-group select,
[data-theme="void"] input[type="text"],
[data-theme="void"] input[type="password"],
[data-theme="void"] input[type="number"],
[data-theme="void"] input[type="date"],
[data-theme="void"] input:not([type]),
[data-theme="void"] select,
[data-theme="void"] textarea,
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group textarea,
[data-theme="light"] .form-group select,
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="date"],
[data-theme="light"] input:not([type]),
[data-theme="light"] select,
[data-theme="light"] textarea {
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 8px 12px;
}

/* Badges */
[data-theme="void"] .badge,
[data-theme="light"] .badge {
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 11px;
  letter-spacing: 0;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  border: none;
}

/* Result messages */
[data-theme="void"] .result-msg,
[data-theme="light"] .result-msg {
  border-radius: 10px;
  font-size: 13px;
}

/* Table */
[data-theme="void"] table,
[data-theme="light"] table {
  border-collapse: separate;
  border-spacing: 0;
}

[data-theme="void"] th,
[data-theme="light"] th {
  padding: 8px 12px;
  font-weight: 600;
}

[data-theme="void"] td,
[data-theme="light"] td {
  padding: 9px 12px;
}

[data-theme="void"] tr:first-child th:first-child,
[data-theme="light"] tr:first-child th:first-child { border-radius: 10px 0 0 0; }
[data-theme="void"] tr:first-child th:last-child,
[data-theme="light"] tr:first-child th:last-child  { border-radius: 0 10px 0 0; }

/* Ctrl inputs */
[data-theme="void"] .ctrl,
[data-theme="light"] .ctrl {
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 7px 11px;
}

/* Toolbar */
[data-theme="void"] .toolbar,
[data-theme="light"] .toolbar {
  margin-bottom: 16px;
  gap: 10px;
}

/* ── Shared structural rules: void + light use same fonts/spacing ── */
[data-theme="void"] body,
[data-theme="light"] body {
  font-family: 'Inter', sans-serif;
}

[data-theme="void"] header h1 {
  text-shadow: 0 0 20px rgba(0,212,255,0.4);
}

[data-theme="void"] header h1,
[data-theme="light"] header h1 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
  animation: none;
}

[data-theme="void"] .tab,
[data-theme="light"] .tab {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  letter-spacing: 0;
}

[data-theme="void"] h2,
[data-theme="light"] h2 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0;
}

[data-theme="void"] h3,
[data-theme="light"] h3 {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 0.02em;
}

[data-theme="void"] .nav-group-label,
[data-theme="light"] .nav-group-label {
  font-family: 'Inter', sans-serif;
}

[data-theme="void"] .btn,
[data-theme="light"] .btn {
  font-family: 'Inter', sans-serif;
  border-radius: 4px;
}
[data-theme="light"] .btn {
  border-radius: 8px;
}

[data-theme="void"] table,
[data-theme="light"] table {
  font-size: 13px;
}

[data-theme="void"] th,
[data-theme="light"] th {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

[data-theme="void"] .badge,
[data-theme="light"] .badge {
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
}
[data-theme="light"] .badge {
  font-family: 'Inter', system-ui, sans-serif;
  border-radius: 6px;
}

[data-theme="void"] .panel.active,
[data-theme="light"] .panel.active {
  border-radius: 6px;
  padding: 16px;
}
[data-theme="light"] .panel.active {
  border-radius: 12px;
}

[data-theme="void"] .stat-card,
[data-theme="void"] .kpi-card {
  border-radius: 6px;
}
[data-theme="light"] .stat-card,
[data-theme="light"] .kpi-card {
  border-radius: 10px;
}

[data-theme="void"] .chat-bubble,
[data-theme="light"] .chat-bubble {
  border-radius: 6px;
}

[data-theme="void"] .chat-send-btn,
[data-theme="light"] .chat-send-btn {
  border-radius: 4px;
}

/* ── Void iOS nav colors ── */
[data-theme="void"] .nav-group {
  background: rgba(0,212,255,0.06);
}
[data-theme="void"] .nav-group-label {
  color: rgba(0,212,255,0.5);
}
[data-theme="void"] .tab {
  color: #4a6080;
}
[data-theme="void"] .tab:hover { color: #c8d8e8; background: rgba(0,212,255,0.06); }
[data-theme="void"] .tab.active {
  background: rgba(0,212,255,0.14);
  color: #00d4ff;
  box-shadow: none;
}

/* ── Void-specific colors ── */
[data-theme="void"] body {
  background: #040810;
}

[data-theme="void"] .panel.active {
  background: rgba(13, 20, 40, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 212, 255, 0.08);
}

[data-theme="void"] #status-bar {
  background: rgba(14, 20, 32, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: rgba(0, 212, 255, 0.1);
}

[data-theme="void"] nav {
  background: rgba(8, 12, 20, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

[data-theme="void"] header {
  background: rgba(8, 12, 20, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom-color: rgba(0, 212, 255, 0.1);
  padding: 10px 20px;
  border-radius: 12px;
}

[data-theme="void"] .stat-card,
[data-theme="void"] .kpi-card {
  background: rgba(13, 20, 40, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 212, 255, 0.1);
}

[data-theme="void"] table th {
  background: rgba(10, 16, 30, 0.6);
}

[data-theme="void"] .approval-card,
[data-theme="void"] .campaign-detail,
[data-theme="void"] .caps-summary,
[data-theme="void"] .scenario,
[data-theme="void"] .repair-item,
[data-theme="void"] .suggest-box {
  background: rgba(13, 20, 40, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

[data-theme="void"] .kpi-card::before {
  background: var(--green-dim);
  box-shadow: 0 0 10px rgba(0,212,255,0.3);
}

[data-theme="void"] .chat-msg-row.outgoing .chat-bubble {
  background: #031824;
  color: #00d4ff;
  border-color: #0088aa;
}

[data-theme="void"] .chat-msg-row.incoming .chat-bubble {
  background: #131c2e;
  color: #c8d8e8;
}

[data-theme="void"] .chat-lead-item.selected {
  background: #031824;
  border-left-color: #00d4ff;
}

[data-theme="void"] .chat-reply-dot {
  background: #00d4ff;
  box-shadow: 0 0 5px rgba(0,212,255,0.8);
}

/* Theme toggle button */
#theme-toggle-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  transition: border-color 0.15s, color 0.15s;
}
#theme-toggle-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

/* ── Settings tab ── */
.settings-section {
  margin-bottom: 28px;
}

.settings-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.settings-theme-grid {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.settings-theme-card {
  width: 160px;
  border: 2px solid var(--border2);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  background: var(--surface2);
}

.settings-theme-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.settings-theme-card.active {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green), 0 4px 16px var(--green-glow);
}

.settings-theme-preview {
  height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  position: relative;
  overflow: hidden;
}

.matrix-preview  { background: #000; }
.void-preview    { background: #080c14; }
.light-preview   { background: linear-gradient(135deg, #c8d8ff 0%, #e8d8ff 50%, #c8f0e8 100%); }

.stc-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: block;
}
.matrix-preview .stc-dot  { background: #00ff41; box-shadow: 0 0 6px #00ff41; }
.void-preview .stc-dot    { background: #00d4ff; box-shadow: 0 0 6px #00d4ff; }
.light-preview .stc-dot   { background: #5b8def; }

.stc-line {
  height: 3px;
  border-radius: 2px;
  display: block;
  width: 80%;
}
.stc-line.short { width: 50%; }
.matrix-preview .stc-line  { background: rgba(0,255,65,0.4); }
.void-preview .stc-line    { background: rgba(0,212,255,0.3); }
.light-preview .stc-line   { background: rgba(91,141,239,0.35); }

.settings-theme-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  padding: 8px 12px 2px;
}

.settings-theme-desc {
  font-size: 11px;
  color: var(--text-dim);
  padding: 0 12px 10px;
}

/* Font size row */
.settings-font-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-font-label {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1;
  width: 14px;
  text-align: center;
}

.settings-font-label.large { font-size: 18px; }

.settings-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 200px;
  height: 4px;
  border-radius: 2px;
  background: var(--border2);
  outline: none;
  cursor: pointer;
}
.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green-glow);
  cursor: pointer;
  transition: transform 0.15s;
}
.settings-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* iOS overrides for settings */
[data-theme="void"] .settings-theme-card,
[data-theme="light"] .settings-theme-card {
  border-radius: 16px;
}
[data-theme="void"] .settings-theme-card.active {
  border-color: #00d4ff;
  box-shadow: 0 0 0 1px #00d4ff, 0 4px 20px rgba(0,212,255,0.2);
}
[data-theme="light"] .settings-theme-card {
  background: rgba(255,255,255,0.6);
  border-color: rgba(180,200,255,0.4);
  backdrop-filter: blur(12px);
}
[data-theme="light"] .settings-theme-card.active {
  border-color: #5b8def;
  box-shadow: 0 0 0 1px #5b8def, 0 4px 20px rgba(91,141,239,0.2);
}
[data-theme="light"] .settings-theme-name { color: #1a2340; }
[data-theme="light"] .settings-theme-desc { color: #6070a0; }
[data-theme="light"] .settings-section-label { color: #8faad8; }
[data-theme="light"] .settings-slider { background: rgba(180,200,255,0.4); }
[data-theme="light"] .settings-slider::-webkit-slider-thumb {
  background: #5b8def;
  box-shadow: 0 2px 8px rgba(91,141,239,0.3);
}
[data-theme="void"] .settings-slider::-webkit-slider-thumb {
  background: #00d4ff;
  box-shadow: 0 0 8px rgba(0,212,255,0.4);
}


/* ── Themed controls (inputs, selects, textareas) ── */
.ctrl {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 5px 9px;
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--mono);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.ctrl:focus { border-color: var(--green); }

.ctrl-dropdown {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
}

.ctrl-banner {
  background: var(--surface2);
  border: 1px solid var(--border2);
}

.active-convo-row { background: var(--green-dark); }
.active-convo-row:hover td { background: transparent !important; }

/* ══════════════════════════════════════════════
   LIGHT THEME — Clean Apple macOS
══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

[data-theme="light"] {
  --green:       #5b8def;
  --green-dim:   #3b6dcc;
  --green-dark:  #dce8ff;
  --green-glow:  rgba(91,141,239,0.18);
  --green-glow2: rgba(91,141,239,0.07);
  --black:       #f0f4ff;
  --surface:     rgba(255,255,255,0.55);
  --surface2:    rgba(255,255,255,0.40);
  --border:      rgba(180,200,255,0.35);
  --border2:     rgba(160,185,240,0.45);
  --muted:       #8faad8;
  --text:        #1a2340;
  --text-dim:    #6070a0;
  --text-bright: #0d1525;
  --red:         #e8345a;
  --red-dim:     #fde8ed;
  --amber:       #d97706;
  --amber-dim:   #fef3c7;
  --blue:        #5b8def;
  --mono:        'Inter', 'SF Pro Text', system-ui, sans-serif;
  --title:       'Inter', 'SF Pro Display', system-ui, sans-serif;
  --card:        #ffffff;
  --accent:      #5b8def;
  --accent-blue: #5b8def;
}

[data-theme="light"] body {
  background: #f5f5f7;
  color: var(--text);
}

[data-theme="light"] header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 10px 20px;
  border-radius: 12px;
}

[data-theme="light"] header h1 {
  color: #1a2340;
  text-shadow: none;
}

[data-theme="light"] #status-bar {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

[data-theme="light"] nav {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

[data-theme="light"] .panel.active {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

[data-theme="light"] .stat-card,
[data-theme="light"] .kpi-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

[data-theme="light"] .kpi-card::before {
  background: var(--green-dim);
  box-shadow: none;
}

[data-theme="light"] .stat-value { color: #1a2340; }
[data-theme="light"] .stat-label { color: #6070a0; }

[data-theme="light"] .nav-group {
  background: rgba(91,141,239,0.08);
}

[data-theme="light"] .nav-group-label {
  color: #8faad8;
}

[data-theme="light"] .tab {
  color: #6070a0;
}

[data-theme="light"] .tab:hover { color: #3b4f7a; background: rgba(91,141,239,0.08); }

[data-theme="light"] .tab.active {
  background: rgba(255,255,255,0.85);
  color: #5b8def;
  box-shadow: 0 1px 4px rgba(91,141,239,0.15);
}

[data-theme="light"] .nav-group-label {
  color: #8faad8;
}

[data-theme="light"] h2 {
  color: #1a2340;
}

[data-theme="light"] h3 {
  color: #3b4f7a;
}

[data-theme="light"] th {
  color: #6b7280;
  background: #f9fafb;
}

[data-theme="light"] td {
  color: #1a2340;
  border-bottom-color: #e5e7eb;
}

[data-theme="light"] tr:hover td { background: #f9fafb; }

[data-theme="light"] .btn {
  font-weight: 500;
}

[data-theme="light"] .btn-green {
  background: #5b8def;
  color: #fff;
  border-color: #5b8def;
}

[data-theme="light"] .btn-green:hover {
  background: #3b6dcc;
  border-color: #3b6dcc;
}

[data-theme="light"] .btn-outline {
  color: #5b8def;
  border-color: rgba(91,141,239,0.4);
  background: rgba(91,141,239,0.06);
}

[data-theme="light"] .btn-outline:hover {
  background: rgba(91,141,239,0.12);
  border-color: #5b8def;
}

[data-theme="light"] .badge {
  border-radius: 6px;
  font-family: 'Inter', system-ui, sans-serif;
}

[data-theme="light"] .badge-green { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
[data-theme="light"] .badge-red   { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
[data-theme="light"] .badge-amber { background: #fef3c7; color: #92400e; border-color: #fde68a; }
[data-theme="light"] .badge-blue  { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
[data-theme="light"] .badge-gray  { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

[data-theme="light"] .approval-card,
[data-theme="light"] .campaign-detail,
[data-theme="light"] .caps-summary,
[data-theme="light"] .scenario,
[data-theme="light"] .repair-item,
[data-theme="light"] .suggest-box {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

[data-theme="light"] #logout-btn {
  border-color: rgba(180,200,255,0.5);
  color: #6070a0;
  border-radius: 8px;
}

[data-theme="light"] #logout-btn:hover { color: #e8345a; border-color: #e8345a; }

[data-theme="light"] #theme-toggle-btn {
  border-color: rgba(180,200,255,0.5);
  color: #6070a0;
  border-radius: 8px;
}

[data-theme="light"] #theme-toggle-btn:hover {
  border-color: #5b8def;
  color: #5b8def;
}

/* ── Chat (light) ── */
[data-theme="light"] .chat-layout {
  border: 1px solid rgba(200,215,255,0.45);
  border-radius: 16px;
  overflow: hidden;
}

[data-theme="light"] .chat-sidebar {
  background: #f9fafb;
  border-right: 1px solid #e5e7eb;
}

[data-theme="light"] .chat-pane { background: #ffffff; }

[data-theme="light"] .chat-pane-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  color: #1a2340;
}

[data-theme="light"] .chat-lead-item:hover { background: rgba(91,141,239,0.06); }
[data-theme="light"] .chat-lead-item.selected {
  background: rgba(91,141,239,0.10);
  border-left-color: #5b8def;
}

[data-theme="light"] .chat-lead-name { color: #1a2340; }
[data-theme="light"] .chat-lead-meta { color: #8faad8; }
[data-theme="light"] .chat-lead-empty { color: #8faad8; }

[data-theme="light"] .chat-msg-row.outgoing .chat-bubble {
  background: #5b8def;
  color: #fff;
  border-bottom-right-radius: 4px;
}

[data-theme="light"] .chat-msg-row.incoming .chat-bubble {
  background: #f3f4f6;
  color: #1a2340;
  border: none;
  border-bottom-left-radius: 4px;
}

[data-theme="light"] .chat-compose {
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
}

[data-theme="light"] .chat-input {
  background: #f3f4f6;
  border: 1px solid transparent;
  color: #1a2340;
  border-radius: 20px;
}
[data-theme="light"] .chat-input:focus {
  background: #ffffff;
  border-color: #5b8def;
}
[data-theme="light"] .chat-send-btn { background: #5b8def; }
[data-theme="light"] .chat-send-btn:hover { background: #3b6dcc; }

/* Login (light) */
[data-theme="light"] #login-screen h1 {
  font-family: 'Inter', system-ui, sans-serif;
  color: #1a2340;
  text-shadow: none;
  animation: none;
}

[data-theme="light"] #login-screen input {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #1a2340;
  border-radius: 10px;
}

[data-theme="light"] #login-screen input:focus {
  border-color: #5b8def;
  box-shadow: 0 0 0 3px rgba(91,141,239,0.15);
}

[data-theme="light"] #login-screen button {
  background: #5b8def;
  color: #fff;
  border: none;
  border-radius: 12px;
}

[data-theme="light"] #login-screen button:hover {
  background: #3b6dcc;
  box-shadow: 0 4px 16px rgba(91,141,239,0.3);
}

/* Scrollbars (light) */
[data-theme="light"] ::-webkit-scrollbar-track { background: rgba(240,244,255,0.5); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(91,141,239,0.25); border-radius: 3px; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(91,141,239,0.4); }

/* Toggle switch (light) */
[data-theme="light"] .toggle-slider { background: #cbd5e1; }
[data-theme="light"] input:checked + .toggle-slider { background: #5b8def; }

/* Collapsible (light) */
[data-theme="light"] .collapsible-header { color: #3b4f7a; border-color: rgba(180,200,255,0.35); }
[data-theme="light"] .collapsible-body { border-color: rgba(180,200,255,0.25); }

/* Result messages (light) */
[data-theme="light"] .result-msg { border-radius: 8px; }
[data-theme="light"] .result-ok  { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
[data-theme="light"] .result-err { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* Themed controls (light) */
[data-theme="light"] .ctrl {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #1a2340;
  border-radius: 8px;
  font-family: 'Inter', system-ui, sans-serif;
}
[data-theme="light"] .ctrl:focus { border-color: #5b8def; box-shadow: 0 0 0 3px rgba(91,141,239,0.12); }

[data-theme="light"] .ctrl-dropdown {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #1a2340;
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}

[data-theme="light"] .ctrl-banner {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
}

[data-theme="light"] .active-convo-row { background: rgba(91,141,239,0.07); }
[data-theme="light"] .active-convo-row td { color: #1a2340; }

/* code blocks (light) */
[data-theme="light"] code {
  background: rgba(230,238,255,0.7);
  color: #3b4f7a;
  border-radius: 4px;
  padding: 2px 4px;
}

/* form labels (light) */
[data-theme="light"] label { color: #6070a0; }
[data-theme="light"] p { color: #6070a0; }

/* textarea (light) */
[data-theme="light"] textarea {
  background: #ffffff;
  border-color: #d1d5db;
  color: #1a2340;
  border-radius: 8px;
}

/* select option background in light (browser controlled, best effort) */
[data-theme="light"] select option {
  background: #ffffff;
  color: #1a2340;
}

/* ── Report tab ── */
.report-campaign-block {
  margin-bottom: 32px;
}
.report-campaign-header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border2);
}
.report-campaign-id {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 0.02em;
}
/* Funnel stats grid above lead table */
.report-funnel-grid {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.report-funnel-col {
  flex: 1;
  min-width: 80px;
  padding: 8px 10px;
  border-right: 1px solid var(--border);
  text-align: center;
}
.report-funnel-col:last-child { border-right: none; }
.report-funnel-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.report-funnel-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1;
}
.report-funnel-pct {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
}
.report-funnel-q {
  font-size: 11px;
  font-weight: 400;
  color: var(--yellow, #f59e0b);
}
.report-funnel-active { color: var(--green) !important; }
.report-funnel-stopped { color: var(--red) !important; }
/* Utility classes replacing inline CSS-var styles */
.report-dim-cell { color: var(--text-dim); }
.report-lead-link { color: var(--green); text-decoration: none; }
.report-lead-link:hover { text-decoration: underline; }
.report-dim { color: var(--text-dim); }
.report-error { color: var(--red); }
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.report-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border2);
  color: var(--text-dim);
  background: var(--surface2);
}
.report-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.report-table tr:last-child td { border-bottom: none; }
.report-table tr:hover td { background: var(--surface2); }

[data-theme="light"] .report-campaign-header { border-bottom-color: #e5e7eb; }
[data-theme="light"] .report-funnel-grid { border-color: #e5e7eb; background: #fff; }
[data-theme="light"] .report-funnel-col { border-right-color: #e5e7eb; }
[data-theme="light"] .report-funnel-value { color: #111; }
[data-theme="light"] .report-funnel-active { color: #16a34a !important; }
[data-theme="light"] .report-funnel-stopped { color: #dc2626 !important; }
[data-theme="light"] .report-dim-cell { color: #6b7280; }
[data-theme="light"] .report-lead-link { color: #2563eb; }
[data-theme="light"] .report-table th { background: #f9fafb; border-bottom-color: #e5e7eb; }
[data-theme="light"] .report-table td { border-bottom-color: #f3f4f6; }
[data-theme="light"] .report-table tr:hover td { background: #f9fafb; }

/* ── Wizard UI ─────────────────────────────────────────── */
.wizard-step { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; background: var(--surface2); margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .form-group { margin: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.check-grid label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.summary-box { border: 1px dashed var(--border); border-radius: 8px; padding: 12px; background: var(--surface); font-size: 12px; color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; }

@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
}


/* Code Reviews Overhaul */
.cr-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.cr-stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  min-height: 110px;
}
.cr-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 6px;
}
.cr-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.cr-stat-help {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}
.cr-tone-warn { border-color: rgba(255,170,0,0.45); box-shadow: inset 0 0 0 1px rgba(255,170,0,0.08); }
.cr-tone-danger { border-color: rgba(255,68,68,0.45); box-shadow: inset 0 0 0 1px rgba(255,68,68,0.08); }
.cr-tone-good { border-color: rgba(0,255,65,0.35); box-shadow: inset 0 0 0 1px rgba(0,255,65,0.08); }
.cr-banner {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid var(--border);
  background: var(--surface2);
}
.cr-banner-ok { border-color: rgba(0,255,65,0.35); color: var(--text); }
.cr-banner-warn { border-color: rgba(255,170,0,0.45); color: #ffd27a; }
.cr-banner-danger { border-color: rgba(255,68,68,0.45); color: #ffb0b0; }
.cr-grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.cr-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface2);
}
.cr-card-accent {
  border-color: rgba(255,170,0,0.35);
  box-shadow: inset 0 0 0 1px rgba(255,170,0,0.06);
}
.cr-warning {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
}
.cr-warning-safe {
  background: rgba(0,204,255,0.07);
  border: 1px solid rgba(0,204,255,0.24);
  color: #9cecff;
}
.cr-warning-danger {
  background: rgba(255,170,0,0.08);
  border: 1px solid rgba(255,170,0,0.28);
  color: #ffd27a;
}
.cr-flow-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.cr-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border);
}
.cr-pill-safe {
  border-color: rgba(0,255,65,0.35);
  color: #afffb0;
}
.cr-pill-warn {
  border-color: rgba(255,170,0,0.35);
  color: #ffd27a;
}
.cr-muted {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}
.cr-run-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 12px;
  background: var(--surface2);
}
.cr-run-card.is-live {
  border-color: rgba(0,204,255,0.35);
  box-shadow: inset 0 0 0 1px rgba(0,204,255,0.06);
}
.cr-run-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Lead Profile Drawer ── */
#lead-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#lead-drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}
#lead-drawer {
  position: fixed;
  top: 0; right: 0;
  width: 540px;
  max-width: 95vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border2);
  z-index: 901;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
#lead-drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border2);
  flex-shrink: 0;
  background: var(--surface2);
}
.drawer-title {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-close {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text-dim);
  width: 28px; height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.drawer-close:hover { color: var(--red); border-color: var(--red); }

.drawer-meta {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
  background: var(--surface2);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
}

.drawer-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.drawer-section-label:first-child { margin-top: 0; }

.drawer-compose {
  padding: 12px 18px;
  border-top: 1px solid var(--border2);
  background: var(--surface2);
  flex-shrink: 0;
}

.drawer-timeline-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.drawer-timeline-row:last-child { border-bottom: none; }
.dtl-time { color: var(--text-dim); white-space: nowrap; min-width: 100px; font-size: 11px; }
.dtl-type { min-width: 90px; }
.dtl-msg { flex: 1; color: var(--text); line-height: 1.5; word-break: break-word; }

/* Light theme drawer */
[data-theme="light"] #lead-drawer {
  background: #f5f5f7;
  border-left-color: #e5e7eb;
}
[data-theme="light"] .drawer-header,
[data-theme="light"] .drawer-meta,
[data-theme="light"] .drawer-compose { background: #ffffff; border-color: #e5e7eb; }
[data-theme="light"] .drawer-section-label { color: #6070a0; border-bottom-color: #e5e7eb; }
[data-theme="light"] .drawer-timeline-row { border-bottom-color: #f3f4f6; }
[data-theme="light"] .dtl-time { color: #9ca3af; }

/* ── Job state cards ── */
.job-card {
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 10px;
  background: var(--surface2);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.job-card.state-running  { border-color: rgba(0,204,255,0.4); }
.job-card.state-done     { border-color: rgba(0,255,65,0.3); }
.job-card.state-failed   { border-color: rgba(255,68,68,0.4); }
.job-card.state-pending  { border-color: var(--border2); }

.job-state-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}
.job-state-dot.running { background: var(--blue); animation: pulse-dot 1.4s infinite; }
.job-state-dot.done    { background: var(--green); }
.job-state-dot.failed  { background: var(--red); }
.job-state-dot.pending { background: var(--amber); }

.job-card-body { flex: 1; min-width: 0; }
.job-card-title { font-size: 13px; font-weight: 600; color: var(--text-bright); margin-bottom: 3px; }
.job-card-meta  { font-size: 11px; color: var(--text-dim); margin-bottom: 6px; display: flex; gap: 12px; flex-wrap: wrap; }
.job-card-summary { font-size: 12px; color: var(--text); line-height: 1.5; }

/* Confirmation modal */
#confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 950;
  display: none;
  align-items: center;
  justify-content: center;
}
#confirm-modal-overlay.open { display: flex; }
#confirm-modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 24px 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
#confirm-modal h3 { margin: 0 0 10px; font-size: 15px; color: var(--text-bright); }
#confirm-modal p  { margin: 0 0 20px; font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

[data-theme="light"] #confirm-modal { background: #fff; border-color: #e5e7eb; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
[data-theme="light"] #confirm-modal h3 { color: #1a2340; }
[data-theme="light"] #confirm-modal p  { color: #6070a0; }

/* ── Campaign Cards ── */
.campaign-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.campaign-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.campaign-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--green);
  opacity: 0.5;
  transition: opacity 0.2s;
}
.campaign-card.is-paused::before { background: var(--red); }
.campaign-card.is-sim::before    { background: var(--amber); }
.campaign-card:hover { border-color: var(--border2); box-shadow: 0 4px 16px rgba(0,0,0,0.25); }
.campaign-card:hover::before { opacity: 1; }

.campaign-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}
.campaign-card-id {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
  flex: 1;
  line-height: 1.2;
}
.campaign-card-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.campaign-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.campaign-card-stat {
  text-align: center;
}
.campaign-card-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--green);
  line-height: 1.1;
}
.campaign-card-stat-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.campaign-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.campaign-card-actions .btn { font-size: 11px; padding: 4px 10px; }

[data-theme="light"] .campaign-card {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
[data-theme="light"] .campaign-card:hover {
  border-color: #5b8def;
  box-shadow: 0 4px 16px rgba(91,141,239,0.15);
}
[data-theme="light"] .campaign-card::before { background: #5b8def; }
[data-theme="light"] .campaign-card.is-paused::before { background: #e8345a; }
[data-theme="light"] .campaign-card.is-sim::before    { background: #d97706; }
[data-theme="light"] .campaign-card-stat-val { color: #5b8def; }

/* ── Activity Rail ── */
#activity-rail {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 320px;
  max-height: 70vh;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 0;
  pointer-events: none;
}

#activity-rail-toggle {
  pointer-events: all;
  align-self: flex-end;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text-dim);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-family: var(--mono);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s, color 0.15s;
  margin-bottom: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
#activity-rail-toggle:hover { border-color: var(--green); color: var(--green); }
#activity-rail-toggle .rail-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
#activity-rail-toggle .rail-dot.has-items { animation: pulse-dot 1.5s infinite; }

#activity-rail-panel {
  pointer-events: all;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 10px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.2s;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
#activity-rail-panel.open {
  max-height: 60vh;
  opacity: 1;
}

.rail-summary-grid {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rail-panel-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright);
  gap: 8px;
}
.rail-panel-header span { flex: 1; }

.rail-items {
  max-height: calc(60vh - 40px);
  overflow-y: auto;
}

.rail-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.rail-item:last-child { border-bottom: none; }
.rail-item:hover { background: var(--surface2); }
.rail-item-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.rail-item-body { flex: 1; min-width: 0; }
.rail-item-title { color: var(--text-bright); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-item-meta  { color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.rail-item-time  { color: var(--text-dim); font-size: 10px; flex-shrink: 0; text-align: right; }

.rail-empty { padding: 20px 14px; text-align: center; color: var(--text-dim); font-size: 12px; }

[data-theme="light"] #activity-rail-toggle {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  color: #6070a0;
}
[data-theme="light"] #activity-rail-toggle:hover { border-color: #5b8def; color: #5b8def; }
[data-theme="light"] #activity-rail-panel {
  background: #f5f5f7;
  border-color: #e5e7eb;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
[data-theme="light"] .rail-panel-header { background: #ffffff; border-bottom-color: #e5e7eb; }
[data-theme="light"] .rail-item:hover { background: #f9fafb; }
[data-theme="light"] .rail-item { border-bottom-color: #f3f4f6; }

@media (max-width: 760px) {
  #activity-rail {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: 10px;
    max-height: 60vh;
  }
  .rail-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .cr-overview-grid,
  .cr-grid-two {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .cr-overview-grid,
  .cr-grid-two {
    grid-template-columns: 1fr;
  }
  .cr-run-head {
    flex-direction: column;
  }
}
