/* PeoplePlus style. Brand colours from peopleplus.co.uk: red hsl(358 83% 38%), hover hsl(358 83% 18%),
   8px radius, soft shadow, dark grey footer. Gotham is licensed to their site, so we use system fonts
   (and the form loads nothing from other domains). */
:root {
  --ink: #1a1a1a;
  --muted: #595959;
  --line: #d1d3d4;
  --field-border: #767676;
  --surface: #ffffff;
  --page: #f6f6f6;
  --wash: #f6f6f6;
  --brand: #b01015;
  --brand-dark: #54080a;
  --brand-tint: #fbeeee;
  --footer: #333333;
  --focus: #b01015;
  --error: #b01015;
  --ok: #00704a;
  --warn: #8a5a00;
  --radius: 8px;
  --shadow: 0 0 8px 0 rgba(171, 171, 171, 0.5);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 1.0625rem; line-height: 1.55; color: var(--ink); background: var(--page); }
.wrap { max-width: 46rem; margin: 0 auto; padding: 0 1.25rem; }
.wrap.wide { max-width: 80rem; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.75rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand); text-underline-offset: 0.15em; }
a:hover { color: var(--brand-dark); text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); color: var(--brand); padding: 0.5rem 0.75rem; border-radius: var(--radius); box-shadow: var(--shadow); z-index: 10; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { background: var(--surface); border-bottom: 4px solid var(--brand); padding: 1rem 0; }
.site-header .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.logo { display: block; height: 2.75rem; width: auto; }

/* Masthead */
.masthead { padding: 2.25rem 0 1.75rem; }
.programme { display: inline-block; font-size: 0.9375rem; font-weight: 600; color: #fff; background: var(--brand); border-radius: 999px; padding: 0.15rem 0.8rem; margin-bottom: 0.9rem; }
.masthead h1 { font-size: clamp(1.9rem, 4.5vw, 2.5rem); font-weight: 700; letter-spacing: -0.015em; max-width: 20ch; }
.lede { font-size: 1.1875rem; max-width: 40ch; margin: 0; color: var(--muted); }

/* Steps: a real sequence, so the numbers carry meaning */
.step { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 1.5rem 0.5rem; margin-bottom: 1.75rem; }
.step h2 { font-size: 1.45rem; display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.step-no { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--brand); color: #fff; font-size: 1rem; font-weight: 700; flex: none; }
.section-note { color: var(--muted); border-left: 4px solid var(--line); padding-left: 0.875rem; margin: 0.25rem 0 1.5rem; }

/* Fields */
.field { margin: 0 0 1.6rem; padding: 0; border: 0; min-width: 0; }
.field > label, legend { display: block; font-weight: 600; margin-bottom: 0.35rem; padding: 0; }
.hint { color: var(--muted); margin: -0.15rem 0 0.5rem; }
.error { color: var(--error); font-weight: 600; margin: 0 0 0.5rem; }
.field.has-error { border-left: 4px solid var(--error); padding-left: 0.875rem; }
input[type="text"], input:not([type]), input[type="email"], input[type="tel"], input[type="search"], textarea, select {
  font: inherit; color: inherit; width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--field-border); border-radius: var(--radius); background: #fff;
}
input:focus-visible, textarea:focus-visible, select:focus-visible { border-color: var(--brand); outline: 3px solid var(--brand-tint); outline-offset: 0; box-shadow: 0 0 0 1px var(--brand); }
textarea { resize: vertical; min-height: 7rem; }
.has-error input, .has-error textarea { border-color: var(--error); border-width: 2px; }
.w-medium { max-width: 16rem; }
.w-short { max-width: 9rem; }

.choices { display: grid; gap: 0.6rem; }
.choices.inline { grid-auto-flow: column; justify-content: start; gap: 1.5rem; }
.choice { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; font-weight: 400; }
.choice input { width: 1.4rem; height: 1.4rem; margin: 0; accent-color: var(--brand); flex: none; }

.money { display: flex; align-items: stretch; }
.money-prefix { display: grid; place-items: center; padding: 0 0.75rem; border: 1px solid var(--field-border); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); background: var(--wash); font-weight: 600; }
.money input { border-radius: 0 var(--radius) var(--radius) 0; }

