/*
 * hd-ui (dark): shared admin UI classes for Hannington Digital apps.
 * Same components and class names as awo_central_heating's public/hd-ui (the Pricernner_api
 * Users look), on a dark zinc palette. Self-contained: no CDN fonts or frameworks, so it works
 * under this app's strict Content-Security-Policy (no inline styles: add a class here instead).
 *
 * Page skeleton:
 *   <main class="hd">
 *     <div class="hd-head">
 *       <h1 class="hd-title">People</h1>
 *       <div class="hd-actions"><a class="hd-btn primary" href="…">Add person</a></div>
 *     </div>
 *     <p class="hd-sub">One or two lines on what this page is for.</p>
 *     <div class="hd-kpis">…</div>
 *     <div class="hd-bar">search / filters <span class="hd-spacer"></span> actions</div>
 *     <div class="hd-card">
 *       <div class="hd-scroll"><table class="hd-table">…</table></div>
 *       <div class="hd-card-foot">pager</div>
 *     </div>
 *   </main>
 */

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
}

:root {
  color-scheme: dark;
  --hd-bg: #09090b;
  --hd-surface: #111113;
  --hd-raised: #18181b;
  --hd-input: #0c0c0e;
  --hd-fg: #fafafa;
  --hd-fg-2: #d4d4d8;
  --hd-muted: #a1a1aa;
  --hd-faint: #8b8b94;
  --hd-border: #27272a;
  --hd-border-strong: #3f3f46;
  --hd-border-soft: #1d1d21;
  --hd-hover: #151518;
  --hd-sel: #1f1f23;
  --hd-accent: #fafafa;
  --hd-accent-fg: #09090b;
  --hd-accent-hover: #e4e4e7;
  --hd-red: #f87171;
  --hd-red-bg: rgba(248, 113, 113, 0.1);
  --hd-red-line: rgba(248, 113, 113, 0.3);
  --hd-green: #34d399;
  --hd-green-bg: rgba(52, 211, 153, 0.1);
  --hd-green-line: rgba(52, 211, 153, 0.3);
  --hd-amber: #fbbf24;
  --hd-amber-bg: rgba(251, 191, 36, 0.1);
  --hd-amber-line: rgba(251, 191, 36, 0.3);
  --hd-blue: #60a5fa;
  --hd-blue-bg: rgba(96, 165, 250, 0.1);
  --hd-blue-line: rgba(96, 165, 250, 0.3);
  /* Chart series (.s1–.s6), in order of use */
  --hd-c1: #60a5fa;
  --hd-c2: #34d399;
  --hd-c3: #fbbf24;
  --hd-c4: #a78bfa;
  --hd-c5: #f472b6;
  --hd-c6: #22d3ee;
  --hd-radius: 6px;
  --hd-radius-lg: 10px;
  --hd-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --hd-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --hd-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --hd-ring: 0 0 0 3px rgba(250, 250, 250, 0.1);
  --hd-font: 'Inter Variable', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hd-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --hd-width: 1200px;
}

/* ---------- Page base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--hd-bg); scrollbar-gutter: stable; }
body.hd-body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--hd-bg); color: var(--hd-fg); font-family: var(--hd-font);
}
::selection { background: rgba(250, 250, 250, 0.2); }

/* ---------- Scope + reset ---------- */

.hd {
  font-family: var(--hd-font);
  font-feature-settings: 'cv11';
  font-size: 13px;
  line-height: 1.5;
  color: var(--hd-fg);
  width: 100%;
  max-width: var(--hd-width);
  margin: 0 auto;
  padding: 24px 24px 96px;
  -webkit-font-smoothing: antialiased;
}
.hd.narrow > * { max-width: 760px; }
.hd *, .hd *::before, .hd *::after { box-sizing: border-box; }

.hd :where(table) { border-collapse: separate; border-spacing: 0; }
.hd :where(h1, h2, h3, p, ul, ol, dl, form) { margin: 0; }
.hd :where(a) {
  color: var(--hd-fg); text-decoration: underline; text-decoration-color: var(--hd-border-strong);
  text-underline-offset: 2px;
}
.hd :where(a):hover { color: var(--hd-fg); text-decoration-color: currentColor; }
.hd :where(input[type=checkbox], input[type=radio]) { accent-color: var(--hd-fg); }
.hd :where(code) { font-family: var(--hd-mono); font-size: 0.92em; color: var(--hd-fg); }
.hd [hidden] { display: none !important; }

/* ---------- Page head ---------- */

.hd-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hd-head-l { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.hd-title { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -0.02em; line-height: 1.3; color: var(--hd-fg); }
.hd-title .hd-tag { margin-left: 6px; vertical-align: 3px; }
.hd-sub { font-size: 13px; color: var(--hd-muted); margin: 4px 0 16px; line-height: 1.5; max-width: 760px; }
.hd-head + .hd-kpis, .hd-head + .hd-bar, .hd-head + .hd-card, .hd-head + .hd-grid, .hd-head + .hd-stack { margin-top: 16px; }
.hd-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hd-crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--hd-muted); margin-bottom: 6px; }
.hd-crumbs a { color: var(--hd-muted); text-decoration: none; }
.hd-crumbs a:hover { color: var(--hd-fg); text-decoration: underline; }
.hd-crumbs .sep { color: var(--hd-border-strong); }
.hd-meta { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--hd-muted); margin-top: 4px; }

