/**
 * Family (guardian-first) Apply Now wizard — kids program. English, left to right.
 * Markup: resources/views/frontend/contact/partials/family-wizard.blade.php
 * Script: public/assets/oxford/js/wizard-family.js
 * Uses the registration page's design tokens (--ink, --gold, --rule, --paper, ...).
 */

#family-wizard-card {
    --fw-ok: #1a7f37;   --fw-ok-bg: #e7f6ec;
    --fw-warn: #8a5a00; --fw-warn-bg: #fff4d6;
    --fw-bad: #b42318;  --fw-bad-bg: #fdecea;
    --fw-ease-out: cubic-bezier(.2, .8, .2, 1);
    display: none;
    margin-top: 32px;
    direction: ltr;
    text-align: left;
}
#family-wizard-card.visible { display: block; }
#family-wizard-card [hidden] { display: none !important; }

/* ---------- Progress rail ---------- */
.fw-rail-wrap { position: relative; padding: 28px 40px 0; }
.fw-counter { margin: 0; font-size: .95rem; font-weight: 600; color: var(--ink-soft); }
.fw-track { position: relative; }
.fw-rail { position: absolute; left: 18px; right: 18px; top: 17px; height: 3px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.fw-rail-fill { display: block; height: 100%; background: var(--gold); transform-origin: left center; transform: scaleX(0); transition: transform .45s var(--fw-ease-out); }
.fw-steps { position: relative; display: flex; justify-content: space-between; list-style: none; margin: 0; padding: 0; }
.fw-steps li { display: flex; }
.fw-step {
    display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 44px; min-height: 44px;
    padding: 0; border: 0; background: transparent; color: var(--ink-3); font-weight: 600; font-size: .9rem;
}
.fw-step:disabled { cursor: default; opacity: 1; }
.fw-step.done { cursor: pointer; color: var(--ink); }
.fw-step .fw-num {
    width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--paper); border: 2px solid var(--rule); font-variant-numeric: tabular-nums;
    transition: background-color .25s ease, border-color .25s ease, color .25s ease, transform .25s var(--fw-ease-out);
}
.fw-step.active { color: var(--ink); }
.fw-step.active .fw-num { border-color: var(--ink); background: var(--gold); color: var(--ink); transform: scale(1.08); }
.fw-step.done .fw-num { border-color: var(--ink); background: var(--ink); color: var(--gold); }
.fw-step.done:hover .fw-num { box-shadow: 0 0 0 4px var(--gold-soft); }
.fw-step:focus-visible { outline: none; }
.fw-step:focus-visible .fw-num { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Panes ---------- */
.fw-pane { display: none; will-change: transform, opacity; }
.fw-pane.active { display: block; }
.fw-step-title { font-family: var(--font-display, inherit); font-size: 1.6rem; font-weight: 600; color: var(--ink); margin: 0 0 6px; }
.fw-step-title:focus { outline: none; }
.fw-step-lead { margin: 0 0 24px; color: var(--ink-soft); font-size: 1rem; line-height: 1.6; max-width: 62ch; }

/* ---------- Cards, grid, fields ---------- */
.fw-card { border: 1px solid var(--rule); border-radius: var(--r-md); padding: 22px; margin-bottom: 20px; background: var(--paper); }
.fw-card--flat { background: var(--surface, #f8fafc); }
.fw-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.fw-card-title { font-weight: 700; font-size: 1.1rem; color: var(--ink); margin: 0; display: flex; align-items: center; gap: 8px; }
.fw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.fw-grid .fw-span { grid-column: 1 / -1; }
.fw-field { min-width: 0; margin-bottom: 0; }
.fw-pane > .fw-field, .fw-card > .fw-field { margin-top: 18px; }
#family-wizard-card .form-label { font-weight: 600; color: var(--ink); margin-bottom: 6px; display: block; }
#family-wizard-card .form-control { min-height: 46px; text-align: left; }
#family-wizard-card .form-control[dir="rtl"] { text-align: right; }
.fw-req { color: var(--fw-bad); }
.fw-opt { color: var(--ink-3); font-weight: 500; }
.fw-hint { margin-top: 6px; font-size: .88rem; color: var(--ink-soft); line-height: 1.5; }

/* Inline errors: icon + text (never colour alone), announced via role="alert". */
#family-wizard-card .is-invalid { border-color: var(--fw-bad) !important; box-shadow: 0 0 0 3px rgba(180, 35, 24, .15) !important; }
.fw-field-error {
    display: flex; align-items: flex-start; gap: 6px; margin-top: 6px;
    color: var(--fw-bad); font-size: .88rem; font-weight: 600; line-height: 1.4;
    animation: fw-error-in .2s var(--fw-ease-out);
}
.fw-field-error .bi { margin-top: 2px; }
@keyframes fw-error-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.fw-toggle { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 3px; background: var(--surface, #f8fafc); }
.fw-toggle button { min-height: 40px; border: 0; background: transparent; padding: 0 18px; border-radius: 999px; font-weight: 600; color: var(--ink-soft); transition: background-color .2s ease, color .2s ease; }
.fw-toggle button.on { background: var(--ink); color: var(--gold); }
.fw-toggle button:focus-visible, .fw-levels button:focus-visible, .fw-remove:focus-visible, .fw-add:focus-visible, .fw-file:focus-visible {
    outline: 3px solid var(--gold); outline-offset: 2px;
}

.fw-remove { border: 0; background: transparent; color: var(--fw-bad); font-weight: 600; min-height: 40px; padding: 0 8px; }
.fw-add {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; margin-bottom: 20px;
    border: 2px dashed var(--rule); background: transparent; border-radius: var(--r-md); font-weight: 700; color: var(--ink);
    transition: border-color .2s ease, background-color .2s ease;
}
.fw-add:hover { border-color: var(--gold); background: var(--gold-soft); }
.fw-empty { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-sm); background: var(--fw-warn-bg); color: var(--fw-warn); font-weight: 600; line-height: 1.5; }

/* ---------- Enrollment path ---------- */
.fw-paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.fw-path {
    display: flex; align-items: flex-start; gap: 12px; min-height: 64px; padding: 14px 16px; text-align: left;
    background: var(--paper); border: 2px solid var(--rule); border-radius: var(--r-sm); cursor: pointer; color: var(--ink);
    transition: border-color .2s ease, background-color .2s ease;
}
.fw-path > .bi { font-size: 1.4rem; line-height: 1; margin-top: 2px; }
.fw-path b { display: block; font-size: 1rem; }
.fw-path small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: .88rem; }
.fw-path:hover { border-color: var(--gold); }
.fw-path:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.fw-path.selected { border-color: var(--ink); background: var(--gold-soft); }

.fw-levels { display: flex; flex-wrap: wrap; gap: 8px; }
.fw-levels button { min-width: 56px; min-height: 44px; border: 1px solid var(--rule); background: var(--paper); border-radius: var(--r-sm); font-weight: 700; color: var(--ink); }
.fw-levels button.on { background: var(--ink); color: var(--gold); border-color: var(--ink); }

/* ---------- Program cards (role="radio") ---------- */
.fw-programs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.fw-pcard {
    display: flex; flex-direction: column; overflow: hidden; cursor: pointer;
    background: var(--paper); border: 2px solid var(--rule); border-radius: var(--r-md);
    transition: border-color .2s ease, box-shadow .2s ease;
    touch-action: manipulation;
}
.fw-pcard:hover { border-color: var(--gold); box-shadow: 0 6px 20px rgba(0, 51, 102, .10); }
.fw-pcard:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.fw-pcard.is-selected { border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold-soft); }
.fw-pcard.is-disabled { cursor: not-allowed; box-shadow: none; }
.fw-pcard.is-disabled:hover { border-color: var(--rule); }
.fw-pcard.is-disabled .fw-pcard-media img { filter: grayscale(.85); opacity: .7; }

/* Reserved 16:9 box (no layout shift). !important beats the site-wide img { height:auto } rules.
   contain, not cover: program images are often logos or posters that must not be cropped. */
.fw-pcard-media { position: relative; aspect-ratio: 16 / 9; background: #f4f1ea; overflow: hidden; }
.fw-pcard-media img {
    position: absolute; inset: 0; width: 100% !important; height: 100% !important; max-width: none !important;
    object-fit: contain; padding: 10px; box-sizing: border-box; display: block;
}
.fw-pcard-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 3rem; color: var(--ink-3); }
.fw-pcard-status {
    position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.fw-pcard-status.is-open { background: var(--fw-ok-bg); color: var(--fw-ok); }
.fw-pcard-status.is-upcoming { background: var(--fw-warn-bg); color: var(--fw-warn); }
.fw-pcard-status.is-ended { background: var(--fw-bad-bg); color: var(--fw-bad); }
.fw-pcard-check {
    position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem;
    background: var(--ink); color: var(--gold); opacity: 0; transform: scale(.6);
    transition: opacity .2s ease, transform .25s var(--fw-ease-out);
}
.fw-pcard.is-selected .fw-pcard-check { opacity: 1; transform: scale(1); }

.fw-pcard-body { padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 12px; flex: 1 1 auto; }
.fw-pcard-title { margin: 0; font-family: var(--font-display, inherit); font-size: 1.3rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.fw-pcard-desc { margin: 0; color: var(--ink-soft); font-size: .95rem; line-height: 1.6; }
.fw-pcard-window { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-soft); }
.fw-pcard-window .bi { color: var(--ink-3); }
.fw-pcard-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 0; padding: 14px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.fw-pcard-details > div { min-width: 0; }
.fw-pcard-details dt { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; color: var(--ink-3); margin: 0; }
.fw-pcard-details dd { margin: 3px 0 0; font-size: .95rem; font-weight: 600; color: var(--ink); line-height: 1.45; overflow-wrap: anywhere; text-align: left; }
.fw-pcard-fees { background: var(--surface, #f8fafc); border-radius: var(--r-sm); padding: 12px 14px; }
.fw-pcard-fees ul { list-style: none; margin: 6px 0 0; padding: 0; }
.fw-pcard-fees li { display: flex; justify-content: space-between; font-size: .9rem; color: var(--ink-soft); padding: 2px 0; }
.fw-pcard-fee-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 700; color: var(--ink); }
.fw-pcard-fee-head b { font-size: 1.15rem; }
.fw-pcard-min { font-size: .85rem; color: var(--ink-soft); margin-top: 6px; }
.fw-pcard-foot {
    min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 8px; font-weight: 700; border-top: 1px solid var(--rule); color: var(--ink);
    transition: background-color .2s ease, color .2s ease;
}
.fw-pcard.is-selected .fw-pcard-foot { background: var(--ink); color: var(--gold); }
.fw-pcard.is-disabled .fw-pcard-foot { color: var(--ink-3); }

@media (min-width: 820px) {
    .fw-programs--single { grid-template-columns: 1fr; }
    .fw-programs--single .fw-pcard { display: grid; grid-template-columns: minmax(260px, 38%) 1fr; grid-template-rows: 1fr auto; }
    .fw-programs--single .fw-pcard-media { grid-row: 1 / 3; aspect-ratio: auto; min-height: 100%; }
    .fw-programs--single .fw-pcard-details { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .fw-programs--single .fw-pcard-foot { margin-top: 0; }
}

/* ---------- Fees, payments, allocation ---------- */
.fw-money { font-variant-numeric: tabular-nums; }
.fw-fee-child { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.fw-fee-child:first-child { padding-top: 0; }
.fw-fee-child-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 8px; color: var(--ink); }
.fw-fee-child-head span { color: var(--ink-soft); font-size: .92rem; }
.fw-fee-table { width: 100%; }
.fw-fee-table td { padding: 4px 0; color: var(--ink-soft); }
.fw-fee-table td small { display: block; font-size: .8rem; color: var(--ink-3); }
.fw-fee-table td:last-child { text-align: right; font-weight: 600; color: var(--ink); white-space: nowrap; }
.fw-fee-child-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: .92rem; color: var(--ink-soft); }
.fw-fee-child-foot b { color: var(--ink); }
.fw-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 1.15rem; padding: 14px 0 0; color: var(--ink); }


.fw-file {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 8px 14px; margin: 0;
    border: 1px dashed var(--rule); border-radius: var(--r-sm); cursor: pointer; background: var(--paper);
}
.fw-file input[type="file"] { display: none !important; }
.fw-file .fw-file-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); }
.fw-file.has-file { border-style: solid; border-color: var(--fw-ok); }
.fw-file.has-file .fw-file-name { color: var(--fw-ok); font-weight: 600; }
.fw-file .fw-file-btn { flex: 0 0 auto; font-weight: 700; color: var(--ink); white-space: nowrap; }

.fw-alloc-status { display: flex; gap: 8px; align-items: center; margin-top: 12px; padding: 10px 14px; border-radius: var(--r-sm); font-weight: 600; }
.fw-alloc-status.is-bad { background: var(--fw-bad-bg); color: var(--fw-bad); }
.fw-alloc-status.is-ok { background: var(--fw-ok-bg); color: var(--fw-ok); }

/* ---------- Review ---------- */
.fw-review-block { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.fw-review-block h6 { margin: 0 0 4px; font-weight: 700; color: var(--ink); font-size: 1rem; }
.fw-review-block p { margin: 0; color: var(--ink); line-height: 1.55; }
.fw-review-block p span[lang="ar"] { margin-left: 8px; color: var(--ink-soft); }
.fw-muted { color: var(--ink-soft) !important; font-size: .92rem; }
.fw-agree { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-weight: 600; color: var(--ink); }
.fw-agree input { width: 22px; height: 22px; margin: 2px 0 0 !important; flex: 0 0 auto; }

/* ---------- Footer ---------- */
.fw-footer { display: flex; justify-content: space-between; gap: 12px; }
.fw-footer #fw-next { margin-left: auto; }
.fw-footer button[aria-busy="true"] { cursor: progress; opacity: .7; }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
    .fw-rail-wrap { padding: 20px 16px 0; }
    .fw-step .fw-label { display: none; }
    .fw-grid { grid-template-columns: 1fr; }
    .fw-step-title { font-size: 1.35rem; }
}
@media (max-width: 480px) {
    .fw-pcard-details { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .fw-rail-fill, .fw-step .fw-num, .fw-pcard, .fw-pcard-check, .fw-pcard-foot, .fw-path, .fw-toggle button, .fw-add { transition: none; }
    .fw-field-error { animation: none; }
}

/* ---------- Rail header: counter + sound toggle ---------- */
.fw-rail-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.fw-sound {
    display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px;
    border: 1px solid var(--rule); background: var(--paper); color: var(--ink-soft); font-size: .85rem; font-weight: 600;
}
.fw-sound[aria-pressed="true"] { color: var(--ink); border-color: var(--gold); background: var(--gold-soft); }
.fw-sound:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.fw-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Avatars tie every block to its child ---------- */
.fw-avatar {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--gold);
    font-weight: 700; font-size: 1rem; line-height: 1;
}
.fw-avatar--sm { width: 26px; height: 26px; font-size: .8rem; }

/* ---------- Vertical rhythm inside a child's program card ---------- */
.fw-card--program { padding: 26px; }
.fw-block + .fw-block { margin-top: 28px; padding-top: 24px; border-top: 1px dashed var(--rule); }
.fw-block > .form-label { margin-bottom: 12px !important; }
.fw-section-title { font-weight: 700; font-size: 1.15rem; color: var(--ink); margin: 28px 0 4px; }
.fw-section-hint { margin: 0 0 16px; }

/* ---------- Placement calendar ---------- */
.fw-cal-wrap { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }
.fw-cal { border: 1px solid var(--rule); border-radius: var(--r-md); padding: 16px; background: var(--paper); }
.fw-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.fw-cal-head b { font-weight: 700; color: var(--ink); }
.fw-cal-nav {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
    display: inline-flex; align-items: center; justify-content: center; transition: background-color .2s ease, border-color .2s ease;
}
.fw-cal-nav:hover:not(:disabled) { border-color: var(--gold); background: var(--gold-soft); }
.fw-cal-nav:disabled { opacity: .35; cursor: default; }
.fw-cal-dow, .fw-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.fw-cal-dow span { text-align: center; font-size: .75rem; font-weight: 600; color: var(--ink-3); padding: 4px 0; }
.fw-cal-day {
    position: relative; aspect-ratio: 1 / 1; min-height: 40px; border: 0; border-radius: 50%; background: transparent;
    color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums;
    transition: background-color .2s ease, color .2s ease, transform .2s var(--fw-ease-out);
}
.fw-cal-day:disabled { cursor: default; opacity: .45; }
.fw-cal-day.is-available { color: var(--ink); background: var(--gold-soft); cursor: pointer; }
.fw-cal-day.is-available::after {
    content: ""; position: absolute; left: 50%; bottom: 6px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--gold);
}
.fw-cal-day.is-available:hover { background: var(--gold); }
.fw-cal-day.is-today { box-shadow: inset 0 0 0 2px var(--rule); }
.fw-cal-day.is-selected { background: var(--ink) !important; color: var(--gold); transform: scale(1.06); }
.fw-cal-day.is-selected::after { background: var(--gold); }
.fw-cal-day:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.fw-cal-legend { margin-top: 10px; font-size: .8rem; color: var(--ink-soft); }
.fw-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-right: 4px; vertical-align: middle; }

