/* HH HR Forms, employee pages. Ink on #F7F7F8, white cards, brand yellow only
   for progress, focus and the primary button. Mobile first, light only: a
   store kiosk and a laptop in dark mode show the same page. No blur behind
   the bars and no endless animation except a spinner while it spins; both
   kept the compositor busy after every step change. */

:root {
  --ink: #0A0A0A;
  --on-yellow: #0A0A0A;
  --yellow: #FEDD00;
  --yellow-press: #E5C700;
  --yellow-halo: rgba(254, 221, 0, 0.55);
  --page: #F7F7F8;
  --card: #FFFFFF;
  --sunken: #FAFAFA;
  --zinc-800: #27272A;
  --zinc-700: #3F3F46;
  --zinc-500: #71717A;
  --zinc-400: #A1A1AA;
  --zinc-300: #D4D4D8;
  --zinc-200: #E4E4E7;
  --zinc-100: #F4F4F5;
  --danger: #B91C1C;
  --danger-soft: #FEF2F2;
  --ok: #15803D;
  --overlay: rgba(10, 10, 10, 0.5);

  --radius-card: 20px;
  --radius-field: 14px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(10, 10, 10, 0.04), 0 8px 24px -12px rgba(10, 10, 10, 0.10), 0 24px 48px -32px rgba(10, 10, 10, 0.14);
  --shadow-pop: 0 2px 6px rgba(10, 10, 10, 0.06), 0 18px 40px -12px rgba(10, 10, 10, 0.25);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --gutter: 16px;
  --rail: 264px;
  --actions-h: 84px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.hhf-body {
  margin: 0;
  min-height: 100dvh;
  background: var(--page);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

.hhf-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hhf-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ------------------------------------------------------------------ top bar */

.hhf-top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: var(--page);
  border-bottom: 1px solid var(--zinc-200);
}

.hhf-top__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 10px var(--gutter);
  min-height: 64px;
}

.hhf-logo { display: block; height: 40px; width: auto; max-width: 160px; object-fit: contain; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 700; line-height: 36px; white-space: nowrap; text-overflow: ellipsis; }
.hhf-logo--text { flex: none; max-width: min(260px, 50vw); font-size: 15px; letter-spacing: -0.01em; }
.hhf-solo .hhf-logo--text { max-width: none; white-space: normal; line-height: 1.3; height: auto; font-size: 17px; }

/* Wraps instead of cutting the store's name short on a phone (sweep 2 D). */
.hhf-chip {
  margin: 0;
  min-width: 0;
  padding: 5px 12px;
  border-radius: 14px;
  background: var(--zinc-100);
  color: var(--zinc-700);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
/* On a phone the pill gets its own line under the logo and menu. */
@media (max-width: 559px) {
  .hhf-top__inner:has(.hhf-chip:not([hidden])) { flex-wrap: wrap; row-gap: 6px; }
  .hhf-top__inner:has(.hhf-chip:not([hidden]))::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
  .hhf-chip { order: 3; max-width: 100%; }
}

.hhf-saved {
  margin: 0 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--zinc-500);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  white-space: nowrap;
}
.hhf-saved.is-visible { opacity: 1; }
.hhf-saved.is-visible::before {
  content: "";
  width: 14px;
  height: 14px;
  background: var(--ok);
  -webkit-mask: var(--icon-check) center / contain no-repeat;
  mask: var(--icon-check) center / contain no-repeat;
}

.hhf-menu { position: relative; flex: none; }

.hhf-menu__button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--zinc-200);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.hhf-menu__dots, .hhf-menu__dots::before, .hhf-menu__dots::after {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.hhf-menu__dots { position: relative; }
.hhf-menu__dots::before, .hhf-menu__dots::after { content: ""; position: absolute; left: 0; }
.hhf-menu__dots::before { top: -7px; }
.hhf-menu__dots::after { top: 7px; }

.hhf-menu__list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  min-width: 280px;
  padding: 6px;
  border: 1px solid var(--zinc-200);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow-pop);
}

.hhf-menu__item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font: 500 15px/1.2 var(--font);
  text-align: left;
  cursor: pointer;
}
.hhf-menu__item:hover { background: var(--zinc-100); }
.hhf-menu__item--danger { color: var(--danger); }

/* ------------------------------------------------------------------ progress */

