:root {
  --purple: #5933e5;
  --purple-dark: #4520c7;
  --ink: #16141f;
  --muted: #667085;
  --line: #ece9f7;
  --bg: #f4f1fb;
  --card: #ffffff;
  --danger: #b42318;
  --ok: #0d7a4f;
  --ok-bg: #e8f6ef;
  --danger-bg: #fdecec;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Manrope, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.screen {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--purple);
  font-weight: 700;
}

h1 {
  margin: 2px 0 8px;
  font-size: 28px;
}

h2 {
  margin: 0;
  font-size: 18px;
}

.sub {
  color: var(--muted);
  margin: 0 0 20px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(89, 51, 229, 0.06);
}

.login-card {
  max-width: 420px;
  margin: 12vh auto 0;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  position: relative;
}

input,
textarea,
select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
}

input:focus,
textarea:focus {
  outline: 2px solid #d9d2f7;
  border-color: var(--purple);
}

.counter {
  position: absolute;
  right: 0;
  top: 0;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.btn {
  border: 0;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 12px 18px;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn.ghost {
  background: transparent;
  color: var(--purple);
  border: 1px solid #d9d2f7;
}

.link {
  background: none;
  border: 0;
  color: var(--purple);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sender {
  color: var(--muted);
  font-size: 13px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stats article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stats strong {
  font-size: 22px;
}

.error,
.banner {
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}

.compose-col {
  display: grid;
  gap: 16px;
}

.compose-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.search-label {
  margin-bottom: 8px;
}

.recipient-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
}

.recipient-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 420px;
  overflow: auto;
}

.recipient-list li {
  border-top: 1px solid var(--line);
}

.recipient-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 4px;
  font-weight: 500;
  cursor: pointer;
}

.recipient-list input {
  width: auto;
  margin: 0;
}

.recipient-email {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-block;
  background: #eee8ff;
  color: var(--purple);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

.target-fieldset {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px 6px;
  margin: 0 0 16px;
}

.target-fieldset legend {
  font-size: 13px;
  font-weight: 700;
  padding: 0 6px;
}

.radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin-bottom: 10px;
}

.radio input {
  width: auto;
  margin: 0;
}

.preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-label {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.phone {
  width: 280px;
  min-height: 180px;
  background: #1b1730;
  border-radius: 28px;
  padding: 22px 14px 16px;
  box-shadow: 0 16px 40px rgba(22, 20, 31, 0.25);
}

.phone-notch {
  width: 72px;
  height: 8px;
  background: #2d2844;
  border-radius: 999px;
  margin: 0 auto 16px;
}

.push-card {
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
}

.push-app {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.push-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
}

#preview-title {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

#preview-body {
  margin: 0;
  font-size: 13px;
  color: #3f3b52;
  white-space: pre-wrap;
}

.result {
  margin-top: 16px;
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
}

.result.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.result.fail {
  background: var(--danger-bg);
  color: var(--danger);
}

.result ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.history-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.history-list li {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.history-list strong {
  display: block;
}

.history-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(22, 20, 31, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
}

.modal-card p {
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 860px) {
  .layout,
  .stats,
  .compose-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .recipient-list {
    max-height: 240px;
  }
}