/* ---------- Buttons ---------- */

.hd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 31px; padding: 0 14px; margin: 0;
  font-family: var(--hd-font); font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap;
  border: 1px solid var(--hd-border); border-radius: var(--hd-radius); background: var(--hd-surface); color: var(--hd-fg);
  text-decoration: none; cursor: pointer; box-shadow: var(--hd-shadow-xs);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.hd-btn:hover { background: var(--hd-sel); border-color: var(--hd-border-strong); color: var(--hd-fg); text-decoration: none; }
.hd-btn:focus-visible { outline: 2px solid var(--hd-fg); outline-offset: 2px; }
.hd-btn.primary { background: var(--hd-accent); border-color: var(--hd-accent); color: var(--hd-accent-fg); }
.hd-btn.primary:hover { background: var(--hd-accent-hover); border-color: var(--hd-accent-hover); color: var(--hd-accent-fg); }
.hd-btn.danger { color: var(--hd-red); }
.hd-btn.danger:hover { background: var(--hd-red-bg); border-color: var(--hd-red-line); color: var(--hd-red); }
.hd-btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--hd-muted); }
.hd-btn.ghost:hover { background: var(--hd-sel); color: var(--hd-fg); }
.hd-btn.sm { height: 26px; padding: 0 10px; font-size: 12px; }
.hd-btn.lg { height: 36px; font-size: 13.5px; }
.hd-btn.block { width: 100%; }
.hd-btn:disabled, .hd-btn.disabled { opacity: 0.45; cursor: default; box-shadow: none; pointer-events: none; }

/* ---------- Controls ---------- */

.hd-control {
  height: 31px; padding: 0 10px; margin: 0; font-family: var(--hd-font); font-size: 13px; color: var(--hd-fg);
  border: 1px solid var(--hd-border); border-radius: var(--hd-radius); background: var(--hd-input);
  box-shadow: var(--hd-shadow-xs); outline: none; max-width: 100%;
}
.hd-control:focus { border-color: var(--hd-faint); box-shadow: var(--hd-ring); }
.hd-control::placeholder { color: #63636b; }
.hd-control:disabled, .hd-control[readonly] { background: var(--hd-hover); color: var(--hd-muted); }
.hd-control.mono { font-family: var(--hd-mono); font-size: 12px; }
.hd-control.code { height: 40px; font-family: var(--hd-mono); font-size: 18px; letter-spacing: 0.2em; text-align: center; }
textarea.hd-control { height: auto; min-height: 72px; padding: 7px 10px; line-height: 1.5; resize: vertical; }
select.hd-control {
  -webkit-appearance: none; appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a1a1aa' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.hd-control.sm { height: 26px; font-size: 12px; padding: 0 8px; }
select.hd-control.sm { padding-right: 24px; background-position: right 8px center; }
.hd-control.invalid { border-color: var(--hd-red-line); }

.hd-search { position: relative; display: inline-flex; align-items: center; }
.hd-search svg { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--hd-faint); pointer-events: none; }
.hd-search .hd-control { padding-left: 30px; width: 260px; }

/* ---------- Toolbar ---------- */

.hd-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.hd-spacer { flex: 1; }
.hd-bar-label { font-size: 12.5px; color: var(--hd-muted); display: inline-flex; align-items: center; gap: 8px; margin: 0; }

/* ---------- Segmented tabs (links or buttons) ---------- */

.hd-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--hd-surface); border: 1px solid var(--hd-border); border-radius: 8px; max-width: 100%; overflow-x: auto; }
.hd-tabs > a, .hd-tabs > button {
  display: inline-flex; align-items: center; height: 25px; padding: 0 12px; margin: 0; border: 0; border-radius: var(--hd-radius);
  font-family: var(--hd-font); font-size: 13px; font-weight: 500; background: transparent; color: var(--hd-muted);
  text-decoration: none; cursor: pointer; box-shadow: none; white-space: nowrap; transition: color 0.12s;
}
.hd-tabs > a:hover, .hd-tabs > button:hover { background: transparent; color: var(--hd-fg); text-decoration: none; }
.hd-tabs > .on { background: var(--hd-sel); color: var(--hd-fg); box-shadow: inset 0 0 0 1px var(--hd-border-strong); }
.hd-tabs > .on:hover { background: var(--hd-sel); }
.hd-tabs .n { color: var(--hd-faint); font-weight: 400; margin-left: 6px; font-variant-numeric: tabular-nums; }
.hd-tabs .on .n { color: var(--hd-muted); }

/* ---------- KPI strip ---------- */

.hd-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--hd-border);
  border: 1px solid var(--hd-border); border-radius: var(--hd-radius-lg); overflow: hidden; margin-bottom: 16px;
}
.hd-kpi { background: var(--hd-surface); padding: 12px 16px; min-width: 0; }
.hd-kpi-l { font-size: 11.5px; font-weight: 500; color: var(--hd-muted); }
.hd-kpi-v { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; line-height: 1.35; }
.hd-kpi-s { font-size: 11.5px; color: var(--hd-faint); margin-top: 1px; }
.hd-kpi-t { font-size: 13px; font-weight: 600; }
a.hd-kpi { display: block; color: inherit; text-decoration: none; transition: background 0.12s; }
a.hd-kpi:hover { background: var(--hd-hover); color: inherit; }

/* ---------- Cards + layout ---------- */