.hhf-progress { padding: 0 var(--gutter) 10px; max-width: 1160px; margin: 0 auto; }

.hhf-progress__bar {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--zinc-200);
  overflow: hidden;
}
.hhf-progress__bar span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--yellow);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.45s var(--ease);
}
.hhf-progress__label {
  margin: 8px 0 0;
  color: var(--zinc-500);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------------ layout */

.hhf-notice {
  max-width: 1160px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border-left: 4px solid var(--yellow);
  border-radius: var(--radius-field);
  background: var(--card);
  box-shadow: var(--shadow-card);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

@media (max-width: 1191px) {
  .hhf-notice { margin-left: var(--gutter); margin-right: var(--gutter); }
}

.hhf-layout {
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px var(--gutter) calc(var(--actions-h) + 32px + env(safe-area-inset-bottom));
}

.hhf-rail { display: none; }

.hhf-main { min-width: 0; outline: none; }

/* Loading, finished, timed out: one centered card, no rail beside it. */
.hhf-app:not([data-state="ready"]) .hhf-main { max-width: 720px; margin: 0 auto; }
.hhf-main > .hhf-card--solo { margin: 0 auto; }

.hhf-card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 24px 20px;
}
.hhf-card + .hhf-card, .hhf-card + .hhf-review, .hhf-review .hhf-card + .hhf-card { margin-top: 16px; }

.hhf-loading { display: flex; align-items: center; gap: 14px; color: var(--zinc-500); }
.hhf-loading p { margin: 0; }

.hhf-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--zinc-200);
  border-top-color: var(--ink);
  animation: hhf-spin 0.8s linear infinite;
}
@keyframes hhf-spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ step */

.hhf-step__eyebrow {
  margin: 0 0 8px;
  color: var(--zinc-500);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hhf-step__title {
  margin: 0;
  font-size: clamp(28px, 7vw, 40px);
  line-height: 1.12;
  font-weight: 750;
  letter-spacing: -0.022em;
  outline: none;
  text-wrap: balance;
}

.hhf-step__intro {
  margin: 12px 0 0;
  color: var(--zinc-700);
  font-size: 17px;
  line-height: 1.55;
  max-width: 60ch;
}

.hhf-step > .hhf-grid { margin-top: 28px; }

.hhf-welcome {
  margin: 20px 0 0;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--sunken);
  border: 1px solid var(--zinc-200);
  color: var(--zinc-700);
  font-size: 16px;
  line-height: 1.55;
}
.hhf-welcome > :first-child { margin-top: 0; }
.hhf-welcome > :last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ fields */

.hhf-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 22px 14px;
}
.hhf-w-full, .hhf-w-half { grid-column: span 6; }
.hhf-w-third { grid-column: span 3; }

@media (min-width: 560px) {
  .hhf-w-half { grid-column: span 3; }
  .hhf-w-third { grid-column: span 2; }
}

.hhf-field { min-width: 0; margin: 0; padding: 0; border: 0; }

.hhf-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 8px;
  padding: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.hhf-optional { color: var(--zinc-500); font-size: 13px; font-weight: 500; }

.hhf-option__help, .hhf-field > .hhf-help { white-space: pre-line; }
.hhf-help { margin: -2px 0 10px; color: var(--zinc-500); font-size: 14px; line-height: 1.45; }

.hhf-input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--zinc-300);
  border-radius: var(--radius-field);
  background: var(--card);
  color: var(--ink);
  font: 400 17px/1.3 var(--font);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.hhf-input::placeholder { color: var(--zinc-500); }
.hhf-input:hover { border-color: var(--zinc-400); }
.hhf-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px var(--yellow-halo); }
.hhf-input--area { min-height: 120px; padding: 14px 16px; resize: vertical; line-height: 1.5; }

.hhf-select {
  padding-right: 44px;
  background-image: var(--icon-chevron);
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px;
}

.is-invalid .hhf-input, .is-invalid .hhf-drop, .is-invalid .hhf-option { border-color: var(--danger); }
.is-invalid .hhf-input:focus { box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.18); }

.hhf-error {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}
.hhf-error::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  background: currentColor;
  -webkit-mask: var(--icon-alert) center / contain no-repeat;
  mask: var(--icon-alert) center / contain no-repeat;
}

