/* =====================================================================
   HOPE Health — design system (proposal, 13 Nov 2026)
   One stylesheet. Classes are prefixed h- so they never collide with
   existing page styles; pages adopt it component by component.
   Brand invariants (logo, fonts, the palette tokens, page loader)
   are unchanged. No pure white anywhere (2026-12-02): --h-white is
   Ivory #FDFBF6 for cards, fields, menus and text on sage/navy.
   Three tokens are ADDED for contrast:
     --h-line-strong  #9a9278  field borders, 3.1:1 on ivory (WCAG 1.4.11)
     --h-slate-ink    #5a6577  small secondary text, 5.2:1 on cream
     --h-sand-ink     #6b5212  warning text, 6.3:1 on sand-tint
   ===================================================================== */

:root {
  /* ---- Colour: brand (unchanged) ---- */
  --h-navy: #1a2a1a;
  --h-navy-soft: #2d3a2d;
  --h-sage: #4A7C59;
  --h-sage-dark: #3a6347;
  --h-sand: #e9c46a;
  --h-cream: #F5F1E8;
  --h-coral: #e76f51;
  --h-slate: #64748b;

  /* ---- Colour: supporting (already in global.css) ---- */
  --h-sage-soft: #e7efe8;
  --h-sage-tint: #f1f5ee;
  --h-sand-tint: #faecc8;
  --h-sand-deep: #8b6a1a;
  --h-cream-deep: #efe9d8;
  --h-paper: #fbf8f0;
  --h-coral-tint: #fbe6dc;
  --h-coral-deep: #8e3520;
  --h-line: #e6dfca;
  --h-line-soft: #efe9d8;
  --h-ivory: #FDFBF6; /* brand rule 2026-12-02: no pure white anywhere */
  --h-white: var(--h-ivory); /* kept for existing rules; it is Ivory, not white */

  /* ---- Colour: added for contrast ---- */
  --h-line-strong: #9a9278;
  --h-slate-ink: #5a6577;
  --h-sand-ink: #6b5212;

  /* ---- Roles ---- */
  --h-bg: var(--h-cream);
  --h-surface: var(--h-white);
  --h-surface-quiet: var(--h-paper);
  --h-text: var(--h-navy);
  --h-text-2: var(--h-slate-ink);
  --h-accent: var(--h-sage);
  --h-accent-strong: var(--h-sage-dark);
  --h-focus: var(--h-sage-dark);

  /* ---- Type ---- */
  --h-font-display: 'Clash Display', system-ui, sans-serif;
  --h-font-body: 'General Sans', system-ui, sans-serif;
  --h-fs-12: 12px;  --h-fs-13: 13px;  --h-fs-14: 14px;  --h-fs-16: 16px;
  --h-fs-20: 20px;  --h-fs-24: 24px;  --h-fs-32: 32px;  --h-fs-44: 44px;  --h-fs-60: 60px;

  /* ---- Space (4px base) ---- */
  --h-s-1: 4px;  --h-s-2: 8px;  --h-s-3: 12px;  --h-s-4: 16px;  --h-s-5: 24px;
  --h-s-6: 32px; --h-s-7: 48px; --h-s-8: 64px;  --h-s-9: 96px;

  /* ---- Shape ---- */
  --h-r-field: 10px;
  --h-r-card-sm: 16px;
  --h-r-card: 22px;
  --h-r-pill: 999px;

  /* ---- Elevation: only things that float ---- */
  --h-shadow-overlay: 0 24px 64px rgba(26, 42, 26, 0.18);
  --h-shadow-toast: 0 8px 30px rgba(26, 42, 26, 0.22);

  /* ---- Motion ---- */
  --h-dur-fast: 120ms;
  --h-dur: 180ms;
  --h-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* ---- Control sizes ---- */
  --h-h-sm: 32px;  --h-h-md: 40px;  --h-h-lg: 48px;
}

/* =====================================================================
   Type styles
   ===================================================================== */