.hd-card {
  background: var(--hd-surface); border: 1px solid var(--hd-border); border-radius: var(--hd-radius-lg);
  box-shadow: var(--hd-shadow-sm); overflow: hidden; min-width: 0;
}
.hd-card + .hd-card { margin-top: 16px; }
.hd-card-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--hd-border-soft);
}
.hd-card-title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; margin: 0; color: var(--hd-fg); }
.hd-card-title .n { color: var(--hd-faint); font-weight: 400; margin-left: 4px; font-variant-numeric: tabular-nums; }
.hd-card-hint { font-size: 12px; color: var(--hd-faint); margin-top: 2px; line-height: 1.5; font-weight: 400; letter-spacing: 0; }
.hd-card-body { padding: 16px; }
.hd-card-body + .hd-card-body, .hd-card-body + .hd-scroll { border-top: 1px solid var(--hd-border-soft); }
.hd-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; border-top: 1px solid var(--hd-border-soft);
}
.hd-scroll { overflow-x: auto; }

.hd-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.hd-stack > .hd-card + .hd-card { margin-top: 0; }
.hd-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.hd-grid.even { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; } /* side-by-side cards end level */
.hd-grid > .hd-card + .hd-card { margin-top: 0; }

/* ---------- Tables ---------- */

table.hd-table { border-collapse: separate; border-spacing: 0; width: 100%; margin: 0; }
.hd-table thead th {
  background: var(--hd-surface); font-size: 11.5px; font-weight: 500; color: var(--hd-muted); text-align: left;
  white-space: nowrap; padding: 10px 16px 8px; border-bottom: 1px solid var(--hd-border); vertical-align: bottom;
}
.hd-table td {
  padding: 9px 16px; border-bottom: 1px solid var(--hd-border-soft); vertical-align: middle;
  font-size: 12.5px; color: var(--hd-fg); line-height: 1.45;
}
.hd-table tbody tr:last-child td { border-bottom: 0; }
.hd-table tbody tr:hover td { background: var(--hd-hover); }
.hd-table tr.off td { color: var(--hd-faint); }
.hd-table .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hd-table .nw { white-space: nowrap; }
.hd-table :where(a) { text-decoration-line: underline; text-decoration-style: dashed; text-decoration-color: var(--hd-faint); text-underline-offset: 3px; }
.hd-table :where(a):hover { text-decoration-style: solid; text-decoration-color: currentColor; }
table.hd-table.fixed { table-layout: fixed; min-width: var(--hd-table-min, 860px); }
/* Many sized columns plus one free-text column: scroll sideways rather than squeeze the text */
table.hd-table.fixed.wide { --hd-table-min: 1100px; }
.hd-table.fixed td { overflow-wrap: anywhere; }
.hd-table.fixed td > .hd-main, .hd-table.fixed td > .hd-s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-table .w-xs { width: 80px; }
.hd-table .w-sm { width: 110px; }
.hd-table .w-md { width: 150px; }
.hd-table .w-lg { width: 180px; }
.hd-table .w-xl { width: 240px; }
.hd-main { font-weight: 500; font-size: 13px; letter-spacing: -0.005em; color: var(--hd-fg); }
.hd-s { font-size: 11.5px; color: var(--hd-muted); margin-top: 1px; }
.hd-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hd-person > div { min-width: 0; }
a.hd-person { color: inherit; text-decoration: none; }
a.hd-person .hd-main { text-decoration-line: underline; text-decoration-style: dashed; text-decoration-color: var(--hd-faint); text-underline-offset: 3px; }
a.hd-person:hover .hd-main { text-decoration-style: solid; text-decoration-color: currentColor; }
.hd-table.fixed td .hd-person .hd-main, .hd-table.fixed td .hd-person .hd-s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-empty { padding: 48px 16px; text-align: center; color: var(--hd-muted); font-size: 13px; }
.hd-empty strong { display: block; color: var(--hd-fg); font-size: 13.5px; font-weight: 600; margin-bottom: 2px; }

/* ---------- Tags, avatars, small text ---------- */

.hd-tag {
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--hd-font); font-size: 11px; font-weight: 500;
  line-height: 18px; padding: 0 7px; border: 0; border-radius: 5px; background: var(--hd-sel); color: var(--hd-fg-2);
  white-space: nowrap; vertical-align: 1px; box-shadow: none; text-decoration: none;
}
.hd-tag.ok { background: var(--hd-green-bg); color: var(--hd-green); }
.hd-tag.warn { background: var(--hd-amber-bg); color: var(--hd-amber); }
.hd-tag.bad { background: var(--hd-red-bg); color: var(--hd-red); }
.hd-tag.info { background: var(--hd-blue-bg); color: var(--hd-blue); }
.hd-tag.muted { color: var(--hd-muted); }
.hd-tag.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--hd-border-strong); }
.hd-tag.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.hd-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 28px; height: 28px;
  border-radius: 50%; background: var(--hd-sel); color: var(--hd-fg-2); font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px var(--hd-border);
}
.hd-avatar.lg { width: 40px; height: 40px; font-size: 14px; }

