/* HR CoPilot design system — self-contained, low-bandwidth, WCAG-conscious. */
:root {
  --ink: #17211f;
  --ink-soft: #4b5a56;
  --ink-faint: #5b6965;   /* 5.7:1 on white, 4.9:1 on the palest tint (was #74827e: 4.0 and 3.4) */
  --paper: #f5f7f6;
  --card: #ffffff;
  --line: #dde5e2;
  --brand: #0f5c4d;
  --brand-strong: #0a4237;
  --brand-soft: #e3efec;
  --accent: #d99a2b;
  --accent-soft: #faf1de;
  --accent-ink: #8a5d10;  /* the accent as text: 5.7:1 on white, where the accent itself is 2.4:1 */
  --danger: #b23a3a;
  --danger-soft: #f9e9e9;
  --ok: #2a7449;          /* 4.9:1 on its own tint (was #2e7d4f: 4.4) */
  --ok-soft: #e6f2ea;
  --info: #2f5fa8;
  --info-soft: #e8eef8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(23, 33, 31, 0.06), 0 4px 14px rgba(23, 33, 31, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; font-family: var(--font); background: var(--paper); color: var(--ink);
  line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
small, .muted { color: var(--ink-faint); }

/* Layout ------------------------------------------------------------------ */
.topbar {
  background: var(--brand-strong); color: #fff; display: flex; align-items: center;
  gap: 1rem; padding: 0 1.2rem; position: sticky; top: 0; z-index: 40;
  /* A floor, not a fixed height: when the menu needs a second row (a wide menu
     on a narrow laptop) the bar grows instead of spilling over the page. */
  min-height: 54px;
}
.topbar .logo { font-weight: 700; font-size: 1.05rem; color: #fff; letter-spacing: .2px;
  display: inline-flex; align-items: center; gap: .5rem; }
.topbar .logo:hover { text-decoration: none; }
.topbar .logo .logo-mark { height: 32px; width: auto; display: block; }
.topbar .logo span { color: #f0c36c; }
.topbar nav { display: flex; gap: .15rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a {
  color: #d7e5e1; padding: .42rem .68rem; border-radius: 7px; font-size: .88rem;
  white-space: nowrap;
}
.topbar nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; color: #fff; }
.topbar nav a.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.topbar .user-chip { color: #d7e5e1; font-size: .85rem; display: flex; align-items: center; gap: .6rem; }
.topbar .user-chip a { color: #f0c36c; }
.badge-dot {
  background: var(--accent); color: #2a1e05; border-radius: 999px; font-size: .72rem;
  font-weight: 700; padding: .05rem .45rem;
}
.page { max-width: 1180px; margin: 0 auto; padding: 1.3rem 1.2rem 3rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head .crumbs { font-size: .8rem; color: var(--ink-faint); margin-bottom: .25rem; }

/* Cards & grids ----------------------------------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1.1rem;
}
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
/* A card that opens and closes on its heading (My data). */
.card.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; }
.card.fold > summary::-webkit-details-marker { display: none; }
.card.fold > summary::before { content: "▸"; color: var(--ink-faint); }
.card.fold[open] > summary::before { content: "▾"; }
.card.fold > summary h2 { margin: 0; flex: 1; }
.card.fold[open] > summary { margin-bottom: .8rem; }
.card.fold > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* A grid is a block like a card, so it carries the same bottom rhythm — and
   the cards inside it drop theirs, or the gap and the margin stack up and the
   vertical spacing between rows of blocks goes uneven page to page. */
.grid { display: grid; gap: 1.1rem; margin-bottom: 1.1rem; }
.grid > .card, .grid > .kpi { margin-bottom: 0; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  /* minmax(0, …), not a bare 1fr: a bare fraction never shrinks below its
     widest child, so one wide table made the whole page scroll sideways. */
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .page { padding: 1rem .8rem 2.5rem; }
}
/* On a narrow screen the page itself never scrolls sideways (audit, 11 Nov
   2026). A block laid out in a grid or a row may shrink to the column it is
   given — the same rule as above, for the grids pages define for themselves —
   and whatever is still too wide (a table with no wrapper, a long unbroken
   label) scrolls inside its own card instead of dragging the whole page with
   it. Wide screens are left exactly as they were. */
input, select, textarea, .btn { max-width: 100%; }
@media (max-width: 900px) {
  .card, .kpi, .grid > * { min-width: 0; }
  .card { overflow-x: auto; }
  .card h2 { flex-wrap: wrap; }
  .badge { white-space: normal; }
}

/* KPI tiles --------------------------------------------------------------- */
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1rem; box-shadow: var(--shadow); }
.kpi .kpi-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-faint); font-weight: 600; }
.kpi .kpi-value { font-size: 1.7rem; font-weight: 700; margin-top: .1rem; }
.kpi .kpi-note { font-size: .8rem; color: var(--ink-soft); }
.kpi.alert { border-left: 4px solid var(--danger); }
.kpi.good { border-left: 4px solid var(--ok); }
.kpi.warn { border-left: 4px solid var(--accent); }

/* Tables ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th {
  text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-faint); padding: .5rem .6rem; border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:hover td { background: #fafcfb; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Badges ------------------------------------------------------------------ */
.badge {
  display: inline-block; font-size: .74rem; font-weight: 600; border-radius: 999px;
  padding: .12rem .6rem; white-space: nowrap; background: var(--brand-soft); color: var(--brand-strong);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--accent-soft); color: #8a5d10; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: #eef1f0; color: var(--ink-soft); }

/* Notification list — circular category icon (colour + glyph carry the meaning) */
.notif-row { display: flex; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line);
  align-items: flex-start; }
.notif-row:last-child { border-bottom: none; }
/* Read rows stay fully legible (they were dimmed to 55%, which took their text
   below 4:1): the icon fades and the title loses its weight instead. */
.notif-row.read .notif-icon { opacity: .45; }
.notif-row.read strong { font-weight: 500; }
.notif-icon { width: 34px; height: 34px; border-radius: 50%; flex: none; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.05rem; line-height: 1; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.notif-icon.info { background: var(--info); }
.notif-icon.alert { background: var(--danger); }
.notif-icon.approval { background: #b57d17; }
.notif-icon.task { background: var(--brand); }
.notif-icon.legal { background: #6d4bb0; }
.notif-cat { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-faint); font-weight: 600; margin-bottom: .05rem; }

/* Forms ------------------------------------------------------------------- */
form.stack label { display: block; font-size: .82rem; font-weight: 600; margin: .8rem 0 .25rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="time"], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--font); font-size: .92rem; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
textarea { min-height: 110px; resize: vertical; }
.btn {
  display: inline-block; background: var(--brand); color: #fff; border: none;
  padding: .55rem 1.05rem; border-radius: 8px; font-size: .9rem; font-weight: 600;
  cursor: pointer; font-family: var(--font);
}
.btn:hover { background: var(--brand-strong); text-decoration: none; color: #fff; }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.secondary:hover { background: var(--brand-soft); }
.btn.danger { background: var(--danger); }
/* A disabled button that looks clickable is a small lie: people press it and
   nothing happens, and they cannot tell whether the button or the system is
   broken. Applies to every button in the app, not just the one that needed it. */
.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn[disabled]:hover, .btn:disabled:hover { background: var(--brand); }
.btn.ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn.small { padding: .3rem .7rem; font-size: .8rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* Messages / alerts ------------------------------------------------------- */
.messages { margin-bottom: 1rem; }
.flash { border-radius: 8px; padding: .65rem .9rem; margin-bottom: .5rem; font-size: .9rem;
  border: 1px solid transparent; }
.flash.success { background: var(--ok-soft); color: var(--ok); border-color: #c4e2cf; }
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: #ecc9c9; }
.flash.warning { background: var(--accent-soft); color: #8a5d10; border-color: #eed9ac; }
.flash.info { background: var(--info-soft); color: var(--info); border-color: #c8d7ee; }
.callout { border-left: 4px solid var(--info); background: var(--info-soft); border-radius: 8px;
  padding: .7rem .9rem; margin: .8rem 0; font-size: .88rem; }
.callout.legal { border-color: var(--brand); background: var(--brand-soft); }
.callout.danger { border-color: var(--danger); background: var(--danger-soft); }
.callout.ok { border-color: var(--ok); background: var(--ok-soft); }
.callout.warn { border-color: var(--accent); background: var(--accent-soft); }
.callout .src { display: block; margin-top: .3rem; font-size: .78rem; color: var(--ink-faint); }

/* Charts ------------------------------------------------------------------ */
.chart { width: 100%; height: auto; }
.chart-label { font-size: 12px; fill: var(--ink-soft); font-family: var(--font); }
.chart-value { font-size: 12px; fill: var(--ink); font-weight: 600; font-family: var(--font); }
.chart-hole { fill: var(--card); }
.chart-bar-link { cursor: pointer; }
.chart-bar-link:hover rect, .chart-bar-link:focus rect { opacity: 1; }
.chart-bar-link:hover path, .chart-bar-link:focus path,
.chart-bar-link:hover circle, .chart-bar-link:focus circle { opacity: 1; }
.chart-bar-link:hover .chart-label, .chart-bar-link:hover .chart-value { fill: var(--brand); font-weight: 700; }
.legend { list-style: none; margin: .6rem 0 0; padding: 0; font-size: .84rem; }
.legend li { display: flex; align-items: center; gap: .5rem; padding: .12rem 0; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* Misc -------------------------------------------------------------------- */
.progress { background: #e8edeb; border-radius: 999px; height: 10px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--line); }
.timeline li { margin: 0 0 .8rem; padding-left: .9rem; position: relative; font-size: .9rem; }
.timeline li::before {
  content: ""; width: 9px; height: 9px; background: var(--brand); border-radius: 50%;
  position: absolute; left: -1.45rem; top: .42rem;
}
.timeline .date { font-size: .78rem; color: var(--ink-faint); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-strong); font-weight: 700; display: inline-flex; align-items: center;
  justify-content: center; font-size: .85rem; flex: none;
}
.person-row { display: flex; align-items: center; gap: .7rem; }
.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filter-bar input, .filter-bar select { width: auto; }
.empty { text-align: center; color: var(--ink-faint); padding: 2rem 1rem; font-size: .92rem; }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: 1rem;
  font-size: .88rem; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: linear-gradient(160deg, #0a4237 0%, #0f5c4d 55%, #17715f 100%); }
.login-card { width: min(430px, 100%); background: #fff; border-radius: 14px; padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.28); }
.login-card { text-align: center; }
.login-card form.stack { text-align: left; }
.login-mark { height: 84px; width: auto; margin: 0 auto .4rem; display: block; }
.login-card .logo { font-size: 1.5rem; font-weight: 800; color: var(--brand-strong); }
.login-card .logo span { color: var(--accent); }
/* Version and update date, directly under the wordmark — the same question
   the topbar's build stamp answers, asked by someone who has not signed in
   yet: is this the current system? Muted, because it is a footnote to the
   brand rather than a second heading. */
.login-card .login-build {
  margin: .15rem 0 0; font-size: .72rem; letter-spacing: .02em;
  color: var(--muted, #6b7280);
}
.spark { vertical-align: middle; }

/* Password unmask toggle ---------------------------------------------------- */
.pw-field { position: relative; display: block; }
.pw-field input { width: 100%; padding-right: 2.6rem; }
.pw-toggle { position: absolute; top: 50%; right: .5rem; transform: translateY(-50%);
  background: none; border: 0; cursor: pointer; font-size: 1.05rem; line-height: 1;
  padding: .25rem; border-radius: 6px; opacity: .75; }
.pw-toggle:hover { opacity: 1; }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Payslip calculation steps -------------------------------------------------- */
.calc-steps { list-style: none; margin: 0; padding: 0; counter-reset: calcstep; }
.calc-step { counter-increment: calcstep; position: relative; padding: .7rem .8rem .7rem 2.6rem;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: .5rem; background: #fff; }
.calc-step::before { content: counter(calcstep); position: absolute; left: .75rem; top: .8rem;
  width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-strong); font-size: .74rem; font-weight: 700;
  display: grid; place-items: center; }
.calc-step.calc-warn { border-color: #d9534f; background: #fff7f7; }
.calc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.calc-label { font-weight: 600; }
.calc-amount { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.calc-detail { color: var(--muted); font-size: .84rem; margin-top: .15rem; }
.calc-source { color: var(--muted); font-size: .74rem; margin-top: .35rem; font-style: italic; }

/* Pay movement against the previous run ------------------------------------- */
tr.pay-up > td { background: #fdf8e7; }             /* increase — worth a look */
tr.pay-up > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.delta-up { color: #8a6d1a; font-weight: 700; text-decoration: none; }
.delta-down { color: #7a3b3b; font-weight: 600; text-decoration: none; }
.delta-up:hover, .delta-down:hover { text-decoration: underline; }

/* Pinned column-totals row (sits under the headings, never sorted) ----------- */
tr.totals-row > td { background: var(--brand-soft); border-bottom: 2px solid var(--line); }
tr.totals-row { position: sticky; top: 0; }

/* Sortable table headings --------------------------------------------------- */
th.sortable-th { cursor: pointer; user-select: none; white-space: nowrap; position: relative; }
th.sortable-th:hover { color: var(--brand-strong); }
th.sortable-th::after { content: "\2195"; opacity: .3; margin-left: .35em; font-size: .8em; }
th.sortable-th[aria-sort="ascending"]::after { content: "\2191"; opacity: .9; }
th.sortable-th[aria-sort="descending"]::after { content: "\2193"; opacity: .9; }
th.sortable-th:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* Clock terminal method chips ----------------------------------------------- */
.method-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin-top: .3rem; }
.method-chip { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--line);
  border-radius: 8px; padding: .55rem .7rem; cursor: pointer; font-size: .9rem; }
.method-chip:has(input:checked) { border-color: var(--accent); background: var(--brand-soft); font-weight: 600; }
.method-chip input { accent-color: var(--accent); }

/* Team leave calendar (Gantt / who's-away timeline) -------------------------- */
.gantt-wrap { overflow-x: auto; }
.gantt { min-width: 720px; }
.gantt-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.gantt-row:last-child { border-bottom: none; }
.gantt-head { border-bottom: 2px solid var(--line); }
.gantt-name { flex: 0 0 190px; display: flex; align-items: center; gap: .55rem;
  padding: .5rem .6rem; font-size: .85rem; }
.gantt-head .gantt-name { font-size: .74rem; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-faint); font-weight: 600; }
.gantt-name-text { line-height: 1.15; }
.gantt-track { position: relative; flex: 1; min-height: 26px; }
.gantt-head .gantt-track { min-height: 30px; }
.gantt-week-label { position: absolute; top: 6px; font-size: .74rem; color: var(--ink-soft);
  padding-left: 4px; border-left: 1px solid var(--line); box-sizing: border-box; }
.gantt-band { position: absolute; top: 0; bottom: 0; }
.gantt-band.weekend { background: #eef1f0; }
.gantt-band.holiday { background: var(--accent-soft); }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger);
  z-index: 3; }
.gantt-bar { position: absolute; top: 3px; height: 20px; border-radius: 5px; color: #fff;
  font-size: .74rem; font-weight: 600; line-height: 20px; padding: 0 6px; overflow: hidden;
  white-space: nowrap; z-index: 2; box-shadow: 0 1px 2px rgba(0,0,0,.12);
  display: flex; align-items: center; gap: 2px; }
.gantt-bar-label { overflow: hidden; text-overflow: ellipsis; }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: .9rem;
  font-size: .8rem; color: var(--ink-soft); }
.gantt-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.gantt-swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.gantt-swatch.weekend { background: #eef1f0; border: 1px solid var(--line); }
.gantt-swatch.holiday { background: var(--accent-soft); border: 1px solid #eed9ac; }
.gantt-today-key { width: 2px; height: 14px; background: var(--danger); display: inline-block; }

/* Viewing as a role (developers): a bar on every page while switched -------- */
.viewas-bar { background: var(--accent-soft); border-bottom: 2px solid var(--accent);
  color: var(--accent-ink); display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .4rem 1rem; padding: .45rem 1.2rem; font-size: .86rem; }
.viewas-bar .viewas-what { display: flex; flex-wrap: wrap; gap: .15rem .9rem; align-items: baseline; }
.viewas-bar .viewas-who, .viewas-bar .viewas-standin { font-size: .8rem; }
.viewas-bar form { margin: 0; }
.viewas-bar button { background: var(--accent-ink); color: #fff; border: 0; border-radius: 6px;
  padding: .35rem .8rem; font: inherit; font-weight: 600; cursor: pointer; }
.viewas-bar button:hover, .viewas-bar button:focus-visible { background: var(--ink); }
@media (max-width: 900px) { .viewas-bar { padding: .45rem .8rem; } .viewas-bar button { width: 100%; } .viewas-bar form { flex: 1 1 100%; } }

/* Drill-down trail bar (JS-driven "path back") ------------------------------ */
.drill-trail { position: sticky; top: var(--topbar-h, 54px); z-index: 30; background: #eef4f2;
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  flex-wrap: wrap; gap: .35rem; padding: .4rem 1.2rem; font-size: .82rem;
  color: var(--ink-soft); }
.drill-trail .dt-tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .5px;
  font-weight: 700; color: var(--ink-faint); margin-right: .2rem; }
.drill-trail a { color: var(--brand); text-decoration: none; }
.drill-trail a:hover { text-decoration: underline; }
.drill-trail .dt-up { font-weight: 600; background: var(--brand-soft); border-radius: 6px;
  padding: .08rem .5rem; }
.drill-trail .dt-sep { color: var(--ink-faint); }
.drill-trail .dt-cur { font-weight: 600; color: var(--ink); }
/* It is a flex row, which would otherwise outrank the hidden attribute and
   leave an empty strip under the bar on every page that has no trail. */
.drill-trail[hidden] { display: none; }
@media (max-width: 620px) { .drill-trail { padding: .4rem .8rem; } }

/* Drill-down breadcrumb + linkable aggregates ------------------------------- */
.drill-link { cursor: pointer; }
a.kpi, a.kpi:hover { text-decoration: none; color: inherit; display: block; }
a.kpi:hover { box-shadow: 0 2px 6px rgba(23,33,31,.12); transform: translateY(-1px);
  transition: all .12s; }
.drill-crumbs { font-size: .82rem; color: var(--ink-faint); margin-bottom: .4rem; }
.drill-crumbs a { color: var(--brand); }
.chip-filter { display: inline-flex; align-items: center; gap: .35rem; background: var(--brand-soft);
  color: var(--brand-strong); border-radius: 999px; padding: .12rem .6rem; font-size: .78rem;
  font-weight: 600; }
.chip-filter a { color: var(--brand-strong); text-decoration: none; }
table.data td a.rowlink { font-weight: 600; }
.trace { background: #101817; color: #cfe3dd; border-radius: 8px; padding: .9rem; font-size: .78rem;
  overflow-x: auto; white-space: pre-wrap; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.pill-row { display: flex; flex-wrap: wrap; gap: .4rem; }
footer.site { text-align: center; color: var(--ink-faint); font-size: .78rem; padding: 1.5rem 0 2rem; }
@media print {
  .topbar, .skip-link, .actions, .filter-bar, footer.site, .no-print { display: none !important; }
  .card { box-shadow: none; border: 1px solid #bbb; }
  body { background: #fff; }
}

/* ---- In-app explanations -------------------------------------------------
   The "?" sits beside the term it explains, small enough to ignore once you
   know the answer and findable the moment you don't. */
.explain-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; margin-left: .35rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-strong);
  font-size: .72rem; font-weight: 700; line-height: 1; text-decoration: none;
  vertical-align: middle;
}
.explain-btn:hover, .explain-btn:focus-visible {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.explain-btn span { font-weight: 600; margin-left: .25rem; }
h1 .explain-btn, h2 .explain-btn, th .explain-btn { vertical-align: .1em; }

.explain-page { max-width: 46rem; }
.explain-page .eyebrow {
  text-transform: uppercase; letter-spacing: .08em; font-size: .72rem;
  color: var(--ink-faint); font-weight: 700;
}
.explain-page .card h2 { font-size: .95rem; margin-top: 0; }
.explain-page .card p { margin: 0; }
/* Do / avoid pairs read across a row, so the columns share the width evenly. */
.explain-page table.checklist td { width: 50%; vertical-align: top; }
/* An example image shown before the checklist, captioned as what it is. */
.explain-figure { margin: 0 0 1rem; display: flex; gap: .9rem; align-items: flex-end; flex-wrap: wrap; }
.explain-figure img { width: 180px; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.explain-figure figcaption { flex: 1; min-width: 12rem; font-size: .84rem; color: var(--ink-soft); }
.card.accent { border-left: 3px solid var(--accent); background: var(--accent-soft); }

.explain-grid {
  display: grid; gap: .6rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}
.explain-card {
  display: block; padding: .6rem .7rem; border: 1px solid var(--line);
  border-radius: 6px; text-decoration: none; background: var(--card);
}
.explain-card:hover { border-color: var(--brand); }
.explain-card strong { display: block; color: var(--brand-strong); font-size: .9rem; }
.explain-card span { display: block; color: var(--ink-soft); font-size: .8rem; margin-top: .2rem; }

/* ---- Release notes & roadmap --------------------------------------------- */
.release-item { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.release-item:last-child { border-bottom: 0; padding-bottom: 0; }
.release-item h3 { margin: 0 0 .25rem; font-size: .95rem; }
.release-item p { margin: 0 0 .3rem; font-size: .9rem; }
.release-item .why { color: var(--ink-soft); font-size: .87rem; }
/* Release notes read as a list: one point to a line (owner, 13 Nov 2026). */
.release-item ul.points { margin: 0 0 .35rem; padding-left: 1.15rem; font-size: .9rem; }
.release-item ul.points li { margin: 0 0 .22rem; line-height: 1.4; }
.release-item ul.points li.point-head { list-style: none; margin: .5rem 0 .2rem -1.15rem;
  font-weight: 600; font-size: .78rem; letter-spacing: .04em; color: var(--ink-soft); }
.release-item .why-head { margin: .35rem 0 .15rem; font-size: .78rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.release-item.blocked h3::after { content: " · waiting"; color: var(--accent-ink); font-weight: 600; font-size: .8rem; }
.release-item.not-chasing { opacity: .9; }

/* ---- Grouped main navigation ---------------------------------------------
   Opens on hover and on keyboard focus (:focus-within), so it works without
   JavaScript and remains reachable by tabbing. A small JS enhancement below
   toggles it on click for touch devices and keeps aria-expanded honest. */
/* overflow must stay visible: the old flat nav scrolled horizontally, and that
   overflow clips an absolutely-positioned dropdown to the height of the bar. */
.topbar nav.mainnav { display: flex; gap: .1rem; align-items: center; flex-wrap: wrap; overflow: visible; }
.topbar { overflow: visible; }
.navgroup { position: relative; }
.navtop {
  display: inline-flex; align-items: center; gap: .3rem;
  background: none; border: 0; cursor: pointer;
  color: inherit; font: inherit; font-size: .88rem;
  padding: .4rem .6rem; border-radius: 5px;
}
.navtop span { font-size: .6rem; opacity: .7; }
.navgroup:hover .navtop,
.navgroup:focus-within .navtop,
.navtop[aria-expanded="true"] { background: rgba(255, 255, 255, .14); }
/* A menu opens as one panel beneath its own title, with its sub-menus side
   by side as titled columns (owner, 13 Nov 2026: the single lists had grown
   too long to read). It is only as wide as its columns need, never wider
   than the window: a long menu wraps to a second row of columns, and the
   shell's script slides a panel left when it would run off the right edge. */
.navmenu {
  display: none; position: absolute; top: calc(100% + .25rem); left: 0; z-index: 60;
  width: max-content; max-width: calc(100vw - 1.5rem);
  padding: .55rem .7rem .7rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 7px;
  box-shadow: 0 10px 26px rgba(15, 35, 30, .22);
  /* The bar is sticky, so a list longer than the window cannot be reached by
     scrolling the page: it scrolls inside itself instead (group HR's People
     list is taller than a laptop screen). */
  max-height: calc(100vh - var(--topbar-h, 54px) - 1.2rem); overflow-y: auto;
  overscroll-behavior: contain;
}
/* Invisible bridge over the gap between title and dropdown, so the pointer
   never leaves the group on its way down to the options. It hangs off the
   group, not the list: a scrolling box clips anything drawn outside it. */
.navgroup::after {
  content: ""; position: absolute; left: 0; right: 0;
  top: 100%; height: calc(.25rem + 1px); display: none;
}
.navgroup:hover::after, .navgroup.is-open::after { display: block; }
.navgroup:hover .navmenu,
.navgroup:focus-within .navmenu,
.navgroup.is-open .navmenu,
.navtop[aria-expanded="true"] + .navmenu { display: block; }
/* .topbar nav a colours links for the dark bar; dropdown items sit on white,
   so they need the same specificity to win back a readable colour. */
.topbar nav .navmenu a {
  display: block; padding: .38rem .55rem; border-radius: 5px;
  color: var(--ink); font-size: .86rem; text-decoration: none; white-space: nowrap;
}
.topbar nav .navmenu a:hover,
.topbar nav .navmenu a:focus-visible { background: var(--brand-soft); color: var(--brand-strong); }
/* Section headings inside a dropdown: labels, never links. */
.topbar nav .navmenu .navsec {
  padding: .5rem .55rem .15rem; font-size: .68rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint);
  border-top: 1px solid var(--line); margin-top: .25rem;
}
.topbar nav .navmenu .navsec:first-child { border-top: 0; margin-top: 0; }
/* The columns: each sub-menu under its title, wrapping to a second row
   before any column is squeezed. */
.navcols { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem 1.1rem; }
/* A column is as wide as its longest entry: the panel covers the options and
   no more. */
.navcol { flex: 0 1 auto; min-width: 7rem; }
.topbar nav .navmenu .navcol .navsec {
  border-top: 0; margin-top: 0; padding: .2rem .55rem .3rem; margin-bottom: .15rem;
  border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: .7rem;
}

/* ---- The shell: skip link, account links, the phone menu -------------------
   Audit of 11 Nov 2026: at 375px the bar was 594px wide, the "Me" menu opened
   off-screen and sign-out could not be reached. Below 900px the whole menu and
   the account links now fold behind one button and open as a single scrolling
   panel; nothing in the bar can be wider than the screen. */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
/* First thing Tab reaches on every page; out of sight until it has focus. */
.skip-link {
  position: absolute; left: .5rem; top: -5rem; z-index: 100;
  background: #fff; color: var(--brand-strong); font-weight: 700;
  padding: .7rem 1rem; border: 2px solid var(--brand); border-radius: 8px;
  box-shadow: var(--shadow);
}
.skip-link:focus { top: .5rem; text-decoration: none; }
/* Where the skip link lands: a place to start reading, not a control. */
main:focus { outline: none; }

.shell-menu { display: flex; flex: 1; align-items: center; gap: 1rem; min-width: 0; }
.nav-toggle { display: none; }
.topbar .user-chip { white-space: nowrap; }
.bell { display: inline-flex; align-items: center; gap: .3rem; }
.bell-text { display: none; }
.signout { display: inline; margin: 0; }
.signout button {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: #f0c36c;
}
.signout button:hover { text-decoration: underline; }
.topbar a:focus-visible, .topbar button:focus-visible {
  outline: 2px solid #f0c36c; outline-offset: 2px;
}
.topbar nav .navmenu a:focus-visible { outline-color: var(--brand); outline-offset: -2px; }

/* A finger needs 44px wherever it is, wide screen or narrow. */
@media (pointer: coarse) {
  .navtop, .topbar .user-chip a, .signout button {
    min-height: 44px; display: inline-flex; align-items: center;
  }
  .topbar nav .navmenu a { min-height: 44px; display: flex; align-items: center; }
}

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; height: auto; min-height: 54px; padding: 0 .8rem; gap: 0 .5rem; }
  .brand { min-height: 54px; justify-content: center; }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: .55rem; margin-left: auto;
    min-width: 44px; min-height: 44px; padding: 0 .75rem;
    background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 8px; color: #fff; font: inherit; font-size: .9rem; font-weight: 600;
    cursor: pointer;
  }
  .nav-toggle-bars {
    width: 18px; height: 2px; background: currentColor; border-radius: 2px;
    box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
  }
  .nav-toggle[aria-expanded="true"] { background: rgba(255, 255, 255, .22); }

  /* One panel under the bar, scrolling inside itself so the last entry and
     sign-out are reachable however long the menu is. Without scripts it is
     simply laid out open. */
  .shell-menu {
    flex: 1 0 100%; flex-direction: column; align-items: stretch; gap: 0;
    padding: .3rem 0 .9rem; border-top: 1px solid rgba(255, 255, 255, .16);
    max-height: calc(100vh - 54px); max-height: calc(100dvh - 54px);
    overflow-y: auto; overscroll-behavior: contain;
  }
  .js .shell-menu { display: none; }
  .js .topbar.menu-open .shell-menu { display: flex; }

  .topbar nav.mainnav { flex: none; flex-direction: column; align-items: stretch;
    flex-wrap: nowrap; gap: 0; }
  .navtop { width: 100%; min-height: 44px; justify-content: space-between;
    padding: 0 .6rem; font-size: .95rem; }
  .navtop span { font-size: .75rem; }
  .navmenu { position: static; box-shadow: none; min-width: 0; max-height: none;
    width: auto; max-width: none; left: auto !important;
    overflow: visible; margin: .1rem 0 .5rem; padding: .3rem; }
  /* On a phone the columns stack, each still under its own title. */
  .navcols { display: block; }
  .navcol { min-width: 0; margin-bottom: .45rem; }
  .navgroup::after { display: none !important; }
  /* A tap has no hover to leave, so here a group is open exactly when its
     button says so (and always, when there is no script to say anything). */
  .js .navgroup .navmenu { display: none; }
  .js .navgroup .navtop[aria-expanded="true"] + .navmenu,
  html:not(.js) .navgroup .navmenu { display: block; }
  .topbar nav .navmenu a { display: flex; align-items: center; min-height: 44px;
    padding: .3rem .7rem; font-size: .92rem; white-space: normal; }

  .topbar .user-chip { flex-direction: column; align-items: stretch; gap: 0;
    white-space: normal; font-size: .95rem; margin-top: .4rem; padding-top: .3rem;
    border-top: 1px solid rgba(255, 255, 255, .16); }
  .topbar .user-chip a, .signout button {
    display: flex; align-items: center; min-height: 44px; width: 100%;
    padding: 0 .6rem; text-align: left;
  }
  .signout { display: block; }
  .bell-text { display: inline; }

  /* The trail scrolls away with the page: two sticky bars is too much of a
     phone's screen. */
  .drill-trail { position: static; }
  .drill-trail a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ---- Citations: a note on the title ----------------------------------------
   See the script at the foot of base.html. The title keeps its dotted
   underline; the note opens beside it on hover, focus or a tap. */
.has-src { cursor: help; text-decoration: underline dotted var(--ink-faint); text-underline-offset: 3px; }
.has-src:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
.src-note {
  position: fixed; z-index: 80; display: block;
  width: max-content; max-width: min(26rem, calc(100vw - 1rem));
  padding: .55rem .75rem; border-radius: 8px;
  background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgba(15, 35, 30, .3);
  /* It can sit inside a column heading or a muted line: take none of that. */
  font-family: var(--font); font-size: .82rem; font-weight: 400; font-style: normal;
  line-height: 1.45; letter-spacing: normal; text-transform: none; text-align: left;
  text-decoration: none; white-space: normal; cursor: auto;
}
.src-note[hidden] { display: none; }
.src-note a { color: #f0c36c; text-decoration: underline; }
@media print { .src-note { display: none !important; } }

/* ---- Friendly error pages ------------------------------------------------ */
.lost { max-width: 34rem; margin: 2rem auto; text-align: center; }
.lost svg { width: min(240px, 60%); height: auto; margin-bottom: .5rem; }
.lost h1 { margin: .2rem 0 .8rem; }
.lost .say { color: var(--ink-soft); font-size: .95rem; margin: 0 0 .7rem; }
.lost .say.quiet { font-size: .86rem; color: var(--ink-faint); }
.lost .actions { justify-content: center; margin-top: 1.1rem; }

/* ---- Organisation chart --------------------------------------------------
   Collapsible sections so a 500-person company is navigable. The summary
   carries the head, the function and the counts, so collapsing a branch never
   hides the numbers that made you collapse it. */
.org-unit { border-left: 2px solid var(--line); padding-left: .7rem; margin: .35rem 0; }
.org-unit > summary {
  cursor: pointer; padding: .35rem .3rem; border-radius: 5px;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem;
  list-style: none;
}
.org-unit > summary::-webkit-details-marker { display: none; }
.org-unit > summary::before {
  content: "▸"; color: var(--ink-faint); font-size: .8rem; width: .8rem;
}
.org-unit[open] > summary::before { content: "▾"; }
.org-unit > summary:hover { background: var(--brand-soft); }
.org-unit > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.org-unit-name { font-weight: 650; font-size: .95rem; color: var(--brand-strong); }
.org-unit-meta { color: var(--ink-soft); font-size: .82rem; }
.org-unit-counts { margin-left: auto; display: flex; gap: .3rem; align-items: baseline; }
.org-unit-body { padding: .2rem 0 .2rem .4rem; }
.org-people { list-style: none; padding-left: 0; margin: .2rem 0 0; }
.org-people > li { padding: .22rem 0; }

/* ---- Build stamp ---------------------------------------------------------
   Which build you are actually looking at. Deliberately faint and small: it
   matters constantly during development and never to an employee, so it has
   to be findable without competing with the product name. */
.brand { display: flex; flex-direction: column; align-items: flex-start; }
.topbar .build-stamp {
  font-size: .58rem; font-weight: 400; letter-spacing: .02em; line-height: 1;
  color: rgba(255, 255, 255, .62); margin-top: -.1rem; padding-left: 1.9rem;
  white-space: nowrap;
}
@media (max-width: 700px) { .topbar .build-stamp { display: none; } }

/* ---- KPI cards that are themselves links ---------------------------------
   The help button is an <a>, and an <a> inside an <a> is invalid HTML: the
   parser closes the outer link at the inner one, which emptied the card and
   spilled its contents across the page. The card stays a div; the link covers
   it, and the help button sits above the link rather than inside it. */
.kpi-linked { position: relative; }
.kpi-hit { display: block; color: inherit; text-decoration: none; }
.kpi-hit:hover .kpi-value { color: var(--brand); }
.kpi-linked > .explain-btn {
  position: absolute; top: .45rem; right: .45rem; margin-left: 0; z-index: 2;
}

/* Process tracker — every multi-step process shows its stage, what remains,
   and who it waits on (owner's rule, 3 Sep 2026). */
.process-steps{display:flex;flex-wrap:wrap;gap:.35rem .9rem;margin:.4rem 0 .8rem;
  padding:.55rem .8rem;background:var(--surface-2,#f6f4ef);border:1px solid var(--line,#e3ded2);
  border-radius:10px;font-size:.86rem}
.pstep{display:flex;align-items:center;gap:.35rem;color:var(--ink-faint,#8a857a)}
.pstep .dot{font-weight:700}
.pstep.done{color:var(--ok,#2e7d4f)}
.pstep.current{color:var(--ink,#1a1a1a);font-weight:600}
.pstep.failed{color:var(--danger,#b3423a)}
.pstep .pwho,.pstep .pwhen{font-weight:400;font-size:.78rem;color:var(--ink-faint,#8a857a)}
.pstep+.pstep::before{content:"→";margin-right:.55rem;color:var(--line,#cfc9ba)}
/* Findings card (analytics/_findings.html): the direction arrow stays quiet —
   the priority badge carries the judgement. */
.finding-dir{font-size:.8rem;color:var(--ink-faint,#8a857a)}

/* A developer's "View as" drop-down in the bar (owner, 19 Nov 2026) ---------- */
.viewas-menu { position: relative; }
.viewas-menu > summary { cursor: pointer; color: #f0c36c; list-style: none; }
.viewas-menu > summary::-webkit-details-marker { display: none; }
.viewas-menu[open] > summary { text-decoration: underline; }
.viewas-panel { position: absolute; right: 0; top: calc(100% + .45rem); z-index: 60;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); padding: .35rem; width: max-content;
  max-width: min(22rem, calc(100vw - 1.5rem)); max-height: 70vh; overflow: auto;
  white-space: normal; }
.viewas-panel form { margin: 0; display: flex; flex-direction: column; }
.viewas-panel .viewas-sec { font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-soft); padding: .35rem .6rem .2rem; }
.viewas-panel button, .topbar .user-chip .viewas-panel a { display: block; width: 100%;
  text-align: left; background: none; border: 0; border-radius: 6px; padding: .35rem .6rem;
  font: inherit; font-size: .88rem; color: var(--ink); cursor: pointer; min-height: 0; }
.viewas-panel button:hover, .viewas-panel button:focus-visible,
.topbar .user-chip .viewas-panel a:hover { background: var(--brand-soft); color: var(--brand-strong); }
.viewas-panel button[aria-current="true"] { font-weight: 700; }
.viewas-panel .viewas-own { font-weight: 600; border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; }
.topbar .user-chip .viewas-panel a { border-top: 1px solid var(--line); border-radius: 0 0 6px 6px;
  font-size: .8rem; color: var(--ink-soft); }
@media (max-width: 900px) {
  .viewas-menu > summary { display: flex; align-items: center; min-height: 44px; padding: 0 .6rem; }
  .viewas-panel { position: static; width: auto; max-width: none; max-height: none; margin: 0 .6rem .4rem; }
  .viewas-panel button, .topbar .user-chip .viewas-panel a { min-height: 44px; display: flex; align-items: center; }
}

/* Search of the menu (0.99.0). */
.menu-search { position: relative; }
.menu-search input { width: 11rem; padding: .28rem .55rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.10); color: #fff; font-size: .85rem; margin: 0; }
.menu-search input::placeholder { color: #c9d8d4; }
.menu-search input:focus { background: #fff; color: #1d2b28; outline: 2px solid #f0c36c; }
.menu-search-results { position: absolute; right: 0; top: calc(100% + .35rem); z-index: 60; width: 22rem; max-width: 90vw;
  max-height: 22rem; overflow: auto; background: #fff; border: 1px solid #d9e2df; border-radius: .5rem;
  box-shadow: 0 10px 28px rgba(0,0,0,.18); white-space: normal; }
.topbar .user-chip .menu-search-results a { display: flex; flex-direction: column; padding: .45rem .7rem; color: #1d2b28;
  text-decoration: none; border-bottom: 1px solid #eef2f1; }
.topbar .user-chip .menu-search-results a.on, .topbar .user-chip .menu-search-results a:hover { background: #eef6f3; }
.menu-search-results .where { color: #6b7c78; font-size: .76rem; }
.menu-search-results .none { padding: .6rem .7rem; color: #6b7c78; }
@media (max-width: 900px) {
  .menu-search { padding: .5rem .9rem; }
  .menu-search input { width: 100%; }
  .menu-search-results { position: static; width: auto; box-shadow: none; }
}
