.recipient-group { border: 1px solid var(--line); border-radius: 8px; margin-top: 16px; overflow: hidden; }
.recipient-group summary { padding: 12px; cursor: pointer; font-weight: 600; background: #f8fafc; }
.recipient-group summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.group-count { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 20px; background: #e4e7ec; font-size: 13px; }
.recipient-group .table-wrap { margin-top: 0; border: 0; border-radius: 0; max-height: 420px; }
.recipient-group table { min-width: 760px; }
.phone-cell, .sent-date { white-space: nowrap; }
.edit-dialog { width: min(440px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 12px; padding: 24px; color: var(--text); }
.edit-dialog::backdrop { background: rgba(15,23,42,.45); }
.edit-dialog label { display: grid; gap: 5px; margin: 12px 0; }
.edit-dialog input { width: 100%; min-height: 40px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
.edit-dialog input:focus { outline: 2px solid #ccfbf1; border-color: var(--accent); }
#editError { color: var(--danger); margin: 12px 0; }

:root {
  color-scheme: light;
  --bg: #eef2f5;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dee6;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --ok: #067647;
  --warn: #b54708;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 13px;
  cursor: pointer;
}

.button-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 13px;
  text-decoration: none;
}

button:hover {
  border-color: #98a2b3;
}

button:disabled {
  cursor: not-allowed;
  opacity: .6;
}

.file-drop.disabled,
.button-link.disabled {
  cursor: not-allowed;
  opacity: .6;
  pointer-events: none;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.shell {
  width: calc(100% - 32px);
  margin: 24px auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 700;
}

h2 {
  font-size: 18px;
  margin-bottom: 14px;
}

.topbar p,
.muted,
.hint {
  color: var(--muted);
}

.chrome-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.status {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.status.ok {
  color: var(--ok);
  border-color: #abefc6;
  background: #ecfdf3;
}

.status.bad {
  color: var(--danger);
  border-color: #fecdca;
  background: #fef3f2;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: 18px;
}

.grid.locked {
  opacity: .55;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
}

.composer {
  display: flex;
  flex-direction: column;
}

.file-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  border: 1px dashed #98a2b3;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  margin-bottom: 10px;
}

.file-drop input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.file-drop span {
  font-weight: 600;
}

.table-wrap {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: calc(100vh - 300px);
}

.list-actions .button-link {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.list-actions .button-link:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.list-actions #clearList {
  margin-left: auto;
}

.list-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 460px;
}

th,
td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
}

.composer textarea:focus {
  outline: 3px solid #ccfbf1;
  border-color: var(--accent);
}

.hint {
  margin-top: 8px;
  font-size: 13px;
}

.options {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.options label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.progress {
  margin-top: 18px;
}

.progress-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.bar {
  height: 10px;
  margin-top: 8px;
  border-radius: 999px;
  background: #e4e7ec;
  overflow: hidden;
}

.bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width .2s ease;
}

.log {
  margin-top: 16px;
  display: grid;
  gap: 7px;
  flex: 1 1 240px;
  min-height: 240px;
  overflow: auto;
}

.log-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
}

.log-item.ok {
  border-color: #abefc6;
}

.log-item.bad {
  border-color: #fecdca;
}

.log-phone {
  font-weight: 700;
}

.log-msg {
  color: var(--muted);
  margin-left: 6px;
}

.swal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .42);
}

.swal-modal {
  width: min(420px, 100%);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .26);
  padding: 24px;
  text-align: center;
}

.swal-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3px solid var(--accent);
}

.swal-icon.error {
  border-color: var(--danger);
}

.swal-icon.success {
  border-color: var(--ok);
}

.swal-icon.warning {
  border-color: var(--warn);
}

.swal-timer {
  height: 4px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e7ec;
}

.swal-timer span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
  animation: swalTimer linear forwards;
}

@keyframes swalTimer {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

.swal-modal h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.swal-modal p {
  color: var(--muted);
  white-space: pre-wrap;
}

.swal-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.swal-confirm {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.swal-cancel {
  background: #fff;
}

@media (max-width: 860px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .chrome-panel {
    justify-content: flex-start;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .shell {
    width: calc(100% - 20px);
    margin: 10px auto;
  }
}