.hd-muted { color: var(--hd-muted); }
.hd-faint { color: var(--hd-faint); }
.hd-num { font-variant-numeric: tabular-nums; }
.hd-nw { white-space: nowrap; }
.hd-mono { font-family: var(--hd-mono); font-size: 12px; }
.hd-code {
  font-family: var(--hd-mono); font-size: 12px; background: var(--hd-sel); color: var(--hd-fg);
  padding: 1px 6px; border-radius: 4px; white-space: nowrap;
}
.hd-hr { border: 0; border-top: 1px solid var(--hd-border-soft); margin: 16px 0; }

/* ---------- Notes / callouts ---------- */

.hd-note {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; margin: 0 0 16px;
  border: 1px solid var(--hd-border); border-radius: 8px; background: var(--hd-surface);
  font-size: 12.5px; line-height: 1.5; color: var(--hd-fg-2);
}
.hd-note strong { color: var(--hd-fg); font-weight: 600; }
.hd-note.warn { background: var(--hd-amber-bg); border-color: var(--hd-amber-line); color: #fde68a; }
.hd-note.info { background: var(--hd-blue-bg); border-color: var(--hd-blue-line); color: #bfdbfe; }
.hd-note.bad { background: var(--hd-red-bg); border-color: var(--hd-red-line); color: #fecaca; }
.hd-note.ok { background: var(--hd-green-bg); border-color: var(--hd-green-line); color: #a7f3d0; }
.hd-note.warn strong, .hd-note.info strong, .hd-note.bad strong, .hd-note.ok strong { color: inherit; }
.hd-note > div { min-width: 0; }
.hd-note > .hd-stack { flex: 1; gap: 10px; }

/* ---------- Forms ---------- */

.hd-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.hd-form-grid.cols-1 { grid-template-columns: minmax(0, 1fr); }
.hd-form-grid .span-all { grid-column: 1 / -1; }
.hd-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; }
.hd-field > label, .hd-label { display: block; margin: 0; font-size: 12px; font-weight: 500; color: var(--hd-fg-2); line-height: 1.4; }
.hd-field .hd-control { width: 100%; }
.hd-field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.hd-hint { font-size: 11.5px; color: var(--hd-faint); line-height: 1.45; font-weight: 400; }
.hd-form-section { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; color: var(--hd-fg); }
.hd-form-section + .hd-hint { margin: 0 0 12px; }
.hd-form-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.hd-error { font-size: 12px; color: var(--hd-red); margin: 0; }
.hd-inline { display: inline; }
.hd-copy-row { display: flex; gap: 8px; align-items: center; }
.hd-copy-row .hd-control { flex: 1; min-width: 0; }

/* ---------- Detail lists ---------- */

.hd-dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px 24px; margin: 0; }
.hd-dl > div { min-width: 0; }
.hd-dl dt { font-size: 11.5px; font-weight: 500; color: var(--hd-muted); margin: 0 0 2px; }
.hd-dl dd { font-size: 13px; color: var(--hd-fg); margin: 0; overflow-wrap: anywhere; }
.hd-dl.rows { grid-template-columns: minmax(0, 1fr); gap: 0; }
.hd-dl.rows > div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--hd-border-soft); }
.hd-dl.rows > div:first-child { padding-top: 0; }
.hd-dl.rows > div:last-child { border-bottom: 0; padding-bottom: 0; }
.hd-dl.rows dt { margin: 0; font-size: 12.5px; }

/* ---------- Action list (stacked rows with a button each) ---------- */

.hd-act { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--hd-border-soft); }
.hd-act:first-child { border-top: 0; }
.hd-act-t { font-size: 13px; font-weight: 500; color: var(--hd-fg); }
.hd-act-s { font-size: 12px; color: var(--hd-muted); margin-top: 1px; }

/* ---------- Pager ---------- */

.hd-pager { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.hd-pager > a, .hd-pager > span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 8px; margin: 0;
  border: 1px solid transparent; border-radius: var(--hd-radius); font-size: 12.5px; font-weight: 500; color: var(--hd-muted);
  text-decoration: none; font-variant-numeric: tabular-nums;
}
.hd-pager > a:hover { background: var(--hd-sel); color: var(--hd-fg); text-decoration: none; }
.hd-pager > .on { background: var(--hd-accent); color: var(--hd-accent-fg); }
.hd-pager > .off { opacity: 0.35; }
.hd-pager-info { font-size: 12px; color: var(--hd-muted); font-variant-numeric: tabular-nums; }

/* ---------- Menus (<details class="hd-menu"><summary>…</summary><div class="hd-menu-list">…</div></details>) ---------- */

.hd-menu { position: relative; display: inline-block; }
.hd-menu > summary { list-style: none; cursor: pointer; }
.hd-menu > summary::-webkit-details-marker { display: none; }
.hd-menu-list {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 1000; min-width: 200px; padding: 4px;
  background: var(--hd-raised); border: 1px solid var(--hd-border); border-radius: 8px;
  box-shadow: var(--hd-shadow-lg); font-family: var(--hd-font); font-size: 13px;
}
.hd-menu.right .hd-menu-list { left: auto; right: 0; }
.hd-menu-list > a, .hd-menu-list > button, .hd-menu-list > form > button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; margin: 0; border: 0; border-radius: 5px;
  background: transparent; box-shadow: none; color: var(--hd-fg-2); font: inherit; font-weight: 400; text-align: left;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.hd-menu-list > a:hover, .hd-menu-list > button:hover, .hd-menu-list > form > button:hover { background: var(--hd-sel); color: var(--hd-fg); text-decoration: none; }
