:root {
  color-scheme: light;
  --ink: #20313a;
  --muted: #68757b;
  --line: #d8e0e2;
  --paper: #ffffff;
  --mist: #eff6f6;
  --blue: #255f85;
  --green: #2f9f72;
  --gold: #f2a33a;
  --red: #ba3b3b;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f5fbfb 0%, #ffffff 58%);
  color: var(--ink);
}

.page-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.intro {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: end;
  padding: 10px 0 22px;
}

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

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(34px, 6vw, 64px);
  line-height: 0.98;
}

.lead {
  grid-column: 1 / 2;
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.contact-link,
.primary-link,
.secondary-link,
button {
  min-height: 48px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  font-weight: 800;
  text-decoration: none;
}

.contact-link,
.secondary-link {
  border: 1px solid var(--line);
  color: var(--blue);
  background: var(--paper);
}

.signup-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 55px rgba(32, 49, 58, 0.08);
}

.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 22px;
  background: var(--mist);
}

label span {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

select,
input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #c7d2d5;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 0 14px;
}

select:focus,
input:focus {
  outline: 3px solid rgba(47, 159, 114, 0.2);
  border-color: var(--green);
}

.groups-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 22px 22px 0;
}

.groups-header h2 {
  font-size: 22px;
}

#groupsCount {
  min-width: 42px;
  border-radius: 8px;
  padding: 6px 10px;
  text-align: center;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

.groups-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 18px 22px 22px;
  min-height: 96px;
}

.group-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  justify-content: flex-start;
  min-height: 72px;
  line-height: 1.2;
}

.group-button.is-selected {
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px var(--green);
}

.empty-state {
  grid-column: 1 / -1;
  color: var(--red);
  background: #fff5f3;
  border: 1px solid #f1c8c2;
  border-radius: 8px;
  padding: 18px;
}

.form {
  display: grid;
  gap: 18px;
  padding: 22px;
  border-top: 1px solid var(--line);
}

.selected-group {
  border-left: 5px solid var(--gold);
  background: #fff8eb;
  border-radius: 8px;
  padding: 14px 16px;
  font-weight: 800;
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.check-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  align-items: start;
  color: var(--muted);
  line-height: 1.35;
}

.check-row input {
  width: 22px;
  min-height: 22px;
  margin: 0;
  accent-color: var(--green);
}

button {
  border: 0;
  background: var(--green);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
}

button:disabled {
  background: #b7c0c3;
  cursor: not-allowed;
}

.form-message {
  margin: 0;
  min-height: 22px;
  color: var(--red);
  font-weight: 700;
}

dialog {
  width: min(560px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 34px;
  color: var(--ink);
  box-shadow: 0 26px 80px rgba(32, 49, 58, 0.28);
}

dialog::backdrop {
  background: rgba(32, 49, 58, 0.58);
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  min-height: 40px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 30px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.primary-link {
  background: var(--green);
  color: #fff;
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 1160px);
    padding-top: 16px;
  }

  .intro,
  .filters,
  .fields-grid {
    grid-template-columns: 1fr;
  }

  .intro {
    align-items: start;
  }

  .contact-link {
    width: 100%;
  }

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

  h1 {
    font-size: 38px;
  }

  .groups-list {
    grid-template-columns: 1fr;
  }
}
