#membership {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  margin: auto;
  width: min(760px, calc(100% - 24px));
  max-height: 90dvh;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0;
  border: 1px solid #c7d5e5;
  border-radius: 18px;
  color: #142b4a;
  background: white;
  box-shadow: 0 24px 80px #10243e55;
}
#membership::backdrop { background: rgb(11 29 52 / 60%); }
html:has(#membership[open]) { overflow: hidden; }
.join-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding: 14px 24px;
  background: #142b4a; color: white;
}
.join-head h2 { margin: 0; font-size: clamp(20px, 3vw, 27px); }
.join-close { flex: none; width: 40px; height: 40px; color: white; border: 1px solid #8093ac; background: transparent; border-radius: 8px; font-size: 24px; cursor: pointer; }
.join-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px 18px; padding: 22px 24px; }
.join-form label { display: block; font-size: 14px; font-weight: 600; }
.join-form :is(input,select,textarea) { display: block; box-sizing: border-box; width: 100%; margin-top: 5px; border: 1px solid #afbed0; border-radius: 7px; padding: 9px; background: #fff; color: #162f50; font: 400 16px/1.4 "Segoe UI",sans-serif; }
.join-form textarea { resize: vertical; min-height: 84px; }
.join-form select:disabled { background: #f0f3f7; }
.join-phone { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 7px; }
.join-wide, .join-actions { grid-column: 1/-1; }
.join-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; color: #50647b; }
.join-actions button { border: 0; background: #e0e7f0; color: #465971; border-radius: 8px; padding: 11px 17px; font-weight: 650; }
@media(max-width: 640px) {
  #membership { inset: auto 0 0; margin: 0; width: 100%; max-width: none; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .join-form { grid-template-columns: 1fr; padding: 16px; }
  .join-head { padding: 10px 16px; }
}

.join-form input[type="hidden"] { display: none; }
.join-country { position: relative; align-self: stretch; margin-top: 5px; }
.join-country summary, .join-countries button {
  display: flex; align-items: center; gap: 8px; min-height: 42px;
  font: inherit; color: #162f50; background: white; cursor: pointer;
}
.join-country summary { height: 100%; padding: 0 9px; border: 1px solid #afbed0; border-radius: 7px; list-style: none; }
.join-country summary::-webkit-details-marker { display: none; }
.join-country summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1px 1px 0; transform: rotate(45deg); }
.join-country img { width: 23px; height: 16px; object-fit: contain; flex: none; }
.join-countries { position: absolute; top: calc(100% + 4px); left: 0; z-index: 2; width: max-content; padding: 4px; border: 1px solid #afbed0; border-radius: 8px; background: white; box-shadow: 0 6px 18px #142b4920; }
.join-countries button { width: 100%; border: 0; border-radius: 4px; padding: 6px 9px; }
.join-countries button:is(:hover,:focus-visible) { background: #edf3fb; }
.join-actions button:enabled, .compose-actions button:enabled { background: #193657; color: #fff; cursor: pointer; }

#membership [hidden] { display: none; }
.join-feedback { min-height: 220px; display: grid; align-content: center; justify-items: center; gap: 16px; padding: 24px; text-align: center; }
.join-feedback strong { font-size: 1.25rem; }
.join-indicator { width: 36px; height: 36px; box-sizing: border-box; border: 3px solid #d5e2f0; border-top-color: #264b78; border-radius: 50%; animation: join-spin .8s linear infinite; }
@keyframes join-spin { to { transform: rotate(360deg); } }
.join-feedback[data-state="sent"] .join-indicator { display: grid; place-items: center; background: #e4f3eb; border: 0; animation: none; }
.join-feedback[data-state="sent"] .join-indicator::after { content: ""; width: 8px; height: 15px; border: solid #267149; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .join-indicator { animation: none; } }
