/* MR/Claude 10/21/2026: the "steps" form layout (form_theme layout "steps", CIPOP-style): a step bar across the top, the
   current section as a card, and a progress rail on the right. Markup comes from lib/tag/xm/inc/form/_xm-3.cfm; states
   from js/steps.js. xm-4 tokens only, so light and dark both follow the shell; --xmf-accent (form_theme accent) wins. */
.xm4 .xmf-steps-head, .xm4 .xmf-steps-body {
  --xmfs-accent: var(--xmf-accent, var(--xm4-accent));
  --xmfs-on-accent: #fff;
  --xmfs-ok: var(--xm4-success);
  --xmfs-warn: var(--xm4-warning);
  --xmfs-bad: var(--xm4-danger);
  /* Small coloured text needs more contrast than the raw status colours give on a light surface. */
  --xmfs-ok-ink: color-mix(in srgb, var(--xm4-success) 72%, var(--xm4-text));
  --xmfs-warn-ink: color-mix(in srgb, var(--xm4-warning) 68%, var(--xm4-text));
  --xmfs-bad-ink: color-mix(in srgb, var(--xm4-danger) 80%, var(--xm4-text));
  --xmfs-tint: color-mix(in srgb, var(--xmfs-accent) 10%, var(--xm4-surface));
}

/* ---------- step bar ---------- */
.xm4 .xmf-steps-head {container: xmf-stepbar / inline-size; margin: 0 0 14px; padding: 6px 6px 0; border: 1px solid var(--xm4-line); border-radius: 16px; background: var(--xm4-surface);}
.xm4 .xmf-steps-head .xmf-steps {display: flex; flex-wrap: nowrap; gap: 4px; margin: 0; padding: 0 0 6px; list-style: none; overflow-x: auto; scrollbar-width: thin;}
.xm4 .xmf-steps-head .xmf-step {display: block; flex: 1 0 auto; padding: 0; margin: 0; border: 0; border-radius: 10px; background: transparent; cursor: default;}
.xm4 .xmf-steps-head .xmf-step-btn {display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 44px; padding: 8px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--xm4-ink-2); font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.25; white-space: nowrap; cursor: pointer; transition: background .15s ease, color .15s ease;}
.xm4 .xmf-steps-head .xmf-step-btn:hover {background: var(--xm4-soft); color: var(--xm4-text);}
/* The wizard's own phone rule display:none's other steps' labels, which would empty their accessible names. */
.xm4 .xmf-steps-head .xmf-step .xmf-step-label {display: inline;}
.xm4 .xmf-steps-head .xmf-step-btn:focus-visible {outline: 3px solid var(--xmfs-accent); outline-offset: 1px;}
.xm4 .xmf-steps-head .xmf-step-num, .xm4 .xmf-steps-head .xmf-step-icon {display: inline-grid; place-items: center; flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; background: var(--xm4-soft); color: var(--xm4-muted); font-size: 11.5px; font-weight: 700; font-style: normal; font-variant-numeric: tabular-nums;}
.xm4 .xmf-steps-head .xmf-step-icon {display: none;}
.xm4 .xmf-steps-head .xmf-step-icon.fa-solid {display: inline-grid;}
.xm4 .xmf-steps-head .xmf-step-icon.fa-solid + .xmf-step-label {margin-left: 0;}
.xm4 .xmf-steps-head .xmf-step:has(.xmf-step-icon.fa-solid) .xmf-step-num {display: none;}
/* done: green check, green label */
.xm4 .xmf-steps-head .xmf-step.xmf-s-done .xmf-step-btn {color: var(--xmfs-ok-ink);}
.xm4 .xmf-steps-head .xmf-step.xmf-s-done .xmf-step-icon {background: var(--xmfs-ok); color: #fff;}
/* required fields still empty: amber number */
.xm4 .xmf-steps-head .xmf-step.xmf-s-missing .xmf-step-num, .xm4 .xmf-steps-head .xmf-step.xmf-s-warning .xmf-step-num {background: color-mix(in srgb, var(--xmfs-warn) 20%, var(--xm4-surface)); color: var(--xmfs-warn-ink);}
/* a validation error or a guardrail blocker: red */
.xm4 .xmf-steps-head .xmf-step.xmf-s-error .xmf-step-btn {color: var(--xmfs-bad-ink);}
.xm4 .xmf-steps-head .xmf-step.xmf-s-error .xmf-step-num, .xm4 .xmf-steps-head .xmf-step.xmf-s-error .xmf-step-icon {background: var(--xmfs-bad); color: #fff;}
/* current: the filled pill (wins over every other state) */
.xm4 .xmf-steps-head .xmf-step.xmf-current .xmf-step-btn {background: var(--xmfs-accent); color: var(--xmfs-on-accent); box-shadow: 0 8px 18px -12px color-mix(in srgb, var(--xmfs-accent) 85%, transparent);}
.xm4 .xmf-steps-head .xmf-step.xmf-current .xmf-step-num, .xm4 .xmf-steps-head .xmf-step.xmf-current .xmf-step-icon {display: inline-grid; background: color-mix(in srgb, var(--xmfs-on-accent) 24%, transparent); color: var(--xmfs-on-accent);}
.xm4 .xmf-steps-head .xmf-step.xmf-current .xmf-step-icon {display: none;}
.xm4 .xmf-steps-head .xmf-step.xmf-current.xmf-s-error .xmf-step-btn {box-shadow: inset 0 0 0 2px var(--xmfs-bad);}
/* the thin progress line under the bar: overall completion, not position */
.xm4 .xmf-steps-head .xmf-wizard-trackrow {display: block; margin: 0 -6px;}
.xm4 .xmf-steps-head .xmf-wizard-track {display: block; height: 4px; margin: 0; border-radius: 0 0 16px 16px; background: var(--xm4-line-2, var(--xm4-soft)); overflow: hidden;}
.xm4 .xmf-steps-head .xmf-wizard-track-fill {display: block; height: 100%; width: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--xmfs-accent) 65%, var(--xm4-surface)), var(--xmfs-accent)); border-radius: 0; transition: width .3s ease;}
.xm4 .xmf-steps-head .xmf-wizard-count {position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;}
@container xmf-stepbar (max-width: 760px) {
  .xm4 .xmf-steps-head .xmf-step {flex: 0 0 auto;}
  .xm4 .xmf-steps-head .xmf-step:not(.xmf-current) .xmf-step-label {position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;}
  .xm4 .xmf-steps-head .xmf-step:not(.xmf-current) .xmf-step-btn {padding: 8px 10px;}
  .xm4 .xmf-steps-head .xmf-step.xmf-current {flex: 1 0 auto;}
}

