:root {
  --bg-a: #eaf8f2;
  --bg-b: #d5e6f9;
  --ink: #17212d;
  --muted: #536579;
  --line: #c8d8ea;
  --card: #ffffff;
  --brand: #1254a1;
  --brand-2: #1e8f63;
  --warn: #8a3e00;
  --ok: #0f6b41;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Manrope, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 12% 8%, var(--bg-a), transparent 40%),
              radial-gradient(circle at 86% 90%, #fff2d4, transparent 46%),
              var(--bg-b);
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(20, 58, 102, 0.06) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(20, 58, 102, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at 50% 40%, black 40%, transparent 90%);
}

.wrap {
  width: min(980px, 92vw);
  margin: 48px auto;
  display: grid;
  gap: 18px;
}

.card {
  background: color-mix(in srgb, var(--card) 92%, #f0f7ff 8%);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px -35px rgba(8, 25, 43, 0.45);
  backdrop-filter: blur(6px);
  animation: rise 500ms ease forwards;
}

.hero {
  padding: 30px;
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 13px;
}

h1 {
  margin: 10px 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 74ch;
}

.form-card {
  padding: 22px;
}

form {
  display: grid;
  gap: 14px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: 1fr 1fr;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: #33465a;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid #bdd0e4;
  border-radius: 12px;
  padding: 12px 13px;
  font: inherit;
  color: #1b2530;
  background: #f9fcff;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

input:focus {
  outline: none;
  border-color: #3a79c0;
  box-shadow: 0 0 0 4px rgba(58, 121, 192, 0.16);
}

button {
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 13px 22px;
  font: 800 15px/1 "Space Grotesk", sans-serif;
  letter-spacing: 0.02em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 24px -12px rgba(18, 84, 161, 0.8);
  transition: transform 140ms ease, filter 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

button:disabled {
  cursor: wait;
  filter: saturate(0.8) brightness(0.95);
}

.status {
  margin-top: 14px;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
}

.status.idle {
  background: #edf3fb;
  color: #2a4868;
}

.status.running {
  background: #fff7e6;
  color: var(--warn);
}

.status.ok {
  background: #ebfaf2;
  color: var(--ok);
}

.status.error {
  background: #fdeced;
  color: #9b2330;
}

.summary {
  margin-top: 12px;
  border: 1px dashed #b7c8db;
  border-radius: 12px;
  padding: 12px 14px;
  color: #223040;
  background: #f8fbff;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 12px;
}

.failed-list {
  max-height: 260px;
  overflow: auto;
  border: 1px solid #d9e4ef;
  border-radius: 10px;
  background: #ffffff;
}

.failed-item {
  padding: 10px 12px;
  border-bottom: 1px solid #edf2f7;
  color: #223040;
}

.failed-item:last-child {
  border-bottom: 0;
}

.failed-email {
  font-weight: 800;
}

.failed-error {
  color: #8a3e00;
  font-size: 13px;
  margin-top: 4px;
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(9, 18, 30, 0.52);
  backdrop-filter: blur(2px);
}

.modal.hidden {
  display: none !important;
}

.modal-card {
  width: min(480px, 92vw);
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #c6d8eb;
  box-shadow: 0 24px 70px -28px rgba(8, 25, 43, 0.6);
  padding: 24px;
  text-align: center;
}

.modal-card h2 {
  margin: 8px 0;
  font-family: "Space Grotesk", sans-serif;
}

.modal-card p {
  margin: 6px 0;
}

.spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin: 0 auto 10px;
  border: 4px solid #c8ddf2;
  border-top-color: #1a6bc2;
  animation: spin 820ms linear infinite;
}

.modal-warnings {
  margin-top: 12px;
  text-align: left;
  border: 1px solid #f1ca8d;
  border-radius: 10px;
  background: #fff7e8;
  color: #8a4c00;
  padding: 10px 12px;
  font-size: 13px;
}

.ghost-btn {
  margin-top: 14px;
  border: 1px solid #bfd1e5;
  background: #f7fbff;
  color: #1f405f;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}

.config-card {
  margin-top: 6px;
  border: 1px solid #d3e0ee;
  background: #f7fbff;
  border-radius: 12px;
  padding: 12px;
}

.config-title {
  margin: 0 0 8px;
  color: #294c6d;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .wrap {
    margin: 24px auto;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .hero,
  .form-card {
    padding: 18px;
  }
}