.hd-menu-list > .on { color: var(--hd-fg); font-weight: 500; }
.hd-menu-head { padding: 8px 10px; border-bottom: 1px solid var(--hd-border-soft); margin: -4px -4px 4px; }
.hd-menu-head .hd-tag { margin-top: 6px; }

/* ---------- Toasts (hd.toast) ---------- */

.hd-toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 10000; display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
.hd-toast {
  display: flex; align-items: center; gap: 8px; max-width: 420px; padding: 10px 14px; border-radius: 10px;
  background: var(--hd-raised); border: 1px solid var(--hd-border-strong); color: var(--hd-fg);
  font-family: var(--hd-font); font-size: 12.5px; font-weight: 500; line-height: 1.45;
  box-shadow: var(--hd-shadow-lg); opacity: 0; transform: translateY(6px);
  transition: opacity 0.15s, transform 0.15s; pointer-events: auto;
}
.hd-toast.show { opacity: 1; transform: none; }
.hd-toast::before { content: ''; flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--hd-green); }
.hd-toast.error::before { background: var(--hd-red); }

/* ---------- Timeline (activity / audit trail) ---------- */

.hd-timeline { list-style: none; margin: 0; padding: 0; }
.hd-timeline > li { position: relative; padding: 0 0 14px 20px; }
.hd-timeline > li::before { content: ''; position: absolute; left: 4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--hd-border-strong); }
.hd-timeline > li::after { content: ''; position: absolute; left: 7px; top: 16px; bottom: 0; width: 1px; background: var(--hd-border); }
.hd-timeline > li:last-child { padding-bottom: 0; }
.hd-timeline > li:last-child::after { display: none; }
.hd-timeline > li.ok::before { background: var(--hd-green); }
.hd-timeline > li.warn::before { background: var(--hd-amber); }
.hd-timeline > li.bad::before { background: var(--hd-red); }
.hd-timeline-t { font-size: 12.5px; font-weight: 500; color: var(--hd-fg); }
.hd-timeline-s { font-size: 11.5px; color: var(--hd-muted); }

/* ---------- App chrome: top bar + footer ---------- */

.hd-topbar {
  background: var(--hd-bg); border-bottom: 1px solid var(--hd-border); font-family: var(--hd-font);
  font-feature-settings: 'cv11'; font-size: 13px; color: var(--hd-fg); -webkit-font-smoothing: antialiased;
  position: sticky; top: 0; z-index: 100;
}
.hd-topbar *, .hd-topbar *::before, .hd-topbar *::after { box-sizing: border-box; }
.hd-topbar-in { display: flex; align-items: center; gap: 20px; max-width: var(--hd-width); margin: 0 auto; padding: 0 24px; min-height: 54px; }
.hd-brand { display: flex; align-items: center; gap: 10px; color: var(--hd-fg); text-decoration: none; font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; white-space: nowrap; }
.hd-brand:hover { color: var(--hd-fg); text-decoration: none; }
/* The logo is a black disc: a faint ring keeps its edge visible on the near-black page */
.hd-logo { display: block; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; box-shadow: 0 0 0 1px var(--hd-border-strong); }
.hd-env { font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--hd-amber); background: var(--hd-amber-bg); padding: 0 6px; border-radius: 4px; line-height: 18px; }
.hd-nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.hd-nav > a, .hd-nav-menu > summary {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--hd-radius);
  color: var(--hd-muted); font-weight: 500; text-decoration: none; white-space: nowrap; transition: color 0.12s, background 0.12s;
}
.hd-nav > a:hover { color: var(--hd-fg); background: var(--hd-sel); text-decoration: none; }
.hd-nav > a.on { color: var(--hd-fg); background: var(--hd-sel); }
/* A dropdown in the main nav (Admin): styled like the links, with a caret */
.hd-nav-menu > summary:hover, .hd-nav-menu[open] > summary { color: var(--hd-fg); background: var(--hd-sel); }
.hd-nav-menu > summary.on { color: var(--hd-fg); background: var(--hd-sel); }
.hd-nav-menu > summary::after { content: '▾'; font-size: 10px; }
.hd-nav-menu .hd-menu-list { min-width: 160px; }
.hd-topbar-r { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.hd-topbar-r .hd-menu > summary { display: flex; align-items: center; gap: 8px; padding: 3px; border-radius: 999px; }
.hd-topbar-r .hd-menu > summary:hover .hd-avatar { background: var(--hd-border); }
.hd-main-name { font-weight: 500; color: var(--hd-fg); }
.hd-s-email { font-size: 11.5px; color: var(--hd-muted); }

.hd-footer { border-top: 1px solid var(--hd-border-soft); font-family: var(--hd-font); font-size: 12px; color: var(--hd-faint); margin-top: auto; }
.hd-footer-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: var(--hd-width); margin: 0 auto; padding: 16px 24px; }

/* ---------- Sign-in screens ---------- */
/* <main class="hd hd-auth"><div class="hd-auth-box"> brand + .hd-card + .hd-auth-foot </div></main> */