.xm4 .xmf-steps-reqnote {margin: 0 0 14px 2px; font-size: 13px; color: var(--xm4-muted);}
.xm4 .xmf-steps-reqnote b {color: var(--xmfs-bad-ink, var(--xm4-danger)); font-weight: 700;}

/* ---------- section card + rail ---------- */
.xm4 .xmf-steps-body {container: xmf-steps / inline-size;}
.xm4 .xmf-steps-grid {display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 24px; align-items: start;}
.xm4 .xmf-steps-main {min-width: 0;}
.xm4 .xmf-steps-main .xmf-wizard-content > .tab-pane.XMFormSection {border-radius: 16px;}
.xm4 .xmf-steps-main .xmf-wizard-content > .tab-pane .SectionLabel {font-size: 19px; letter-spacing: -.02em;}
.xm4 .xmf-steps-rail {position: sticky; top: calc(var(--xm4-sticky-stack, var(--xm4-header, 56px)) + 16px); display: grid; gap: 12px; max-height: calc(100dvh - var(--xm4-sticky-stack, var(--xm4-header, 56px)) - var(--xm4-bottom, 0px) - 32px); overflow: auto; overscroll-behavior: contain;}
.xm4 .xmf-steps-rail:empty {display: none;}
.xm4 .xmf-rail-card {padding: 16px; border: 1px solid var(--xm4-line); border-radius: 16px; background: var(--xm4-surface);}
.xm4 .xmf-rail-title {display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 14px; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; color: var(--xm4-text);}
.xm4 .xmf-rail-title i {color: var(--xmfs-accent); width: 16px; text-align: center;}
/* progress ring */
.xm4 .xmf-rail-progress {display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: center;}
.xm4 .xmf-ring {position: relative; width: 64px; height: 64px;}
.xm4 .xmf-ring svg {width: 64px; height: 64px; transform: rotate(-90deg);}
.xm4 .xmf-ring circle {fill: none; stroke-width: 6;}
.xm4 .xmf-ring .xmf-ring-track {stroke: var(--xm4-soft);}
.xm4 .xmf-ring .xmf-ring-fill {stroke: var(--xmfs-accent); stroke-linecap: round; transition: stroke-dashoffset .6s ease;}
.xm4 .xmf-ring-pct {position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 750; color: var(--xmfs-accent); font-variant-numeric: tabular-nums;}
.xm4 .xmf-rail-sub {margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--xm4-muted);}
.xm4 .xmf-rail-req {margin: 6px 0 0; font-size: 12px; font-weight: 600; color: var(--xmfs-ok-ink);}
.xm4 .xmf-rail-req:empty {display: none;}
.xm4 .xmf-rail-req.is-open {color: var(--xmfs-warn-ink);}
/* session timer */
.xm4 .xmf-timer-value {margin: 6px 0 8px; font-size: 28px; font-weight: 750; letter-spacing: -.01em; line-height: 1.1; color: var(--xm4-text); font-variant-numeric: tabular-nums;}
.xm4 .xmf-timer-bar {height: 4px; border-radius: 4px; background: var(--xm4-soft); overflow: hidden;}
.xm4 .xmf-timer-bar span {display: block; height: 100%; width: 100%; background: var(--xm4-ink-2); transition: width 1s linear, background-color .3s;}
.xm4 .xmf-timer-note {margin: 10px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--xm4-muted);}
.xm4 .xmf-rail-timer.is-soon {border-color: color-mix(in srgb, var(--xmfs-warn) 60%, var(--xm4-line));}
.xm4 .xmf-rail-timer.is-soon .xmf-timer-value {color: var(--xmfs-warn-ink);}
.xm4 .xmf-rail-timer.is-soon .xmf-timer-bar span {background: var(--xmfs-warn);}
.xm4 .xmf-rail-timer.is-urgent {border-color: var(--xmfs-bad); animation: xmf-steps-pulse 1s ease-in-out infinite alternate;}
.xm4 .xmf-rail-timer.is-urgent .xmf-timer-value {color: var(--xmfs-bad-ink);}
.xm4 .xmf-rail-timer.is-urgent .xmf-timer-bar span {background: var(--xmfs-bad);}
@keyframes xmf-steps-pulse {from {box-shadow: 0 0 0 0 color-mix(in srgb, var(--xmfs-bad) 0%, transparent);} to {box-shadow: 0 0 0 4px color-mix(in srgb, var(--xmfs-bad) 22%, transparent);}}
/* sections list */
.xm4 .xmf-rail-list {display: grid; gap: 2px; margin: 10px 0 0; padding: 0; list-style: none;}
.xm4 .xmf-rail-item {display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--xm4-ink-2); font: inherit; font-size: 13px; font-weight: 550; line-height: 1.35; text-align: left; cursor: pointer; transition: background .12s, color .12s;}
.xm4 .xmf-rail-item:hover {background: var(--xm4-soft); color: var(--xm4-text);}
.xm4 .xmf-rail-item:focus-visible {outline: 3px solid var(--xmfs-accent); outline-offset: 1px;}
.xm4 .xmf-rail-item > i {flex: 0 0 16px; width: 16px; text-align: center; font-size: 15px; color: var(--xm4-faint);}
.xm4 .xmf-rail-label {flex: 1 1 auto; min-width: 0;}
.xm4 .xmf-rail-tally {flex: none; padding: 2px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums;}
.xm4 .xmf-rail-tally:empty {display: none;}
.xm4 .xmf-rail-item.is-done > i {color: var(--xmfs-ok);}
.xm4 .xmf-rail-item.is-missing > i, .xm4 .xmf-rail-item.is-warning > i {color: var(--xmfs-warn);}
.xm4 .xmf-rail-item.is-missing .xmf-rail-tally {background: color-mix(in srgb, var(--xmfs-warn) 18%, var(--xm4-surface)); color: var(--xmfs-warn-ink);}
.xm4 .xmf-rail-item.is-error {color: var(--xmfs-bad-ink);}
.xm4 .xmf-rail-item.is-error > i {color: var(--xmfs-bad);}
.xm4 .xmf-rail-item.is-error .xmf-rail-tally {background: color-mix(in srgb, var(--xmfs-bad) 16%, var(--xm4-surface)); color: var(--xmfs-bad-ink);}
.xm4 .xmf-rail-item.is-current {background: var(--xmfs-tint); color: color-mix(in srgb, var(--xmfs-accent) 80%, var(--xm4-text)); font-weight: 650;}
.xm4 .xmf-rail-item.is-current > i {color: var(--xmfs-accent);}
.xm4 .xmf-rail-next {display: block; margin: 10px 0 0; padding: 6px 10px; border: 0; background: transparent; color: var(--xmfs-accent); font: inherit; font-size: 12.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;}
.xm4 .xmf-rail-next[hidden] {display: none;}
.xm4 .xmf-rail-next:focus-visible {outline: 3px solid var(--xmfs-accent); outline-offset: 1px; border-radius: 6px;}
.xm4 .xmf-sr {position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;}
/* The rail already reports progress; the legacy footer pill would say it twice. */
.xm4 .xmf-steps-body #ProgressChartForm {display: none;}