.hhf-affix { position: relative; }
.hhf-affix__sign { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--zinc-500); font-size: 17px; pointer-events: none; }
.hhf-affix .hhf-input { padding-left: 32px; }

.hhf-group { grid-column: span 6; margin: 4px 0 0; padding: 0; border: 0; min-width: 0; }
.hhf-group__legend {
  margin: 0 0 14px;
  padding: 0;
  color: var(--zinc-500);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* On file: a secure value we will not send back to the browser. */
.hhf-onfile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 6px 6px 6px 16px;
  border: 1.5px dashed var(--zinc-300);
  border-radius: var(--radius-field);
  background: var(--sunken);
}
.hhf-onfile__value { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; font-variant-numeric: tabular-nums; }
.hhf-onfile__lock { width: 16px; height: 16px; background: var(--zinc-500); -webkit-mask: var(--icon-lock) center / contain no-repeat; mask: var(--icon-lock) center / contain no-repeat; }
.hhf-onfile__change {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--zinc-100);
  color: var(--ink);
  font: 600 14px/1 var(--font);
  cursor: pointer;
}

/* Locked: filled in by HR on an invite; shown, not editable. */
.hhf-locked {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 16px;
  border: 1.5px solid var(--zinc-200);
  border-radius: var(--radius-field);
  background: var(--sunken);
}
.hhf-locked__value { margin: 0; font-size: 16px; font-variant-numeric: tabular-nums; }
.hhf-locked__note { margin-top: 6px; }

/* Radio / checkbox cards */
.hhf-options { display: grid; gap: 10px; }

.hhf-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 56px;
  padding: 15px 16px;
  border: 1.5px solid var(--zinc-200);
  border-radius: 16px;
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.hhf-option:hover { border-color: var(--zinc-400); }
.hhf-option:has(.hhf-option__input:checked) { border-color: var(--ink); background: var(--sunken); }
.hhf-option:has(.hhf-option__input:focus-visible) { box-shadow: 0 0 0 4px var(--yellow-halo); border-color: var(--ink); }
.hhf-option:has(.hhf-option__input:disabled) { cursor: not-allowed; opacity: 0.55; }

.hhf-option__input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }

.hhf-option__mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border: 2px solid var(--zinc-300);
  border-radius: 50%;
  background: var(--card);
  transition: all 0.15s var(--ease);
}
.hhf-option__input[type="checkbox"] ~ .hhf-option__mark { border-radius: 7px; }
.hhf-option__input:checked ~ .hhf-option__mark { border-color: var(--ink); background: var(--ink); }
.hhf-option__input[type="radio"]:checked ~ .hhf-option__mark::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--card);
}
.hhf-option__input[type="checkbox"]:checked ~ .hhf-option__mark::after {
  content: "";
  width: 14px;
  height: 14px;
  background: var(--card);
  -webkit-mask: var(--icon-check) center / contain no-repeat;
  mask: var(--icon-check) center / contain no-repeat;
}

.hhf-option__text { display: grid; gap: 2px; min-width: 0; }
.hhf-option__label { font-size: 16px; font-weight: 600; line-height: 1.4; }
.hhf-option__help { color: var(--zinc-500); font-size: 14px; line-height: 1.45; }