.hd.hd-auth { flex: 1; display: flex; align-items: center; justify-content: center; max-width: none; padding: 56px 16px; }
.hd-auth-box { width: 100%; max-width: 380px; }
.hd-auth-box.wide { max-width: 440px; }
.hd-auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 24px; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.hd-auth-brand .hd-logo { width: 56px; height: 56px; }
.hd-auth-name { display: flex; align-items: center; gap: 8px; }
.hd-auth .hd-card-body { padding: 24px; }
.hd-auth .hd-title { font-size: 17px; }
.hd-auth .hd-sub { margin-bottom: 18px; }
.hd-auth-foot { text-align: center; font-size: 12px; color: var(--hd-faint); margin: 16px 0 0; line-height: 1.5; }
.hd-auth-foot a { color: var(--hd-muted); }
.hd-field-row a { font-size: 12px; color: var(--hd-muted); }

.hd-steps { margin: 0 0 16px; padding-left: 18px; color: var(--hd-fg-2); line-height: 1.5; }
.hd-steps li + li { margin-top: 6px; }
.hd-qr { display: flex; justify-content: center; margin-bottom: 12px; }
.hd-qr img { display: block; width: 200px; height: 200px; border-radius: 8px; padding: 8px; background: #fff; }
.hd-key { text-align: center; margin: 0 0 18px; }
.hd-key .hd-code { display: inline-block; margin-top: 6px; white-space: normal; user-select: all; font-size: 13px; letter-spacing: 0.04em; }
.hd-codes {
  list-style: none; margin: 0 0 16px; padding: 12px 16px; columns: 2; column-gap: 16px;
  border: 1px solid var(--hd-border); border-radius: 8px; background: var(--hd-input);
  font-family: var(--hd-mono); font-size: 14px; line-height: 2; text-align: center; user-select: all;
}

/* ---------- Reports: range filter, figures, charts, bars ---------- */
/* Charts and bars are SVG with sizes as attributes (config/charts.js, views/partials/line-chart.ejs),
   so nothing needs an inline style. Series colours come from .s1–.s6. */

.hd-range { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 8px; }
.hd-range input[type=date].hd-control { width: 132px; }
.hd-range-to { font-size: 12px; color: var(--hd-faint); }
.hd-period { font-size: 12.5px; color: var(--hd-muted); margin: 0 0 16px; }
.hd-period strong { color: var(--hd-fg); font-weight: 500; }
.hd-period-warn { color: var(--hd-amber); }

/* Changes on the comparison period: -d lines under a figure, .hd-delta in bars, legends and tables */
.hd-kpi-v.bad { color: var(--hd-red); }
.hd-kpi-d, .hd-mini-d { font-size: 11.5px; color: var(--hd-faint); margin-top: 6px; font-variant-numeric: tabular-nums; }
.hd-mini-d { margin-top: 4px; }
.hd-section-d { font-weight: 400; color: var(--hd-faint); margin-left: 6px; font-variant-numeric: tabular-nums; }
.hd-delta { color: var(--hd-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hd-kpi-d .good, .hd-mini-d .good, .hd-section-d .good, .hd-delta.good { color: var(--hd-green); }
.hd-kpi-d .bad, .hd-mini-d .bad, .hd-section-d .bad, .hd-delta.bad { color: var(--hd-red); }
.hd-kpis.reports { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
/* A heading between dashboard blocks (card title and hint, without a card) */
.hd-block-head { margin: 28px 0 10px; }

.hd-chart { display: block; width: 100%; height: auto; }
.hd-chart .grid { stroke: var(--hd-border-soft); stroke-width: 1; }
.hd-chart .axis { fill: var(--hd-faint); font-family: var(--hd-font); font-size: 11px; }
.hd-chart .band { fill: rgba(250, 250, 250, 0.035); }
.hd-chart .target { stroke: var(--hd-faint); stroke-width: 1; stroke-dasharray: 4 4; }
.hd-chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.hd-chart .dot { stroke: var(--hd-surface); stroke-width: 1.5; }
/* Hover (hd-ui.js): a guide line at the nearest point, its dots enlarged. Charts with many
   points (.many) show no dots except the hovered ones. */
.hd-chart .guide { display: none; stroke: var(--hd-border-strong); stroke-width: 1; }
.hd-chart.hovering .guide { display: inline; }
.hd-chart.many .dot { display: none; }
.hd-chart .dot.on { display: inline; r: 4px; }

.hd-tip {
  position: fixed; z-index: 9000; pointer-events: none; min-width: 150px; max-width: 300px;
  padding: 8px 10px; border-radius: 8px; background: var(--hd-raised); border: 1px solid var(--hd-border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); font-family: var(--hd-font); font-size: 12px; line-height: 1.6;
  opacity: 0; transition: opacity 0.1s;
}
.hd-tip.show { opacity: 1; }
.hd-tip-h { font-weight: 500; color: var(--hd-fg); margin-bottom: 2px; }
.hd-tip-r { display: flex; align-items: center; gap: 6px; color: var(--hd-muted); }
.hd-tip-r .l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-tip-r .v { margin-left: 12px; color: var(--hd-fg); font-variant-numeric: tabular-nums; }
.hd-chart .s1 { stroke: var(--hd-c1); } .hd-chart .dot.s1 { fill: var(--hd-c1); }
.hd-chart .s2 { stroke: var(--hd-c2); } .hd-chart .dot.s2 { fill: var(--hd-c2); }
.hd-chart .s3 { stroke: var(--hd-c3); } .hd-chart .dot.s3 { fill: var(--hd-c3); }
.hd-chart .s4 { stroke: var(--hd-c4); } .hd-chart .dot.s4 { fill: var(--hd-c4); }
.hd-chart .s5 { stroke: var(--hd-c5); } .hd-chart .dot.s5 { fill: var(--hd-c5); }
.hd-chart .s6 { stroke: var(--hd-c6); } .hd-chart .dot.s6 { fill: var(--hd-c6); }

.hd-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--hd-muted); margin: 0 0 8px; }
.hd-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.hd-swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--hd-faint); }
.hd-swatch.s1 { background: var(--hd-c1); }
.hd-swatch.s2 { background: var(--hd-c2); }
.hd-swatch.s3 { background: var(--hd-c3); }
.hd-swatch.s4 { background: var(--hd-c4); }
.hd-swatch.s5 { background: var(--hd-c5); }
.hd-swatch.s6 { background: var(--hd-c6); }
.hd-swatch.dash { width: 14px; height: 0; border-radius: 0; background: none; border-top: 1px dashed var(--hd-faint); }