/* Narrow (phone, or a docked AI panel): one column; the rail becomes a compact progress row above the section, the
   timer appears only in its last two minutes, and the step bar takes over section navigation. */
@container xmf-steps (max-width: 860px) {
  .xm4 .xmf-steps-grid {grid-template-columns: minmax(0, 1fr); gap: 12px;}
  .xm4 .xmf-steps-rail {position: static; order: -1; max-height: none; overflow: visible; grid-template-columns: minmax(0, 1fr); gap: 8px;}
  .xm4 .xmf-rail-sections {display: none;}
  .xm4 .xmf-rail-card {padding: 10px 12px; border-radius: 12px;}
  .xm4 .xmf-rail-progress {grid-template-columns: 44px minmax(0, 1fr); gap: 10px;}
  .xm4 .xmf-ring, .xm4 .xmf-ring svg {width: 44px; height: 44px;}
  .xm4 .xmf-ring-pct {font-size: 11.5px;}
  .xm4 .xmf-rail-progress .xmf-rail-title {font-size: 13px; margin: 0;}
  .xm4 .xmf-rail-timer:not(.is-soon):not(.is-urgent) {display: none;}
  .xm4 .xmf-rail-timer {display: grid; grid-template-columns: auto auto minmax(60px, 1fr); align-items: center; gap: 4px 12px;}
  .xm4 .xmf-rail-timer .xmf-rail-title {margin: 0;}
  .xm4 .xmf-rail-timer .xmf-timer-value {margin: 0; font-size: 20px;}
  .xm4 .xmf-rail-timer .xmf-timer-note {grid-column: 1 / -1; margin: 0;}
}

