/* SafeTrack UI. Colours come only from tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-sans); font-size: 14px; line-height: 1.6; color: var(--ink-900); background: var(--paper-0); }
a { color: var(--link); }
a:hover { color: var(--blue-500); }
h1, h2, h3 { font-family: var(--font-display); color: var(--heading); margin: 0; }
h1 { font-size: 32px; line-height: 1.1; font-weight: 700; }
h2 { font-size: 20px; line-height: 1.2; font-weight: 600; }
h3 { font-size: 16px; line-height: 1.3; font-weight: 600; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--cyan-400); outline-offset: 2px; }
.icon { flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--grey-600); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex-grow: 1; }

/* ---- top bar ------------------------------------------------------------ */
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }
.topbar { height: var(--topbar-h); background: var(--navy-900); color: var(--on-brand); display: flex; align-items: center; gap: 28px; padding: 0 40px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--on-brand); text-decoration: none; flex-shrink: 0; }
.brand:hover { color: var(--on-brand); }
.brand img { width: 90px; height: 32px; object-fit: contain; }
.brand img.brand-product, .logo-block img.brand-product { width: auto; height: 30px; }
.brand-divider { width: 1px; height: 28px; background: var(--topbar-divider); }
.brand-name { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.mainnav { display: flex; align-items: center; gap: 2px; flex-grow: 1; min-width: 0; }
.mainnav a { display: flex; align-items: center; gap: 6px; height: var(--topbar-h); padding: 0 12px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--topbar-link); white-space: nowrap; border-bottom: 3px solid transparent; padding-top: 3px; }
.mainnav a:hover { color: var(--on-brand); }
.mainnav a[aria-current="page"] { color: var(--on-brand); font-weight: 600; border-bottom-color: var(--cyan-400); }
.badge { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 9px; background: var(--blue-500); color: var(--on-brand); line-height: 1.5; }
.badge-red { background: var(--overdue-dot); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 44px; height: 44px; border-radius: var(--radius-sm); border: 0; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.topbar .icon-btn { color: var(--on-brand); }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
.avatar { width: 34px; height: 34px; border-radius: 17px; background: var(--blue-500); color: var(--on-brand); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.avatar-sm { width: 30px; height: 30px; border-radius: 15px; background: var(--blue-50); color: var(--link); font-size: 12px; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; display: flex; align-items: center; height: 44px; border-radius: 22px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu-panel { position: absolute; right: 0; top: 52px; min-width: 220px; background: var(--surface); color: var(--ink-900); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 8px 0; z-index: 30; }
.usermenu-panel .who { padding: 6px 16px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.usermenu-panel a, .usermenu-panel button { display: flex; width: 100%; align-items: center; min-height: 40px; padding: 0 16px; color: var(--ink-900); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--blue-50); }
.usermenu-panel .appearance { display: flex; flex-direction: column; gap: 6px; padding: 2px 16px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.usermenu-panel .segmented button { flex: 1; width: auto; min-height: 30px; height: 30px; padding: 0 10px; justify-content: center; }
.usermenu-panel .segmented button:not([aria-pressed="true"]):hover { background: transparent; color: var(--heading); }
.menu-toggle { display: none; }

/* ---- page ---------------------------------------------------------------- */
main { padding: 28px 40px 48px; display: flex; flex-direction: column; gap: 24px; max-width: 1600px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-head .titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--link); }
.lede { font-size: 15px; color: var(--ink-600); }
.breadcrumb { font-size: 13px; }

/* ---- buttons ------------------------------------------------------------- */
.btn { height: 44px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-secondary); background: var(--surface); color: var(--heading); font: inherit; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { color: var(--heading); border-color: var(--blue-500); }
.btn-primary { background: var(--blue-600); border-color: var(--link); color: var(--on-brand); padding: 0 18px; }
.btn-primary:hover { background: var(--blue-500); border-color: var(--blue-500); color: var(--on-brand); }
.btn-incident { background: var(--overdue-dot); border-color: var(--overdue-dot); color: var(--on-brand); padding: 0 18px; }
.btn-incident:hover { background: var(--overdue-fg); border-color: var(--overdue-fg); color: var(--on-brand); }
.btn-incident:focus-visible { outline: 3px solid var(--overdue-bg); outline-offset: 2px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; color: var(--link); }
.btn-primary.btn-sm, .btn-primary.btn-sm:hover { color: var(--on-brand); }  /* small primary buttons keep white text */
.btn-danger { color: var(--overdue-fg); }
.btn-link { background: none; border: 0; color: var(--link); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.quick { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- cards --------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-body { padding: 18px 22px; }
.card-foot { padding: 14px 22px; font-size: 14px; font-weight: 600; }
.card-foot a { text-decoration: none; }
.card-note { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 22px; font-size: 13px; color: var(--grey-600); flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 20px; align-items: start; }
.grid-halves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.stat { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); text-decoration: none; color: var(--ink-900); }
.stat:hover { border-color: var(--border-secondary); color: var(--ink-900); }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-600); }
.stat-value { font-family: var(--font-display); font-size: 40px; line-height: 1; font-weight: 700; color: var(--heading); }
.stat-value.is-overdue { color: var(--overdue-dot); }
.stat-sub { font-size: 13px; color: var(--grey-600); }
.dot { width: 10px; height: 10px; border-radius: 5px; flex-shrink: 0; background: var(--neutral-dot); }
.dot-overdue { background: var(--overdue-dot); }
.dot-soon { background: var(--amber-500); }
.dot-ok { background: var(--ok-dot); }
.dot-info { background: var(--blue-500); }

/* ---- tables -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { background: var(--blue-50); font-size: 12px; font-weight: 600; color: var(--heading); text-transform: uppercase; letter-spacing: 0.04em; text-align: left; padding: 11px 12px; white-space: nowrap; }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-600); vertical-align: middle; }
table.data th:first-child, table.data td:first-child { padding-left: 22px; }
table.data th:last-child, table.data td:last-child { padding-right: 22px; }
table.data tr.is-overdue td { background: var(--overdue-row); }
table.data td.strong, table.data td .strong { color: var(--ink-900); font-weight: 500; }
table.data td.actions { text-align: right; white-space: nowrap; }
.cell-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cell-title > a, .cell-title > .t { font-size: 14px; font-weight: 600; color: var(--ink-900); text-decoration: none; }
.cell-title > a:hover { color: var(--link); text-decoration: underline; }
.cell-title .sub { font-size: 12px; color: var(--grey-600); }
.cell-title > a, .cell-title > .t, .cell-title .sub { overflow-wrap: anywhere; }  /* long file names must wrap, not push columns out of the card */
.empty { padding: 28px 22px; color: var(--grey-600); text-align: center; }

/* definition list */
dl.facts { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
dl.facts dt { font-size: 13px; font-weight: 600; color: var(--ink-600); }
dl.facts dd { margin: 0; color: var(--ink-900); }
.fact-date { display: inline-block; min-width: 7em; font-variant-numeric: tabular-nums; }  /* lines up the pills after it */

/* ---- pills & labels ------------------------------------------------------ */
.pill { display: inline-flex; align-items: center; width: fit-content; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-overdue { background: var(--overdue-bg); color: var(--overdue-fg); }
.pill-soon { background: var(--soon-bg); color: var(--soon-fg); }
.pill-ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill-info { background: var(--info-bg); color: var(--info-fg); }
.pill-neutral { background: var(--line-soft); color: var(--ink-600); }
.basis { width: fit-content; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; padding: 1px 7px; border-radius: 4px; line-height: 1.6; }
.basis-legal { background: var(--navy-900); color: var(--on-brand); }
.basis-guidance { background: var(--blue-50); color: var(--link); }
.basis-good { background: var(--line-soft); color: var(--ink-600); }
.basis-ours { background: var(--surface); color: var(--grey-600); border: 1px solid var(--border-input); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--link); background: var(--blue-50); padding: 1px 8px; border-radius: 4px; }

/* ---- filters / segmented ------------------------------------------------- */
.filters { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; width: 280px; max-width: 100%; height: 40px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border-input); border-radius: var(--radius-sm); color: var(--grey-600); }
.search-lg { width: 300px; height: 44px; padding: 0 14px; }
.search input { border: 0; outline: none; background: transparent; font: inherit; font-size: 14px; flex-grow: 1; min-width: 0; color: var(--ink-900); }
.search:focus-within { outline: 3px solid var(--cyan-400); outline-offset: 1px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { position: relative; height: 34px; padding: 0 12px; border-radius: 17px; font: inherit; font-size: 13px; font-weight: 500; border: 1px solid var(--border-input); background: var(--surface); color: var(--ink-600); cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; }
.chip:hover { color: var(--heading); border-color: var(--heading); }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip:focus-within { outline: 3px solid var(--cyan-400); outline-offset: 2px; }
.chip[aria-pressed="true"], .chip:has(input:checked) { border-color: var(--heading); background: var(--navy-900); color: var(--on-brand); font-weight: 600; }
.segmented { display: flex; gap: 4px; background: var(--segment-bg); padding: 3px; border-radius: var(--radius-sm); }
.segmented a, .segmented button { height: 30px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent; color: var(--ink-600); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; }
.segmented [aria-pressed="true"], .segmented [aria-current="true"] { background: var(--surface); color: var(--heading); font-weight: 600; }
.inline-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-600); }

/* ---- forms --------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-900); }
.field .hint { font-size: 12px; font-weight: 400; color: var(--grey-600); }
.input, .field input[type="text"], .field input[type="email"], .field input[type="date"], .field input[type="datetime-local"],
.field input[type="number"], .field input[type="password"], .field select, .field textarea, select.input {
  height: 42px; padding: 0 12px; border: 1px solid var(--border-input); border-radius: var(--radius-sm); background: var(--surface);
  font: inherit; font-size: 14px; font-weight: 400; color: var(--ink-900); width: 100%;
}
.field select, select.input { padding: 0 10px; }
.field textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.freq-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.freq-num { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink-900); }
.freq-num input { width: 96px; }
.freq-unit select { width: auto; min-width: 140px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-size: 13px; font-weight: 600; color: var(--ink-900); padding: 0; margin-bottom: 8px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border: 1px solid var(--border-input); border-radius: var(--radius-sm); font-size: 14px; font-weight: 400; color: var(--ink-900); cursor: pointer; background: var(--surface); }
.choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--link); flex-shrink: 0; }
.choice:has(input:checked) { border: 2px solid var(--blue-600); padding: 0 13px; font-weight: 600; }
.choice.choice-fault:has(input:checked) { border-color: var(--overdue-dot); background: var(--overdue-row); color: var(--overdue-fg); }
.choice.choice-fault input { accent-color: var(--overdue-dot); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--heading); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--link); }
.subpanel { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--blue-50); border-radius: var(--radius-md); }
.subpanel .field { font-size: 12px; color: var(--heading); }
.subpanel .field input, .subpanel .field select { border-color: var(--border-secondary); height: 40px; }
.dropzone { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border: 1px dashed var(--border-dashed); border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: var(--link); cursor: pointer; text-align: center; padding: 8px; }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone:focus-within { outline: 3px solid var(--cyan-400); outline-offset: 2px; }
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--link); }
.file-item a { flex-grow: 1; color: var(--ink-900); text-decoration: none; font-size: 14px; overflow-wrap: anywhere; }
.file-item a:hover { color: var(--link); text-decoration: underline; }
.errors { background: var(--overdue-bg); color: var(--overdue-fg); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; }
.errors ul { margin: 4px 0 0; padding-left: 18px; }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--blue-50); color: var(--heading); border-radius: var(--radius-md); padding: 14px 16px; font-size: 14px; }
.notice-warn { background: var(--soon-bg); color: var(--soon-fg); }
/* Compliance health (dashboard) */
.handover-group h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 14px; }
.handover-group ul { margin: 0 0 6px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.health-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: stretch; }
.health-row-single { grid-template-columns: minmax(0, 1fr); }
.health { display: flex; flex-direction: column; gap: 18px; padding: 22px 24px; }
.health-main { display: flex; gap: 22px; align-items: center; min-width: 0; }
.health-ring { position: relative; flex: none; width: 148px; height: 148px; border-radius: 50%; text-decoration: none; }
.health-ring svg { display: block; }
.health-track, .health-meter { fill: none; stroke-width: 13; }
.health-track { stroke: var(--line-soft); }
.health-meter { stroke-linecap: round; }
.health-value { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--heading); }
.health-value strong { font-family: var(--font-display); font-size: 36px; font-weight: 700; line-height: 1; }
.health-value small { font-size: 18px; margin-left: 1px; }
.health-value span { font-size: 12px; font-weight: 600; color: var(--ink-600); }
.health-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.health-text p { margin: 0; font-size: 14px; color: var(--ink-600); }
.health-verdict { margin: 0; font-size: 22px; }
.health-verdict-overdue { color: var(--overdue-fg); }
.health-verdict-soon { color: var(--soon-fg); }
.health-verdict-ok { color: var(--ok-fg); }
.health-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.health-chips a { text-decoration: none; }
.health-person .health-main { flex-wrap: wrap; }
.health-person .health-text { flex: 1 1 220px; }
.health-person .health-todo { flex: 1 1 340px; }
.score-link { text-decoration: none; }
.health-value-sm strong { font-size: 28px; }
.health-value-sm small { font-size: 14px; }
.health-value-sm span { font-size: 11px; }
.health-todo h3 { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--ink-600); }
.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.todo-list a { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--line-soft); text-decoration: none; color: var(--ink-900); }
.todo-list li:first-child a { border-top: 0; }
.todo-list a:hover { background: var(--paper-0); }
.todo-list .icon { flex: none; color: var(--ink-600); }
.todo-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.todo-text strong { font-size: 14px; font-weight: 600; }
.todo-text span { font-size: 12px; color: var(--ink-600); }
.todo-more { margin: 6px 0 0; font-size: 13px; }
.health-done { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; color: var(--ok-fg); }
.score-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: var(--ink-900); }
.score-pill::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--score-colour); }
.health-areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.area-tile { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; align-content: start; padding: 10px 12px; border-radius: var(--radius-sm); text-decoration: none; border: 1px solid transparent; transition: transform .15s ease, border-color .15s ease; }
.area-tile:hover { transform: translateY(-1px); border-color: currentColor; }
.area-tile-icon { grid-row: span 2; align-self: center; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--tile-icon-bg); margin-right: 2px; }
.area-tile-icon .area-icon { color: inherit; }
.area-tile-name { font-size: 14px; font-weight: 600; color: var(--ink-900); }
.area-tile-note { grid-column: 2; font-size: 12px; font-weight: 600; }
.area-tile-ok { background: var(--ok-bg); color: var(--ok-fg); }
.area-tile-soon { background: var(--soon-bg); color: var(--soon-fg); }
.area-tile-overdue { background: var(--overdue-bg); color: var(--overdue-fg); }
.area-tile-overdue .area-tile-name { color: var(--overdue-fg); }
@media (max-width: 1100px) { .health-row { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) {
  .health { padding: 18px 16px; }
  .health-main { flex-direction: column; text-align: center; }
  .health-chips { justify-content: center; }
  .health-areas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .area-tile { transition: none; } .area-tile:hover { transform: none; } }

/* Outcome notifications */
.toasts { position: fixed; top: calc(var(--topbar-h) + 14px); right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; position: relative; overflow: hidden; display: flex; gap: 12px; align-items: flex-start; background: var(--surface); color: var(--ink-900); border: 1px solid var(--line); border-left: 4px solid var(--ok-dot); border-radius: var(--radius-md); padding: 14px 12px 14px 14px; box-shadow: 0 10px 30px rgba(13, 43, 99, .16); animation: toast-in .35s cubic-bezier(.2, .9, .3, 1.2) both; }
.toast.is-leaving { animation: toast-out .25s ease-in both; }
.toast-icon { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok-fg); }
.toast-ok .toast-icon .icon path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: tick-draw .45s .25s ease-out forwards; }
.toast-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 1.4; }
.toast-body strong { font-family: var(--font-display); font-size: 15px; color: var(--heading); }
.toast-body span { color: var(--ink-600); overflow-wrap: anywhere; }
.toast-close { flex: none; border: 0; background: none; color: var(--ink-600); width: 28px; height: 28px; border-radius: var(--radius-sm); display: grid; place-items: center; cursor: pointer; }
.toast-close:hover { background: var(--line-soft); }
.toast-ok::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--ok-dot); opacity: .35; transform-origin: left; animation: toast-timer 6s linear forwards; }
.toast-ok.is-paused::after { animation-play-state: paused; }
.toast-warn { border-left-color: var(--soon-fg); }
.toast-warn .toast-icon { background: var(--soon-bg); color: var(--soon-fg); }
.toast-error { border-left-color: var(--overdue-dot); }
.toast-error .toast-icon { background: var(--overdue-bg); color: var(--overdue-fg); animation: nudge .5s .3s ease-in-out; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }
@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes tick-draw { to { stroke-dashoffset: 0; } }
@keyframes nudge { 0%, 100% { transform: none; } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.errors.is-new { animation: nudge-x .4s ease-in-out; }
@keyframes nudge-x { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Submitting: spinner in the button, progress bar under the top bar */
.btn.is-busy, .btn-link.is-busy { pointer-events: none; opacity: .85; cursor: progress; }
.spinner { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 70; pointer-events: none; opacity: 0; overflow: hidden; }
.is-submitting .progress-bar { opacity: 1; }
.is-submitting .progress-bar::before { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: linear-gradient(90deg, transparent, #7fb2ff, var(--white), #7fb2ff, transparent); animation: progress-slide 1.2s ease-in-out infinite; }
@keyframes progress-slide { from { left: -40%; } to { left: 100%; } }
.is-submitting { cursor: progress; }

/* Longer jobs (building and sending packs) */
.busy-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(13, 43, 99, .45); display: grid; place-items: center; padding: 16px; animation: fade-in .2s ease-out both; }
.busy-card { background: var(--surface); border-radius: var(--radius-lg); padding: 28px 28px 24px; width: min(420px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: 0 20px 60px rgba(13, 43, 99, .3); animation: toast-in .35s cubic-bezier(.2, .9, .3, 1.2) both; }
.busy-title { font-family: var(--font-display); font-size: 20px; color: var(--heading); }
.busy-detail, .busy-slow { margin: 0; font-size: 14px; color: var(--ink-600); }
.busy-slow { color: var(--soon-fg); }
.busy-track { width: 100%; height: 6px; margin-top: 10px; border-radius: 3px; background: var(--blue-50); position: relative; overflow: hidden; }
.busy-track span { position: absolute; top: 0; bottom: 0; width: 35%; border-radius: 3px; background: var(--blue-600); animation: progress-slide 1.4s ease-in-out infinite; }
.busy-art { width: 120px; height: 80px; margin-bottom: 4px; }
.busy-send .plane { fill: var(--blue-50); stroke: var(--blue-600); stroke-width: 2.5; stroke-linejoin: round; animation: plane-fly 1.8s ease-in-out infinite; }
.busy-send .fold { fill: none; }
.busy-send .trail { fill: none; stroke: var(--border-secondary); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 5 7; animation: trail-move 0.8s linear infinite; }
@keyframes plane-fly { 0% { transform: translate(-6px, 6px) rotate(-2deg); } 50% { transform: translate(4px, -5px) rotate(3deg); } 100% { transform: translate(-6px, 6px) rotate(-2deg); } }
@keyframes trail-move { to { stroke-dashoffset: -12; } }
.busy-build .page { fill: var(--surface); stroke: var(--blue-600); stroke-width: 2.5; transform-box: fill-box; transform-origin: center; }
.busy-build .p1 { animation: page-deal 2.4s ease-in-out infinite; }
.busy-build .p2 { animation: page-deal 2.4s .8s ease-in-out infinite; }
.busy-build .p3 { animation: page-deal 2.4s 1.6s ease-in-out infinite; }
.busy-build .lines { fill: none; stroke: var(--border-secondary); stroke-width: 3; stroke-linecap: round; }
@keyframes page-deal { 0% { opacity: 0; transform: translate(30px, -10px) rotate(12deg); } 25%, 70% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translate(-30px, 6px) rotate(-10deg); } }
@keyframes fade-in { from { opacity: 0; } }

@media (max-width: 760px) {
  .toasts { top: auto; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.is-leaving, .busy-card, .busy-overlay, .errors.is-new, .toast-error .toast-icon { animation: none; }
  .toast-ok .toast-icon .icon path { animation: none; stroke-dashoffset: 0; }
  .busy-send .plane, .busy-send .trail, .busy-build .page { animation: none; }
  .busy-build .p2, .busy-build .p3 { opacity: 0; }
  .spinner { animation-duration: 1.6s; }
}
@media print { .toasts, .progress-bar, .busy-overlay { display: none !important; } }

/* ---- slide-over panel ---------------------------------------------------- */
.backdrop { position: fixed; inset: 0; background: var(--backdrop); z-index: 40; }
.panel { position: fixed; right: 0; top: 0; bottom: 0; width: var(--panel-w); max-width: 100%; background: var(--surface); display: flex; flex-direction: column; z-index: 41; }
.panel form { display: flex; flex-direction: column; min-height: 0; flex-grow: 1; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 28px 32px 20px; border-bottom: 1px solid var(--line); }
.panel-head .titles { display: flex; flex-direction: column; gap: 6px; }
.panel-head h2 { font-size: 24px; line-height: 1.15; font-weight: 700; }
.panel-body { flex-grow: 1; display: flex; flex-direction: column; gap: 18px; padding: 22px 32px; overflow-y: auto; }
.panel-foot { display: flex; flex-direction: column; gap: 14px; padding: 18px 32px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.panel-foot .next { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-600); }
.panel-foot .next .icon { color: var(--link); }
.panel-foot .next strong { color: var(--ink-900); }
.panel-foot .buttons { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.page-panel { max-width: 640px; }
.page-panel .panel-inline { position: static; width: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }

/* ---- lists (dashboard side cards) ---------------------------------------- */
.area-list a { display: flex; align-items: center; gap: 12px; padding: 8px 22px; text-decoration: none; color: var(--ink-900); border-top: 1px solid var(--line-soft); min-height: 40px; }
.area-list a:hover { background: var(--paper-0); }
.area-list .name { flex-grow: 1; font-size: 14px; font-weight: 500; }
.area-list .note { font-size: 13px; color: var(--grey-600); }
.area-list .note-overdue { color: var(--overdue-fg); font-weight: 600; }
.area-list .note-soon { color: var(--soon-fg); font-weight: 600; }
.activity { display: flex; gap: 12px; padding: 10px 22px; }
.activity .text { font-size: 13px; color: var(--ink-900); }
.activity .when { font-size: 12px; color: var(--grey-600); }

/* ---- assessment form ----------------------------------------------------- */
.q { padding: 16px 22px; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px 24px; }
.q:first-of-type { border-top: 0; }
.q-text { font-size: 14px; font-weight: 600; color: var(--ink-900); }
.q-guidance { font-size: 13px; color: var(--grey-600); margin-top: 4px; }
.q-answer { display: flex; flex-direction: column; gap: 8px; }
.q-answer .choice-grid { gap: 8px; }
.q-answer .choice { min-height: 40px; }
.q-answer textarea { min-height: 42px; }
.q-full { grid-template-columns: minmax(0, 1fr); }
.q.is-problem { background: var(--overdue-row); }
.answer-read { font-weight: 600; color: var(--ink-900); }
.answer-read.is-problem { color: var(--overdue-fg); }
.risk-table td { vertical-align: top; }
.risk-table input, .risk-table select, .risk-table textarea { width: 100%; min-width: 90px; border: 1px solid var(--border-input); border-radius: var(--radius-sm); font: inherit; font-size: 13px; padding: 6px 8px; background: var(--surface); }
.risk-table textarea { min-height: 60px; resize: vertical; }
.score { display: inline-flex; min-width: 30px; justify-content: center; font-weight: 700; }
.matrix { border-collapse: collapse; font-size: 12px; }
.matrix th, .matrix td { border: 1px solid var(--line); padding: 4px 8px; text-align: center; }
.matrix th { background: var(--blue-50); color: var(--heading); }
.band-low { background: var(--ok-bg); color: var(--ok-fg); }
.band-medium { background: var(--soon-bg); color: var(--soon-fg); }
.band-high, .band-very-high { background: var(--overdue-bg); color: var(--overdue-fg); }
.band-very-high { font-weight: 700; }
.lock-banner { display: flex; align-items: center; gap: 10px; background: var(--blue-50); color: var(--heading); border-radius: var(--radius-md); padding: 12px 16px; font-weight: 600; }

/* ---- policy body --------------------------------------------------------- */
.prose { max-width: 760px; font-size: 15px; line-height: 1.65; }
.prose h1 { font-size: 26px; margin: 0 0 12px; }
.prose h2 { font-size: 20px; margin: 24px 0 8px; }
.prose h3 { font-size: 16px; margin: 18px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 12px; }
.prose li { margin-bottom: 4px; }
.template-banner { display: flex; gap: 10px; background: var(--soon-bg); color: var(--soon-fg); border-radius: var(--radius-md); padding: 14px 16px; font-size: 14px; font-weight: 600; }

/* ---- login --------------------------------------------------------------- */
.login-wrap { max-width: none; margin: 0; width: 100%; box-sizing: border-box; position: relative; overflow: hidden; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 16px;
  background:
    radial-gradient(900px 600px at 88% -10%, rgba(41, 182, 216, 0.22), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(21, 94, 201, 0.35), transparent 60%),
    linear-gradient(160deg, var(--navy-950), var(--navy-900) 60%, #10357a); }
/* One large, faint shield from the SafeTrack logo, partly off the left edge */
.login-shield { position: absolute; left: -9vh; bottom: -14vh; width: 62vh; height: 81vh; pointer-events: none; background: var(--on-brand); opacity: .05;
  -webkit-mask: url("/static/shield.png") no-repeat center / contain; mask: url("/static/shield.png") no-repeat center / contain; }
.login-card { position: relative; z-index: 1; width: 420px; max-width: 100%; background: var(--surface); border-radius: var(--radius-lg); padding: 36px 32px; display: flex; flex-direction: column; gap: 20px;
  box-shadow: 0 24px 60px rgba(5, 12, 40, 0.35); }
.login-tagline { margin: -8px 0 0; font-size: 13px; color: var(--grey-600); }
.login-foot { position: relative; z-index: 1; margin: 0; font-size: 12px; letter-spacing: .02em; color: rgba(255, 255, 255, 0.55); }
@media (max-width: 760px) { .login-shield { left: -18vh; width: 48vh; height: 63vh; opacity: .04; } }
.login-card .logo-block { display: flex; align-items: center; gap: 12px; background: var(--navy-900); color: var(--on-brand); border-radius: var(--radius-md); padding: 14px 18px; }

/* ---- responsive ---------------------------------------------------------- */
@media (max-width: 1280px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .topbar { gap: 16px; padding: 0 24px; }
  .mainnav a { padding: 0 8px; }
}
@media (max-width: 1290px) {  /* 12 menu items need about 1290px; narrower screens use the menu button */
  .menu-toggle { display: inline-flex; }
  .mainnav { display: none; position: absolute; top: var(--topbar-h); left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--navy-900); padding: 8px 0 12px; gap: 0; }
  .mainnav.is-open { display: flex; }
  .mainnav a { height: 48px; padding: 0 24px; border-bottom: 0; border-left: 3px solid transparent; }
  .mainnav a[aria-current="page"] { border-left-color: var(--cyan-400); border-bottom-color: transparent; }
  .topbar-actions { margin-left: auto; }
}
@media (max-width: 760px) {
  main { padding: 20px 16px 40px; }
  .topbar { padding: 0 12px; }
  .brand img { width: 70px; }
  .brand img.brand-product { width: auto; height: 24px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-halves, .field-row, .field-row-3 { grid-template-columns: minmax(0, 1fr); }
  .q { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .panel-head, .panel-body, .panel-foot { padding-left: 20px; padding-right: 20px; }
  dl.facts { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  dl.facts dd { margin-bottom: 10px; }
  h1 { font-size: 26px; }
  .search, .search-lg { width: 100%; }
  table.data.stack-mobile thead { display: none; }
  table.data.stack-mobile, table.data.stack-mobile tbody, table.data.stack-mobile tr, table.data.stack-mobile td { display: block; width: 100%; }
  table.data.stack-mobile tr { border-bottom: 1px solid var(--line); padding: 10px 16px; }
  table.data.stack-mobile td { border: 0; padding: 3px 0 !important; text-align: left; }
  table.data.stack-mobile td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--ink-600); }
  table.data.stack-mobile td.actions { padding-top: 8px !important; }
}

/* ---- print --------------------------------------------------------------- */
@media print {
  .topbar, .quick, .filters, .btn, .no-print { display: none !important; }
  main { padding: 0; }
  .card { break-inside: avoid; }
}

/* Shield watermarks (from the SafeTrack logo): one faint shield behind the page (the login page has its own). Never clickable. */
:root { --shield-mask: url("/static/shield.png"); }
body.app::before {
  content: ""; pointer-events: none;
  -webkit-mask: var(--shield-mask) no-repeat center / contain; mask: var(--shield-mask) no-repeat center / contain;
}
body.app::before { position: fixed; right: -50px; bottom: -60px; width: 300px; height: 392px; background: var(--navy-900); opacity: .022; z-index: 0; }
body.app > main, body.app > header { position: relative; z-index: 1; }
body.app > .topbar { position: sticky; z-index: 20; }
@media (max-width: 760px) {
  /* Phones (decision 70): keep the watermark inside the screen, and never let anything widen the page sideways,
     or phone browsers zoom the whole page out to fit it. */
  body.app::before { width: 200px; height: 262px; right: 0; bottom: 0; }
  html, body { overflow-x: clip; max-width: 100%; }
}
@media print { body.app::before { display: none; } }

/* ---- Polish: area icons, softer depth, hover states, loading placeholders ---- */
:root {
  --shadow-card: 0 1px 2px rgba(13, 43, 99, .05), 0 6px 20px rgba(13, 43, 99, .05);
  --shadow-lift: 0 2px 4px rgba(13, 43, 99, .06), 0 12px 28px rgba(13, 43, 99, .10);
}
.area-icon { display: inline-grid; place-items: center; color: var(--link); flex: none; }
.with-icon { display: inline-flex; align-items: center; gap: 8px; }
.with-icon .area-icon { width: 26px; height: 26px; border-radius: 8px; background: var(--blue-50); }

.card, .stat { box-shadow: var(--shadow-card); }
.stat { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.area-tile:hover { box-shadow: var(--shadow-card); }
.btn { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease; }
.btn:hover { box-shadow: 0 2px 8px rgba(13, 43, 99, .12); }
.btn:active { transform: scale(.98); }
table.data tbody tr { transition: background-color .12s ease; }
table.data tbody tr:not(.is-overdue):hover td { background: var(--paper-0); }
.todo-list a, .area-list a { transition: background-color .12s ease; }

/* Loading placeholders: shown while a slide-over panel or a section is fetched */
.sk { border-radius: 6px; background: linear-gradient(90deg, var(--line-soft) 0%, var(--sk-shine) 40%, var(--line-soft) 80%); background-size: 200% 100%; animation: sk-shimmer 1.2s ease-in-out infinite; }
.panel-skeleton { padding: 26px 32px; gap: 16px; }
.panel-skeleton .sk-eyebrow { width: 70px; height: 10px; }
.panel-skeleton .sk-title { width: 55%; height: 22px; margin-bottom: 14px; }
.panel-skeleton .sk-label { width: 30%; height: 10px; }
.panel-skeleton .sk-field { width: 100%; height: 42px; margin-bottom: 6px; }
.is-loading { position: relative; }
.is-loading::after { content: ""; position: absolute; inset: 0; background: var(--loading-veil); pointer-events: none; z-index: 2; }
.is-loading tbody { opacity: .5; }
@keyframes sk-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  .stat, .btn, table.data tbody tr { transition: none; }
  .stat:hover { transform: none; }
  .btn:active { transform: none; }
  .sk { animation: none; }
}
.link-existing { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.link-existing label { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 220px; }
.link-existing select { height: 34px; }
/* RAMS template library */
.rams-library { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.rams-tile { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 4px; padding: 18px 20px; text-decoration: none; color: var(--ink-900); transition: transform .18s ease, box-shadow .18s ease; }
.rams-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.rams-num { grid-row: span 3; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--blue-50); color: var(--link); font-weight: 700; }
.rams-name { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--heading); }
.rams-sum { font-size: 13px; color: var(--ink-600); }
.rams-meta { font-size: 12px; color: var(--grey-600); }
.tpl-q { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.tpl-q:last-child { border-bottom: 0; padding-bottom: 0; }
.tpl-label { font-size: 13px; font-weight: 600; color: var(--grey-600); }
.tpl-answer { white-space: pre-line; color: var(--ink-900); }
.tpl-comment { font-size: 13px; color: var(--soon-fg); }
@media (prefers-reduced-motion: reduce) { .rams-tile { transition: none; } .rams-tile:hover { transform: none; } }
.add-template { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.add-template .field { flex: 1; min-width: 240px; }
.check.covers { align-items: flex-start; font-weight: 400; }
.check.covers .sub { display: block; font-size: 12px; color: var(--grey-600); }
.no-action summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--link); margin-top: 4px; }
.no-action form { margin-top: 8px; max-width: 460px; }
.dispute-banner { border-left: 4px solid var(--soon-fg); }
/* Checklist ticks as equal tiles: the box never shrinks, each row of tiles is the same height, ticked ones turn green */
.checklist-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 8px; }
.checklist-items .check { font-weight: 400; align-items: flex-start; gap: 12px; padding: 10px 12px; line-height: 1.45;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); transition: background .12s, border-color .12s; }
.checklist-items .check input { width: 20px; height: 20px; margin: 0; }
.checklist-items .check:hover { border-color: var(--link); }
.checklist-items .check:has(input:checked) { background: var(--ok-bg); border-color: var(--ok-dot); }
/* Ticks with a longer label and a hint underneath (driving check) */
.check.check-long { align-items: flex-start; font-weight: 500; }
.check.check-long input { margin-top: 2px; flex: none; }
.check .hint-line { display: block; font-size: 12px; font-weight: 400; color: var(--ink-600); margin-top: 2px; }
.check.is-missing { color: var(--overdue-fg); }
.check.is-missing input { outline: 2px solid var(--overdue-fg); outline-offset: 2px; }
.field.is-missing input { border-color: var(--overdue-fg); box-shadow: 0 0 0 2px var(--overdue-bg); }
/* Profile photos (decision 38) */
img.avatar-photo { object-fit: cover; background: var(--line-soft); padding: 0; }
.person-cell { display: flex; align-items: center; gap: 10px; }
.titles.person-hero { display: flex; flex-direction: row; align-items: center; gap: 16px; }
.avatar-lg { width: 64px; height: 64px; border-radius: 32px; font-size: 22px; }
/* Policy signature block and quotes (decision 39) */
.prose blockquote { margin: 0 0 14px; padding: 10px 14px; background: var(--blue-50); border-left: 3px solid var(--link); border-radius: 0 var(--radius-md) var(--radius-md) 0; color: var(--heading); }
.prose blockquote p { margin: 0; }
/* Training matrix (decision 41) */
.training-matrix th { vertical-align: bottom; min-width: 110px; }
.training-matrix th .tm-head { display: block; }
.training-matrix th .tm-req { display: block; font-size: 10px; font-weight: 600; color: var(--overdue-fg); text-transform: none; letter-spacing: 0; }
.training-matrix td.tm-cell { white-space: nowrap; }
.training-matrix td.tm-cell .pill { font-size: 11px; text-decoration: none; }
/* Wellbeing survey (decision 44) */
.survey-grid th.c, .survey-grid td.c { text-align: center; width: 9%; }
.survey-grid td.c label { display: block; padding: 6px 0; cursor: pointer; }
.survey-grid td.c input { width: 18px; height: 18px; accent-color: var(--link); }
.survey-bar { height: 10px; border-radius: 5px; background: var(--line-soft); overflow: hidden; }
.survey-bar span { display: block; height: 100%; }
.survey-bar .bar-ok { background: var(--ok-fg); } .survey-bar .bar-soon { background: var(--soon-fg); } .survey-bar .bar-overdue { background: var(--overdue-fg); }
/* Help (decision 48) */
.help-layout { display: flex; flex-direction: column; gap: 16px; max-width: 900px; }
.help-article { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 14px; background: var(--surface); }
.help-article > summary { cursor: pointer; font-weight: 600; color: var(--heading); }
.help-article[open] > summary { margin-bottom: 8px; }
.help-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--link); text-decoration: none; }
.help-link:hover { text-decoration: underline; }
/* What's new card (decision 49) */
.whats-new { border-left: 4px solid var(--cyan-400, var(--link)); }
.whats-new .card-head h2 { display: flex; align-items: center; gap: 8px; }
/* Phone-friendly checklists (van checks, decision 51) */
@media (max-width: 700px) {
  .checklist-items .check { padding: 12px; font-size: 15px; }
  .checklist-items .check input { width: 22px; height: 22px; }
  .choice { padding: 14px 12px; }
}
/* UK number plate for vehicle registrations (decision 52) */
.reg-plate { display: inline-flex; align-items: stretch; vertical-align: middle; background: #f7c600; color: #111; border: 1.5px solid #1a1a1a;
  border-radius: 4px; overflow: hidden; line-height: 1; box-shadow: 0 1px 0 rgba(0,0,0,.15); text-decoration: none; }
.reg-plate .reg-band { background: #003399; color: #fff; font: 700 8px/1 var(--font-sans); letter-spacing: .02em; padding: 0 3px;
  display: flex; align-items: flex-end; padding-bottom: 3px; }
.reg-plate .reg-text { font: 700 15px/1 "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif; letter-spacing: .06em;
  padding: 5px 8px 4px; text-transform: uppercase; white-space: nowrap; }
.reg-plate.reg-lg .reg-band { font-size: 11px; padding: 0 5px 5px; }
.reg-plate.reg-lg .reg-text { font-size: 26px; padding: 7px 12px 6px; }
.reg-plate.reg-ev .reg-band { background: #00a651; }  /* zero-emission green flash */
/* Fuel badge beside the plate, in UK pump colours (decision 54) */
.fuel-chip { display: inline-block; vertical-align: middle; margin-left: 8px; padding: 3px 8px; border-radius: 999px; font: 700 11px/1.2 var(--font-sans);
  letter-spacing: .02em; color: #fff; background: #1f2329; }
.fuel-chip.fuel-petrol { background: #1b7f3b; }
.fuel-chip.fuel-hybrid { background: #0b6e8a; }
.fuel-chip.fuel-electric { background: #00a651; }
.plate-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plate-row .fuel-chip { margin: 0; }
.make-logo { display: inline-flex; align-items: center; justify-content: center; width: var(--s); height: var(--s); flex: none;
  color: var(--heading); vertical-align: middle; }
.make-logo svg { width: 100%; height: 100%; }
.make-initials { border-radius: 50%; border: 1.5px solid currentColor; font: 700 calc(var(--s) * .38)/1 var(--font-sans); color: var(--grey-600); }
.make-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
th a.sort { color: inherit; text-decoration: none; } th a.sort[aria-current] { text-decoration: underline; text-underline-offset: 3px; }
a:hover > .reg-plate, a.reg-link:hover .reg-plate { box-shadow: 0 0 0 2px var(--link); }
input.reg-input { background: #f7c600; color: #111; border-color: #1a1a1a; font: 700 18px "Arial Narrow", Arial, sans-serif;
  letter-spacing: .08em; border-left: 22px solid #003399; }
input.reg-input::placeholder { color: rgba(0,0,0,.4); }
/* Twelve menu items: tighter spacing up to 1440px so the last items never run under the icons */
@media (max-width: 1440px) and (min-width: 1291px) {
  .topbar { gap: 16px; padding: 0 24px; }
  .mainnav a { padding: 0 8px; }
}
/* Assessment risk levels (decision 58) */
.risk-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.risk-tile { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink-900); background: var(--surface); }
.risk-tile strong { font: 700 24px/1.1 var(--font-display); }
.risk-tile span { font-size: 12px; font-weight: 600; }
a.risk-tile:hover { border-color: var(--link); }
.lvl-high { background: var(--overdue-bg); color: var(--overdue-fg); border-color: transparent; }
.lvl-medium { background: var(--soon-bg); color: var(--soon-fg); border-color: transparent; }
.lvl-low { background: var(--info-bg); color: var(--info-fg); border-color: transparent; }
.lvl-none { background: var(--ok-bg); color: var(--ok-fg); border-color: transparent; }
.risk-tile.lvl-info, .risk-tile.lvl-oh { background: var(--surface); color: var(--ink-900); border-color: var(--line); }
.risk-pill { white-space: nowrap; }
.resp-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line-soft); min-width: 120px; }
.resp-bar span { display: block; height: 100%; }
.resp-bar .ok { background: var(--ok-dot); } .resp-bar .bad { background: var(--overdue-dot); } .resp-bar .na { background: var(--neutral-dot); }
/* Badges (decision 62) */
.badge-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
.badge-medal { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; width: 88px; text-align: center; }
.badge-disc { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--line-soft);
  color: var(--grey-600); border: 2px dashed var(--line); }
.badge-medal.is-earned .badge-disc { background: linear-gradient(145deg, #f7c600, #e09a00); color: #3b2a00; border: 2px solid #fff3c4;
  box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.badge-name { font-size: 12px; font-weight: 600; line-height: 1.25; color: var(--ink-600); }
.badge-medal.is-earned .badge-name { color: var(--ink-900); }
.badge-sm { width: auto; } .badge-sm .badge-disc { width: 30px; height: 30px; border-width: 1.5px; }
.badge-new { border-left: 4px solid #e09a00; }
/* Mandatory training alert on the dashboard (decision 64) */
.training-alert { border-left: 4px solid var(--overdue-fg); }
.training-alert .card-head h2 { display: flex; align-items: center; gap: 8px; color: var(--overdue-fg); }
.training-alert-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* ---- phones (decision 69): only inside these media queries, so desktop is unchanged ------------------ */
@media (max-width: 760px) {
  /* 16px stops iPhones zooming the page when a field is tapped */
  input:not([type=checkbox]):not([type=radio]), select, textarea, .search input { font-size: 16px; }
  /* Filters stack full width instead of running off the screen */
  .filters { gap: 10px; }
  .filters .inline-label { flex: 1 1 100%; }
  .filters .inline-label select, .inline-label .input { flex: 1; width: 100% !important; min-width: 0; }
  .filters .segmented { flex-wrap: wrap; }
  /* Buttons: long labels wrap rather than overflow; small ones are still comfortable to tap */
  .btn { white-space: normal; height: auto; min-height: 44px; padding-top: 8px; padding-bottom: 8px; text-align: center; max-width: 100%; }
  .btn-sm { min-height: 38px; padding-top: 6px; padding-bottom: 6px; }
  .page-head > form, .page-head .search, .page-head .search-lg { width: 100%; }
  .segmented a, .segmented button { height: 36px; }
  form { max-width: 100%; }
}
@media (max-width: 480px) {
  /* Top bar: keep the SafeTrack logo, drop the small SW-IT one, so the buttons fit */
  .topbar { gap: 8px; padding: 0 8px 0 12px; }
  .brand { gap: 10px; }
  .brand img:not(.brand-product), .brand .brand-divider { display: none; }
  .topbar-actions { gap: 0; }
  .topbar .icon-btn { width: 40px; }
}

/* Confidential concerns (decision 71) */
.concern-note { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.concern-note.from-reporter { border-left: 3px solid var(--link); }
.concern-note.private { background: var(--segment-bg); }
.follow-code { font: 700 clamp(22px, 6vw, 30px)/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .06em; padding: 14px 16px; border: 2px dashed var(--link); border-radius: var(--radius-md); text-align: center; margin: 0; word-break: break-all; }

/* First aiders: a small green cross on their profile picture (decision 74) */
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
.first-aid-dot { position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; border-radius: 50%; background: #1b8a3c; color: #fff;
  border: 2px solid var(--surface); display: grid; place-items: center; }
.first-aid-dot svg { width: 9px; height: 9px; }
.avatar-lg + .first-aid-dot { width: 24px; height: 24px; right: -2px; bottom: -2px; }
.avatar-lg + .first-aid-dot svg { width: 14px; height: 14px; }
