:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --success: #3ecf8e;
  --warn: #f0c14a;
  --danger: #f87171;
  --font: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.hero h1 {
  font-size: 1.65rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.sub {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.75rem 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
}

.card h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.65rem;
  font-weight: 600;
}

.state-pill {
  display: inline-block;
  margin: 0;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--border);
}

.state-pill.idle {
  background: #334155;
  color: #cbd5e1;
}

.state-pill.active {
  background: rgba(62, 207, 142, 0.2);
  color: var(--success);
}

.state-pill.sending_dm {
  background: rgba(61, 139, 253, 0.25);
  color: #93c5fd;
  animation: pulse 1.4s ease-in-out infinite;
}

.state-pill.disabled {
  background: #422006;
  color: var(--warn);
}

.state-pill.batch_pause {
  background: rgba(240, 193, 74, 0.2);
  color: var(--warn);
}

.run-mode {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.65rem;
  color: var(--text);
}

@keyframes pulse {
  50% {
    opacity: 0.85;
  }
}

.big-num {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.label-k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0.65rem 0 0.2rem;
}

.label-k:first-of-type {
  margin-top: 0;
}

.last-line {
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
  word-break: break-all;
}

.when-line {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 500;
}

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

.small {
  font-size: 0.85rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.5rem;
}

.settings-grid {
  display: grid;
  gap: 1rem;
  margin-top: 0.75rem;
}

@media (min-width: 640px) {
  .settings-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
}

.field span {
  color: var(--muted);
  font-weight: 500;
}

.field input {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

.panel h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

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

th {
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  font-weight: 600;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.editor textarea {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  background: #0d1117;
  color: #e6edf3;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
}

.actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.secondary {
  background: var(--border);
  color: var(--text);
}

.btn.secondary:hover {
  filter: brightness(1.12);
}

.msg {
  min-height: 1.4rem;
  margin: 0.6rem 0 0;
  font-size: 0.88rem;
}

.msg.ok {
  color: var(--success);
}

.msg.err {
  color: var(--danger);
}

code {
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