/* Dark: a solid accent pill is too bright with light text, so the current step is a tinted pill with an accent ring. */
html[data-bs-theme="dark"] .xm4 .xmf-steps-head .xmf-step.xmf-current .xmf-step-btn {background: color-mix(in srgb, var(--xmfs-accent) 26%, var(--xm4-surface)); color: var(--xm4-text); box-shadow: inset 0 0 0 1px var(--xmfs-accent);}
html[data-bs-theme="dark"] .xm4 .xmf-steps-head .xmf-step.xmf-current .xmf-step-num {background: var(--xmfs-accent); color: var(--xm4-bg);}
html[data-bs-theme="dark"] .xm4 .xmf-steps-head .xmf-step.xmf-s-done .xmf-step-icon,
html[data-bs-theme="dark"] .xm4 .xmf-steps-head .xmf-step.xmf-s-error .xmf-step-num,
html[data-bs-theme="dark"] .xm4 .xmf-steps-head .xmf-step.xmf-s-error .xmf-step-icon {color: var(--xm4-bg);}

@media (prefers-reduced-motion: reduce) {
  .xm4 .xmf-rail-timer.is-urgent {animation: none;}
  .xm4 .xmf-ring .xmf-ring-fill, .xm4 .xmf-steps-head .xmf-wizard-track-fill, .xm4 .xmf-timer-bar span {transition: none;}
}
@media print {
  .xm4 .xmf-steps-head, .xm4 .xmf-steps-reqnote, .xm4 .xmf-steps-rail {display: none !important;}
  .xm4 .xmf-steps-grid {display: block;}
}