.h-display { font: 500 var(--h-fs-60)/1.02 var(--h-font-display); letter-spacing: -0.03em; color: var(--h-text); text-wrap: balance; }
.h-h1      { font: 500 var(--h-fs-44)/1.06 var(--h-font-display); letter-spacing: -0.025em; color: var(--h-text); text-wrap: balance; }
.h-h2      { font: 500 var(--h-fs-32)/1.12 var(--h-font-display); letter-spacing: -0.02em; color: var(--h-text); text-wrap: balance; }
.h-h3      { font: 500 var(--h-fs-24)/1.2 var(--h-font-display); letter-spacing: -0.015em; color: var(--h-text); }
.h-h4      { font: 500 var(--h-fs-20)/1.25 var(--h-font-display); letter-spacing: -0.01em; color: var(--h-text); }
.h-lead    { font: 400 var(--h-fs-20)/1.5 var(--h-font-body); color: var(--h-navy-soft); max-width: 60ch; }
.h-body    { font: 400 var(--h-fs-16)/1.6 var(--h-font-body); color: var(--h-text); max-width: 68ch; }
.h-small   { font: 400 var(--h-fs-14)/1.5 var(--h-font-body); color: var(--h-text-2); }
.h-caption { font: 400 var(--h-fs-13)/1.45 var(--h-font-body); color: var(--h-text-2); }
.h-label   { font: 500 var(--h-fs-14)/1.3 var(--h-font-body); color: var(--h-text); }
.h-num     { font-variant-numeric: tabular-nums; }

/* Logo lockup — brand invariant, unchanged */
.h-logo { display: inline-flex; align-items: baseline; gap: 6px; text-decoration: none; }
.h-logo b { font: 600 24px/1 var(--h-font-display); letter-spacing: -0.025em; color: var(--h-navy); }
.h-logo i { font: 500 10px/1 var(--h-font-body); font-style: normal; letter-spacing: 0.22em; text-transform: uppercase; color: var(--h-slate); }

/* =====================================================================
   Focus — one ring everywhere, keyboard only
   ===================================================================== */
.h-btn:focus-visible, .h-link:focus-visible, .h-field:focus-visible, .h-choice:has(input:focus-visible),
.h-check input:focus-visible, .h-tab:focus-visible, .h-nav a:focus-visible, .h-upload:has(input:focus-visible) {
  outline: 2px solid var(--h-focus); outline-offset: 2px;
}

/* =====================================================================
   Buttons
   Primary: one per view. Secondary: everything else that matters.
   Quiet: low-stakes (Cancel, Edit). Danger: irreversible or alarming.
   ===================================================================== */
