:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #edeae2;
  --border: #d2c4bb;
  --text: #262420;
  --text-muted: #6b675e;
  --accent: #a26769;
  --accent-strong: #7e5052;
  --accent-contrast: #ffffff;
  --accent-soft: #f4eded;
  --danger: #a8271f;
  --danger-soft: #fbe7e5;
  --warning: #8a5410;
  --warning-soft: #fbeedd;
  --routine: #33546f;
  --routine-soft: #e7eef4;
  --done: #2e7d4f;
  --done-soft: #e5f3ea;
  --shadow: 0 1px 2px rgba(30, 25, 15, 0.06), 0 6px 20px -8px rgba(30, 25, 15, 0.18);
  --radius: 12px;
  --font-display: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171a18;
    --surface: #1f2321;
    --surface-2: #262b28;
    --border: #534d4a;
    --text: #edeae2;
    --text-muted: #a7a299;
    --accent: #b38284;
    --accent-strong: #c5a1a2;
    --accent-contrast: #241213;
    --accent-soft: #443b3a;
    --danger: #e5877e;
    --danger-soft: #3a201d;
    --warning: #e3ae6c;
    --warning-soft: #3a2e19;
    --routine: #9dc0da;
    --routine-soft: #202f3d;
    --done: #8fcba6;
    --done-soft: #1c3225;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -10px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; text-wrap: balance; margin: 0 0 .3em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }
a { color: var(--accent-strong); }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tabular { font-variant-numeric: tabular-nums; }

#app { min-height: 100%; display: flex; flex-direction: column; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: .7em 1.1em; font-weight: 600; cursor: pointer;
  min-height: 44px; line-height: 1.2;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: .45em .8em; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Login ---------- */
.login-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px;
}
.brand-mark {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; justify-content: center;
  background: #ffffff; border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px;
}
.brand-logo { height: 34px; width: auto; display: block; }
.brand-word {
  font-family: var(--font-display); color: var(--accent); font-weight: 600;
  margin: 0; line-height: 1.15; font-size: 1.15rem;
}
.login-brand-mark { margin-bottom: 1.4em; width: 100%; }
.login-brand-mark .brand-logo { height: 36px; }
.login-brand-mark .brand-word { font-size: 1.25rem; }
.field { margin-bottom: 1.1em; }
.field label { display: block; font-weight: 600; font-size: .85rem; color: var(--text-muted); margin-bottom: .4em; text-transform: uppercase; letter-spacing: .04em; }
select, input[type=text], input[type=date], input[type=number], input[type=time], input[type=email], input[type=tel], input[type=search], input[type=datetime-local], textarea {
  width: 100%; padding: .7em .8em; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; }