/* Acknowledgments */
.hhf-ack {
  padding: 20px;
  border: 1px solid var(--zinc-200);
  border-radius: 18px;
  background: var(--sunken);
}
.hhf-ack__title { margin: 0 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.hhf-ack__panel {
  position: relative;
  max-height: 168px;
  margin: 12px 0 10px;
  padding: 16px 18px;
  overflow: auto;
  border: 1px solid var(--zinc-200);
  border-radius: 14px;
  background: var(--card);
  color: var(--zinc-700);
  font-size: 15px;
  line-height: 1.6;
  overscroll-behavior: contain;
  transition: max-height 0.3s var(--ease);
}
.hhf-ack__panel.is-expanded { max-height: 55vh; }
.hhf-ack__hint { margin: 0 0 4px; }
.hhf-ack__panel:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--yellow-halo); }
.hhf-ack__panel p { margin: 0 0 12px; }
.hhf-ack__panel p:last-child { margin-bottom: 0; }
.hhf-ack__toggle {
  min-height: 44px;
  margin: 0 0 12px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 15px/1 var(--font);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.hhf-ack__confirm { background: var(--card); }

/* Notes */
.hhf-note {
  padding: 16px 18px;
  border-left: 3px solid var(--zinc-300);
  border-radius: 4px 14px 14px 4px;
  background: var(--sunken);
  color: var(--zinc-700);
  font-size: 15px;
}
.hhf-note__title { margin: 0 0 6px; color: var(--ink); font-size: 16px; font-weight: 700; }
.hhf-note p { margin: 0 0 8px; }
.hhf-note p:last-child, .hhf-note__body > :last-child { margin-bottom: 0; }
.hhf-note__body > :first-child { margin-top: 0; }
.hhf-ack__panel ul, .hhf-ack__panel ol, .hhf-note ul, .hhf-note ol { margin: 0 0 12px; padding-left: 22px; }
.hhf-help a, .hhf-note a, .hhf-ack__panel a { color: inherit; text-underline-offset: 3px; }

/* Repeater */
.hhf-repeater { display: grid; gap: 14px; }
.hhf-rows { display: grid; gap: 14px; }
.hhf-row {
  padding: 18px;
  border: 1px solid var(--zinc-200);
  border-radius: 18px;
  background: var(--sunken);
}
.hhf-row__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.hhf-row__title { margin: 0; font-size: 17px; font-weight: 700; }
.hhf-row__remove {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--zinc-200);
  border-radius: 12px;
  background: var(--card);
  color: var(--danger);
  font: 600 14px/1 var(--font);
  cursor: pointer;
}

/* Uploads */
.hhf-upload { display: grid; gap: 12px; position: relative; }
.hhf-file__input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

.hhf-drop {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 96px;
  padding: 20px;
  border: 2px dashed var(--zinc-300);
  border-radius: 18px;
  background: var(--sunken);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.hhf-drop:hover, .hhf-drop.is-over { border-color: var(--ink); }
.hhf-upload:has(.hhf-file__input:focus-visible) .hhf-drop { border-color: var(--ink); box-shadow: 0 0 0 4px var(--yellow-halo); }
.hhf-drop__icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--card) var(--icon-upload) center / 22px no-repeat;
  box-shadow: inset 0 0 0 1px var(--zinc-200);
}
.hhf-drop__text { display: grid; gap: 2px; }
.hhf-drop__text strong { font-size: 16px; font-weight: 600; }
.hhf-drop__text span { color: var(--zinc-500); font-size: 14px; }

.hhf-btn--camera { justify-self: start; gap: 10px; }
.hhf-camera { width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--icon-camera) center / contain no-repeat; mask: var(--icon-camera) center / contain no-repeat; }

.hhf-files { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.hhf-file {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 10px 10px 14px;
  border: 1px solid var(--zinc-200);
  border-radius: 14px;
  background: var(--card);
}
.hhf-file__icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--zinc-100) var(--icon-doc) center / 18px no-repeat;
}
.hhf-file__icon.is-image { background-image: var(--icon-image); }
.hhf-file__icon.is-error { background-color: var(--danger-soft); background-image: var(--icon-alert-red); }
.hhf-file__body { display: grid; gap: 4px; min-width: 0; flex: 1; }
.hhf-file__name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hhf-file__meta { color: var(--zinc-500); font-size: 13px; }
.hhf-file__meta--error { color: var(--danger); font-weight: 500; }
.hhf-file__bar { display: block; height: 4px; border-radius: var(--radius-pill); background: var(--zinc-200); overflow: hidden; }
.hhf-file__bar span { display: block; height: 100%; width: 100%; background: var(--yellow); transform: scaleX(0); transform-origin: left center; transition: transform 0.2s linear; }
.hhf-file__check {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ok);
  -webkit-mask: var(--icon-check-circle) center / contain no-repeat;
  mask: var(--icon-check-circle) center / contain no-repeat;
}
.hhf-file__remove {
  flex: none;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--zinc-700);
  font: 600 14px/1 var(--font);
  cursor: pointer;
}
.hhf-file__remove:hover { background: var(--zinc-100); }

/* ------------------------------------------------------------------ buttons */

.hhf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  font: 650 16px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), transform 0.1s var(--ease), box-shadow 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.hhf-btn:active { transform: translateY(1px); }
.hhf-btn:disabled { cursor: progress; opacity: 0.7; }