.hd-split { display: block; width: 100%; height: 10px; border-radius: 3px; }
.hd-split .s1 { fill: var(--hd-c1); }
.hd-split .s2 { fill: var(--hd-c2); }
.hd-split .s3 { fill: var(--hd-c3); }
.hd-split .empty { fill: var(--hd-sel); }
.hd-split .muted { fill: var(--hd-border-strong); }
.hd-swatch.muted { background: var(--hd-border-strong); }

/* Bookings made vs appointments seen (clinicians): two split bars on one scale, a 2px gap between segments */
.hd-flow .hd-split { height: 14px; border-radius: 4px; }
.hd-flow .hd-split rect { stroke: var(--hd-surface); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.hd-flow-lead { font-size: 13px; color: var(--hd-fg-2); margin: 0 0 14px; line-height: 1.6; }
.hd-flow-lead strong { color: var(--hd-fg); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Diary fill (clinicians): a square per clinician and day (or week), shaded in one hue by hours
   booked out of hours open, from faint (under 25%) to solid (the target and over) */
.hd-fill { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 10.5px; }
.hd-fill th { padding: 0 0 4px; font-weight: 400; color: var(--hd-faint); text-align: center; line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hd-fill th.today { color: var(--hd-fg); font-weight: 600; }
.hd-fill td { padding: 0; }
.hd-fill .wk { padding-left: 6px; }
.hd-fill .who {
  position: sticky; left: 0; z-index: 1; width: 1%; padding: 0 12px 0 0; background: var(--hd-surface);
  text-align: left; white-space: nowrap; font-size: 12.5px; color: var(--hd-fg-2);
}
.hd-fill tfoot td { padding-top: 6px; }
.hd-fill tfoot .who { color: var(--hd-muted); }
.hd-fill :where(a) { color: inherit; text-decoration-line: underline; text-decoration-style: dashed; text-decoration-color: var(--hd-faint); text-underline-offset: 3px; }
.hd-fill :where(a):hover { text-decoration-style: solid; text-decoration-color: currentColor; }
.hd-fill-c { display: block; min-width: 14px; height: 22px; border-radius: 4px; background: var(--hd-sel); }
.hd-fill.weekly .hd-fill-c { min-width: 11px; }
.hd-fill.weekly th { text-align: left; }
.hd-fill-c.f0 { background: rgba(96, 165, 250, 0.14); }
.hd-fill-c.f1 { background: rgba(96, 165, 250, 0.34); }
.hd-fill-c.f2 { background: rgba(96, 165, 250, 0.54); }
.hd-fill-c.f3 { background: rgba(96, 165, 250, 0.76); }
.hd-fill-c.f4 { background: var(--hd-c1); }
.hd-fill-c.off { background: none; position: relative; }
.hd-fill-c.off::after { content: ''; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px 0 0 -1.5px; border-radius: 50%; background: var(--hd-border-strong); }
.hd-fill-c.nohours { background: none; border: 1px dashed var(--hd-border-strong); }
.hd-fill-c[data-hd-tip] { cursor: default; }
.hd-fill-c.on { box-shadow: 0 0 0 2px var(--hd-fg); }
.hd-fill-c.key { display: inline-block; min-width: 0; width: 12px; height: 12px; border-radius: 3px; }
.hd-mini.hd-fill-weeks { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hd-bars { display: flex; flex-direction: column; gap: 8px; }
.hd-bars-row { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr) 48px; gap: 12px; align-items: center; font-size: 12.5px; }
.hd-bars.with-change .hd-bars-row { grid-template-columns: minmax(0, 190px) minmax(0, 1fr) 48px 64px; }
.hd-bars-row .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--hd-fg-2); }
.hd-bars-row .v { text-align: right; font-variant-numeric: tabular-nums; }
.hd-bars-row .hd-delta { text-align: right; font-size: 11.5px; }
.hd-hbar { display: block; width: 100%; height: 8px; }
.hd-hbar .track { fill: var(--hd-sel); }
.hd-hbar .fill { fill: var(--hd-c1); }

.hd-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hd-mini > div { border: 1px solid var(--hd-border-soft); border-radius: 8px; padding: 10px 12px; background: var(--hd-bg); }
.hd-mini-l { font-size: 11.5px; color: var(--hd-muted); }
.hd-mini-v { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.hd-mini-v small { font-size: 12px; font-weight: 400; color: var(--hd-muted); letter-spacing: 0; }

.hd-section-l { font-size: 11.5px; font-weight: 500; color: var(--hd-muted); margin: 0 0 8px; }
* + .hd-section-l { margin-top: 18px; }
/* A section label with controls on the right (the type picker over Bookings by type's chart) */
.hd-section-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin: 0 0 10px; }
.hd-section-row > .hd-section-l { margin: 0; }
.hd-section-row select.hd-control { max-width: 320px; }

/* Chart picks: an × on a legend entry, and type names that add or remove themselves */
.hd-legend-x { color: var(--hd-faint); text-decoration: none; font-size: 13px; line-height: 1; padding: 0 2px; }
.hd-legend-x:hover { color: var(--hd-fg); text-decoration: none; }
.hd-type-link { display: inline-flex; align-items: center; gap: 6px; color: inherit; }
.hd-type-link:hover { color: var(--hd-fg); }

.hd-more > summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-size: 12.5px; font-weight: 500; color: var(--hd-muted);
}
.hd-more > summary::-webkit-details-marker { display: none; }
.hd-more > summary::after { content: '▾'; font-size: 10px; }
.hd-more[open] > summary::after { content: '▴'; }
.hd-more > summary:hover { color: var(--hd-fg); }
.hd-more[open] > summary { margin-bottom: 12px; }

