:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f8f9fb;
  --border: #e5e7eb;
  --text: #17191c;
  --muted: #717680;
  --primary: #17191c;
  --primary-contrast: #ffffff;
  --success-bg: #eaf8f0;
  --success: #247a4b;
  --plus-bg: #f0edff;
  --plus: #6654c7;
  --selected: #f2f5ff;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.topbar > div {
  max-width: 1080px;
  margin: auto;
  min-height: 76px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--text);
  color: white;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.contacts-main {
  width: min(1080px, calc(100% - 32px));
  margin: 24px auto 120px;
}

.search-panel {
  margin-bottom: 18px;
}

.search-box {
  height: 50px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.search-box span {
  font-size: 23px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.filters {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter {
  white-space: nowrap;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.filter.active {
  border-color: var(--text);
  background: var(--text);
  color: white;
}

.contacts-list {
  display: grid;
  gap: 8px;
}

.contact-card {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: 120ms ease;
}

.contact-card:hover {
  border-color: #cfd3d9;
}

.contact-card.selected {
  background: var(--selected);
  border-color: #bbc6ed;
}

.check-wrapper {
  flex: 0 0 auto;
}

.check-wrapper input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}

.contact-content {
  min-width: 0;
  flex: 1;
}

.contact-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.contact-header strong {
  font-size: 14px;
}

.contact-details {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  color: var(--muted);
  font-size: 13px;
}

.contact-email {
  overflow: hidden;
  text-overflow: ellipsis;
}

.muted {
  color: #9a9ea6;
}

.badge {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.badge.verified {
  background: var(--success-bg);
  color: var(--success);
}

.badge.plus {
  background: var(--plus-bg);
  color: var(--plus);
}

.state-box {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.pagination {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  color: var(--muted);
  font-size: 13px;
}

.pagination button {
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}

.pagination button:disabled {
  opacity: .4;
  cursor: default;
}

.selection-bar {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(620px, calc(100% - 28px));
  padding: 12px 12px 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #33373d;
  border-radius: 16px;
  background: #17191c;
  color: white;
  box-shadow: 0 16px 45px rgba(0, 0, 0, .22);
}

.selection-bar div {
  display: flex;
  gap: 5px;
  font-size: 13px;
}

.selection-bar button {
  border: 0;
  border-radius: 10px;
  padding: 10px 15px;
  background: white;
  color: #17191c;
  font-weight: 700;
}

@media (max-width: 600px) {
  .topbar > div {
    min-height: 68px;
    padding: 12px 16px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .contacts-main {
    width: calc(100% - 24px);
    margin-top: 14px;
  }

  .contact-card {
    padding: 12px;
    border-radius: 14px;
  }

  .avatar {
    width: 40px;
    height: 40px;
  }

  .contact-details {
    flex-direction: column;
    gap: 3px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f11;
    --surface: #17191c;
    --surface-soft: #202328;
    --border: #292d32;
    --text: #f4f5f6;
    --muted: #9499a2;
    --primary: #f4f5f6;
    --primary-contrast: #17191c;
    --selected: #202633;
  }

  .topbar {
    background: rgba(23, 25, 28, .94);
  }

  .brand-mark {
    background: white;
    color: #17191c;
  }

  .filter.active {
    background: white;
    color: #17191c;
    border-color: white;
  }
}

/* Campaign send confirmation */

.send-confirmation {
  width: min(440px, calc(100% - 32px));
  margin: auto;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .24);
  text-align: center;
}

.send-confirmation-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--text);
  color: var(--surface);
  font-size: 24px;
  font-weight: 700;
}

.send-confirmation h2 {
  margin: 0;
  font-size: 20px;
}

.send-confirmation > p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.send-confirmation-warning {
  margin-top: 22px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.send-confirmation-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.send-confirmation-actions button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
}

@media (max-width: 600px) {
  .send-confirmation {
    padding: 24px 20px 20px;
  }

  .send-confirmation-actions {
    flex-direction: column-reverse;
  }

  .send-confirmation-actions button {
    width: 100%;
  }
}

/* SMS delivery method */

.delivery-method-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.delivery-option {
  min-height: 72px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.delivery-option strong,
.delivery-option span {
  display: block;
}

.delivery-option strong {
  font-size: 13px;
}

.delivery-option span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.delivery-option.active {
  border-color: var(--text);
  box-shadow: inset 0 0 0 1px var(--text);
}

@media (max-width: 600px) {
  .delivery-method-selector {
    grid-template-columns: 1fr;
  }
}