.hhf-btn--primary { background: var(--yellow); color: var(--on-yellow); box-shadow: 0 1px 0 rgba(10, 10, 10, 0.08), 0 6px 16px -8px rgba(229, 199, 0, 0.9); }
.hhf-btn--primary:hover { background: var(--yellow-press); }
.hhf-btn--ghost { background: var(--card); border-color: var(--zinc-300); color: var(--ink); }
.hhf-btn--ghost:hover { background: var(--zinc-100); }
.hhf-btn--danger { background: var(--danger); color: #FFFFFF; box-shadow: none; }
.hhf-btn--danger:hover { background: var(--danger); filter: brightness(0.92); }
.hhf-btn--block { width: 100%; }
/* After every variant, and above the signing room's aria-disabled look (sign.css),
   so each button keeps the page / yellow / ink ring when it has keyboard focus. */
.hhf-btn:focus-visible,
.hhf-btn[aria-disabled]:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--page), 0 0 0 5px var(--yellow), 0 0 0 7px var(--ink); }
.hhf-btn.is-busy::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(10, 10, 10, 0.25);
  border-top-color: var(--on-yellow);
  animation: hhf-spin 0.8s linear infinite;
}

.hhf-btn--add {
  width: 100%;
  min-height: 56px;
  border: 1.5px dashed var(--zinc-300);
  background: transparent;
  color: var(--ink);
}
.hhf-btn--add:hover { border-color: var(--ink); background: var(--sunken); }
.hhf-plus { position: relative; width: 14px; height: 14px; }
.hhf-plus::before, .hhf-plus::after { content: ""; position: absolute; background: currentColor; border-radius: 2px; }
.hhf-plus::before { left: 6px; top: 0; width: 2px; height: 14px; }
.hhf-plus::after { top: 6px; left: 0; height: 2px; width: 14px; }

/* A choice scrolled into view (a tap, Tab, a browser's own "find") stops
   above the pinned Back / Continue bar and below the sticky top bar, never
   under them; the page's bottom padding covers the end of the step. */
@media (max-width: 899px) {
  html {
    scroll-padding-top: calc(72px + env(safe-area-inset-top));
    scroll-padding-bottom: calc(var(--actions-h) + 16px + env(safe-area-inset-bottom));
  }
}

/* Back / Continue, pinned to the bottom on phones; under the card from 900px. */
.hhf-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: var(--page);
  border-top: 1px solid var(--zinc-200);
  box-shadow: 0 -8px 24px -16px rgba(10, 10, 10, 0.18);
}
.hhf-actions__inner { display: flex; gap: 10px; max-width: 1160px; margin: 0 auto; }
.hhf-actions .hhf-btn--primary { flex: 1; }
.hhf-actions .hhf-btn--ghost { flex: none; min-width: 96px; }

/* ------------------------------------------------------------------ review */

.hhf-review__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.hhf-review__title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.hhf-review__edit {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--zinc-300);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--ink);
  font: 600 14px/1 var(--font);
  cursor: pointer;
}
.hhf-review__edit:hover { background: var(--zinc-100); }
.hhf-review__edit:focus-visible, .hhf-onfile__change:focus-visible, .hhf-row__remove:focus-visible,
.hhf-file__remove:focus-visible, .hhf-menu__button:focus-visible, .hhf-menu__item:focus-visible,
.hhf-ack__toggle:focus-visible, .hhf-rail__link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--card), 0 0 0 5px var(--yellow), 0 0 0 7px var(--ink);
}
.hhf-review__list { margin: 0; }
.hhf-review__row { display: grid; gap: 2px; padding: 12px 0; border-top: 1px solid var(--zinc-200); }
.hhf-review__row:first-child { border-top: 0; }
.hhf-review__row dt { color: var(--zinc-500); font-size: 14px; }
.hhf-review__row dd { margin: 0; font-size: 16px; font-weight: 500; white-space: pre-line; overflow-wrap: anywhere; }

@media (min-width: 640px) {
  .hhf-review__row { grid-template-columns: minmax(180px, 38%) 1fr; gap: 16px; }
}

/* ------------------------------------------------------------------ done, solo pages */