.fw-times { min-width: 0; }
.fw-times-date { font-family: var(--font-display, inherit); font-size: 1.2rem; font-weight: 600; color: var(--ink); margin: 0 0 14px; }
.fw-time-list { display: flex; flex-wrap: wrap; gap: 10px; }
.fw-time {
    display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 999px;
    border: 2px solid var(--rule); background: var(--paper); color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums;
    transition: border-color .2s ease, background-color .2s ease;
}
.fw-time:hover { border-color: var(--gold); }
.fw-time.on { border-color: var(--ink); background: var(--ink); color: var(--gold); }
.fw-time:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.fw-times-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 220px; padding: 20px;
    text-align: center; color: var(--ink-soft); border: 2px dashed var(--rule); border-radius: var(--r-md);
}
.fw-times-empty .bi { font-size: 2rem; color: var(--gold); }

/* ---------- Payments grouped per child ---------- */
.fw-paygroup { border-width: 2px; }
.fw-paygroup-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--rule); }
.fw-paygroup-who { flex: 1 1 220px; min-width: 0; }
.fw-paygroup-who h5 { margin: 0; font-weight: 700; font-size: 1.15rem; color: var(--ink); }
.fw-paygroup-who p { margin: 2px 0 0; color: var(--ink-soft); font-size: .9rem; }
.fw-paygroup-meter { flex: 0 1 220px; display: flex; flex-direction: column; gap: 6px; text-align: right; font-size: .9rem; color: var(--ink-soft); }
.fw-paygroup-meter b { color: var(--ink); }
.fw-meter { display: block; height: 6px; border-radius: 6px; background: var(--rule); overflow: hidden; }
.fw-meter span { display: block; height: 100%; background: var(--gold); transform-origin: left center; transition: transform .35s var(--fw-ease-out), background-color .2s ease; }
.fw-paygroup-meter.is-ok .fw-meter span { background: var(--fw-ok); }
.fw-paygroup-meter.is-over .fw-meter span { background: var(--fw-bad); }
.fw-paygroup-meter.is-over b { color: var(--fw-bad); }