.h-btn {
  --bg: var(--h-sage); --fg: #FDFBF6; --bd: transparent; --bg-h: var(--h-sage-dark);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h-h-md); padding: 0 18px; border-radius: var(--h-r-pill);
  border: 1px solid var(--bd); background: var(--bg); color: var(--fg);
  font: 500 var(--h-fs-14)/1 var(--h-font-body); letter-spacing: 0; white-space: nowrap;
  text-decoration: none; cursor: pointer; user-select: none;
  transition: background-color var(--h-dur-fast) ease, border-color var(--h-dur-fast) ease, color var(--h-dur-fast) ease;
}
.h-btn:hover { background: var(--bg-h); }
.h-btn:active { background: var(--bg-h); transform: translateY(0.5px); }
.h-btn svg { width: 16px; height: 16px; flex: none; }
.h-btn--lg { height: var(--h-h-lg); padding: 0 24px; font-size: var(--h-fs-16); }
.h-btn--sm { height: var(--h-h-sm); padding: 0 14px; font-size: var(--h-fs-13); }
.h-btn--block { width: 100%; }
.h-btn--secondary { --bg: var(--h-white); --fg: var(--h-navy); --bd: var(--h-line-strong); --bg-h: var(--h-cream-deep); }
.h-btn--quiet { --bg: transparent; --fg: var(--h-sage-dark); --bg-h: var(--h-sage-soft); }
.h-btn--danger { --bg: var(--h-white); --fg: var(--h-coral-deep); --bd: #d9a493; --bg-h: var(--h-coral-tint); }
.h-btn--danger-solid { --bg: var(--h-coral-deep); --fg: #FDFBF6; --bg-h: #74291a; }
.h-btn--on-dark { --bg: var(--h-sand); --fg: var(--h-navy); --bg-h: #dfb653; }
.h-btn--icon { width: var(--h-h-md); padding: 0; }
.h-btn--icon.h-btn--sm { width: var(--h-h-sm); }

/* Unavailable: avoid. If a button truly can't act, say why next to it. */
.h-btn[aria-disabled="true"] { --bg: var(--h-cream-deep); --fg: #6f7a6f; --bd: transparent; --bg-h: var(--h-cream-deep); cursor: not-allowed; }

/* Working: spinner replaces nothing; label changes to the verb in progress */
.h-btn[aria-busy="true"] { cursor: progress; }
.h-btn[aria-busy="true"]::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: h-spin 0.7s linear infinite; opacity: 0.85;
}
/* Done: brief confirmation, then back to rest */
.h-btn[data-state="done"] { --bg: var(--h-sage-soft); --fg: var(--h-sage-dark); --bd: transparent; --bg-h: var(--h-sage-soft); }

.h-link { color: var(--h-sage-dark); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: pointer; background: none; border: 0; padding: 0; font-family: inherit; font-size: inherit; }
.h-link:hover { color: var(--h-navy); }

@keyframes h-spin { to { transform: rotate(360deg); } }

/* =====================================================================
   Form fields
   ===================================================================== */
.h-fieldset { display: flex; flex-direction: column; gap: var(--h-s-5); border: 0; padding: 0; margin: 0; }
.h-form-row { display: flex; flex-direction: column; gap: 6px; }
.h-form-row > .h-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.h-hint { font: 400 var(--h-fs-13)/1.45 var(--h-font-body); color: var(--h-text-2); margin-top: -2px; }
.h-optional { font-weight: 400; color: var(--h-text-2); }

.h-field {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--h-r-field);
  border: 1px solid var(--h-line-strong); background: var(--h-white); color: var(--h-navy);
  font: 400 var(--h-fs-16)/1.2 var(--h-font-body); box-sizing: border-box;
  transition: border-color var(--h-dur-fast) ease, box-shadow var(--h-dur-fast) ease;
}
.h-field:hover { border-color: var(--h-navy-soft); }
.h-field:focus { outline: none; border-color: var(--h-sage-dark); box-shadow: 0 0 0 3px rgba(58, 99, 71, 0.22); }
.h-field::placeholder { color: transparent; }
textarea.h-field { height: auto; min-height: 104px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
select.h-field { appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232d3a2d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.h-field[aria-invalid="true"] { border-color: var(--h-coral-deep); box-shadow: 0 0 0 1px var(--h-coral-deep); }
.h-field:disabled, .h-field[readonly] { background: var(--h-paper); color: var(--h-text-2); border-color: var(--h-line); }

.h-field-wrap { position: relative; }
.h-field-wrap .h-field { padding-right: 52px; }
.h-field-wrap .h-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); height: 36px; padding: 0 10px; font-size: 13px; }

.h-error-msg { display: flex; gap: 6px; align-items: flex-start; font: 500 var(--h-fs-14)/1.4 var(--h-font-body); color: var(--h-coral-deep); }
.h-error-msg svg { flex: none; width: 16px; height: 16px; margin-top: 1px; }

/* Date of birth: three boxes, no calendar */
.h-date { display: flex; gap: var(--h-s-3); }
.h-date label { display: flex; flex-direction: column; gap: 4px; font: 400 var(--h-fs-14)/1.3 var(--h-font-body); color: var(--h-text-2); }
.h-date .h-field { text-align: left; }
.h-date .h-dd, .h-date .h-mm { width: 64px; }
.h-date .h-yyyy { width: 96px; }

/* Choice cards (radio or checkbox) */
.h-choices { display: grid; gap: var(--h-s-2); }
.h-choices--2 { grid-template-columns: 1fr 1fr; }
.h-choice {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--h-line-strong); background: var(--h-white);
  font: 500 var(--h-fs-16)/1.3 var(--h-font-body); color: var(--h-navy); cursor: pointer;
  transition: border-color var(--h-dur-fast) ease, background-color var(--h-dur-fast) ease;
}
.h-choice:hover { border-color: var(--h-navy-soft); }
.h-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.h-choice .h-mark { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--h-line-strong); background: #FDFBF6; display: grid; place-items: center; }
.h-choice--check .h-mark { border-radius: 6px; }
.h-choice:has(input:checked) { border-color: var(--h-sage-dark); background: var(--h-sage-tint); box-shadow: 0 0 0 1px var(--h-sage-dark); }
.h-choice:has(input:checked) .h-mark { border-color: var(--h-sage-dark); background: var(--h-sage-dark); }
.h-choice:has(input:checked) .h-mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #FDFBF6; }
.h-choice--check:has(input:checked) .h-mark::after { width: 10px; height: 5px; border-radius: 0; background: none; border-left: 2px solid #FDFBF6; border-bottom: 2px solid #FDFBF6; transform: rotate(-45deg) translate(1px, -1px); }
.h-choice small { display: block; font: 400 var(--h-fs-14)/1.4 var(--h-font-body); color: var(--h-text-2); margin-top: 2px; }

/* Plain checkbox row (consent, opt-in) */
.h-check { display: flex; gap: 12px; align-items: flex-start; font: 400 var(--h-fs-14)/1.5 var(--h-font-body); color: var(--h-navy-soft); cursor: pointer; }
.h-check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--h-sage-dark); cursor: pointer; }
.h-check b { color: var(--h-navy); font-weight: 600; }