.hhf-done { width: 100%; max-width: 560px; margin: 0 auto; text-align: center; padding-top: 40px; padding-bottom: 40px; }
.hhf-done .hhf-step__intro { margin-left: auto; margin-right: auto; }
.hhf-done .hhf-btn { margin-top: 28px; }
.hhf-done__check {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--ink);
}
.hhf-done__check::after {
  content: "";
  width: 34px;
  height: 34px;
  background: var(--card);
  -webkit-mask: var(--icon-check) center / contain no-repeat;
  mask: var(--icon-check) center / contain no-repeat;
}
@media (prefers-reduced-motion: no-preference) {
  .hhf-done__check { animation: hhf-pop 0.5s var(--ease) both; }
  @keyframes hhf-pop { from { transform: scale(0.6); opacity: 0; } }
}

.hhf-solo {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: calc(24px + env(safe-area-inset-top)) var(--gutter) calc(24px + env(safe-area-inset-bottom));
}
.hhf-layout .hhf-solo, .hhf-main .hhf-card--solo { min-height: 0; }
.hhf-card--solo { width: 100%; max-width: 480px; padding: 32px 24px; }
.hhf-card--solo .hhf-btn { margin-top: 24px; }
.hhf-logo--solo { margin-bottom: 24px; }
.hhf-solo__form { margin-top: 24px; display: grid; gap: 20px; }

/* ------------------------------------------------------------------ dialog, toast */

.hhf-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 28px 24px 20px;
  border: 0;
  border-radius: 24px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-pop);
}
.hhf-dialog::backdrop { background: var(--overlay); }
.hhf-dialog__title { margin: 0 0 8px; font-size: 22px; font-weight: 750; letter-spacing: -0.015em; }
.hhf-dialog__text { margin: 0; color: var(--zinc-700); font-size: 16px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.hhf-dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 24px; }

.hhf-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--actions-h) + 16px + env(safe-area-inset-bottom));
  z-index: 40;
  width: min(520px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--zinc-800);
  color: var(--page);
  font-size: 15px;
  line-height: 1.45;
  box-shadow: var(--shadow-pop);
  /* A tap goes through to what is under it (Continue, on a desktop) and closes it on the way. */
  pointer-events: none;
}

/* ------------------------------------------------------------------ desktop */

/* The buttons sit right under the card, in the flow, not pinned to the
   bottom of a tall window far from what they act on. */
@media (min-width: 900px) {
  :root { --gutter: 32px; --radius-card: 24px; }

  .hhf-progress { display: none; }

  .hhf-layout { padding-top: 40px; padding-bottom: 64px; }

  .hhf-app[data-state="ready"] .hhf-layout {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 720px);
    grid-template-rows: auto 1fr;
    column-gap: 48px;
    justify-content: center;
  }

  .hhf-rail { display: block; grid-row: 1 / span 2; position: sticky; top: 104px; align-self: start; }
  .hhf-rail[hidden] { display: none; }
  .hhf-app[data-state="ready"] .hhf-main,
  .hhf-app[data-state="ready"] .hhf-actions { grid-column: 2; }

  .hhf-card { padding: 40px 44px; }

  .hhf-actions {
    position: static;
    z-index: auto;
    padding: 24px 0 0;
    background: none;
    border-top: 0;
    box-shadow: none;
  }
  .hhf-actions__inner { justify-content: space-between; }
  .hhf-actions .hhf-btn--primary { flex: none; min-width: 200px; }

  .hhf-toast { bottom: 24px; }
}

.hhf-rail__list { position: relative; margin: 0; padding: 0; list-style: none; }

.hhf-rail__item { position: relative; }
.hhf-rail__item + .hhf-rail__item::before {
  content: "";
  position: absolute;
  left: 15px;
  top: -14px;
  width: 2px;
  height: 28px;
  border-radius: 2px;
  background: var(--zinc-200);
}
.hhf-rail__item.is-done + .hhf-rail__item::before { background: var(--ink); }

.hhf-rail__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  padding: 6px 10px 6px 4px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--zinc-500);
  font: 500 15px/1.3 var(--font);
  text-align: left;
}
button.hhf-rail__link { cursor: pointer; }
button.hhf-rail__link:hover { background: var(--card); color: var(--ink); }

