:root {
  --bg: #0e1014;
  --bg-2: #151922;
  --bg-3: #1b212c;
  --line: #2a3140;
  --text: #f4f1ea;
  --muted: #9aa3b2;
  --accent: #7dffc3;
  --accent-ink: #0c1612;
  --spark: #c4ff4a;
  --warn: #ffbf47;
  --bad: #ff6b6b;
  --good: #7dff9a;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Instrument Sans", sans-serif;
  font-size: 13px;
  background:
    radial-gradient(900px 380px at 8% -12%, rgba(125, 255, 195, 0.08), transparent 52%),
    radial-gradient(700px 320px at 100% 0%, rgba(196, 255, 74, 0.05), transparent 45%),
    var(--bg);
  color: var(--text);
  letter-spacing: 0.01em;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
  z-index: 0;
}

.top, main, footer { position: relative; z-index: 1; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand { display: flex; gap: 8px; align-items: center; }
.mark { width: 24px; height: 24px; color: var(--accent); }
.brand strong { display: block; font-size: 14px; letter-spacing: 0.04em; }
.brand span { color: var(--muted); font-size: 11px; }

.tabs { display: flex; gap: 5px; flex-wrap: wrap; }
.tab, button, .file-btn { font: inherit; cursor: pointer; }
.tab {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}
.tab.on {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}

main { padding: 14px 18px; max-width: 980px; margin: 0 auto; }
.hidden { display: none !important; }

.view { animation: fade 0.15s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

#view-send {
  display: block;
  max-width: 640px;
}

.compose, .panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.status-box {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.channel {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.channel-btn {
  flex: 1;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-weight: 600;
  font-size: 12px;
}
.channel-btn.on {
  background: var(--spark);
  color: var(--accent-ink);
  border-color: var(--spark);
}

.phone-wrap { position: relative; }
#phone {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}
.phone-history {
  list-style: none;
  margin: 4px 0 0;
  padding: 4px;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 20;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow: auto;
}
.phone-history li button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 7px 9px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}
.phone-history li button:hover,
.phone-history li button:focus {
  background: rgba(125, 255, 195, 0.12);
  outline: none;
}
.phone-history .meta {
  color: var(--muted);
  font-family: "Instrument Sans", sans-serif;
  font-size: 11px;
}

.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 8px; }
.field span, legend {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.field em, legend {
  font-style: normal;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}
textarea, input, select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  width: 100%;
  font-size: 12px;
}
textarea {
  resize: vertical;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.4;
  min-height: 0;
}
input:focus, textarea:focus, select:focus {
  outline: 1px solid rgba(125, 255, 195, 0.4);
  border-color: var(--accent);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.file-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--muted);
}
.file-btn input { display: none; }

.hint { color: var(--muted); font-size: 11px; margin: 0; }
.lede { color: var(--muted); line-height: 1.4; font-size: 12px; margin: 0 0 8px; }

.lines-pick {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px;
  margin: 0 0 8px;
}
.panel-head.tight {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.panel-head.tight .kicker { margin: 0 0 2px; }
.panel-head.tight .hint { margin: 0; }
.panel-head.tight em {
  font-style: normal;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}
.from-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 8px;
  min-height: 28px;
}
.from-list label {
  display: flex;
  gap: 6px;
  align-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px 3px 6px;
}
.from-list input { width: auto; margin: 0; }
.from-list .lab { color: var(--muted); font-family: "Instrument Sans", sans-serif; font-size: 11px; }
.from-list .fake { opacity: 0.45; }
.from-add { gap: 6px; }
.from-add input { flex: 1; min-width: 0; }
.from-add .ghost { flex-shrink: 0; }

.consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 8px;
}
.consent input { width: auto; margin-top: 2px; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.call-actions { margin-top: 4px; }
.call-actions .primary { min-width: 88px; }
.primary, .ghost, .danger {
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 12px;
  border: 1px solid transparent;
}
.primary { background: var(--accent); color: var(--accent-ink); }
.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.danger { background: var(--bad); color: #1a0b0b; }
.primary:disabled, .danger:disabled, .ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.status { min-height: 1.2em; font-size: 11px; color: var(--muted); margin: 8px 0 0; }
.status.bad { color: var(--bad); }
.status.good { color: var(--good); }

.run-banner {
  margin-top: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: var(--bg);
}
.run-banner strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}
.run-banner p { margin: 0; color: var(--muted); font-size: 12px; }
.run-banner.idle { border-color: var(--line); }
.run-banner.pending {
  border-color: rgba(255, 191, 71, 0.55);
  background: rgba(255, 191, 71, 0.08);
}
.run-banner.pending strong { color: var(--warn); }
.run-banner.good {
  border-color: rgba(125, 255, 154, 0.45);
  background: rgba(125, 255, 154, 0.08);
}
.run-banner.good strong { color: var(--good); }
.run-banner.bad {
  border-color: rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.08);
}
.run-banner.bad strong { color: var(--bad); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(6, 8, 12, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-card {
  width: min(560px, 100%);
  max-height: min(70vh, 640px);
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.modal-head h2 { margin: 0; font-size: 16px; }

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  color: var(--accent);
  margin: 0 0 4px;
}
.panel h2 { margin: 0 0 10px; font-size: 16px; }

.progress { margin-top: 10px; }
.bar {
  height: 6px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.bar span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--spark));
  transition: width 0.45s ease;
}
/* Dialing: sliding bar from the start */
.bar.dialing span {
  width: 36% !important;
  transition: none;
  animation: dial-slide 1.1s ease-in-out infinite;
}
/* Pickup: fill the bar all the way across */
.bar.pickup span {
  width: 100% !important;
  animation: none;
  transition: width 0.55s ease;
  background: linear-gradient(90deg, var(--good), var(--accent));
}
.bar.failed span {
  width: 18% !important;
  animation: none;
  background: var(--bad);
  transition: width 0.25s ease;
}
.bar.ended span {
  width: 100% !important;
  animation: none;
  opacity: 0.45;
  transition: width 0.3s ease, opacity 0.3s ease;
}
@keyframes dial-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
#progress-text { font-size: 11px; color: var(--muted); margin: 6px 0 0; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.panel-head h2 { margin: 0; }
.panel-head.tight { margin-bottom: 6px; align-items: center; }
.panel-head.tight .subhead { margin: 0; }
.add-line {
  display: grid;
  grid-template-columns: 1.1fr 1fr auto;
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
}
.narrow { max-width: 480px; }
.subhead { margin: 16px 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.split {
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(0, 1.25fr);
  gap: 12px;
  margin-top: 10px;
}
.primary-file {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
}
.pill.scheduled { color: #5eead4; border-color: rgba(94, 234, 212, 0.4); }

.table { overflow: auto; }
.table table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th, .table td {
  text-align: left;
  padding: 6px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th { color: var(--muted); font-weight: 500; font-size: 11px; }
.table .mono { font-family: "IBM Plex Mono", monospace; font-size: 11px; }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
  border: 1px solid var(--line);
}
.pill.on { color: var(--good); border-color: rgba(125, 255, 154, 0.4); }
.pill.off { color: var(--muted); }
.pill.done, .pill.sent { color: var(--good); }
.pill.failed, .pill.partial { color: var(--bad); }
.pill.running, .pill.queued { color: var(--warn); }
.tiny {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
}

footer {
  padding: 4px 18px 16px;
  color: var(--muted);
  font-size: 11px;
  max-width: 980px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .grid-2, .add-line, .split { grid-template-columns: 1fr; }
  .top { padding: 10px 12px; }
  main { padding: 10px 12px; }
}
