.flow-dialog {
  position: fixed;
  inset: 0;
  width: min(600px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--fg);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 90px #0008;
}

.flow-dialog::backdrop {
  background: #05060bc9;
  backdrop-filter: blur(5px);
}
.flow-dialog:has(.board-reason) { width: min(420px, calc(100% - 28px)); }
.board-reason { display: grid; gap: 18px; padding: 18px 24px 24px; }
.board-reason p { display: grid; gap: 3px; margin: 0; overflow-wrap: anywhere; }
.board-reason span { color: var(--muted); font-size: .88rem; }

.flow-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 26px 28px 20px;
  border-bottom: 1px solid var(--line);
}

.flow-header h2 {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  line-height: 1.11;
  letter-spacing: -.045em;
}

.flow-header h2:focus {
  outline: none;
}

.flow-description {
  margin: 9px 0 0;
  color: var(--muted);
}

.flow-option:hover > span { background: var(--raised); }

.flow-form {
  display: grid;
  gap: 15px;
  padding: 20px 28px 26px;
}
.checkout-extra { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.checkout-extra strong { margin-inline-start: auto; white-space: nowrap; }
.checkout-extra small { display: block; margin-top: 4px; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.checkout-note { font-size: .9rem; color: var(--muted); }
.checkout-note.is-compatible::before {
  content: ''; display: inline-block; width: 10px; height: 6px; margin-inline-end: 7px;
  border: solid var(--accent); border-width: 0 0 2px 2px; transform: translateY(-3px) rotate(-45deg);
}
.checkout-note.is-incompatible::before {
  content: ''; display: inline-block; width: 10px; height: 10px; margin-inline-end: 7px;
  color: #d96850; vertical-align: baseline;
  background: linear-gradient(45deg, transparent 43%, currentColor 43% 57%, transparent 57%),
              linear-gradient(-45deg, transparent 43%, currentColor 43% 57%, transparent 57%);
}
.checkout-note:empty { display: none; }

.flow-fieldset {
  min-inline-size: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.flow-fieldset legend,
.flow-label {
  display: block;
  padding: 0;
  margin-bottom: 8px;
  font-size: .9375rem;
  font-weight: 700;
}

.flow-products,
.flow-days,
.flow-times {
  display: grid;
  gap: 6px;
}

.flow-days {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.flow-times {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.flow-option {
  display: block;
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.flow-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.flow-option > span {
  display: grid;
  place-content: center;
  min-height: 44px;
  padding: 5px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: .875rem;
  text-align: center;
}

.flow-option input:checked + span {
  color: var(--accent);
  background: var(--raised);
  border-color: var(--accent);
}

.flow-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Reserve room for both the time and its optional booking status. */
.flow-times .flow-option > span { min-height: 3.125rem; height: 100%; }
.flow-times input:disabled + span {
  color: #a3a7ab;
  background: #25292c;
  border-color: #3c4145;
  cursor: not-allowed;
}
.flow-times input:disabled + span strong { font-weight: 500; }
.flow-times small { font-size: .72rem; line-height: 1.2; }
[data-theme="relay"] .flow-times input:disabled + span {
  color: #62676b; background: #e5e6e7; border-color: #cfd1d3;
}

.flow-day small {
  font-size: .875rem;
  color: var(--muted);
}

.flow-product > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-inline: 12px;
  text-align: start;
}

.flow-option-price {
  white-space: nowrap;
}

.flow-option-price small {
  font-size: inherit;
  font-weight: 400;
}

.flow-form select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 7px 38px 7px 11px;
  appearance: none;
  color: var(--fg);
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) right 18px center / 5px 5px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) right 13px center / 5px 5px no-repeat,
    var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
}

.flow-zone {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: .875rem;
}

.flow-total,
.flow-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--raised);
}

.flow-total strong,
.flow-result > span {
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 700;
}

.flow-result {
  margin: 20px 28px;
}

.flow-result p {
  margin: 5px 0 0;
  color: var(--muted);
}

.flow-footer {
  display: grid;
  gap: 8px;
}

.flow-footer .button {
  width: 100%;
}

.flow-footer p {
  margin: 0;
  color: var(--muted);
  font-size: .875rem;
  text-align: center;
}