.fw-pay { padding: 18px; border-radius: var(--r-md); background: var(--surface, #f8fafc); margin-bottom: 14px; }
.fw-pay-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.fw-pay-head h6 { margin: 0; font-weight: 700; color: var(--ink); font-size: 1rem; }
.fw-pay .fw-block + .fw-block { border-top: 0; padding-top: 0; margin-top: 18px; }
.fw-add--inline { margin: 0; min-height: 48px; }

/* Method tiles show the logo stored for each payment method. */
.fw-methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 12px; }
.fw-method {
    position: relative; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px; text-align: left;
    border: 2px solid var(--rule); border-radius: var(--r-md); background: var(--paper); color: var(--ink);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.fw-method:hover { border-color: var(--gold); }
.fw-method:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.fw-method.on { border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold-soft); }
.fw-method-logo {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; overflow: hidden; background: #fff;
    display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--rule); font-size: 1.3rem; color: var(--ink);
}
.fw-method-logo img { width: 100% !important; height: 100% !important; object-fit: contain; padding: 4px; box-sizing: border-box; }
.fw-method-name { font-weight: 700; line-height: 1.3; }
.fw-method-check {
    position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--gold);
    display: inline-flex; align-items: center; justify-content: center; font-size: .8rem;
    opacity: 0; transform: scale(.5); transition: opacity .2s ease, transform .25s var(--fw-ease-out);
}
.fw-method.on .fw-method-check { opacity: 1; transform: scale(1); }