/* File upload */
.h-upload { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--h-r-card-sm); border: 1.5px dashed var(--h-line-strong); background: var(--h-white); }
.h-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.h-upload .h-upload-ic { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--h-sage-soft); color: var(--h-sage-dark); }
.h-upload .h-upload-ic svg { width: 20px; height: 20px; }
.h-upload .h-upload-txt { flex: 1; min-width: 0; }
.h-upload .h-upload-txt b { display: block; font: 600 var(--h-fs-14)/1.35 var(--h-font-body); color: var(--h-navy); overflow-wrap: anywhere; }
.h-upload .h-upload-txt span { font: 400 var(--h-fs-13)/1.4 var(--h-font-body); color: var(--h-text-2); }
.h-upload[data-state="done"] { border-style: solid; border-color: #b9d1bf; }
.h-upload[data-state="error"] { border-style: solid; border-color: var(--h-coral-deep); }
.h-upload[data-state="error"] .h-upload-ic { background: var(--h-coral-tint); color: var(--h-coral-deep); }

/* Plan selector */
.h-plan { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-radius: var(--h-r-card-sm); border: 1px solid var(--h-line-strong); background: #FDFBF6; cursor: pointer; }
.h-plan input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.h-plan:has(input:checked) { border-color: var(--h-sage-dark); box-shadow: 0 0 0 1px var(--h-sage-dark); background: var(--h-sage-tint); }
.h-plan b { display: block; font: 600 var(--h-fs-16)/1.3 var(--h-font-body); }
.h-plan span { font: 400 var(--h-fs-14)/1.4 var(--h-font-body); color: var(--h-text-2); }
.h-plan strong { font: 500 var(--h-fs-24)/1 var(--h-font-display); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.h-plan strong small { font: 400 var(--h-fs-14)/1 var(--h-font-body); color: var(--h-text-2); }

/* =====================================================================
   Feedback
   ===================================================================== */
/* Notice: four tones. Coral is for errors only. */
.h-notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; border: 1px solid; font: 400 var(--h-fs-14)/1.5 var(--h-font-body); }
.h-notice svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.h-notice b { font-weight: 600; }
.h-notice > div > b:first-child { display: block; margin-bottom: 2px; }
.h-notice > div > :last-child { margin-bottom: 0; }
.h-notice .h-notice-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.h-notice--error   { background: var(--h-coral-tint); border-color: #e9b9aa; color: var(--h-coral-deep); }
.h-notice--warning { background: var(--h-sand-tint); border-color: #e2cf8e; color: var(--h-sand-ink); }
.h-notice--info    { background: var(--h-paper); border-color: var(--h-line); color: var(--h-navy-soft); }
.h-notice--info b  { color: var(--h-navy); }
.h-notice--success { background: var(--h-sage-soft); border-color: #c9dccd; color: var(--h-sage-dark); }

/* Error summary: top of a form after a failed submit (GOV.UK pattern) */
.h-error-summary { display: flex; gap: 12px; padding: 16px 18px; border-radius: 12px; border: 1px solid #e9b9aa; background: var(--h-coral-tint); color: var(--h-coral-deep); }
.h-error-summary > svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.h-error-summary h3 { font: 600 var(--h-fs-16)/1.3 var(--h-font-body); color: var(--h-navy); margin: 0 0 6px; }
.h-error-summary ul { margin: 0; padding-left: 18px; }
.h-error-summary a { color: var(--h-coral-deep); font: 500 var(--h-fs-14)/1.6 var(--h-font-body); }

/* Toast: confirmations only; errors that block stay on the page */
.h-toast { display: inline-flex; align-items: center; gap: 10px; max-width: 420px; padding: 12px 14px 12px 16px; border-radius: 12px; background: var(--h-navy); color: #FDFBF6; font: 500 var(--h-fs-14)/1.4 var(--h-font-body); box-shadow: var(--h-shadow-toast); }
.h-toast svg { flex: none; width: 18px; height: 18px; color: #a9cdb3; }
.h-toast .h-btn { --bg: rgba(253,251,246,0.12); --fg: #FDFBF6; --bg-h: rgba(253,251,246,0.22); height: 30px; padding: 0 12px; font-size: 13px; margin-left: 4px; }

/* Save status: inline, beside the thing being saved */
.h-save { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--h-fs-13)/1 var(--h-font-body); color: var(--h-text-2); }
.h-save svg { width: 14px; height: 14px; }
.h-save[data-state="saving"]::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: h-spin 0.7s linear infinite; }
.h-save[data-state="saved"] { color: var(--h-sage-dark); }
.h-save[data-state="failed"] { color: var(--h-coral-deep); }

/* Status chip */
.h-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--h-r-pill); font: 600 var(--h-fs-12)/1 var(--h-font-body); white-space: nowrap; }
.h-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.h-chip--neutral { background: #ecebe4; color: var(--h-navy-soft); }
.h-chip--success { background: var(--h-sage-soft); color: var(--h-sage-dark); }
.h-chip--warning { background: var(--h-sand-tint); color: var(--h-sand-ink); }
.h-chip--danger  { background: var(--h-coral-tint); color: var(--h-coral-deep); }
.h-chip--plain::before { display: none; }

/* Counter: only when above zero */
.h-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--h-r-pill); background: var(--h-navy); color: #FDFBF6; font: 600 11px/1 var(--h-font-body); font-variant-numeric: tabular-nums; }
.h-count[data-n="0"] { display: none; }

/* =====================================================================
   Loading
   ===================================================================== */
.h-skel { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--h-cream-deep) 0%, #f6f2e6 50%, var(--h-cream-deep) 100%); background-size: 200% 100%; animation: h-shimmer 1.4s linear infinite; }
@keyframes h-shimmer { to { background-position: -200% 0; } }
.h-spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--h-line); border-top-color: var(--h-sage-dark); animation: h-spin 0.7s linear infinite; }
.h-progress { height: 6px; border-radius: var(--h-r-pill); background: var(--h-cream-deep); overflow: hidden; }
.h-progress > i { display: block; height: 100%; border-radius: inherit; background: var(--h-sage); transition: width var(--h-dur) var(--h-ease); }
.h-progress-meta { display: flex; justify-content: space-between; font: 500 var(--h-fs-13)/1 var(--h-font-body); color: var(--h-text-2); margin-bottom: 8px; }

/* =====================================================================
   Surfaces
   ===================================================================== */
.h-card { background: var(--h-white); border: 1px solid var(--h-line); border-radius: var(--h-r-card); padding: var(--h-s-6); }
.h-card--quiet { background: var(--h-paper); }
.h-card--sm { border-radius: var(--h-r-card-sm); padding: var(--h-s-5); }

/* Summary list: label, value, action — always visible */
.h-summary { display: flex; flex-direction: column; }
.h-summary-row { display: grid; grid-template-columns: 180px 1fr auto; gap: 16px; align-items: center; min-height: 56px; padding: 10px 0; border-top: 1px solid var(--h-line-soft); }
.h-summary-row:first-child { border-top: 0; }
.h-summary-row dt { font: 500 var(--h-fs-14)/1.4 var(--h-font-body); color: var(--h-text-2); }
.h-summary-row dd { margin: 0; font: 500 var(--h-fs-16)/1.4 var(--h-font-body); color: var(--h-navy); overflow-wrap: anywhere; }
.h-summary-row dd.h-empty { color: var(--h-text-2); font-weight: 400; }

/* To-do list (doctor Today, admin Home) */
.h-todo { background: #FDFBF6; border: 1px solid var(--h-line); border-radius: var(--h-r-card-sm); overflow: hidden; }
.h-todo-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--h-line-soft); }
.h-todo-row:first-child { border-top: 0; }
.h-todo-row b { font: 600 var(--h-fs-16)/1.35 var(--h-font-body); color: var(--h-navy); }
.h-todo-row span { grid-column: 1; font: 400 var(--h-fs-14)/1.4 var(--h-font-body); color: var(--h-text-2); }
.h-todo-row .h-btn { grid-row: 1 / 3; grid-column: 2; }

/* Empty state */
.h-empty-state { text-align: center; padding: var(--h-s-7) var(--h-s-5); }
.h-empty-state .h-empty-ic { width: 44px; height: 44px; margin: 0 auto var(--h-s-3); border-radius: 12px; background: var(--h-sage-soft); color: var(--h-sage-dark); display: grid; place-items: center; }
.h-empty-state .h-empty-ic svg { width: 22px; height: 22px; }
.h-empty-state h3 { font: 500 var(--h-fs-20)/1.25 var(--h-font-display); letter-spacing: -0.01em; color: var(--h-navy); margin: 0 0 6px; }
.h-empty-state p { font: 400 var(--h-fs-14)/1.5 var(--h-font-body); color: var(--h-text-2); max-width: 40ch; margin: 0 auto var(--h-s-4); }

/* Dialog */
.h-dialog-backdrop { position: fixed; inset: 0; background: rgba(26, 42, 26, 0.42); display: grid; place-items: center; padding: 24px; z-index: 100000; }
.h-dialog { width: min(460px, 100%); background: var(--h-paper); border: 1px solid var(--h-line); border-radius: var(--h-r-card); padding: 28px; box-shadow: var(--h-shadow-overlay); }
.h-dialog h2 { font: 500 var(--h-fs-24)/1.2 var(--h-font-display); letter-spacing: -0.015em; color: var(--h-navy); margin: 0; text-wrap: balance; }
.h-dialog p { font: 400 var(--h-fs-14)/1.55 var(--h-font-body); color: var(--h-navy-soft); margin: 8px 0 0; }
.h-dialog .h-form-row { margin-top: 18px; }
.h-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

/* Tabs */
.h-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--h-line); }
.h-tab { position: relative; height: 44px; padding: 0 14px; background: none; border: 0; font: 500 var(--h-fs-14)/1 var(--h-font-body); color: var(--h-text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.h-tab:hover { color: var(--h-navy); }
.h-tab[aria-selected="true"] { color: var(--h-navy); }
.h-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--h-sage-dark); }