/* ======================================================================================================================
   MR/Claude 10/24/2026: shared pieces for long forms on phones, usable by any xm-4 page. The Flex "steps" layout uses the
   sheet for its Sections list; CIPOP's hand-written petition forms use all four (lib/com/cipop/js/portal-forms.js):
   .xmf-mbar    a compact sticky "Step 2 of 7 · 14% complete" header with an "All steps" button
   .xmf-sheet   a bottom sheet on a native <dialog> (focus stays inside, the page behind is inert)
   .xmf-seg     big tap targets for short radio choices (Yes / No), drawn on the REAL inputs
   .xmf-group   question groups: a soft labelled divider by default, a card each with .xmf-groups-cards on an ancestor
   Helpers in js/steps.js (window.xmfSteps.sheet / makeSheet / groups / seg). xm-4 tokens plus --xmf-accent, so light,
   dark and a page's own accent all follow. Only new class names: nothing that exists today changes.
   ====================================================================================================================== */
.xm4 :is(.xmf-mbar, .xmf-sheet, .xmf-seg, .xmf-group) {
  --xmfs-accent: var(--xmf-accent, var(--xm4-accent));
  --xmfs-tint: color-mix(in srgb, var(--xmfs-accent) 12%, var(--xm4-surface));
  --xmfs-accent-ink: color-mix(in srgb, var(--xmfs-accent) 78%, var(--xm4-text));
  --xmfs-warn-ink: color-mix(in srgb, var(--xm4-warning) 68%, var(--xm4-text));
  --xmfs-bad-ink: color-mix(in srgb, var(--xm4-danger) 80%, var(--xm4-text));
}