.flow-dialog > .flow-footer {
  margin: 0 28px 26px;
}

@media (max-width: 480px) {
  .flow-dialog {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 20px);
  }

  .flow-header,
  .flow-form {
    padding-inline: 16px;
  }

  .flow-days {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .flow-result,
  .flow-dialog > .flow-footer {
    margin-inline: 16px;
  }
}

/* Product checkout */
.flow-dialog:has(.order-form) { width: min(704px, calc(100% - 20px)); }
.order-cover { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: end; min-height: clamp(164px, 29vh, 252px); padding: 28px; color: #f4fffb; background: #101e24; }
.order-cover > .preview-cover { position: absolute; right: 0; top: 0; z-index: -2; width: 73%; height: 100%; object-fit: contain; object-position: right center; }
.order-cover::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg,#101e24 11%,#101e24f2 29%,#101e2490 49%,transparent 74%),linear-gradient(0deg,#08151e7a,transparent 55%); }
.order-cover p { color: #9be5d3; font-size: .72rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 7px; }
.order-cover h2 { margin: 0; font-size: clamp(2rem,5vw,3.2rem); line-height: 1; letter-spacing: -.035em; outline: none; }
.order-cover .dialog-close { position: absolute; top: 10px; right: 10px; }
.order-form { gap: 18px; padding: 22px 28px; }
.order-form legend { margin-bottom: 10px; font-size: 1.06rem; }
.order-form .flow-products { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.order-form .flow-product > span { position: relative; display: grid; justify-content: start; align-content: start; justify-items: start; gap: 3px; height: 100%; padding: 13px 14px; border-radius: 12px; }
.plan-duration { font-size: .85rem; }
.plan-price { font-size: clamp(1.28rem, 3.1vw, 1.8rem); line-height: 1.25; color: var(--fg); }
.order-form .flow-product small, .ferrum-copy small { color: var(--muted); line-height: 1.35; }
.order-form .flow-product em { position: absolute; bottom: 12px; right: 10px; font: 700 .73rem/1.4 var(--font); color: var(--accent); }
.order-form .flow-product input:checked + span { box-shadow: inset 0 0 0 1px var(--accent); }
.ferrum-option { display: grid; grid-template-columns: 110px 1fr auto auto; align-items: center; gap: 14px; padding: 8px 14px 8px 8px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.ferrum-option:has(input:checked) { background: var(--raised); border-color: var(--accent); }
.ferrum-photo { display: grid; place-items: center; min-height: 74px; border-radius: 8px; background: radial-gradient(ellipse at 45% 74%,#60817e,#293d41 60%,#192a31); }
.ferrum-photo img { width: 90%; height: auto; filter: drop-shadow(0 5px 3px #07151b85); }
.ferrum-copy { display: grid; gap: 4px; }
.ferrum-required { justify-self: start; padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--accent); font: 700 .66rem/1.4 var(--font); letter-spacing: .07em; text-transform: uppercase; }
.ferrum-option input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.order-footer { display: grid; grid-template-columns: 1fr minmax(45%,170px); align-items: center; border-top: 1px solid var(--line); padding-top: 14px; }
.order-footer .flow-total { display: grid; justify-content: start; gap: 0; padding: 0; border: none; background: none; }
.order-footer .flow-total span { font-size: .8rem; color: var(--muted); }
.order-footer .flow-total strong { font-size: 1.85rem; line-height: 1.15; color: var(--fg); }
.order-footer .button { gap: 12px; min-height: 46px; }
.order-footer p { grid-column: 1 / -1; text-align: start; font-size: .78rem; }
@media(max-width:560px) {
  .order-cover { padding: 18px; }
  .order-form { padding: 16px; gap: 14px; }
  .order-form .flow-product > span { padding: 10px 7px; }
  .order-form .flow-product em { position: static; }
  .ferrum-option { grid-template-columns: 72px 1fr auto; gap: 6px 10px; padding: 8px; }
  .ferrum-photo { grid-row: 1/3; min-height: 64px; }
  .ferrum-copy { grid-column: 2; }
  .ferrum-option strong { grid-column: 2; font-size: .88rem; }
  .ferrum-option input { grid-column: 3; grid-row: 1/3; }
  .order-footer { grid-template-columns: auto 1fr; }
}