/* Side navigation (patient + doctor shells) */
.h-nav { display: flex; flex-direction: column; gap: 2px; }
.h-nav a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 14px; border-radius: 12px; font: 500 var(--h-fs-16)/1 var(--h-font-body); color: var(--h-navy); text-decoration: none; }
.h-nav a svg { width: 20px; height: 20px; color: var(--h-slate); }
.h-nav a:hover { background: var(--h-cream-deep); }
.h-nav a[aria-current="page"] { background: var(--h-sage-soft); color: var(--h-sage-dark); }
.h-nav a[aria-current="page"] svg { color: var(--h-sage-dark); }
.h-nav a .h-count { margin-left: auto; }

@media (prefers-reduced-motion: reduce) {
  .h-btn, .h-field, .h-choice, .h-progress > i { transition: none; }
  .h-skel, .h-spinner, .h-btn[aria-busy="true"]::before, .h-save[data-state="saving"]::before { animation: none; }
}

/* Tick list (reassurance lines under a call to action) */
.h-ticks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font: 400 var(--h-fs-14)/1.5 var(--h-font-body); color: var(--h-navy-soft); }
.h-ticks li { position: relative; padding-left: 26px; }
.h-ticks li::before { content: ""; position: absolute; left: 3px; top: 5px; width: 11px; height: 6px; border-left: 2px solid var(--h-sage-dark); border-bottom: 2px solid var(--h-sage-dark); transform: rotate(-45deg); }
.h-ticks b { color: var(--h-navy); font-weight: 600; }
.h-ticks--row { flex-direction: row; flex-wrap: wrap; gap: 8px 24px; }
.h-on-dark .h-ticks, .h-ticks.h-on-dark { color: rgba(253,251,246,0.86); }
.h-on-dark .h-ticks li::before { border-color: var(--h-sand); }
.h-on-dark .h-ticks b { color: #FDFBF6; }

/* Consent list: one quiet panel, hairline rows (no per-item cards) */
.h-consent { background: var(--h-white); border: 1px solid var(--h-line); border-radius: var(--h-r-card-sm); }
.h-consent .h-check { padding: 12px 16px; border-top: 1px solid var(--h-line-soft); font-size: var(--h-fs-14); }
.h-consent .h-check:first-child { border-top: 0; }
/* Results: flat definition grid, no card */
.h-facts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--h-line); border-bottom: 1px solid var(--h-line); }
.h-facts div { padding: 14px 0; }
.h-facts dt { font: 400 var(--h-fs-13)/1.3 var(--h-font-body); color: var(--h-text-2); }
.h-facts dd { margin: 4px 0 0; font: 500 var(--h-fs-20)/1.2 var(--h-font-display); color: var(--h-navy); }
.h-steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.h-steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 10px 0; font: 400 var(--h-fs-14)/1.5 var(--h-font-body); color: var(--h-text-2); }
.h-steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--h-line-strong); display: grid; place-items: center; font: 600 12px/1 var(--h-font-body); color: var(--h-navy); }
.h-steps b { display: block; color: var(--h-navy); font-weight: 600; }