/* ---------- compact step header ---------- */
.xm4 .xmf-mbar {position: sticky; top: calc(var(--xm4-sticky-stack, var(--xm4-header, 56px)) + 8px); z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; margin: 0 0 14px; padding: 10px 10px 10px 14px; border: 1px solid var(--xm4-line); border-radius: 14px; background: color-mix(in srgb, var(--xm4-surface) 94%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 10px 24px -18px rgba(15, 23, 42, .45);}
.xm4 .xmf-mbar[hidden] {display: none;}
.xm4 .xmf-mbar-main {min-width: 0;}
.xm4 .xmf-mbar-count {display: block; font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--xm4-muted); font-variant-numeric: tabular-nums;}
.xm4 .xmf-mbar-count b {font-weight: 700; color: var(--xm4-ink-2);}
.xm4 .xmf-mbar-name {display: block; overflow: hidden; font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--xm4-text); text-overflow: ellipsis; white-space: nowrap;}
.xm4 .xmf-mbar-btn {display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid color-mix(in srgb, var(--xmfs-accent) 40%, var(--xm4-line)); border-radius: 999px; background: var(--xmfs-tint); color: var(--xmfs-accent-ink); font: inherit; font-size: 14px; font-weight: 650; line-height: 1.2; white-space: nowrap; cursor: pointer;}
.xm4 .xmf-mbar-btn:hover {background: color-mix(in srgb, var(--xmfs-accent) 20%, var(--xm4-surface));}
.xm4 .xmf-mbar-btn:focus-visible {outline: 3px solid var(--xmfs-accent); outline-offset: 2px;}
.xm4 .xmf-mbar-note {grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 12.5px; line-height: 1.35; color: var(--xm4-muted); font-variant-numeric: tabular-nums;}
.xm4 .xmf-mbar-note[hidden] {display: none;}
.xm4 .xmf-mbar-note.is-soon {color: var(--xmfs-warn-ink, var(--xm4-warning)); font-weight: 650;}
.xm4 .xmf-mbar-note.is-urgent {color: var(--xmfs-bad-ink, var(--xm4-danger)); font-weight: 700;}
.xm4 .xmf-mbar-track {grid-column: 1 / -1; height: 4px; margin-top: 6px; border-radius: 4px; background: var(--xm4-soft); overflow: hidden;}
.xm4 .xmf-mbar-track > span {display: block; width: 0; height: 100%; border-radius: inherit; background: var(--xmfs-accent); transition: width .3s ease;}

/* ---------- bottom sheet (a <dialog>; a centred panel on wider screens) ---------- */
.xm4 dialog.xmf-sheet {position: fixed; inset: auto 0 0 0; width: 100%; max-width: 560px; max-height: min(88dvh, 760px); margin: 0 auto; padding: 0; border: 0; border-radius: 22px 22px 0 0; background: var(--xm4-surface); color: var(--xm4-text); box-shadow: 0 -18px 48px -18px rgba(0, 0, 0, .45); overflow: hidden;}
.xm4 dialog.xmf-sheet[open] {display: flex; flex-direction: column; animation: xmf-sheet-in .22s ease-out;}
.xm4 dialog.xmf-sheet::backdrop {background: rgba(15, 23, 42, .5);}
@keyframes xmf-sheet-in {from {transform: translateY(28px); opacity: .5;} to {transform: none; opacity: 1;}}
.xm4 .xmf-sheet-grip {flex: none; width: 44px; height: 5px; margin: 10px auto 0; border-radius: 3px; background: var(--xm4-line);}
.xm4 .xmf-sheet-head {flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px 12px 20px;}
.xm4 .xmf-sheet-title {margin: 0; font-size: 19px; font-weight: 750; line-height: 1.25; letter-spacing: -.01em; color: var(--xm4-text);}
.xm4 .xmf-sheet-close {flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--xm4-soft); color: var(--xm4-text); font-size: 18px; cursor: pointer;}
.xm4 .xmf-sheet-close:hover {background: var(--xm4-line);}
.xm4 .xmf-sheet-close:focus-visible {outline: 3px solid var(--xmfs-accent); outline-offset: 2px;}
.xm4 .xmf-sheet-body {display: grid; gap: 12px; align-content: start; min-height: 0; padding: 0 16px calc(20px + env(safe-area-inset-bottom, 0px)); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;}
@media (min-width: 640px) {
  .xm4 dialog.xmf-sheet {inset: 0; margin: auto; border-radius: 20px; max-height: min(80dvh, 760px);}
  .xm4 .xmf-sheet-grip {display: none;}
}
/* Rail cards the Steps layout moves into the sheet keep their full size there. */
.xm4 .xmf-sheet-body .xmf-rail-sections {display: block;}