/* Transfer details: one row per credential with its own copy button. */
.fw-creds { margin-top: 14px; border-radius: var(--r-md); background: var(--ink); color: #fff; padding: 16px; }
.fw-creds-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-weight: 700; color: var(--gold); font-size: .95rem; }
.fw-cred { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.fw-cred:first-of-type { border-top: 0; }
.fw-cred-icon { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; background: rgba(255, 255, 255, .1); display: inline-flex; align-items: center; justify-content: center; color: var(--gold); }
.fw-cred-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.fw-cred-text small { color: rgba(255, 255, 255, .7); font-size: .78rem; }
.fw-cred-text b { font-size: 1.02rem; letter-spacing: .02em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; color: #fff; }
.fw-copy {
    position: relative; overflow: hidden; flex: 0 0 auto; min-width: 96px; min-height: 40px; padding: 0 14px;
    border-radius: 999px; border: 1px solid var(--gold); background: transparent; color: var(--gold); font-weight: 700; font-size: .85rem;
    isolation: isolate;
}
.fw-copy-fill { position: absolute; inset: 0; z-index: -1; background: var(--gold); transform: scaleX(0); transform-origin: left center; }
.fw-copy-label { position: relative; display: inline-flex; align-items: center; gap: 6px; transition: color .2s ease; }
.fw-copy:hover { background: rgba(255, 204, 0, .12); }
.fw-copy:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.fw-copy.is-copied { color: var(--ink); }
.fw-copy.is-copied .fw-copy-fill { animation: fw-copy-fill .45s cubic-bezier(.2, .8, .2, 1) forwards; }
.fw-copy.is-copied .fw-copy-label { animation: fw-copy-pop .3s .2s var(--fw-ease-out) both; }
@keyframes fw-copy-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fw-copy-pop { 0% { transform: scale(.85); } 100% { transform: scale(1); } }

/* ---------- Summary ---------- */
.fw-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.fw-summary > div { padding: 14px; border-radius: var(--r-sm); background: var(--paper); border: 1px solid var(--rule); }
.fw-summary dt { font-size: .82rem; font-weight: 600; color: var(--ink-3); margin: 0 0 4px; }
.fw-summary dd { margin: 0; font-size: 1.2rem; font-weight: 700; color: var(--ink); }

@media (max-width: 760px) {
    .fw-cal-wrap { grid-template-columns: 1fr; }
    .fw-summary { grid-template-columns: 1fr; }
    .fw-paygroup-meter { flex-basis: 100%; text-align: left; }
}
@media (max-width: 420px) {
    .fw-cred { flex-wrap: wrap; }
    .fw-copy { margin-left: 48px; }
}
@media (prefers-reduced-motion: reduce) {
    .fw-cal-day, .fw-time, .fw-method, .fw-method-check, .fw-meter span, .fw-copy-label { transition: none; }
    .fw-copy.is-copied .fw-copy-fill { animation: none; transform: scaleX(1); }
    .fw-copy.is-copied .fw-copy-label { animation: none; }
}

/* Receipt label while the image is prepared (fill comes from wizard-fx.css). */
.fw-spin { display: inline-block; animation: fw-spin .9s linear infinite; }
@keyframes fw-spin { to { transform: rotate(360deg); } }
.fw-file.fx-filling { border-style: solid; border-color: var(--gold); }
@media (prefers-reduced-motion: reduce) { .fw-spin { animation: none; } }