/* =====================================================================
   [D2] Questionnaire / sign-in pages — added 20 Nov 2026
   (patient/assessment, fix, help, reset-password, checkout-success).
   Everything below is scoped to body.h-qs or uses new h-qs-/h-pagehead
   class names, so it never touches the dashboard or other portals.
   ===================================================================== */
/* One page header: 64px, cream, hairline; the logo sits in the same place */
.h-pagehead { position: sticky; top: 0; z-index: 50; background: rgba(245, 241, 232, 0.95); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(26, 42, 26, 0.08); }
.h-pagehead-in { max-width: 64rem; height: 64px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; box-sizing: border-box; }
@media (min-width: 640px) { .h-pagehead-in { padding: 0 32px; } }
.h-pagehead-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; font: 500 var(--h-fs-14)/1.2 var(--h-font-body); color: var(--h-sage-dark); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; background: none; border: 0; cursor: pointer; }
.h-pagehead-link:hover { color: var(--h-navy); }
.h-pagehead-text { font: 400 var(--h-fs-14)/1.2 var(--h-font-body); color: var(--h-slate-ink); }
.h-pagehead-in > a:first-child { padding: 6px 0; } /* 44px tap target, logo unchanged */

/* Global colour + type rules on these pages (design spec "Global") */
.h-qs main .text-slate, .h-qs main .text-slate\/80 { color: var(--h-slate-ink); }
.h-qs main .text-sage { color: var(--h-sage-dark); }
.h-qs main .text-coral, .h-qs main .text-coral\/80 { color: var(--h-coral-deep); }
.h-qs main .text-navy\/80, .h-qs main .text-navy\/70, .h-qs main .text-navy\/60 { color: var(--h-navy-soft); }
.h-qs main h1.font-display, .h-qs main h2.font-display, .h-qs main h3.font-display { font-weight: 500; }
.h-qs main .uppercase.tracking-widest, .h-qs main .uppercase.tracking-wider { text-transform: none; letter-spacing: 0; }
.h-qs a:focus-visible, .h-qs button:focus-visible, .h-qs input:focus-visible, .h-qs select:focus-visible,
.h-qs textarea:focus-visible, .h-qs [tabindex]:focus-visible { outline: 2px solid var(--h-focus); outline-offset: 2px; }
.h-qs h1[tabindex="-1"]:focus, .h-qs h2[tabindex="-1"]:focus, .h-qs [data-focus-target]:focus { outline: none; }

/* Upload row: label inside, the button is a <label for> so the native
   "Choose File / No file chosen" control stays hidden */
.h-upload .h-upload-btn { flex: none; position: relative; z-index: 1; }
.h-upload--plain { border-style: solid; }
.h-upload[data-state="done"] .h-upload-ic { background: var(--h-sage-soft); color: var(--h-sage-dark); }
@media (max-width: 479px) {
  .h-upload { flex-wrap: wrap; align-items: flex-start; }
  .h-upload .h-upload-txt { flex: 1 1 calc(100% - 54px); }
  .h-upload .h-upload-btn { margin-left: 54px; }
}