/* ---------- big choices on real radios ---------- */
.xm4 .xmf-seg {display: flex; flex-flow: row wrap; gap: 10px;}
.xm4 .xmf-seg > label {position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 96px; min-height: 48px; margin: 0; padding: 8px 20px; border: 2px solid var(--xm4-line); border-radius: 12px; background: var(--xm4-surface); color: var(--xm4-ink-2); font-size: 15px; font-weight: 600; line-height: 1.25; text-align: center; cursor: pointer; transition: border-color .12s ease, background-color .12s ease, color .12s ease; -webkit-tap-highlight-color: transparent;}
/* The input stays in the page (1px, see-through) so the keyboard, screen readers and validation still find it. */
.xm4 .xmf-seg > label > input {position: absolute; top: 50%; left: 50%; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none;}
.xm4 .xmf-seg > label:hover {border-color: color-mix(in srgb, var(--xmfs-accent) 45%, var(--xm4-line));}
.xm4 .xmf-seg > label:has(> input:checked) {border-color: var(--xmfs-accent); background: var(--xmfs-tint); color: var(--xmfs-accent-ink); box-shadow: inset 0 0 0 1px var(--xmfs-accent);}
.xm4 .xmf-seg > label:has(> input:focus-visible) {outline: 3px solid var(--xmfs-accent); outline-offset: 2px;}
.xm4 .xmf-seg > label:has(> input:disabled) {opacity: .55; cursor: not-allowed;}
@media (max-width: 480px) {
  .xm4 .xmf-seg > label {flex: 1 1 0; min-width: 0;}
}

/* ---------- question groups ---------- */
.xm4 .xmf-group {min-width: 0; margin: 32px 0 0; padding: 0; border: 0;}
.xm4 .xmf-group.xmf-group-first {margin-top: 0;}
.xm4 .xmf-group > .xmf-group-title {display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 0; font-size: 13.5px; font-weight: 700; line-height: 1.3; letter-spacing: .01em; color: var(--xmfs-accent-ink);}
.xm4 .xmf-group > .xmf-group-title::after {content: ""; flex: 1 1 auto; height: 1px; background: color-mix(in srgb, var(--xmfs-accent) 24%, var(--xm4-line));}
/* A group with no name (the page had a plain rule there) keeps a plain rule. */
.xm4 .xmf-group:not(.xmf-group-first):not(:has(> .xmf-group-title)) {margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--xm4-line);}
/* Cards: each group its own box. The page should drop the box it drew around the whole step (see CIPOP's portal.css). */
.xm4 .xmf-groups-cards .xmf-group {margin-top: 16px; padding: 22px 24px 24px; border: 1px solid var(--xm4-line); border-radius: 16px; background: var(--xm4-surface); box-shadow: 0 1px 2px rgba(15, 23, 42, .05);}
.xm4 .xmf-groups-cards .xmf-group.xmf-group-first {margin-top: 0;}
.xm4 .xmf-groups-cards .xmf-group:not(.xmf-group-first):not(:has(> .xmf-group-title)) {margin-top: 16px; padding-top: 22px; border-top: 1px solid var(--xm4-line);}
.xm4 .xmf-groups-cards .xmf-group > .xmf-group-title {margin-bottom: 18px; font-size: 16.5px; letter-spacing: -.01em; color: var(--xm4-text);}
.xm4 .xmf-groups-cards .xmf-group > .xmf-group-title::after {display: none;}
@media (max-width: 600px) {
  .xm4 .xmf-groups-cards .xmf-group {padding: 18px 16px 20px; border-radius: 14px;}
}

/* ---------- the Steps layout's "All steps" button: only where the Sections card is hidden ---------- */
.xm4 .xmf-steps-rail .xmf-rail-allsteps {display: none;}
@container xmf-steps (max-width: 860px) {
  .xm4 .xmf-steps-rail .xmf-rail-allsteps {display: inline-flex;}
  .xm4 .xmf-rail-progress:has(.xmf-rail-allsteps) {grid-template-columns: 44px minmax(0, 1fr) auto;}
}

@media (prefers-reduced-motion: reduce) {
  .xm4 dialog.xmf-sheet[open] {animation: none;}
  .xm4 .xmf-mbar-track > span, .xm4 .xmf-seg > label {transition: none;}
}
@media print {
  .xm4 .xmf-mbar, .xm4 dialog.xmf-sheet {display: none !important;}
  .xm4 .xmf-groups-cards .xmf-group {border: 0; padding: 0; box-shadow: none;}
}
