/* Shared by public DOM forms and React forms. Keep hidden questions out of layout. */
.mg-flow [data-flow-hidden], .mg-flow [hidden] { display: none !important; }
.mg-flow { position: relative; display: flex !important; flex-direction: column; gap: 20px; min-width: 0; width: 100%; }
.mg-flow > * { order: 1; }
.mg-flow > .mg-flow-heading { order: 0; }
.mg-flow > .mg-flow-error { order: 2; }
.mg-flow > .mg-flow-history { order: 3; }
.mg-flow > .mg-flow-actions, .mg-flow > .mg-flow-final { order: 4; }
.mg-flow-heading { display: grid; gap: 18px; margin: 0 0 8px; }
.mg-flow .mg-flow-title { color: #17251e; font-size: clamp(22px, 3vw, 28px); font-weight: 750; line-height: 1.45; margin: 0; outline: none; letter-spacing: -.04em; }
.mg-flow .mg-flow-back { justify-self: start; width: auto; min-height: 40px; border: 0; padding: 8px 0; background: transparent; color: #53635a; font: inherit; cursor: pointer; }
.mg-flow .mg-flow-back::before { content: '‹'; font-size: 24px; margin-right: 8px; vertical-align: -1px; }
.mg-flow .mg-flow-error { color: #b42318; font-size: 14px; line-height: 1.5; margin: 0; }
.mg-flow .mg-flow-error:empty { display: none; }
.mg-flow .mg-flow-history { display: grid; gap: 10px; margin: 4px 0; }
.mg-flow .mg-flow-answer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; text-align: left; width: 100%; height: auto; min-height: 64px; padding: 14px 16px; border: 1px solid #e4eae6; border-radius: 14px; background: #f5f8f6; color: #253d2e; box-shadow: none; cursor: pointer; line-height: 1.5; }
.mg-flow-answer span { font-size: 12px; color: #68766e; }
.mg-flow-answer strong { grid-column: 1; font-size: 15px; font-weight: 550; overflow-wrap: anywhere; white-space: pre-wrap; }
.mg-flow-answer small { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 12px; color: #52675a; }
.mg-flow .mg-flow-actions { display: flex; align-items: center; gap: 12px; position: sticky; bottom: 0; z-index: 3; background: #fff; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); margin-top: 6px; }
.mg-flow .mg-flow-next { flex: 1; min-height: 52px; border: 0; border-radius: 14px; background: #164b35; color: white; font-size: 16px; font-weight: 650; cursor: pointer; }
.mg-flow .mg-flow-skip { width: auto; min-height: 48px; background: transparent; color: #52675a; border: 0; padding: 10px 14px; cursor: pointer; }
.mg-flow button:disabled { cursor: wait; opacity: .55; }
.mg-flow button:focus-visible, .mg-flow input:focus-visible, .mg-flow select:focus-visible, .mg-flow textarea:focus-visible { outline: 3px solid #63a980; outline-offset: 3px; }
.mg-flow input, .mg-flow select, .mg-flow textarea { scroll-margin: 100px 0 140px; max-width: 100%; }
.mg-flow input[aria-invalid="true"] { border-color: #b42318; }
.mg-flow .create-step > header, .mg-flow .checkout-v2-card > header > span { display: none; }
.mg-flow .create-step, .mg-flow .create-field-grid, .mg-flow .auth-password-grid, .mg-flow .mg-form-grid, .mg-flow .profile-edit-fields { display: flex; flex-direction: column; width: 100%; gap: 16px; }
.mg-flow .create-step, .mg-flow .checkout-v2-card { margin: 0; }
.mg-flow .checkout-v2-main { display: flex; flex-direction: column; gap: 0; }
.mg-flow:not(.mg-flow-review) .checkout-v2-summary { display: none; }
.create-party-shell:has(.mg-flow) { grid-template-columns: minmax(0, 620px); justify-content: center; }
.create-party-shell:has(.mg-flow:not(.mg-flow-review)) > .create-preview { display: none; }
.checkout-v2-layout.mg-flow { max-width: 640px; margin: auto; padding: 0 20px 40px; }
.mg-flow .checkout-v2-summary { position: static; width: 100%; }
.mg-flow-backdrop { position: fixed; inset: 0; z-index: 9998; background: #10221c80; }
form.mg-flow.mg-flow-consent { position: fixed; z-index: 9999; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain; padding: 24px; border-radius: 24px; background: #fff; box-shadow: 0 24px 100px #0003; margin: 0; }
dialog form.mg-flow.mg-flow-consent { position: relative; inset: auto; transform: none; width: 100%; padding: 0; box-shadow: none; }
.mg-flow-consent .mg-flow-actions { background: #fff; }
@media (max-width: 640px) {
  form.mg-flow.mg-flow-consent { inset: auto 0 0; transform: none; width: 100%; max-height: 90dvh; border-radius: 24px 24px 0 0; padding: 24px 20px max(20px, env(safe-area-inset-bottom)); }
  .mg-flow input, .mg-flow select, .mg-flow textarea { font-size: 16px; }
  body:has(.mg-flow input:focus, .mg-flow textarea:focus) .mobile-bottom-nav { display: none; }
}
@keyframes mg-flow-enter { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
.mg-flow [data-flow-active] { animation: mg-flow-enter 200ms ease-out; }
@media (prefers-reduced-motion: reduce) { .mg-flow *, .mg-flow [data-flow-active] { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
.mg-flow-confirm-dialog { border: 0; border-radius: 24px; padding: 24px; width: min(480px, calc(100vw - 32px)); max-height: 85dvh; overflow-y: auto; }
.mg-flow-confirm-dialog::backdrop { background: #10221c80; }
.mg-flow-confirm-copy { font-size: 16px; line-height: 1.7; white-space: pre-line; }
.mg-flow .mg-flow-next.is-danger { background: #b42318; }
.auth-card-v2:has(.mg-flow) .auth-trust-panel, .auth-card-v2:has(.mg-flow) .auth-card-heading > p { display: none; }
.auth-card-v2:has(.mg-flow) .auth-card-heading { margin-bottom: 20px; }
.mg-flow .mg-flow-next { background: #2685e9; }
.mg-flow .mg-flow-title { color: var(--ink, #202c35); }
.mg-flow .mg-flow-answer { background: #f5f8fc; border-color: #e3eaf2; color: #253b50; }
.mg-flow button:focus-visible, .mg-flow input:focus-visible, .mg-flow select:focus-visible, .mg-flow textarea:focus-visible { outline-color: #77b9ff; }
@media (max-width: 640px) { .mg-flow-confirm-dialog { margin: auto 0 0; width: 100%; max-width: none; border-radius: 24px 24px 0 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); } }

.mg-flow-consent::backdrop { background: #10221c80; }
.mg-flow-backdrop { pointer-events: none; }
form.mg-flow-consent:popover-open { border: 0; }

/* Enhancement must never reveal a form hidden by permissions or route state. */
form.mg-flow[hidden] { display: none !important; }

.mg-flow .mg-flow-actions { bottom: var(--mg-flow-keyboard-inset, 0px); }
form.mg-flow.mg-flow-consent { max-height: calc(var(--mg-flow-visible-height, 100dvh) - 48px); }
@media (max-width: 640px) { form.mg-flow.mg-flow-consent { bottom: var(--mg-flow-keyboard-inset, 0px); max-height: calc(var(--mg-flow-visible-height, 100dvh) - 24px); } }
