* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: #1e293b; border-bottom: 1px solid #334155;
}
.topbar h1 { margin: 0; font-size: 18px; }
.topbar-meta { display: flex; gap: 8px; align-items: center; }
.pill { padding: 2px 10px; border-radius: 999px; background: #16a34a; color: white; font-size: 12px; }
.pill.error { background: #dc2626; }
.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 16px;
  align-items: start;
}
.panel {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 16px;
}
.panel h2 { margin: 0 0 12px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; }
.panel-wide { grid-column: 1 / -1; }

label { display: flex; flex-direction: column; font-size: 13px; margin: 8px 0; gap: 4px; flex: 1; }
input {
  background: #0f172a; color: #e2e8f0;
  border: 1px solid #334155; border-radius: 4px;
  padding: 6px 8px; font-size: 13px;
}
input:focus { outline: 2px solid #38bdf8; outline-offset: -1px; border-color: #38bdf8; }
.row { display: flex; gap: 8px; }
.row label { flex: 1; }
.hint { font-size: 12px; color: #94a3b8; margin: 8px 0 0; }

.scenario {
  border-top: 1px solid #334155;
  padding-top: 12px;
  margin-top: 12px;
}
.scenario:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.scenario h3 { margin: 0 0 8px; font-size: 14px; color: #e2e8f0; }
.muted { color: #94a3b8; font-weight: normal; font-size: 12px; }

.btn {
  background: #334155; color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 4px; padding: 6px 12px;
  font-size: 13px; cursor: pointer;
  margin-top: 8px;
}
.btn:hover { background: #475569; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: transparent; border: 1px solid #475569; }

.event-list { max-height: 540px; overflow-y: auto; }
.empty { padding: 24px; text-align: center; color: #64748b; }
.event {
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #0f172a;
}
.event-header { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.event-dir { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; }
.event-dir.out { background: #1d4ed8; color: white; }
.event-dir.in { background: #ca8a04; color: white; }
.event-status { padding: 2px 8px; border-radius: 4px; font-size: 11px; background: #16a34a; color: white; }
.event-status.error { background: #dc2626; }
.event-time { color: #64748b; font-size: 11px; margin-left: auto; }
.event-label { font-weight: 600; }
.event-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: #94a3b8; word-break: break-all; }
.event-body { margin-top: 6px; }
.event-body pre {
  margin: 0; padding: 8px;
  background: #020617;
  border-radius: 4px;
  font-size: 11px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.event-body summary { cursor: pointer; font-size: 11px; color: #94a3b8; }
code { background: #020617; padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* === Автообзвоны === */
.batches { display: flex; flex-direction: column; gap: 10px; }
.batch {
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 10px 12px;
  background: #0f172a;
}
.batch-header { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 6px; flex-wrap: wrap; }
.batch-state { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.state-running { background: #ca8a04; color: white; }
.state-done { background: #16a34a; color: white; }
.state-cancelled { background: #64748b; color: white; }
.batch-progress {
  height: 6px; border-radius: 3px; background: #1e293b; overflow: hidden;
}
.batch-progress-bar {
  height: 100%; background: linear-gradient(90deg, #2563eb, #38bdf8); transition: width 0.3s;
}
.batch-items { margin-top: 6px; }
.batch-items summary { cursor: pointer; font-size: 11px; color: #94a3b8; }
.batch-item { font-size: 11px; padding: 2px 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.status-completed_confirmed { color: #22c55e; font-weight: 600; }
.status-completed_cancelled  { color: #ef4444; font-weight: 600; }
.status-no_answer { color: #94a3b8; }
.status-busy      { color: #f59e0b; }
.status-hangup    { color: #a78bfa; }

select {
  background: #0f172a; color: #e2e8f0;
  border: 1px solid #334155; border-radius: 4px;
  padding: 6px 8px; font-size: 13px;
}
select:focus { outline: 2px solid #38bdf8; outline-offset: -1px; }
