/* AllCare SIL Referral form — page-specific styles.
   Extends the shared design tokens + .wizard system in style.css.
   Loaded only on /refer via head_extra. */

.refer-wrap { max-width: 860px; margin: 0 auto; padding: clamp(1.4rem, 4vw, 2.6rem) clamp(1.1rem, 4vw, 1.5rem) 4rem; }
.refer-meta { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; align-items: center; font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 1.4rem; }
.refer-meta .pill { background: var(--cream-deep); border-radius: 99px; padding: 0.35rem 0.9rem; font-weight: 600; font-size: 0.82rem; }

/* Stepper / progress indicator */
.stepper { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1.2rem; padding: 0; }
.stepper li { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); background: var(--cream-deep); border-radius: 99px; padding: 0.3rem 0.7rem; opacity: 0.65; }
.stepper li.is-current { background: var(--ink); color: var(--cream); opacity: 1; }
.stepper li.is-done { background: var(--teal); color: var(--cream); opacity: 1; }
.stepper li.is-done::before { content: "\2713 "; }

/* Fieldset legends already styled via .wizard__step legend */
.step-intro { color: var(--ink-soft); font-size: 1rem; margin: -0.4rem 0 1.4rem; max-width: 46rem; }

/* Field helper text + errors */
.fld .hint { font-weight: 400; font-size: 0.82rem; color: var(--ink-soft); margin-top: -0.1rem; }
.fld .err { color: #9a1b2f; font-size: 0.84rem; font-weight: 600; display: none; }
.fld.has-error .err { display: block; }
.fld.has-error input, .fld.has-error select, .fld.has-error textarea { border-color: #9a1b2f; box-shadow: 0 0 0 2px rgba(154,27,47,0.14); }
.fld textarea { min-height: 6.5rem; resize: vertical; }
.fld .count { font-size: 0.76rem; color: var(--ink-soft); text-align: right; }

/* Radio / checkbox stacks reuse .opt-card grid */
.opt-stack { display: grid; gap: 0.6rem; }
.opt-stack.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .opt-stack.cols-2 { grid-template-columns: 1fr; } }
.opt-card--sm { padding: 0.85rem 1rem; }
.opt-card--sm .opt-card__t { font-size: 0.96rem; }

/* Consent rows */
.consent-row { display: flex; gap: 0.8rem; align-items: flex-start; background: #fff; border: 1px solid rgba(35,44,73,0.18); border-radius: 14px; padding: 1rem 1.1rem; }
.consent-row input[type="checkbox"] { width: 22px; height: 22px; margin-top: 0.15rem; flex: none; accent-color: var(--ink); }
.consent-row label { font-weight: 500; font-size: 0.95rem; line-height: 1.45; margin: 0; }
.consent-row.has-error { border-color: #9a1b2f; box-shadow: 0 0 0 2px rgba(154,27,47,0.12); }

/* Signature component */
.sig { background: #fff; border: 1px solid rgba(35,44,73,0.2); border-radius: 14px; padding: 1rem; }
.sig__tabs { display: flex; gap: 0.5rem; margin-bottom: 0.8rem; }
.sig__tab { font: inherit; font-size: 0.85rem; font-weight: 600; border: 1px solid rgba(35,44,73,0.25); background: var(--cream); color: var(--ink); border-radius: 99px; padding: 0.4rem 1rem; cursor: pointer; }
.sig__tab[aria-selected="true"] { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.sig__pad-wrap { position: relative; }
.sig__pad { width: 100%; height: 180px; border: 2px dashed rgba(35,44,73,0.3); border-radius: 12px; background: repeating-linear-gradient(0deg, transparent, transparent 178px, rgba(35,44,73,0.25) 178px, rgba(35,44,73,0.25) 179px); touch-action: none; cursor: crosshair; display: block; }
.sig__hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); color: var(--ink-soft); font-size: 0.9rem; pointer-events: none; }
.sig__typed { width: 100%; font-size: 1.6rem; font-family: "Segoe Script", "Snell Roundhand", cursive; padding: 0.9rem 1rem; border: 1px solid rgba(35,44,73,0.22); border-radius: 12px; }
.sig__actions { display: flex; gap: 0.6rem; margin-top: 0.7rem; }
.sig__btn { font: inherit; font-size: 0.82rem; font-weight: 600; border: 1px solid rgba(35,44,73,0.25); background: var(--cream); color: var(--ink); border-radius: 99px; padding: 0.35rem 0.9rem; cursor: pointer; }
.sig__btn:hover { background: var(--cream-deep); }
.sig[hidden] { display: none; }

/* Upload dropzones */
.uploads { display: grid; gap: 1.1rem; }
.upslot { background: #fff; border: 1px solid rgba(35,44,73,0.16); border-radius: 16px; padding: 1.1rem 1.2rem; }
.upslot__head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.upslot__label { font-weight: 600; font-size: 0.98rem; }
.upslot__status { font: inherit; font-size: 0.8rem; border: 1px solid rgba(35,44,73,0.25); border-radius: 99px; padding: 0.3rem 0.7rem; background: var(--cream); color: var(--ink); }
.dropzone { border: 2px dashed rgba(35,44,73,0.3); border-radius: 12px; padding: 1.3rem; text-align: center; color: var(--ink-soft); font-size: 0.9rem; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--amber-deep); background: rgba(85,97,140,0.06); color: var(--ink); }
.dropzone b { color: var(--amber-deep); text-decoration: underline; }
.dropzone.is-disabled { opacity: 0.5; pointer-events: none; }
.filelist { list-style: none; margin: 0.8rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.filelist li { display: flex; align-items: center; gap: 0.7rem; background: var(--cream); border-radius: 10px; padding: 0.55rem 0.75rem; font-size: 0.86rem; }
.filelist .fmeta { flex: 1; min-width: 0; }
.filelist .fname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filelist .fsize { color: var(--ink-soft); font-size: 0.78rem; }
.filelist .fbar { height: 4px; background: rgba(35,44,73,0.15); border-radius: 99px; overflow: hidden; margin-top: 0.3rem; }
.filelist .fbar span { display: block; height: 100%; background: var(--teal); width: 0; transition: width 0.3s; }
.filelist .fremove, .filelist .fview { font: inherit; font-size: 0.78rem; font-weight: 600; border: none; background: none; cursor: pointer; padding: 0.2rem 0.4rem; border-radius: 6px; }
.filelist .fremove { color: #9a1b2f; }
.filelist .fview { color: var(--amber-deep); }
.filelist .fremove:hover, .filelist .fview:hover { background: rgba(35,44,73,0.06); }
.upslot .err { color: #9a1b2f; font-size: 0.82rem; font-weight: 600; margin-top: 0.5rem; }

/* Review screen */
.review-group { background: #fff; border: 1px solid rgba(35,44,73,0.14); border-radius: 16px; padding: 1.2rem 1.3rem; margin-bottom: 1rem; }
.review-group__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.7rem; }
.review-group__head h3 { font-size: 1.1rem; }
.review-edit { font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--amber-deep); background: none; border: none; cursor: pointer; text-decoration: underline; }
.review-dl { display: grid; grid-template-columns: minmax(9rem, 34%) 1fr; gap: 0.4rem 1rem; margin: 0; font-size: 0.9rem; }
.review-dl dt { color: var(--ink-soft); }
.review-dl dd { margin: 0; font-weight: 500; word-break: break-word; }
.review-dl .muted { color: var(--ink-soft); font-weight: 400; font-style: italic; }
@media (max-width: 540px) { .review-dl { grid-template-columns: 1fr; gap: 0.1rem 0; } .review-dl dd { margin-bottom: 0.6rem; } }
.privacy-notice { background: var(--cream-deep); border-radius: 14px; padding: 1.1rem 1.2rem; font-size: 0.86rem; color: var(--ink-soft); line-height: 1.5; margin: 1rem 0; }
.privacy-notice h4 { color: var(--ink); font-size: 0.95rem; margin-bottom: 0.4rem; }

/* Save + status bar */
.save-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin-top: 1.2rem; font-size: 0.85rem; color: var(--ink-soft); }
.save-bar .save-status { display: inline-flex; align-items: center; gap: 0.4rem; }
.save-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.save-bar button { font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--amber-deep); background: none; border: none; cursor: pointer; text-decoration: underline; }

/* Global form banner (errors / offline / retry) */
.form-banner { border-radius: 12px; padding: 0.9rem 1.1rem; font-size: 0.9rem; font-weight: 500; margin-bottom: 1.2rem; display: none; }
.form-banner[data-kind="error"] { display: block; background: #fbe9ec; color: #7a1526; border: 1px solid #e3a9b3; }
.form-banner[data-kind="info"] { display: block; background: rgba(85,97,140,0.1); color: var(--ink); border: 1px solid rgba(85,97,140,0.3); }
.form-banner[data-kind="warn"] { display: block; background: #fdf3e0; color: #7a5312; border: 1px solid #e6cf9a; }

/* Success screen */
.success { text-align: center; max-width: 620px; margin: 0 auto; padding: 2rem 1rem; }
.success__badge { width: 76px; height: 76px; border-radius: 50%; background: var(--teal); color: var(--cream); display: grid; place-items: center; font-size: 2.4rem; margin: 0 auto 1.4rem; }
.success__ref { display: inline-block; font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; letter-spacing: 0.06em; background: var(--cream-deep); border-radius: 12px; padding: 0.7rem 1.3rem; margin: 1rem 0; }
.success ul { text-align: left; max-width: 460px; margin: 1.4rem auto; color: var(--ink-soft); font-size: 0.92rem; line-height: 1.6; }

/* Screen-reader only + a11y */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wizard__step:focus { outline: none; }

/* Spinner */
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(246,247,251,0.4); border-top-color: currentColor; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; margin-right: 0.5rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .wizard__step.is-active { animation: none; }
  .spin { animation-duration: 1.4s; }
}
