.membership-status-card {
  margin: 0 0 18px;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;  /* in a narrow column (Settings) the button goes under the details instead of sticking out of the card */
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
}

.membership-status-card > div:first-child {
  flex: 1 1 240px;
  min-width: 0;
}

.membership-status-card h2 {
  margin: 8px 0 4px;
  font-size: 28px;
}

.membership-status-card p {
  margin: 0;
  color: var(--muted);
}

.feature-check {
  color: var(--success);
  font-weight: 800;
}

.membership-dl {
  display: grid;
  /* Labels may wrap (Russian "Продлевается / заканчивается" is long) rather than squeeze the values into a sliver. */
  grid-template-columns: fit-content(55%) minmax(0, 1fr);
  gap: 8px 14px;
  margin: 16px 0;
}

.membership-dl dt {
  color: var(--muted);
  font-weight: 800;
}

.membership-dl dd {
  margin: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.membership-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-search {
  min-height: 44px;
  width: min(320px, 100%);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #ffffff;
}

.admin-panel {
  overflow: hidden;
}

.admin-table td:first-child {
  min-width: 260px;
}

.admin-table .field-hint {
  display: block;
}

/* Administration > Promo codes: used / remaining / total above the table (membership-ui.js PromoCodes). */
.promo-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 16px;
}

.promo-summary div {
  min-width: 110px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.promo-summary dt {
  font-size: 0.85rem;
}

.promo-summary dd {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

/* Its own wrapper, not .table-wrap: styles.css hides .table-wrap on phones (it swaps in a card list for exercises), and this
   table has no card version. It scrolls sideways inside the panel instead. */
.promo-table {
  overflow-x: auto;
}

.promo-table .field-hint {
  display: block;
}

@media (max-width: 760px) {
  .membership-status-card {
    align-items: stretch;
    flex-direction: column;
  }
}

/* "Check your inbox" after sign-up (membership-ui.js CheckEmailPage, docs/membership/email-confirmation.md). */
/* One column: the sign-in pages' layout has the artwork on the left and the card on the right, which would leave half the screen
   empty here. */
.auth-page.auth-single {
  grid-template-columns: 1fr;
}

.check-email {
  max-width: 520px;
}

/* The "email sent" line is the point of the page, so it stands out. */
.check-email .membership-notice {
  padding: 12px 14px;
  border-left: 4px solid var(--brand-gold);
  background: #f4ead2;
  color: var(--brand-night);
}

.check-email .membership-notice strong {
  display: block;
  overflow-wrap: anywhere;
}

.check-email-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* Terms of Membership and Health Data Notice (membership-ui.js TermsPage): a readable column of legal text. */
.legal-wrap {
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.6;
}

.legal-wrap h2 {
  margin-top: 2.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 1rem;
}

.legal-wrap h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
}

.legal-wrap ul {
  padding-left: 1.25rem;
}

.legal-wrap li + li {
  margin-top: 0.35rem;
}

.legal-contents {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Owner's details still to be filled in before launch. */
.legal-placeholder {
  padding: 0 3px;
  border-radius: 3px;
  background: #fde68a;
  color: inherit;
}

/* The terms window on the sign-up page (membership-ui.js openTermsDialog): the text scrolls, the buttons stay in view. */
.legal-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--background, #f6f2e9);
  color: inherit;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}

.legal-dialog[open] {
  display: flex;
  flex-direction: column;
}

.legal-dialog::backdrop {
  background: rgba(7, 11, 26, 0.6);
}

.legal-dialog-body {
  overflow-y: auto;
  padding: 20px 24px;
  overscroll-behavior: contain;
}

.legal-dialog-text h1 {
  font-size: 1.5rem;
  margin-top: 0;
}

.legal-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
}

@media (max-width: 520px) {
  .legal-dialog-body,
  .legal-dialog-actions {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* The terms link in the sign-up box (app.js renderAuth, membership-ui.js termsAgreement). The global "a" rule makes links look
   like plain text, so in a bold label it was invisible; the user could not find it. Gold-brown like the auth card's other
   inline links (brand.css .auth-card .nav-text.inline), underlined so it reads as a link. */
.check-field a[data-terms-link] {
  color: #8a6424;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.check-field a[data-terms-link]:hover,
.check-field a[data-terms-link]:focus-visible {
  color: #5e4316;
  text-decoration-thickness: 2px;
}
