/* TFO Medical compliance portal. Brand colours from the TFO Medical logo: navy #29315a and sage #7aa39a.
   Sage is too light for white text, so buttons are navy; sage is used for lines, bars and highlights. */
:root {
  --navy: #29315a; --sage: #7aa39a; --sage-dark: #3f6e65; --sage-tint: #eef4f2;
  --accent: var(--navy); --ink: #1d1d1f; --muted: #5f6368; --line: #e3e5e8;
  --bg: #f5f7f6; --card: #ffffff; --ok: #1e7d32; --warn: #b26b00; --bad: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ink: #e8eaed; --muted: #a0a4a8; --line: #3a3d42; --bg: #1b1c1e; --card: #26282b; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
/* The logo sits on white in both themes (it is drawn for a white background). */
.brand { background: #fff; padding: 14px 0; border-bottom: 4px solid var(--sage); }
.brand .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.logo { display: block; height: 57px; width: auto; max-width: 60vw; }
.brand-sub { color: var(--navy); font-size: 14px; font-weight: 600; }
main { padding-top: 20px; padding-bottom: 8px; }
h1 { font-size: 22px; margin: 0 0 6px; }
.lead { margin: 0 0 18px; }
.overall { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 18px; }
.overall .meter { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; margin-top: 8px; }
.overall .meter > div { height: 100%; background: var(--sage); width: 0; transition: width .4s; }
h1 { color: var(--navy); }
.step { border-top: 3px solid var(--sage); }
.step { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.step-head { display: flex; align-items: center; gap: 10px; }
.step-head h2 { font-size: 18px; margin: 0; flex: 1; color: var(--ink); }
.num { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.count { font-size: 13px; color: var(--muted); }
.intro { margin: 8px 0 10px; color: var(--muted); }
.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item-main { flex: 1 1 260px; min-width: 0; }
.item-name { font-weight: 600; }
.item-hint, .item-note { font-size: 14px; color: var(--muted); }
.item-note:empty { display: none; }
.item-note.bad { color: var(--bad); }
.item-side { display: flex; align-items: center; gap: 8px; flex: none; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--line); color: var(--muted); white-space: nowrap; }
.badge.received { background: #e8f0fe; color: #1a56c4; }
.badge.accepted { background: #e6f4ea; color: var(--ok); }
.badge.attention { background: #fde8e6; color: var(--bad); }
.btn { position: relative; display: inline-block; padding: 9px 16px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; min-height: 40px; }
.btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.btn.secondary { background: var(--navy); }
.btn[aria-disabled="true"] { opacity: .6; pointer-events: none; }
.progress { flex-basis: 100%; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--sage); transition: width .2s; }
.btn.secondary { background: var(--sage-dark); }
.badge.accepted { background: var(--sage-tint); color: var(--sage-dark); }
.form-grid { display: grid; gap: 12px; }
.form-grid label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.form-grid input, .form-grid select, .form-grid textarea { font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); width: 100%; }
.submit { margin-top: 12px; border: 0; font: inherit; }
.form-grid .field-hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.form-grid .field-error { font-weight: 600; color: var(--bad); font-size: 13px; }
.form-grid .field-error:empty { display: none; }
.form-grid .invalid input { border-color: var(--bad); }
.form-grid .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 15px; }
.form-grid .check input { width: 22px; height: 22px; flex: none; margin: 2px 0 0; }
.photo-preview { width: 120px; height: 150px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.photo-preview[hidden] { display: none; }
.back { background: none; border: 0; color: var(--sage-dark); font: inherit; font-weight: 600; padding: 0; margin-bottom: 12px; cursor: pointer; }
.item-side .btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--navy); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .item-side .btn.ghost { color: #fff; border-color: #fff; } :root:not([data-theme="light"]) h1 { color: var(--ink); } }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
@media (max-width: 480px) { .item-side { flex-wrap: wrap; } }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; }
.alert.bad { background: #fde8e6; color: var(--bad); }
.alert.ok { background: #e6f4ea; color: var(--ok); }
.muted { color: var(--muted); }
.small { font-size: 13px; padding-top: 8px; padding-bottom: 28px; }

/* Redesign (owner, 08/11/2026): three-part progress, the "needs your attention" box, folded finished steps,
   "what we need" notes, valid-until dates and the all-done page. */
:root { --checking: #8fa3c9; --checking-ink: #2c4a8a; --checking-tint: #e8edf7; --amber-tint: #fff4e5; --amber-line: #f0c27a; --amber-ink: #7a4a00; }
.overall { border-radius: 12px; }
.overall-head { display: flex; align-items: baseline; justify-content: space-between; }
.overall-head strong { font-size: 17px; }
.small-num { font-size: 13px; }
.overall .meter { display: flex; gap: 2px; }
.overall .meter > .seg { width: 0; height: 100%; transition: width .4s; }
.overall .meter > .seg.accepted { background: var(--sage-dark); }
.overall .meter > .seg.received { background: var(--checking); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: #c9ccd1; }
.legend .key.accepted { background: var(--sage-dark); }
.legend .key.received { background: var(--checking); }
.badge.received { background: var(--checking-tint); color: var(--checking-ink); }
.badge.attention { background: #fde8e6; color: var(--bad); }
.attention-box { background: var(--amber-tint); border: 1px solid var(--amber-line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; display: grid; gap: 12px; }
.attention-box h2 { margin: 0; font-size: 17px; color: var(--amber-ink); }
.fix { background: #fff; color: #1d1d1f; border-radius: 10px; padding: 12px; display: grid; gap: 8px; justify-items: start; }
.fix .progress { width: 100%; }
.need { font-size: 13px; color: #4a4e53; background: var(--bg); border-radius: 8px; padding: 8px 10px; margin-top: 4px; }
.fix .need { background: #f5f7f6; }
.item-note.ok { color: var(--sage-dark); }
details.step.folded { padding: 0; border-top-width: 1px; }
details.step.folded > summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; min-height: 56px; cursor: pointer; list-style: none; }
details.step.folded > summary::-webkit-details-marker { display: none; }
details.step.folded > summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: 0 4px 4px auto; transition: transform .2s; }
details.step.folded[open] > summary::after { transform: rotate(-135deg); margin-bottom: -4px; }
details.step.folded > .items, details.step.folded > .fold-step { margin: 0 16px; }
details.step.folded > .items { padding-bottom: 8px; }
.fold-step { font-size: 15px; margin-top: 12px !important; color: var(--muted); }
.num.done { background: var(--sage-dark); }
.fold-title { display: flex; flex-direction: column; flex: 1; }
.fold-sub { font-size: 13px; color: var(--sage-dark); }
.done-card { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--sage-dark); border-radius: 12px; padding: 24px 18px; text-align: center; margin-bottom: 16px; }
.done-card h1 { margin: 10px 0 6px; }
.done-card p { margin: 0; color: var(--muted); }
.done-tick { width: 56px; height: 56px; border-radius: 50%; background: var(--sage-tint); color: var(--sage-dark); display: grid; place-items: center; font-size: 28px; font-weight: 700; margin: 0 auto; }
.renewals { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.renewals h2 { font-size: 16px; margin: 0 0 4px; }
.renewal { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.small-note { font-size: 13px; margin: 6px 0 0; }
.contact { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; font-size: 14px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .attention-box h2 { color: var(--amber-ink); }
  :root:not([data-theme="light"]) .need { background: #1b1c1e; color: var(--muted); }
  :root:not([data-theme="light"]) .fold-sub, :root:not([data-theme="light"]) .item-note.ok { color: var(--sage); }
}

/* YMS health questionnaire (2026-11-07): Yes / No answers as two buttons, longer text boxes. */
.form-grid .yesno { font-weight: 500; }
.yesno-btns { display: flex; gap: 8px; }
.yesno-btns .btn { min-width: 84px; justify-content: center; background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.yesno-btns .btn[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.form-grid textarea { resize: vertical; min-height: 96px; }
.form-grid .invalid textarea, .form-grid .invalid .yesno-btns .btn { border-color: var(--bad); }