/* Controlled access: the request form (a dialog on the gate, a full-screen sheet
   under 700 px, a plain page at /request-access), the waiting and approved
   notices, and the approve page. Drawn in the design tokens from base.css and
   one.css, like gate.css. */

.ra-card-wide {
  max-width: 680px;
}

.ra-gate-note,
.ra-notice {
  display: grid;
  gap: 6px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
}

.ra-gate-note b {
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ra-open {
  margin-top: 14px;
}

.ra-notice p {
  margin: 0;
  overflow-wrap: anywhere;
}

.ra-notice-title {
  margin: 0 0 4px;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 620;
  letter-spacing: -0.01em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.ra-good .ra-notice-title {
  color: var(--good);
}

.ra-bad .ra-notice-title {
  color: var(--danger);
}

/* The dialog. With no script it is open in the page (not modal) and reads as a
   section of the card; the script turns it into a modal dialog. */
.ra-dialog {
  box-sizing: border-box;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
}

.ra-dialog:not(:modal) {
  position: static;
  width: 100%;
  max-height: none;
  margin: 16px 0 0;
  box-shadow: none;
}

.ra-dialog::backdrop {
  background: color-mix(in oklch, var(--ink) 45%, transparent);
  backdrop-filter: blur(2px);
}

.ra-sheet {
  padding: 22px 24px 20px;
}

.ra-dialog:not(:modal) .ra-sheet {
  padding: 16px;
}

.ra-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: -22px;
  margin: -22px -24px 0;
  padding: 18px 24px 8px;
  background: var(--surface);
  z-index: 1;
}

.ra-dialog:not(:modal) .ra-head {
  position: static;
  margin: 0;
  padding: 0;
}

.ra-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 640;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.ra-page .ra-title {
  font-size: 20px;
  margin-bottom: 4px;
}

.ra-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -8px -10px 0 0;
  border-radius: var(--radius);
  color: var(--ink-3);
}

.ra-close:hover {
  background: var(--bg-3);
  color: var(--ink);
}

.ra-close:focus-visible,
.ra-chip:focus-within,
.ra-check input:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.ra-lede {
  margin: 6px 0 16px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-3);
}

.ra-form {
  display: grid;
  gap: 14px;
}

.ra-alert {
  margin: 0;
}

.ra-head .ra-lede {
  margin: 4px 0 0;
}

/* The three steps. Stacked by default (and with no script); side by side as
   numbered columns from 1024 px; one at a time on a phone. */
.ra-steps {
  display: grid;
  gap: 18px;
}

.ra-step {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.ra-step[hidden] {
  display: none;
}

.ra-step-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13.5px;
  font-weight: 620;
  color: var(--ink);
}

.ra-step-num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.ra-step-fields {
  display: grid;
  gap: 10px;
}

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

.ra-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.ra-actions .ra-foot {
  text-align: left;
  max-width: 560px;
}

.ra-actions .ra-submit {
  width: auto;
  flex: none;
  padding: 10px 22px;
}

.ra-back {
  flex: none;
  padding: 10px 18px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.ra-progress {
  display: grid;
  gap: 8px;
}

.ra-bars {
  display: flex;
  gap: 6px;
}

.ra-bars span {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--bg-3);
}

.ra-bars span[data-done] {
  background: var(--accent-2);
}

.ra-stepno {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.ra-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.ra-field > label,
.ra-set legend {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}

.ra-optional {
  margin-left: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--ink-4);
}

.ra-field input,
.ra-field select,
.ra-field textarea,
.ra-note {
  width: 100%;
  box-sizing: border-box;
  min-height: 38px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
}

.ra-field textarea {
  resize: vertical;
  min-height: 60px;
}

.ra-field input:focus,
.ra-field select:focus,
.ra-field textarea:focus,
.ra-note:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.ra-field [aria-invalid='true'],
.ra-set[aria-invalid='true'] .ra-chip {
  border-color: var(--danger);
}

.ra-error {
  margin: 0;
  font-size: 12px;
  color: var(--danger);
}

.ra-set {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.ra-set legend {
  padding: 0;
  margin-bottom: 2px;
}

.ra-set:focus {
  outline: none;
}

.ra-hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-3);
}

.ra-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ra-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

.ra-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.ra-chip:has(input:checked) {
  border-color: var(--accent-2);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 550;
}

.ra-chip:has(input:checked)::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.ra-teams {
  display: grid;
  gap: 6px;
}

.ra-team {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.ra-team .ra-chip {
  justify-self: start;
}

.ra-note {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12.5px;
}

.ra-note[hidden] {
  display: none;
}

.ra-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
  cursor: pointer;
}

.ra-check input {
  flex: none;
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.ra-check a,
.ra-foot a,
.ra-notice a,
.auth-foot a {
  color: var(--accent);
}

.ra-submit {
  width: 100%;
  padding: 10px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.ra-submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

.ra-foot {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-3);
  text-align: center;
}

/* Phones: the dialog is a full-screen sheet, with the X at the top right. */
@media (max-width: 699px) {
  .ra-dialog:modal {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .ra-sheet {
    padding: 16px 16px 28px;
  }

  .ra-head {
    top: -16px;
    margin: -16px -16px 0;
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--border);
  }

  .ra-pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .ra-dialog:modal .ra-sheet {
    min-height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }

  .ra-dialog:modal .ra-form {
    flex: 1;
    align-content: start;
  }

  .ra-form[data-stepped] .ra-progress {
    margin-top: 12px;
  }

  .ra-form[data-stepped] .ra-step-title {
    font-size: 18px;
  }

  .ra-form[data-stepped] .ra-actions {
    border-top: 0;
    padding-top: 4px;
  }

  .ra-form[data-stepped] .ra-actions .ra-submit {
    flex: 1;
    padding: 13px;
  }

  .ra-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .ra-form[data-stepped] .ra-actions {
    flex-direction: row;
  }

  .ra-team {
    grid-template-columns: minmax(0, 1fr);
  }

  .ra-card-wide {
    padding: 20px 16px;
  }
}

/* Wide screens: one wide dialog, the three steps side by side as numbered
   columns divided by hairlines, the whole form in one view (fits 1280 x 768). */
@media (min-width: 1024px) {
  .ra-dialog:modal {
    width: min(1150px, calc(100vw - 48px));
  }

  .ra-dialog:modal .ra-sheet {
    padding: 20px 28px 18px;
  }

  .ra-dialog:modal .ra-head {
    position: static;
    margin: 0 0 12px;
    padding: 0;
  }

  .ra-card-wide {
    max-width: 1150px;
  }

  .ra-steps {
    grid-template-columns: 1.05fr 1fr 1fr;
    gap: 0;
  }

  .ra-step {
    padding: 0 22px;
  }

  .ra-step:first-child {
    padding-left: 0;
  }

  .ra-step:last-child {
    padding-right: 0;
  }

  .ra-step + .ra-step {
    border-left: 1px solid var(--border);
  }

  .ra-team {
    grid-template-columns: 172px minmax(0, 1fr);
    gap: 6px;
  }

  .ra-teams {
    gap: 6px;
  }
}