/* Clinician KPI tables: a figure with a small line under it (its change, or its counts) */
.hd-cell-v { font-variant-numeric: tabular-nums; }
.hd-cell-v.bad { color: var(--hd-red); }
.hd-cell-n { font-size: 11px; color: var(--hd-faint); line-height: 1.35; font-variant-numeric: tabular-nums; }
.hd-table tr.sel td { background: rgba(250, 250, 250, 0.035); }
.hd-table tfoot td { border-top: 1px solid var(--hd-border); font-weight: 500; }

/* ---------- Spacing helpers (inline styles are blocked by the CSP) ---------- */

.hd-mt-8 { margin-top: 8px; }
.hd-mt-16 { margin-top: 16px; }
.hd-mt-24 { margin-top: 24px; }
.hd-mb-16 { margin-bottom: 16px; }
.hd-gap-8 { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Dialog (the "How it's worked out" guide, views/partials/metric-guide.ejs) ---------- */

.hd-dialog {
  width: min(760px, calc(100vw - 32px)); max-height: min(86vh, 960px); padding: 0; margin: auto;
  background: var(--hd-surface); color: var(--hd-fg); border: 1px solid var(--hd-border-strong);
  border-radius: var(--hd-radius-lg); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}
.hd-dialog[open] { display: flex; flex-direction: column; }
.hd-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.hd-dialog-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--hd-border-soft);
}
.hd-dialog-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--hd-fg); }
.hd-dialog-nav { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--hd-border-soft); }
.hd .hd-dialog-nav a {
  font-size: 12px; color: var(--hd-muted); text-decoration: none; padding: 3px 9px;
  border: 1px solid var(--hd-border); border-radius: 999px;
}
.hd .hd-dialog-nav a:hover { color: var(--hd-fg); border-color: var(--hd-border-strong); }
.hd-dialog-body { overflow-y: auto; padding: 0 16px 20px; overscroll-behavior: contain; }
.hd-guide { padding-top: 16px; scroll-margin-top: 4px; }
.hd-guide + .hd-guide { border-top: 1px solid var(--hd-border-soft); margin-top: 16px; }
.hd-guide-h { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; color: var(--hd-fg); }
.hd-guide-intro { font-size: 12.5px; color: var(--hd-muted); margin-top: 4px; line-height: 1.55; }
.hd-guide-list { margin: 6px 0 0; }
.hd-guide-item { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 4px 16px; padding: 9px 0; }
.hd-guide-item + .hd-guide-item { border-top: 1px dashed var(--hd-border-soft); }
.hd-guide-item dt { font-size: 12.5px; font-weight: 600; color: var(--hd-fg-2); line-height: 1.55; }
.hd-guide-item dd { margin: 0; font-size: 12.5px; color: var(--hd-fg-2); line-height: 1.55; }
.hd-guide-item ul { margin: 0; padding-left: 18px; color: var(--hd-muted); }
.hd-guide-item p + ul { margin-top: 4px; }
.hd-guide-item li + li { margin-top: 3px; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .hd-grid, .hd-grid.even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .hd { padding: 16px 16px 96px; }
  .hd-topbar-in { flex-wrap: wrap; gap: 0 12px; padding: 8px 16px 0; }
  /* No overflow scrolling: it would clip the Admin dropdown, and three items fit at phone width */
  .hd-nav { order: 3; flex-basis: 100%; padding: 6px 0 8px; margin: 0 -4px; }
  .hd-topbar-r { order: 2; }
  .hd-hide-sm { display: none !important; }
  .hd-search, .hd-search .hd-control { width: 100%; }
  .hd-form-grid { grid-template-columns: minmax(0, 1fr); }
  .hd-dl.rows > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .hd-act { flex-direction: column; align-items: flex-start; }
  .hd-bars-row, .hd-bars.with-change .hd-bars-row { grid-template-columns: minmax(0, 120px) minmax(0, 1fr) 40px; }
  .hd-bars-row .hd-delta { display: none; }
  .hd-kpis.reports > .hd-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .hd-footer-in { padding: 16px; }
  .hd-mini.hd-fill-weeks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hd-guide-item { grid-template-columns: minmax(0, 1fr); }
}