/* Receipts */
.accepted { background: var(--brand-tint); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 1rem 1.125rem; margin-bottom: 1rem; }
.accepted p { margin: 0; }
.accepted p + p { margin-top: 0.35rem; color: var(--ink); }
.accepted-types { font-weight: 700; font-size: 1.125rem; color: var(--brand-dark); }
.dropzone { border: 2px dashed var(--field-border); border-radius: var(--radius); padding: 1.5rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.dropzone.is-dragging { border-color: var(--brand); background: var(--brand-tint); }
.dropzone:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop-text { margin: 0; color: var(--muted); }
.file-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.file-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.file-name { overflow-wrap: anywhere; }
.file-size { color: var(--muted); white-space: nowrap; margin-left: 0.5rem; }

/* Buttons */
.button { display: inline-block; font: inherit; font-weight: 600; padding: 0.7rem 1.5rem; border: 2px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; border-radius: var(--radius); text-decoration: none; transition: background-color 0.15s, border-color 0.15s; }
.button:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.button:disabled { opacity: 0.6; cursor: progress; }
.button.secondary { background: #fff; color: var(--brand); }
.button.secondary:hover { background: var(--brand-tint); color: var(--brand-dark); }
.link-button { font: inherit; background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font-weight: 600; }
.link-button:hover { color: var(--brand-dark); }

.submit-area { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 3rem; }
.submit-area .field { margin-bottom: 1.25rem; }
.progress { margin: 1rem 0 0; font-weight: 600; min-height: 1.55em; }
.submit-area .progress:empty { margin: 0; min-height: 0; }

/* Error summary */
.error-summary { background: var(--surface); border: 2px solid var(--error); border-left-width: 8px; border-radius: var(--radius); padding: 1.25rem; margin-bottom: 2rem; }
.error-summary h2 { font-size: 1.3rem; color: var(--error); }
.error-summary ul { margin: 0; padding-left: 1.1rem; }
.error-summary a { color: var(--error); font-weight: 600; }

/* Confirmation */
.done { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border-top: 8px solid var(--ok); padding: 2rem 1.5rem; margin-bottom: 3rem; }
.done h2 { font-size: 1.75rem; color: var(--ok); }
.reference { display: inline-block; font-size: 2rem; font-weight: 700; letter-spacing: 0.06em; color: var(--brand); background: var(--brand-tint); border-radius: var(--radius); padding: 0.25rem 0.9rem; margin-bottom: 1.25rem; }

.footer { background: var(--footer); color: #fff; padding: 2rem 0 2.5rem; }
.footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.footer a { color: #fff; }
.footer a:hover { color: #fff; text-decoration-thickness: 2px; }
.footer :focus-visible { outline-color: #fff; }
.footer .logo { height: 2.25rem; }

/* Admin */
.admin-bar { background: var(--surface); border-bottom: 4px solid var(--brand); padding: 0.8rem 0; }
.admin-bar .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.admin-brand { display: flex; align-items: center; gap: 1rem; }
.admin-bar .logo { height: 2.25rem; }
.admin-bar h1 { font-size: 1.2rem; margin: 0; padding-left: 1rem; border-left: 1px solid var(--line); }
.admin-bar span { color: var(--muted); }
.admin-bar a { color: var(--brand); font-weight: 600; }
.admin-main { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.25rem 1.5rem 1rem; margin-top: 1.5rem; }
.filters { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; margin: 1.25rem 0; }
.filters .field { margin: 0; }
.filters input { min-width: 16rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.6rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { border-bottom: 2px solid var(--brand); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--wash); }
tr.is-selected td, tr.is-selected:hover td { background: var(--brand-tint); }
.tag { display: inline-block; padding: 0.05rem 0.6rem; font-size: 0.85rem; font-weight: 600; border: 1px solid currentColor; border-radius: 999px; white-space: nowrap; }
.tag.ok { color: var(--ok); }
.tag.warn { color: var(--warn); }
.tag.bad { color: var(--error); }
.tag.muted { color: var(--muted); }
.detail { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border-top: 6px solid var(--brand); padding: 1.25rem 1.5rem; margin: 1.75rem 0 3rem; }
.detail-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; flex-wrap: wrap; }
.detail-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.detail dl { display: grid; grid-template-columns: minmax(10rem, max-content) 1fr; gap: 0.4rem 1.5rem; margin: 1rem 0 1.5rem; }
.detail dt { font-weight: 600; }
.detail dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 1.5rem 0; }
.status-form { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 0.5rem; max-width: 36rem; }
.status-form .field { margin-bottom: 1rem; }
@media (max-width: 40rem) {
  .detail dl { grid-template-columns: 1fr; }
  .detail dd { margin-bottom: 0.5rem; }
  .step, .submit-area { padding-left: 1.1rem; padding-right: 1.1rem; }
  .admin-bar h1 { border-left: 0; padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Employer forms additions ---------- */
.user-bar { display: flex; gap: 1rem; align-items: center; color: var(--muted); font-size: 0.95rem; flex-wrap: wrap; }
.user-bar strong { color: var(--ink); }
.user-bar a { font-weight: 600; }
.button-row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; margin: 0.5rem 0 0; }
.button.quiet { background: #fff; color: var(--ink); border-color: var(--field-border); }
.button.quiet:hover { background: var(--wash); color: var(--ink); }
.button.danger { background: #fff; color: var(--error); border-color: var(--error); }
.button.small { padding: 0.35rem 0.9rem; font-size: 0.95rem; }
.step > .button-row:last-child { margin-bottom: 1.25rem; }
/* Employer home: the three forms */
.tracker { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; gap: 1rem; }
.tracker li { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.5rem; display: grid; grid-template-columns: auto 1fr auto; gap: 0.25rem 1.25rem; align-items: center; }
.tracker .letter { grid-row: span 2; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: 1.3rem; }
.tracker .letter.done { background: var(--ok); }
.tracker h2 { font-size: 1.2rem; margin: 0; }
.tracker p { margin: 0; color: var(--muted); grid-column: 2; }
.tracker .act { grid-row: span 2; grid-column: 3; }
.sub-list { grid-column: 2 / 4; list-style: none; padding: 0; margin: 0.75rem 0 0; }
.sub-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-top: 1px solid var(--line); box-shadow: none; border-radius: 0; background: none; }
@media (max-width: 40rem) {
  .tracker li { grid-template-columns: auto 1fr; }
  .tracker .act { grid-column: 1 / 3; grid-row: auto; }
  .sub-list { grid-column: 1 / 3; }
}

/* Read-only prefilled details */
.summary { display: grid; grid-template-columns: minmax(10rem, max-content) 1fr; gap: 0.4rem 1.5rem; margin: 0 0 1.5rem; }
.summary dt { font-weight: 600; }
.summary dd { margin: 0; }
.prefilled { display: inline-block; font-size: 0.8rem; font-weight: 600; color: var(--warn); border: 1px solid currentColor; border-radius: 999px; padding: 0 0.5rem; margin-left: 0.4rem; vertical-align: middle; }
@media (max-width: 40rem) { .summary { grid-template-columns: 1fr; } .summary dd { margin-bottom: 0.5rem; } }

/* Status line on forms */
.saved { color: var(--ok); font-weight: 600; font-size: 0.95rem; }
.locked { background: var(--wash); border-left: 4px solid var(--muted); border-radius: var(--radius); padding: 0.9rem 1.1rem; margin-bottom: 1.5rem; }

/* Staff: tabs */
.tabs { display: flex; gap: 0.25rem; border-bottom: 2px solid var(--line); margin: 1.25rem 0 1.25rem; flex-wrap: wrap; }
.tabs button { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; padding: 0.6rem 1rem; margin-bottom: -2px; cursor: pointer; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel[hidden] { display: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.kpi b { display: block; font-size: 1.8rem; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 0.95rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2rem; }
@media (max-width: 48rem) { .two-col { grid-template-columns: 1fr; } }
.masked { font-family: Consolas, monospace; letter-spacing: 0.05em; }

/* Notices, inline edit panels, admin navigation */
.notice { background: var(--surface); border-left: 6px solid var(--ok); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.25rem; margin: 1.25rem 0; }
.notice.is-error { border-left-color: var(--error); }
.notice p { margin: 0; }
.edit-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.25rem 0.25rem; margin: 1rem 0 1.5rem; background: #fcfcfc; }
.edit-panel h3 { margin-top: 0; }
.admin-nav { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.admin-nav a[aria-current="page"] { color: var(--ink); text-decoration: none; }
.loading { color: var(--muted); padding: 1.5rem 0; }
.checks { display: grid; gap: 0.5rem; }
.detail-title { margin-bottom: 0.25rem; }
.detail-sub { margin: 0 0 1rem; color: var(--muted); }
.field > label.choice { display: flex; font-weight: 400; margin-bottom: 0; }
.filters .field > label.choice { padding-bottom: 0.7rem; }
.filters input[type="checkbox"] { min-width: 0; }