.hhf-rail__dot {
  position: relative;
  z-index: 1;
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-left: 0;
  border: 2px solid var(--zinc-300);
  border-radius: 50%;
  background: var(--page);
}
.is-done .hhf-rail__link { color: var(--ink); }
.is-done .hhf-rail__dot { border-color: var(--ink); background: var(--ink); }
.is-done .hhf-rail__dot::after {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--page);
  -webkit-mask: var(--icon-check) center / contain no-repeat;
  mask: var(--icon-check) center / contain no-repeat;
}
.is-current .hhf-rail__link { color: var(--ink); font-weight: 700; }
.is-current .hhf-rail__dot { border-color: var(--ink); background: var(--yellow); box-shadow: 0 0 0 4px var(--yellow-halo); }

/* ------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: no-preference) {
  .hhf-step { animation: hhf-rise 0.35s var(--ease) both; }
  @keyframes hhf-rise { from { opacity: 0; transform: translateY(8px); } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------ icons (data URIs; the CSP allows data: images) */

:root {
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --icon-check-circle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' fill-rule='evenodd' d='M12 2a10 10 0 100 20 10 10 0 000-20zm4.7 7.7a1 1 0 00-1.4-1.4L10.5 13l-1.8-1.8a1 1 0 10-1.4 1.4l2.5 2.5a1 1 0 001.4 0l5.5-5.4z'/%3E%3C/svg%3E");
  --icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' fill-rule='evenodd' d='M12 2a10 10 0 100 20 10 10 0 000-20zm0 5a1.2 1.2 0 011.2 1.2v4.6a1.2 1.2 0 01-2.4 0V8.2A1.2 1.2 0 0112 7zm0 8.6a1.4 1.4 0 110 2.8 1.4 1.4 0 010-2.8z'/%3E%3C/svg%3E");
  --icon-alert-red: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23B91C1C' fill-rule='evenodd' d='M12 2a10 10 0 100 20 10 10 0 000-20zm0 5a1.2 1.2 0 011.2 1.2v4.6a1.2 1.2 0 01-2.4 0V8.2A1.2 1.2 0 0112 7zm0 8.6a1.4 1.4 0 110 2.8 1.4 1.4 0 010-2.8z'/%3E%3C/svg%3E");
  --icon-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a5 5 0 00-5 5v3H6a2 2 0 00-2 2v8a2 2 0 002 2h12a2 2 0 002-2v-8a2 2 0 00-2-2h-1V7a5 5 0 00-5-5zm-3 8V7a3 3 0 016 0v3H9z'/%3E%3C/svg%3E");
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --icon-upload: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A0A0A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4M7 9l5-5 5 5M4 16v3a1 1 0 001 1h14a1 1 0 001-1v-3'/%3E%3C/svg%3E");
  --icon-camera: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M9 3L7.2 5H4a2 2 0 00-2 2v11a2 2 0 002 2h16a2 2 0 002-2V7a2 2 0 00-2-2h-3.2L15 3H9zm3 5a4.5 4.5 0 110 9 4.5 4.5 0 010-9zm0 2a2.5 2.5 0 100 5 2.5 2.5 0 000-5z'/%3E%3C/svg%3E");
  --icon-doc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A0A0A' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 00-2 2v14a2 2 0 002 2h10a2 2 0 002-2V8l-5-5z'/%3E%3Cpath d='M14 3v5h5'/%3E%3C/svg%3E");
  --icon-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A0A0A' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Ccircle cx='9' cy='10' r='2'/%3E%3Cpath d='M21 16l-5-5-9 9'/%3E%3C/svg%3E");
}

/* 0.6.2 (sweep B, M20): the loading card speaks up if form.js never takes over. */
.hhf-loading__slow { visibility: hidden; animation: hhf-slow 0s linear 8s forwards; margin-top: 12px; }
@keyframes hhf-slow { to { visibility: visible; } }

/* 0.6.2 (sweep B): a handout to read above its acknowledgment, and the family list's status line. */
.hhf-handout { margin: 0 0 8px; }
.hhf-handout__lead { margin: 0 0 8px; color: var(--zinc-700); font-size: 15px; }
details.hhf-handout { padding: 12px 14px; border: 1px solid var(--zinc-200); border-radius: 12px; background: var(--card, #FFFFFF); }
details.hhf-handout summary { cursor: pointer; font-weight: 600; }
.hhf-rows__status:empty { display: none; }
