:root {
  color-scheme: dark;
  --bg: #0b1210;
  --card: #121b18;
  --card-2: #17221f;
  --line: #22302c;
  --text: #e7f0ec;
  --muted: #8ba39a;
  --accent: #25d366;
  --accent-dim: #128c7e;
  --danger: #ef5b5b;
  --warn: #e0a33e;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #16302a 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.02em; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1rem; margin-bottom: 14px; }

.muted { color: var(--muted); }
.small { font-size: 0.8rem; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 16, 0.7);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent), var(--accent-dim));
  color: #04231a; font-size: 1.3rem; font-weight: 700;
}
.brand p { margin: 2px 0 0; }

.status-wrap { display: flex; align-items: center; gap: 10px; }

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill-off { background: #2a1d1d; color: #f0a3a3; border-color: #4a2a2a; }
.pill-on { background: #10291e; color: #6ff0a8; border-color: #1e5c3d; }

.layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 20px;
  align-items: start;
}

.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.list-card { grid-column: 1 / -1; }

label { display: block; margin-bottom: 14px; }
label > span { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
label > small { display: block; margin-top: 4px; text-align: right; }

input, textarea {
  width: 100%;
  background: #0e1714;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.12);
}
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }

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

.actions { display: flex; align-items: center; gap: 14px; }

button {
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #16211e;
  color: var(--text);
  padding: 10px 16px;
  transition: transform 0.06s, background 0.15s, border-color 0.15s;
}
button:hover { background: #1c2b27; }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  border-color: transparent;
  color: #04231a;
}
.primary:hover { background: linear-gradient(180deg, #2ee06f, #149e8d); }

.ghost { background: transparent; padding: 6px 12px; font-size: 0.8rem; }
.ghost:hover { background: #1a2723; }

.form-msg { font-size: 0.85rem; }
.form-msg.ok { color: var(--accent); }
.form-msg.err { color: var(--danger); }

.qr-box {
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin: 16px 0 12px;
  min-height: 220px;
}
.qr-box img { width: 100%; max-width: 260px; display: block; }

.list-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }

.task-list { display: flex; flex-direction: column; gap: 10px; }

.task {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f1816;
}
.task-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-name { font-weight: 650; }
.task-phone { color: var(--muted); font-size: 0.82rem; }
.task-body {
  grid-column: 1 / -1;
  color: #cfe0d8;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.task-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); }
.task-actions { display: flex; gap: 6px; align-items: start; }
.task-actions button { padding: 6px 10px; font-size: 0.76rem; }

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.pending { background: #1d2a3a; color: #9dc2ee; border-color: #2a3d55; }
.badge.sent { background: #10291e; color: #6ff0a8; border-color: #1e5c3d; }
.badge.failed, .badge.missed { background: #2a1d1d; color: #f0a3a3; border-color: #4a2a2a; }
.badge.sending { background: #2a2416; color: #edc579; border-color: #4a3d1e; }
.badge.cancelled, .badge.unknown { background: #212121; color: #9c9c9c; border-color: #333; }

.task-error { grid-column: 1 / -1; color: var(--danger); font-size: 0.78rem; }

.empty { color: var(--muted); font-size: 0.9rem; padding: 8px 2px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .row { grid-template-columns: 1fr; }
  .topbar { padding: 14px 16px; }
  .brand p { display: none; }
}