.autocomplete { position: relative; }
.autocomplete-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; padding: 6px;
}
.autocomplete-item {
  display: block; width: 100%; text-align: left; padding: .6em .7em; border-radius: 8px;
  border: none; background: transparent; color: var(--text); font-size: 1rem; cursor: pointer;
}
.autocomplete-item:hover, .autocomplete-item:focus-visible { background: var(--accent-soft); }
.autocomplete-empty { padding: .6em .7em; color: var(--text-muted); font-size: .9rem; }
.pin-display { display: flex; gap: 10px; justify-content: center; margin: 1em 0 1.2em; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent); }
.pin-dot.filled { background: var(--accent); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pinpad button {
  min-height: 60px; font-size: 1.4rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer; font-family: var(--font-display); font-weight: 600;
}
.pinpad button:active { background: var(--accent-soft); }
.login-error { color: var(--danger); font-size: .9rem; margin-top: .6em; min-height: 1.2em; }

/* ---------- App shell ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; flex-wrap: wrap;
}
.topbar-brand-mark { margin-right: auto; padding: 6px 12px; }
.topbar-brand-mark .brand-logo { height: 28px; }
.topbar-brand-mark .brand-word { font-size: 1.05rem; }
.topbar .who { font-size: .85rem; color: var(--text-muted); text-align: right; }
.topbar .who strong { color: var(--text); }

.tabs { display: flex; gap: 4px; padding: 8px 12px 0; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  border: none; background: transparent; padding: .8em 1.1em; font-weight: 600; color: var(--text-muted);
  border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; min-height: 44px;
}
.tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); }

main { flex: 1; padding: 18px; max-width: 1100px; width: 100%; margin: 0 auto; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1.1fr 1.4fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
/* Emergencies section on the site reference sheet — background tint + a
   coloured left edge so it stands out from the other, plainer sections when
   scanning the Management tab in a hurry (see the matching print styling
   further down for the printed sheet). */
.card-emergencies { background: var(--danger-soft); border-color: var(--danger); border-left-width: 4px; }
.card-emergencies h3 { color: var(--danger); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 160px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: .4em; padding: .3em .7em; border-radius: 999px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-routine { background: var(--routine-soft); color: var(--routine); }
.pill-done { background: var(--done-soft); color: var(--done); }
.pill-neutral { background: var(--surface-2); color: var(--text-muted); }
.urgency-stripe { width: 6px; border-radius: 4px; align-self: stretch; flex: 0 0 6px; }
.urgency-stripe.safety_critical, .pill-safety_critical { background: var(--danger); }
.urgency-stripe.high, .pill-high { background: var(--warning); }
.urgency-stripe.routine, .pill-routine-u { background: var(--routine); }
.urgency-stripe.low { background: var(--done); }

/* ---------- Job list ---------- */
.job-card { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.job-card:hover { border-color: var(--accent); }
.job-card .meta { color: var(--text-muted); font-size: .85rem; margin-top: .2em; }
.job-card .title { font-weight: 600; }
.job-list { display: flex; flex-direction: column; gap: 10px; }
.empty { color: var(--text-muted); text-align: center; padding: 30px 10px; }
.muted { color: var(--text-muted); font-size: .85rem; }
.job-number { display: inline-block; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .82em; font-weight: 700; color: var(--accent-strong); background: var(--accent-soft); border-radius: 5px; padding: 1px 6px; margin-right: 2px; letter-spacing: .02em; }
.panel-head .job-number { font-size: .9rem; margin-right: 4px; }

/* ---------- Board home hint (maintenance default-home filter) ---------- */
.board-home-hint { color: var(--text-muted); font-size: .9rem; margin-bottom: 10px; }
.board-home-hint strong { color: var(--text); }
.link-btn { background: none; border: none; padding: 0; margin: 0; font: inherit; font-size: .9rem; color: var(--accent-strong); text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--accent); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 140px; }

/* Category / type of work picker — heading select above, item select
   below (see categoryPickerHtml in app.js); the item select is disabled
   and shows its blank label until a heading is chosen. */
.category-picker { display: flex; flex-direction: column; gap: 6px; }
.category-picker select:disabled { color: var(--text-muted); background: var(--surface-2); }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.kpi .num { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; }
.kpi .label { color: var(--text-muted); font-size: .82rem; }

/* ---------- Table (management) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 720px; background: var(--surface); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { background: var(--surface-2); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
tr:last-child td { border-bottom: none; }

/* Contractor capability matrix — a heading row per category, then one row
   per specific type of work under it (see capabilityMatrixHtml in app.js). */
.cap-matrix td, .cap-matrix th { padding: 6px 10px; }
.cap-matrix-heading th { background: var(--surface); color: var(--text); font-size: .82rem; text-transform: none; letter-spacing: 0; border-top: 2px solid var(--border); }
.cap-matrix select.cap-pref-input { width: 100%; min-width: 100px; font-size: .85rem; }

/* ---------- Modal / detail panel ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 18, 12, .45); display: flex; justify-content: flex-end; z-index: 50; }
.panel { width: 100%; max-width: 560px; background: var(--bg); height: 100%; overflow-y: auto; box-shadow: var(--shadow); }
.panel-head { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 18px; display: flex; align-items: center; gap: 10px; z-index: 2; }
.panel-body { padding: 18px; }
.panel-close { margin-left: auto; }

.overlay-center { justify-content: center; align-items: center; padding: 20px; z-index: 60; }
.modal-card { width: 100%; max-width: 360px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.modal-card h3 { margin-bottom: .3em; }
.modal-card .meta { margin-bottom: 1.1em; }
.modal-card-wide { max-width: 460px; }
.modal-actions { display: flex; gap: 10px; margin-top: 1.3em; }
.modal-actions .btn { flex: 1; }
.checkbox-list { display: flex; flex-direction: column; gap: .5em; max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.checkbox-list .checkbox-row { gap: .6em; }
.export-error { color: var(--danger); font-size: .88rem; min-height: 1.1em; margin-top: .2em; }

.notes-thread { display: flex; flex-direction: column; gap: 10px; margin: .5em 0 1em; }
.note { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.note .who { font-weight: 700; font-size: .82rem; }
.note .when { color: var(--text-muted); font-size: .75rem; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin: .6em 0; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
.photo-thumb { position: relative; }
.photo-thumb .photo-download {
  position: absolute; bottom: 4px; right: 4px; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .6); color: #fff; border-radius: 50%;
  font-size: 13px; line-height: 1; text-decoration: none;
}

.checkbox-row { display: flex; align-items: center; gap: .6em; }
.checkbox-row input { width: 20px; height: 20px; }

.doc-list { list-style: none; padding: 0; margin: .4em 0; display: flex; flex-direction: column; gap: .4em; }
.doc-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .5em; }

.toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%) translateY(-140%); background: var(--text); color: var(--bg); padding: .7em 1.2em; border-radius: 10px; font-weight: 600; z-index: 100; transition: transform .25s ease; box-shadow: var(--shadow); }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); color: #fff; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }

/* ---------- Print — the "site reference sheet" wall printout ---------- */
/* #printArea (see index.html) is built fresh from current data right before
   window.print() is called (see printReferenceSheet in app.js) and is
   otherwise empty and hidden — everything else on screen (#app, the toast)
   is hidden only while actually printing, so the normal app is untouched. */
.print-only { display: none; }
/* Sets the printed page's own margin so the sheet doesn't depend on
   whatever margin Chrome's print dialog happens to be set to — narrower
   than Chrome's default, which was leaving too little usable width and
   pushing the section tables' right-hand border past the printable area. */
@page {
  size: A4;
  margin: 10mm 8mm;
}
@media print {
  #app, #toast { display: none !important; }
  .print-only {
    display: block !important;
    color: #000; background: #fff; font-family: "Work Sans", Arial, sans-serif;
    padding: 0 3mm;
  }
  .print-only .print-head { display: flex; align-items: center; gap: 4mm; margin-bottom: 4mm; }
  .print-only .print-logo { height: 16mm; width: auto; max-width: 40mm; object-fit: contain; }
  .print-only h1 { font-size: 20pt; margin: 0 0 1mm; }
  .print-only .print-meta { color: #444; font-size: 9pt; margin: 0; }
  .print-only .print-meta-date { font-size: 8pt; color: #777; margin-top: .5mm; }
  .print-only h2 { font-size: 13pt; margin: 6mm 0 2mm; border-bottom: 1px solid #000; padding-bottom: 1mm; break-after: avoid; }
  /* box-sizing: border-box is the important part here — without it, a
     width:100% table plus its own border ends up slightly WIDER than its
     container (border added on top of the 100%), which is exactly what
     was pushing the coloured frame off the right edge of the page.
     table-layout:fixed + the explicit column widths below, plus
     overflow-wrap on the cells, stop a single long, unbroken URL or email
     address from forcing a column (and the whole table) wider than the
     page — the other way a "frame" can end up running off the page. */
  .print-only table { width: 100%; box-sizing: border-box; table-layout: fixed; border-collapse: collapse; margin-bottom: 3mm; break-inside: auto; }
  .print-only tr { break-inside: avoid; }
  .print-only th, .print-only td { text-align: left; padding: 1.2mm 2mm; border-bottom: 1px solid #ccc; font-size: 10pt; vertical-align: top; overflow-wrap: anywhere; }
  .print-only th { border-bottom: 1px solid #000; font-size: 9pt; text-transform: uppercase; letter-spacing: .03em; }
  .print-only th:nth-child(1), .print-only td:nth-child(1) { width: 24%; }
  .print-only th:nth-child(2), .print-only td:nth-child(2) { width: 56%; }
  .print-only th:nth-child(3), .print-only td:nth-child(3) { width: 20%; }

  /* Every section gets its own colour-coded heading and a tinted table —
     a coloured outline around the table itself, plus a tint on every row —
     so the sheet reads as clearly divided blocks rather than one long
     plain table. Emergencies keeps red (the one Steve most wants to jump
     out); the other four each get their own colour purely to separate
     them visually.
     This is deliberately colour applied to the table/cells, NOT a border
     wrapped around a <div> containing the table: a div's border/background
     doesn't reliably redraw itself when the browser splits it across a
     page break (that's what caused the "text interferes with the box"
     bug), whereas a <table>'s own border and each row's own background are
     handled properly by the browser's print engine no matter how many
     pages a long section spans. */
  .print-only .ref-section { margin-top: 6mm; }
  .print-only .ref-section h2 { margin-top: 3mm; border-bottom: none; padding: 0 0 1mm; font-weight: 700; }
  .print-only .ref-section table { border: 1.5px solid; }

  .print-only .ref-section-contractors h2 { color: #2c5f8a; }
  .print-only .ref-section-contractors table { border-color: #2c5f8a; }
  .print-only .ref-section-contractors th { background: #d7e4f0; border-bottom-color: #2c5f8a; }
  .print-only .ref-section-contractors td { background: #eaf1f8; border-bottom-color: #bcd0e3; }

  .print-only .ref-section-other_suppliers h2 { color: #6a3d9a; }
  .print-only .ref-section-other_suppliers table { border-color: #6a3d9a; }
  .print-only .ref-section-other_suppliers th { background: #e3d5ef; border-bottom-color: #6a3d9a; }
  .print-only .ref-section-other_suppliers td { background: #f1eaf7; border-bottom-color: #d2bde5; }

  .print-only .ref-section-utilities h2 { color: #9a6b0c; }
  .print-only .ref-section-utilities table { border-color: #9a6b0c; }
  .print-only .ref-section-utilities th { background: #f3e1b8; border-bottom-color: #9a6b0c; }
  .print-only .ref-section-utilities td { background: #faf1de; border-bottom-color: #ead29a; }

  .print-only .ref-section-emergencies h2 { color: #c0392b; }
  .print-only .ref-section-emergencies table { border-color: #c0392b; }
  .print-only .ref-section-emergencies th { background: #f6d5d0; border-bottom-color: #c0392b; }
  .print-only .ref-section-emergencies td { background: #fdecea; border-bottom-color: #e6b8b2; }

  .print-only .ref-section-local_contacts h2 { color: #2e7d4f; }
  .print-only .ref-section-local_contacts table { border-color: #2e7d4f; }
  .print-only .ref-section-local_contacts th { background: #d2ecdc; border-bottom-color: #2e7d4f; }
  .print-only .ref-section-local_contacts td { background: #e9f5ee; border-bottom-color: #b9e0c8; }
}

/* ---------- Device registration (14 Oct 2026) ---------- */
.device-banner { background: var(--warning-soft); color: var(--text); border-bottom: 1px solid var(--warning); padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: .92rem; line-height: 1.4; }
.device-banner > div:first-child { flex: 1 1 320px; }
.device-banner-actions { display: flex; gap: 8px; flex: 1 1 300px; flex-wrap: wrap; }
.device-banner-actions input { flex: 1 1 180px; min-width: 0; }
.device-status { background: var(--warning-soft); border: 1px solid var(--warning); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; line-height: 1.45; }
.device-status-on { background: var(--done-soft); border-color: var(--done); }
.devices-h { margin: 18px 0 8px; }
.devices-revoked { margin-top: 18px; }
.devices-revoked summary { cursor: pointer; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.enrol-done { text-align: center; font-size: 1.3rem; font-weight: 700; color: var(--done); margin: 6px 0 8px; }
.qr-box { background: #fff; border-radius: 10px; padding: 8px; margin: 10px auto 12px; max-width: 300px; }
.qr-box svg { width: 100%; height: auto; display: block; }
.qr-steps { text-align: left; margin: 0 0 10px; padding-left: 1.3em; line-height: 1.5; font-size: .92rem; }
@media print {
  .print-only .qr-print { text-align: center; padding-top: 10mm; }
  .print-only .qr-print h1 { font-size: 24pt; }
  .print-only .qr-print-code { width: 110mm; margin: 8mm auto; }
  .print-only .qr-print-code svg { width: 100%; height: auto; }
  .print-only .qr-print ol { text-align: left; display: inline-block; font-size: 13pt; line-height: 1.6; }
}

/* ---------- Accounts & Devices (18 Oct 2026) ---------- */
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: .95rem; color: var(--text); margin: 4px 0; }
label.check input { width: auto; margin-top: 3px; }
.temp-pin { font-size: 2.2rem; font-weight: 700; letter-spacing: .3em; text-align: center; padding: 14px; margin: 8px 0 12px; background: var(--accent-soft); border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.modal-card .field select, .modal-card .field input[type="text"] { width: 100%; }

/* ---------- Sign-in layout for PCs / landscape screens (20 Oct 2026) ----------
   Phones in portrait keep the single column. On a wide landscape screen the
   card becomes two columns: logo and intro on the left, name and PIN pad on
   the right, sized to fit a laptop screen without scrolling. */
.login-side .login-intro { text-align: center; margin: -4px 0 1em; color: var(--text-muted); font-size: .92rem; }
.login-side .login-tip { display: none; }
.login-refresh { margin-top: .5em; font-size: .85rem; color: var(--text-muted); display: flex; gap: .4em; align-items: center; flex-wrap: wrap; }
.login-refresh-warn { color: var(--danger); }
.login-refresh .link-btn { background: none; border: none; padding: 2px 4px; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.toast:not(.show) { visibility: hidden; }
@media (orientation: landscape) and (min-width: 860px) and (pointer: fine) { .login-side .login-tip { display: block; } }
@media (orientation: landscape) and (min-width: 860px) {
  .login-card.login-split {
    max-width: 860px; padding: 0; display: grid; grid-template-columns: 340px 1fr; overflow: hidden;
  }
  .login-split .login-side {
    background: var(--accent-soft); border-right: 1px solid var(--border);
    padding: 40px 32px; display: flex; flex-direction: column; justify-content: center;
  }
  .login-split .login-side .login-brand-mark { flex-direction: column; padding: 18px 14px; gap: 10px; }
  .login-split .login-side .login-brand-mark .brand-logo { height: 64px; }
  .login-split .login-side .login-brand-mark .brand-word { font-size: 1.5rem; }
  .login-split .login-side .login-intro { text-align: left; margin: 0 0 .8em; font-size: .95rem; color: var(--text); }
  .login-split .login-side .login-tip { text-align: left; margin: 0; font-size: .85rem; color: var(--text-muted); }
  .login-split .login-main { padding: 32px 36px; min-height: 420px; display: flex; flex-direction: column; justify-content: center; }
  .login-split .pinpad { max-width: 330px; margin: 0 auto; }
  .login-split .pinpad button { min-height: 52px; font-size: 1.25rem; }
  .login-split .pin-display { margin: .6em 0 .9em; }
  .login-split .login-main > .btn-block, .login-split .login-main #loginPinBlock > .btn-block { max-width: 330px; margin-left: auto; margin-right: auto; display: block; }
}
@media (orientation: landscape) and (min-width: 860px) and (max-height: 760px) {
  .login-wrap { padding: 12px; }
  .login-split .login-main { padding: 22px 32px; min-height: 0; }
  .login-split .pinpad { gap: 8px; }
  .login-split .pinpad button { min-height: 44px; font-size: 1.15rem; }
  .login-split .field { margin-bottom: .7em; }
}

/* Staff spreadsheet upload (20 Oct 2026) */
.modal-card.modal-card-xl { max-width: 860px; }
.modal-card-xl .modal-actions { flex-wrap: wrap; }
.modal-card-xl table td, .modal-card-xl table th { vertical-align: top; }
.card-buttons { flex: 0 1 auto; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.card-buttons > * { flex: 0 0 auto; width: auto; }

/* Two-step sign-in (20 Oct 2026) */
.mfa-code-input { font-size: 1.5rem; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.mfa-steps { margin: 4px 0 8px; padding-left: 1.3em; font-size: .92rem; }
.mfa-steps li { margin-bottom: 4px; }
.mfa-qr { display: flex; justify-content: center; margin: 6px 0; }
.mfa-qr svg { width: 180px; height: 180px; background: #fff; border-radius: 8px; }
.mfa-secret { font-family: ui-monospace, Consolas, monospace; letter-spacing: .05em; font-size: .95rem; color: var(--text); word-break: break-all; }
.mfa-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; padding: 12px; background: var(--surface-2); border-radius: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; text-align: center; }
.mfa-banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ===================== HR app (22 Oct 2026) ===================== */
[hidden] { display: none !important; }
.hr-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 12px; }
.hr-filters input[type="search"] { flex: 1 1 220px; }
.hr-filters select { flex: 0 1 200px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: .9rem; }
.hr-list { display: flex; flex-direction: column; gap: 6px; }
.hr-row { display: flex; gap: 12px; justify-content: space-between; align-items: center; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; color: inherit; }
.hr-row:hover { border-color: #A26769; }
.hr-row-name { flex: 1 1 auto; min-width: 0; }
.hr-row-rtw { flex: 0 1 46%; text-align: right; font-size: .85rem; }
.rag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.rag-red { background: #f8d7da; color: #842029; }
.rag-amber { background: #fff1cc; color: #7a5300; }
.rag-green { background: #d7f0dd; color: #1d5e2e; }
.rag-text { color: var(--text-muted); }
.rag-red-bg { border-left: 4px solid #c0392b; }
.rag-amber-bg { border-left: 4px solid #e0a100; }
.rag-green-bg { border-left: 4px solid #2e8b57; }
.hr-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 14px; }
.hr-kpis .kpi { padding: 10px; background: var(--surface-2); border-radius: 8px; }
.hr-kpis .kpi strong { font-size: 1.4rem; display: block; }
.hr-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 16px; margin-top: 8px; }
.hr-facts div { display: flex; flex-direction: column; }
.hr-facts span { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.hr-facts strong { font-weight: 500; overflow-wrap: anywhere; }
.hr-rtw-line { margin-top: 12px; font-size: .9rem; }
.hr-section { padding: 10px 0; border-bottom: 1px solid var(--border); }
.hr-section:last-child { border-bottom: 0; }
.hr-section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.hr-section-head h4 { margin: 0; font-size: 1rem; }
.hr-records { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.hr-record { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.hr-record-actions { gap: 6px; flex-wrap: wrap; align-items: center; }
.hr-none { margin: 6px 0 0; }
.hr-form { max-width: 820px; }
.hr-form .field textarea, .hr-form .field input, .hr-form .field select { max-width: 100%; }
.hr-form-heading { margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 2px solid #A26769; color: #8a2d3b; font-size: 1.05rem; }
.hr-form-heading:first-child { margin-top: 0; }
.choice-list { display: flex; flex-direction: column; gap: 6px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer;
  text-transform: none !important; letter-spacing: 0 !important; font-weight: 400 !important; font-size: .95rem !important; color: var(--text) !important; margin: 0 !important; }
.choice input { width: 22px; height: 22px; margin: 0; flex: 0 0 auto; accent-color: #A26769; }
.choice-single { margin-bottom: 0 !important; }
.req { color: #c0392b; }
.field-help { margin: -2px 0 6px; }
.field-error { color: #c0392b; font-size: .85rem; margin-top: 4px; min-height: 0; }
.has-error .choice, .has-error input, .has-error select, .has-error textarea { border-color: #c0392b; }
.hr-files { margin: 4px 0 8px; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.link-btn.danger { color: #c0392b; }
.hr-form-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); margin: 16px -16px -16px; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-radius: 0 0 var(--radius) var(--radius); }
.hr-final-box { margin-top: 10px; padding: 12px; border-radius: 8px; background: var(--surface-2); border-left: 4px solid #A26769; }
.hr-intro { background: var(--surface-2); padding: 10px 12px; border-radius: 8px; }
.hr-libs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.hr-lib { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: inherit; background: var(--surface); }
label.btn { cursor: pointer; }
@media (max-width: 640px) {
  .hide-narrow { display: none; }
  .hr-row { flex-direction: column; align-items: flex-start; }
  .hr-row-rtw { text-align: left; flex-basis: auto; }
  .hr-kpis { grid-template-columns: 1fr 1fr 1fr; font-size: .8rem; }
  .hr-form-foot .btn-primary { flex: 1 1 100%; }
}
.hr-filters input[type="search"] { padding: .7em .8em; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--surface); color: var(--text); }
.check input { width: auto !important; margin: 0; }
.hr-final-box .row > * { flex: 0 0 auto; }
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 6px 10px; }
  .topbar .who { font-size: .78rem; flex: 1 1 auto; }
}
.hr-filters label.check { flex: 0 0 auto !important; width: auto !important; display: inline-flex !important; justify-content: flex-start; gap: 6px; text-transform: none; letter-spacing: 0; }
.hr-filters label.check input { flex: 0 0 auto !important; }
.hr-filters label.check input { min-width: 0 !important; }

/* ============ Compliance checks (17 Nov 2026) ============ */
.rag-na { background: var(--surface-2); color: var(--text-muted); }
.hr-reminder { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; width: 100%; text-align: left; font: inherit; cursor: pointer;
  margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid #e0a100; background: #fff7e0; color: #5c3f00; }
.hr-reminder span { font-weight: 600; }
.hr-reminder-ok { cursor: default; border-color: #2e8b57; background: #e9f6ed; color: #1d5e2e; }
.hr-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin-top: 14px; }
.hr-check { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-size: .88rem; }
.hr-check-name { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; margin-bottom: 3px; }
.hr-checks > .meta { grid-column: 1 / -1; }
.hr-tally { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 4px 0 14px; }
.hr-tally-card { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 8px; background: var(--surface-2); font-size: .88rem; }
/* Compliance table: scrolls sideways (and down) inside its own box; names and headings stay put. */
.hr-matrix-wrap { overflow: auto; max-height: calc(100vh - 150px); border: 1px solid var(--border); border-radius: 10px; overscroll-behavior-x: contain; }
.hr-matrix { min-width: 640px; width: max-content; border-collapse: separate; border-spacing: 0; }
.hr-matrix th, .hr-matrix td { min-width: 150px; max-width: 190px; }
.hr-matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); }
.hr-matrix thead th:first-child { z-index: 3; }
.mx-nav { display: flex; align-items: center; gap: 6px; margin: 8px 0 6px; }
.mx-nav .meta { flex: 1; margin: 0; }
.hr-matrix td { vertical-align: top; font-size: .85rem; }
.hr-matrix tbody tr { cursor: pointer; }
.hr-matrix tbody tr:hover td { background: var(--surface-2); }
.hr-matrix td:first-child, .hr-matrix th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 190px; max-width: 220px; box-shadow: 2px 0 0 var(--border); }
.hr-matrix th:first-child { background: var(--surface-2); }
.hr-matrix td.na { color: var(--text-muted); }
.cell-note { color: var(--text-muted); font-size: .76rem; margin-top: 3px; max-width: 220px; }
.hr-section-head .row > *, .hr-record-actions > * { flex: 0 0 auto; }
.hr-section-head .row { flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (max-width: 640px) {
  .hr-tally { grid-template-columns: 1fr 1fr; }
  .hr-section-head .row { justify-content: flex-start; }
}

/* Drag and drop onto evidence boxes (17 Nov 2026) */
.hr-drop { border: 2px dashed var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.hr-drop-text { font-size: .9rem; color: var(--text-muted); }
@media (pointer: coarse) { .hr-drop { border: 0; padding: 0; background: none; } .hr-drop-text { display: none; } }
body.dragging-file .hr-drop { border-color: var(--accent); }
.hr-drop.drag-over { border-style: solid; border-color: var(--accent-strong); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }

/* New-starter checklist (17 Nov 2026) */
.starter-card { border-left: 5px solid var(--danger); }
.starter-card.is-cleared { border-left-color: var(--done); }
.starter-list { display: flex; flex-direction: column; }
.starter-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.starter-item:last-child { border-bottom: 0; }
.starter-item .st-text { flex: 1 1 auto; min-width: 0; }
.starter-item .btn { flex: 0 0 auto; width: auto; }
.st-icon { flex: 0 0 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; border: 2px solid var(--border); color: var(--text-muted); }
.st-done .st-icon { background: var(--done-soft); border-color: var(--done); color: var(--done); }
.st-concern .st-icon { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.st-waiting .st-icon { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.hr-reminder-starter { cursor: default; }
.starter-card .row .btn { width: auto; flex: 0 0 auto; }

.hr-reminder-starter { flex-direction: column; align-items: flex-start; gap: 8px; }
.starter-banner-title { text-align: left; color: inherit; }
.starter-names { display: flex; flex-wrap: wrap; gap: 6px; }
.starter-name { font: inherit; font-size: .9rem; padding: 5px 12px; border-radius: 999px; border: 1px solid currentColor; background: var(--surface); color: var(--accent-strong); cursor: pointer; }
.starter-name:hover, .starter-name:focus-visible { background: var(--accent-soft); }

/* Documents and photo on the person record (17 Nov 2026) */
.person-head { justify-content: flex-start; gap: 12px; }
.person-head h3 { flex: 1 1 auto; }
.person-photo { flex: 0 0 auto; width: 64px; height: 64px; padding: 0; border-radius: 50%; overflow: hidden; border: 2px solid var(--border); background: var(--surface-2); cursor: zoom-in; }
.person-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.doc-tile { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-align: left; font: inherit; color: inherit; cursor: pointer; min-width: 0; }
.doc-tile:hover, .doc-tile:focus-visible { border-color: var(--accent); }
.doc-thumb { display: flex; align-items: center; justify-content: center; height: 100px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-pdf { font-weight: 700; color: var(--danger); border: 2px solid currentColor; border-radius: 4px; padding: 6px 8px; font-size: .85rem; }
.doc-caption { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.doc-caption strong { font-size: .88rem; }
.doc-fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.hr-photo-viewer { cursor: zoom-out; z-index: 80; }
.hr-photo-viewer figure { margin: 0; text-align: center; }
.hr-photo-viewer img { max-width: 92vw; max-height: 84vh; border-radius: 8px; background: #fff; }
.hr-photo-viewer figcaption { color: #fff; margin-top: 8px; font-size: .9rem; }

/* People list sorting (18 Nov 2026) */
.people-count { margin: 4px 0 6px; }
.people-group { margin: 14px 0 6px; font-size: .9rem; color: var(--accent-strong); text-transform: none; }
.hr-filters select { flex: 0 1 auto; }

/* Personal details (18 Nov 2026) */
.personal-card .hr-facts a { color: inherit; }
.revealed { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--warning-soft); padding: 1px 6px; border-radius: 4px; }
.ec-head { margin: 14px 0 6px; }
.ec-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.ec { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.ec a { color: inherit; }
.ec-edit { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 4px; margin-bottom: 8px; }
.hist-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.hist-item ul { margin: 4px 0 0 18px; padding: 0; }
.form-errors { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.hr-facts .revealed { text-transform: none; letter-spacing: 0; font-size: .95rem; font-weight: 600; color: var(--text); }

.starter-item.st-optional.st-missing .st-icon { border-style: dashed; }

/* Back to the Crestview Hub (18 Nov 2026, Steve: make it stand out) */
.hub-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px 9px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-contrast, #fff); font-weight: 700; font-size: .95rem; line-height: 1; text-decoration: none; white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); border: 2px solid transparent; order: -1; }
.hub-btn:hover, .hub-btn:focus-visible { background: var(--accent-strong); color: var(--accent-contrast, #fff); outline: none; border-color: rgba(255, 255, 255, .5); transform: translateY(-1px); }
.hub-btn svg { width: 18px; height: 18px; flex: none; }
.hub-btn svg:first-child { width: 16px; height: 16px; margin-right: -2px; }
.hub-btn-short { display: none; }
@media (max-width: 600px) { .hub-btn { padding: 7px 12px 7px 8px; font-size: .9rem; } .hub-btn-text { display: none; } .hub-btn-short { display: inline; } }

/* Students and sponsored workers (18 Nov 2026) */
.imm-now { font-weight: 600; margin: 4px 0 8px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); }
.imm-now.rag-line-green { background: var(--done-soft, #e3f1e4); }
.imm-now.rag-line-amber { background: #fff1cc; }
.imm-now.rag-line-red { background: #fbe4e2; }
.sp-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.sp-row .sp-main { flex: 1 1 320px; }
.sp-row .row { gap: 6px; }
.sp-overdue { background: #fbe4e2; padding-left: 8px; padding-right: 8px; border-radius: 8px; }
.sp-done summary { cursor: pointer; margin-top: 10px; color: var(--text-muted); }

/* Job roles library and interview questions (18 Nov 2026) */
.lib-general { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border, #d2c4bb); border-radius: 12px; margin-bottom: 14px; background: var(--surface-2, #edeae2); }
.lib-table { width: 100%; border-collapse: collapse; }
.lib-table th, .lib-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border, #d2c4bb); vertical-align: top; }
.lib-table td .btn { margin-top: 6px; }
.lib-q { border: 1px solid var(--border, #d2c4bb); border-radius: 10px; padding: 10px; margin-bottom: 10px; display: grid; gap: 6px; }
.lib-q textarea { width: 100%; }
.lib-versions { padding-left: 18px; }
.lib-versions li { margin-bottom: 6px; }
.qa-row { border: 1px solid var(--border, #d2c4bb); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: grid; gap: 8px; }
.qa-q input { width: 100%; margin-top: 4px; }
.qa-n { display: inline-block; min-width: 28px; font-weight: 700; color: var(--accent-strong, #7e5052); }
.qa-row textarea { width: 100%; }
.qa-foot { justify-content: space-between; align-items: center; gap: 10px; }
.jd-ref { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border, #d2c4bb); border-radius: 10px; }

/* Recruitment (18 Nov 2026) */
.rc-list { display: grid; gap: 10px; }
.rc-vac { display: flex; justify-content: space-between; gap: 12px; text-align: left; width: 100%; padding: 12px 14px; border: 1px solid var(--border, #d2c4bb); border-radius: 12px; background: var(--surface, #fff); cursor: pointer; font: inherit; color: inherit; }
.rc-vac:hover { border-color: var(--accent, #a26769); }
.rc-counts { text-align: right; }
.rc-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 8px 0; }
.rc-facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #6b675e); }
.rc-facts dd { margin: 0; font-weight: 600; }
.rc-row { cursor: pointer; }
.rc-row:hover td { background: var(--accent-soft, #f4eded); }
.rc-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rc-pin { font-size: 2rem; font-weight: 700; letter-spacing: .2em; text-align: center; margin: 10px 0; }
.rc-purge ul { margin: 6px 0; padding-left: 18px; }
.rc-eo { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.rc-eo-q table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.rc-eo-q td { padding: 3px 0; border-bottom: 1px solid var(--border, #d2c4bb); font-size: .9rem; }
.rc-eo-q td.num { text-align: right; font-weight: 600; }
@media (max-width: 560px) { .rc-2col { grid-template-columns: 1fr; } .rc-vac { flex-direction: column; } .rc-counts { text-align: left; } }

/* Fold / unfold (18 Nov 2026) */
.fold-btn { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.fold-btn h3, .fold-btn h4 { margin: 0; }
.fold-arrow { display: inline-block; width: 1em; transition: transform .15s ease; color: var(--accent-strong, #7e5052); transform: rotate(90deg); }
.folded .fold-arrow { transform: rotate(0deg); }
.fold-mark { font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.fold-red { background: var(--danger-soft, #fbe9e7); color: var(--danger, #a8271f); }
.fold-amber { background: var(--warning-soft, #fff4dc); color: var(--warning, #8a5a00); }
.fold-count { font-weight: 400; }
.hr-section.folded .fold-body { display: none !important; }
.hr-section.folded { padding-bottom: 6px; }
.fold-card.folded .card > :not(.section-title) { display: none !important; }
.fold-card.folded .card .section-title .card-buttons { display: none; }
.row.fold-all { display: flex; justify-content: flex-end; font-size: .85rem; margin-bottom: 4px; gap: 6px; }

/* Agency staff (18 Nov 2026) */
.ag-issues { margin: 6px 0 10px; padding-left: 18px; color: var(--danger, #a8271f); }
.ag-checks ul { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 3px; }
.ag-checks li.ok { color: var(--done, #2e6b3a); }
.ag-checks li.no { color: var(--danger, #a8271f); }
.ag-photo { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 1px solid var(--border, #d2c4bb); }

/* "?" guidance notes (18 Nov 2026) */
.help-tip { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: 8px; border-radius: 50%; border: 1.5px solid currentColor; color: var(--accent, #a26769); font-size: .75rem; font-weight: 700; line-height: 1; cursor: help; vertical-align: middle; opacity: .8; text-transform: none; letter-spacing: 0; font-family: inherit; }
.help-tip:hover, .help-tip:focus-visible { opacity: 1; background: var(--accent, #a26769); color: #fff; outline: none; }
.help-pop { position: fixed; z-index: 9999; background: #2b2523; color: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: .88rem; line-height: 1.45; font-weight: 400; text-transform: none; letter-spacing: 0; text-align: left; }
.help-pop p { margin: 0 0 8px; white-space: pre-line; }
.help-pop p:last-child { margin-bottom: 0; }

/* More noticeable "?" (18 Nov 2026, Steve) */
.help-tip { width: 24px; height: 24px; margin-left: 10px; border: 0; background: var(--accent, #a26769); color: #fff; font-size: .85rem; opacity: 1; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.help-tip:hover, .help-tip:focus-visible { background: var(--accent-strong, #7e5052); color: #fff; transform: scale(1.08); }
/* More noticeable fold arrows (18 Nov 2026, Steve) */
.fold-arrow { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--accent-soft, #f4eded); border: 1.5px solid var(--accent, #a26769); color: var(--accent-strong, #7e5052); font-size: 1rem; line-height: 1; transition: transform .15s ease, background .15s ease; }
.fold-btn:hover .fold-arrow, .fold-btn:focus-visible .fold-arrow { background: var(--accent, #a26769); color: #fff; }
.fold-btn { padding: 4px 0; border-radius: 10px; }
.fold-btn:focus-visible { outline: 2px solid var(--accent, #a26769); outline-offset: 3px; }
.hr-section .fold-btn h4 { font-size: 1.02rem; }
.hr-section { border-bottom: 1px solid var(--border, #d2c4bb); padding: 6px 0; }
.hr-section:last-child { border-bottom: 0; }
.row.fold-all { display: block !important; text-align: right; }
.row.fold-all > * { display: inline !important; }

/* Templates (18 Nov 2026) */
.tpl-list { display: grid; gap: 8px; margin-bottom: 8px; }
.tpl-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border, #d2c4bb); border-radius: 12px; flex-wrap: wrap; }
.tpl-off { opacity: .65; }
.tpl-btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tpl-btns .btn { width: auto; }

/* 06 Absence: Bradford score panel (18 Nov 2026) */
.abs-panel { margin: 10px 0 4px; padding: 10px 12px; border: 1px solid var(--border, #e3e6ea); border-radius: 10px; background: var(--card-2, #fafbfc); }
.abs-panel h3 { margin: 0 0 6px; font-size: 0.95rem; }
.abs-score { display: flex; align-items: baseline; gap: 10px; }
.abs-score strong { font-size: 1.6rem; line-height: 1; }
.abs-score.abs-red strong { color: #b42318; }
.abs-score.abs-amber strong { color: #b54708; }
.abs-label { margin: 8px 0 0; }
.hr-section.folded .abs-panel { display: none; }
p.form-info { background: #fff8e6; border-left: 3px solid #f5b400; padding: 8px 10px; border-radius: 6px; }
p.form-info[hidden] { display: none; }

/* Phones: fade the right edge of the tab bar so it's clear there are more tabs to swipe to (18 Nov 2026). */
@media (max-width: 760px) {
  .tabs { padding-right: 36px; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
  .tabs::-webkit-scrollbar { display: none; }
}

/* Phones: just the name in the top bar (18 Nov 2026). */
@media (max-width: 560px) { .topbar .who-role { display: none; } .topbar .who br { display: none; } }

/* Tab bar: extra tabs under one menu (18 Nov 2026) */
.tab-more-btn { display: inline-flex; align-items: center; gap: 4px; }
.tab-more-caret { font-size: .75em; opacity: .75; }
.tab-more-menu { position: fixed; z-index: 1000; min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.14); padding: 6px; display: flex; flex-direction: column; }
.tab-more-item { text-align: left; background: transparent; border: none; color: var(--text); font: inherit; font-size: .95rem; padding: 10px 12px; border-radius: 8px; cursor: pointer; min-height: 40px; }
.tab-more-item:hover, .tab-more-item:focus-visible { background: var(--accent-soft, rgba(0,0,0,.05)); outline: none; }
.tab-more-item.active { font-weight: 700; color: var(--accent); }

/* Person page (18 Nov 2026): status line under the name; panels inside their section; numbered 01 Personal details */
.person-status { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.sec-panels > .card { box-shadow: none; margin-top: 10px !important; background: var(--surface-2, #faf8f7); }
.sec-no { color: var(--accent); font-variant-numeric: tabular-nums; margin-right: 2px; }
.sec-note { margin: 6px 0 4px 40px; }
.sec-hidden { margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed var(--border); }
.hr-section.folded .sec-note { display: none; }

/* 08 Employee relations (19 Nov 2026) */
.er-members { margin: 4px 0 10px 18px; padding: 0; }
.er-members li { margin: 4px 0; }
.er-row .hr-row-rtw { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.er-actions > *, .er-add > .btn { flex: 0 0 auto !important; }

/* My HR: from staff (19 Nov 2026) */
.fs-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.fs-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); flex-wrap: wrap; }
.fs-row > div:first-child { flex: 1 1 320px; min-width: 0; }
.fs-btns { display: flex; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; }
.fs-btns .btn { width: auto; }
.fs-row .link-btn { margin-right: 8px; }
.hr-warn { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--warning); border-left-width: 5px; background: var(--warning-soft); color: var(--warning); margin: 8px 0 12px; }

/* Compliance: tap a check to list everyone by it (19 Nov 2026) */
button.hr-tally-card { font-family: inherit; color: inherit; text-align: left; cursor: pointer; border: 1px solid var(--border); }
button.hr-tally-card:hover, button.hr-tally-card:focus-visible { border-color: var(--accent); outline: none; }
button.hr-tally-card.active { border: 2px solid var(--accent); background: var(--accent-soft); }
.comp-sorted { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.comp-hint { margin: 8px 0 0; }
.hr-matrix th.sorted { background: var(--accent-soft); color: var(--accent-strong); }
.hr-matrix td.sorted { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }

/* Compliance history (19 Nov 2026) */
.snap-chart { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px 6px; margin: 12px 0; background: var(--surface); }
.snap-chart svg { display: block; width: 100%; height: auto; margin-top: 8px; overflow: visible; }
.snap-chart-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: flex-start; }
.snap-ctrls { display: flex; flex-wrap: wrap; gap: 8px; }
.snap-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.snap-seg button { font-family: inherit; font-size: .82rem; padding: 5px 10px; white-space: nowrap; border: 0; background: var(--surface); color: var(--text); cursor: pointer; }
.snap-seg button + button { border-left: 1px solid var(--border); }
.snap-seg button.on { background: var(--accent); color: #fff; }
.snap-key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin: 0 4px 3px 6px; vertical-align: middle; }
.snap-key.red { background: var(--danger, #a8271f); } .snap-key.amber { background: var(--warning, #c58a1a); } .snap-key.green { background: var(--done, #2e7d4f); }
.snap-grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.snap-ylab, .snap-xlab { font-size: 11px; fill: var(--text-muted); font-family: inherit; }
.snap-ylab { text-anchor: end; }
.snap-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.snap-line.red { stroke: var(--danger, #a8271f); } .snap-line.amber { stroke: var(--warning, #c58a1a); } .snap-line.green { stroke: var(--done, #2e7d4f); }
.snap-dot.red { fill: var(--danger, #a8271f); } .snap-dot.amber { fill: var(--warning, #c58a1a); } .snap-dot.green { fill: var(--done, #2e7d4f); }
.snap-dot { stroke: var(--surface); stroke-width: 1.5; }
.snap-hit { fill: transparent; cursor: pointer; }
.snap-chart g:hover .snap-hit { fill: var(--surface-2); }
.snap-selline { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.snap-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.snap-tile { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); }
.snap-tile span:first-child { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.snap-tile strong { font-size: 1.4rem; }
.snap-diff { font-size: .8rem; color: var(--text-muted); }
.snap-diff.good { color: var(--done, #2e7d4f); }
.snap-diff.bad { color: var(--danger, #a8271f); }

/* Team meetings (19 Nov 2026) */
.mt-panel { margin-top: 10px; }
.mt-recent { margin: 6px 0 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.mt-counts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mt-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; margin: 8px 0; }
.mt-reason { margin-top: 6px; width: 100%; }
.si-overlay { position: fixed; inset: 0; z-index: 3000; background: var(--bg); overflow: auto; }
.si-wrap { max-width: 900px; margin: 0 auto; padding: 24px 20px 40px; }
.si-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.si-head h2 { margin: 0; font-size: 1.8rem; }
.si-head p { margin: 4px 0 0; color: var(--text-muted); }
.si-count { background: var(--done-soft, #e5f3ea); color: var(--done, #2e7d4f); border-radius: 999px; padding: 8px 14px; font-weight: 700; white-space: nowrap; }
.si-hint { font-size: 1.1rem; margin: 18px 0 10px; }
.si-search { width: 100%; font-size: 1.1rem; padding: 12px; margin-bottom: 12px; }
.si-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.si-name { font: inherit; font-size: 1.15rem; padding: 18px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; min-height: 64px; }
.si-name:hover, .si-name:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.si-done { margin-top: 18px; color: var(--text-muted); }
.si-exit { margin-top: 24px; }
.si-pin { max-width: 360px; margin: 24px auto 0; text-align: center; }
.si-msg { margin: 14px 0 0; padding: 14px 16px; border-radius: 10px; font-size: 1.1rem; font-weight: 600; }
.si-msg.ok { background: var(--done-soft, #e5f3ea); color: var(--done, #2e7d4f); }
.si-msg.bad { background: var(--danger-soft, #fbe7e5); color: var(--danger, #a8271f); }
@media (max-width: 600px) {
  .hr-matrix td:first-child, .hr-matrix th:first-child { min-width: 130px; max-width: 150px; }
  .hr-matrix th, .hr-matrix td { min-width: 130px; }
}
