/* hype_ui.css — THE one shared style file for the Hype dashboard (LAWS.md Law 4 + Law 12; new-dashboard-ui item #1, 19 Oct 2026).
   The Planner page is the master look: every value here is taken from planner.css (the signed-off look) or from the
   palette in LAWS.md Law 4. Pages never carry their own colours or button styles: they use the classes below.
   The written standard is UI_STANDARD.md (repo root). tests/test_ui_template.py fails on drift.

   How a page gets it:
     - templates that link planner.css get it automatically (planner.css @imports this file first);
     - Python-built pages call app/modules/header/ui.py  head(title)  (meta + this link) or  page(...);
     - a new template calls {{ ui_css() }} inside <head>.

   Naming: the planner's own component names are kept where they already existed on every page (.btn, .modal-bg/.modal,
   .field, .toast, table.list); everything new starts .hu- so it cannot collide with a page that has not moved yet. */

/* ---------- Inter, self-hosted (no font CDN; app/static/fonts/README.txt). The stack falls back to the system font. ---------- */
@font-face{
  font-family:"Inter"; font-style:normal; font-weight:100 900; font-display:swap;
  src:url("/static/fonts/inter-latin-var.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root{
  /* ===== Palette (LAWS.md Law 4): edge · fill · ink (dark text) · fill-light (the lighter second fill for tentative items) =====
     Colour always means something; text on a fill uses that family's ink; RED IS FOR PROBLEMS ONLY; never colour alone. */
  --hu-blue-edge:#3b82f6;   --hu-blue-fill:#dbeafe;   --hu-blue-ink:#1e40af;   --hu-blue-fill-light:#eff6ff;
  --hu-indigo-edge:#6366f1; --hu-indigo-fill:#e0e7ff; --hu-indigo-ink:#3730a3; --hu-indigo-fill-light:#eef2ff;
  --hu-violet-edge:#8b5cf6; --hu-violet-fill:#ede9fe; --hu-violet-ink:#5b21b6; --hu-violet-fill-light:#f5f3ff;
  --hu-pink-edge:#ec4899;   --hu-pink-fill:#fce7f3;   --hu-pink-ink:#9d174d;   --hu-pink-fill-light:#fdf2f8;
  --hu-rose-edge:#f43f5e;   --hu-rose-fill:#ffe4e6;   --hu-rose-ink:#9f1239;   --hu-rose-fill-light:#fff1f2;
  --hu-orange-edge:#f97316; --hu-orange-fill:#ffedd5; --hu-orange-ink:#9a3412; --hu-orange-fill-light:#fff7ed;
  --hu-amber-edge:#f59e0b;  --hu-amber-fill:#fef3c7;  --hu-amber-ink:#92400e;  --hu-amber-fill-light:#fffbeb;
  --hu-green-edge:#22c55e;  --hu-green-fill:#dcfce7;  --hu-green-ink:#166534;  --hu-green-fill-light:#f0fdf4;
  --hu-teal-edge:#14b8a6;   --hu-teal-fill:#ccfbf1;   --hu-teal-ink:#115e59;   --hu-teal-fill-light:#f0fdfa;
  --hu-cyan-edge:#06b6d4;   --hu-cyan-fill:#cffafe;   --hu-cyan-ink:#155e75;   --hu-cyan-fill-light:#ecfeff;
  --hu-slate-edge:#64748b;  --hu-slate-fill:#f1f5f9;  --hu-slate-ink:#334155;  --hu-slate-fill-light:#f8fafc;
  --hu-red-edge:#dc2626;    --hu-red-fill:#fee2e2;    --hu-red-ink:#991b1b;    --hu-red-fill-light:#fef2f2;

  /* ===== Neutrals: the planner chrome (planner.css hero/dashboard values). The ONLY other hex colours allowed anywhere. ===== */
  --hu-white:#ffffff;          /* cards, inputs */
  --hu-page:#e5eaf2;           /* page background: light grey so white cards stand out (19 Oct 2026, "too white"; was #f3f6fb, which is now the input fill) */
  --hu-input:#f3f6fb;          /* input / select / textarea fill: grey, not white (19 Oct 2026) */
  --hu-tint:#f7f9fc;           /* alternate rows, sub-panels */
  --hu-head:#e5eaf2;           /* table / calendar header band (planner --head-grey) */
  --hu-border:#e2e8f0;         /* card + control borders (planner --light-border) */
  --hu-divider:#cbd5e1;        /* row dividers (planner --row-divider) */
  --hu-heading:#0f1b33;        /* headings + strong text (planner --hero-navy) */
  --hu-navy:#1a1a2e;           /* dark surfaces: toast, header (planner --navy) */
  --hu-text:#2c3e50;           /* body text (planner --ink) */
  --hu-muted:#64748b;          /* helper text (planner --muted2; same as slate edge) */
  --hu-faint:#64748b;          /* faint labels, placeholders, AM/PM marks */
  --hu-action:#3b82f6;         /* primary buttons, links, focus (planner --hero-blue) */
  --hu-action-hover:#1e40af;   /* primary hover */
  --hu-action-soft:#eff6ff;    /* hover wash on empty cells / rows */
  /* Control greys (John, 21 Oct 2026, LAWS.md Law 4): buttons and controls only. Raised grey button = fill / edge / ink; pale fill for dropdowns and filters. */
  --hu-ctl-fill:#e2e8f0; --hu-ctl-edge:#cbd5e1; --hu-ctl-ink:#1e293b; --hu-ctl-hover:#cbd5e1; --hu-ctl-pale:#f1f5f9;

  /* ===== Type, shape, depth ===== */
  --hu-font:"Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --hu-font-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  --hu-radius-hero:16px; --hu-radius-card:14px; --hu-radius-btn:9px; --hu-radius-input:9px; --hu-radius-pill:999px;
  --hu-shadow-hero:0 8px 26px rgba(15,27,51,.08);
  --hu-shadow-card:0 4px 16px rgba(15,27,51,.06);
  --hu-shadow-pop:0 18px 50px rgba(0,0,0,.28);
  --hu-shadow-toast:0 8px 24px rgba(0,0,0,.25);
  --hu-focus-ring:0 0 0 3px rgba(59,130,246,.15);
  --hu-focus-ring-ctl:0 0 0 3px rgba(59,130,246,.45);   /* visible ring on buttons and boxes (Law 4: focus ring in palette Blue) */
  --hu-chevron:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --hu-list-h-tall:720px;      /* the same ten rows when each row is two lines (label + plain words), e.g. the Who sees what grid */
  --hu-list-h:468px;           /* the one standard height of a growing list: about ten rows (spec section 13) */
  --hu-overlay:rgba(15,27,51,.45);
  --hu-gap:18px; --hu-pad-y:26px; --hu-pad-x:32px;
  --hu-tap:44px;               /* smallest tap target on a phone */

  /* default family for anything coloured (pills, dots, edges) = slate; a family class below swaps it */
  --hu-c-edge:var(--hu-slate-edge); --hu-c-fill:var(--hu-slate-fill); --hu-c-ink:var(--hu-slate-ink); --hu-c-fill-light:var(--hu-slate-fill-light);
}

/* ---------- Family classes: put one on any pill / dot / card edge / title to give it that colour ---------- */
.hu-blue{--hu-c-edge:var(--hu-blue-edge); --hu-c-fill:var(--hu-blue-fill); --hu-c-ink:var(--hu-blue-ink); --hu-c-fill-light:var(--hu-blue-fill-light)}
.hu-indigo{--hu-c-edge:var(--hu-indigo-edge); --hu-c-fill:var(--hu-indigo-fill); --hu-c-ink:var(--hu-indigo-ink); --hu-c-fill-light:var(--hu-indigo-fill-light)}
.hu-violet{--hu-c-edge:var(--hu-violet-edge); --hu-c-fill:var(--hu-violet-fill); --hu-c-ink:var(--hu-violet-ink); --hu-c-fill-light:var(--hu-violet-fill-light)}
.hu-pink{--hu-c-edge:var(--hu-pink-edge); --hu-c-fill:var(--hu-pink-fill); --hu-c-ink:var(--hu-pink-ink); --hu-c-fill-light:var(--hu-pink-fill-light)}
.hu-rose{--hu-c-edge:var(--hu-rose-edge); --hu-c-fill:var(--hu-rose-fill); --hu-c-ink:var(--hu-rose-ink); --hu-c-fill-light:var(--hu-rose-fill-light)}
.hu-orange{--hu-c-edge:var(--hu-orange-edge); --hu-c-fill:var(--hu-orange-fill); --hu-c-ink:var(--hu-orange-ink); --hu-c-fill-light:var(--hu-orange-fill-light)}
.hu-amber{--hu-c-edge:var(--hu-amber-edge); --hu-c-fill:var(--hu-amber-fill); --hu-c-ink:var(--hu-amber-ink); --hu-c-fill-light:var(--hu-amber-fill-light)}
.hu-green{--hu-c-edge:var(--hu-green-edge); --hu-c-fill:var(--hu-green-fill); --hu-c-ink:var(--hu-green-ink); --hu-c-fill-light:var(--hu-green-fill-light)}
.hu-teal{--hu-c-edge:var(--hu-teal-edge); --hu-c-fill:var(--hu-teal-fill); --hu-c-ink:var(--hu-teal-ink); --hu-c-fill-light:var(--hu-teal-fill-light)}
.hu-cyan{--hu-c-edge:var(--hu-cyan-edge); --hu-c-fill:var(--hu-cyan-fill); --hu-c-ink:var(--hu-cyan-ink); --hu-c-fill-light:var(--hu-cyan-fill-light)}
.hu-slate{--hu-c-edge:var(--hu-slate-edge); --hu-c-fill:var(--hu-slate-fill); --hu-c-ink:var(--hu-slate-ink); --hu-c-fill-light:var(--hu-slate-fill-light)}
.hu-red{--hu-c-edge:var(--hu-red-edge); --hu-c-fill:var(--hu-red-fill); --hu-c-ink:var(--hu-red-ink); --hu-c-fill-light:var(--hu-red-fill-light)}


/* ---------- Colour with meaning (LAWS.md Law 4; new-dashboard-ui items #4 + #5) ----------
   One place decides which palette family each MEANING gets, so every page, chart and the printed programme agree:
     SITE  (planner)    .site-c0 .. .site-c7   - eight families, a site always keeps the same one (planner.js hashes its id)
     PERSON (name tablet, assignee chips) .person-c0 .. .person-c9
     PHASE (programme, tasks, the client PDF) .phase-<key>: setup, ripout, dpc, structure, windows, roof, firstfix, plaster, secondfix, finish, external, neutral
     STAGE (leads board, pipeline) .hu-stage-<slug>          SOURCE (tags) .hu-src-<slug>
   Each class only sets the four working variables, exactly like .hu-blue; the component (chip, bar, pill, swatch) does the painting.
   Red is NOT used for any meaning here: it is only for problems (sick, overdue, behind, expired). */
.site-c0,.person-c0,.phase-firstfix,.hu-stage-new-lead,.hu-src-website{--hu-c-edge:var(--hu-blue-edge); --hu-c-fill:var(--hu-blue-fill); --hu-c-ink:var(--hu-blue-ink); --hu-c-fill-light:var(--hu-blue-fill-light)}
.site-c1,.person-c1,.phase-external,.hu-stage-jobs-won{--hu-c-edge:var(--hu-green-edge); --hu-c-fill:var(--hu-green-fill); --hu-c-ink:var(--hu-green-ink); --hu-c-fill-light:var(--hu-green-fill-light)}
.site-c2,.person-c9,.phase-ripout,.hu-src-youtube-dm{--hu-c-edge:var(--hu-orange-edge); --hu-c-fill:var(--hu-orange-fill); --hu-c-ink:var(--hu-orange-ink); --hu-c-fill-light:var(--hu-orange-fill-light)}
.site-c3,.person-c3,.phase-finish,.hu-stage-quote-sent,.hu-src-email-askme{--hu-c-edge:var(--hu-violet-edge); --hu-c-fill:var(--hu-violet-fill); --hu-c-ink:var(--hu-violet-ink); --hu-c-fill-light:var(--hu-violet-fill-light)}
.site-c4,.person-c8,.phase-secondfix,.hu-stage-job-complete,.hu-src-phone-call{--hu-c-edge:var(--hu-teal-edge); --hu-c-fill:var(--hu-teal-fill); --hu-c-ink:var(--hu-teal-ink); --hu-c-fill-light:var(--hu-teal-fill-light)}
.site-c5,.person-c5,.phase-plaster,.hu-stage-subby-enquiries,.hu-src-instagram-dm{--hu-c-edge:var(--hu-pink-edge); --hu-c-fill:var(--hu-pink-fill); --hu-c-ink:var(--hu-pink-ink); --hu-c-fill-light:var(--hu-pink-fill-light)}
.site-c6,.person-c6,.phase-structure,.hu-stage-future-jobs,.hu-src-facebook-dm,.hu-src-referral,.hu-src-site-board{--hu-c-edge:var(--hu-indigo-edge); --hu-c-fill:var(--hu-indigo-fill); --hu-c-ink:var(--hu-indigo-ink); --hu-c-fill-light:var(--hu-indigo-fill-light)}
.site-c7,.phase-setup,.hu-stage-no-good,.hu-stage-sent-to-chaps,.hu-src-manual{--hu-c-edge:var(--hu-slate-edge); --hu-c-fill:var(--hu-slate-fill); --hu-c-ink:var(--hu-slate-ink); --hu-c-fill-light:var(--hu-slate-fill-light)}
.person-c4,.phase-windows,.hu-stage-make-appointment,.hu-src-sms-reply{--hu-c-edge:var(--hu-cyan-edge); --hu-c-fill:var(--hu-cyan-fill); --hu-c-ink:var(--hu-cyan-ink); --hu-c-fill-light:var(--hu-cyan-fill-light)}
.person-c2,.phase-dpc,.hu-stage-to-price,.hu-src-email-jsale{--hu-c-edge:var(--hu-amber-edge); --hu-c-fill:var(--hu-amber-fill); --hu-c-ink:var(--hu-amber-ink); --hu-c-fill-light:var(--hu-amber-fill-light)}
.hu-src-repeat-client{--hu-c-edge:var(--hu-green-edge); --hu-c-fill:var(--hu-green-fill); --hu-c-ink:var(--hu-green-ink); --hu-c-fill-light:var(--hu-green-fill-light)}
.person-c7,.phase-roof{--hu-c-edge:var(--hu-rose-edge); --hu-c-fill:var(--hu-rose-fill); --hu-c-ink:var(--hu-rose-ink); --hu-c-fill-light:var(--hu-rose-fill-light)}
.phase-neutral{--hu-c-edge:var(--hu-faint); --hu-c-fill:var(--hu-head); --hu-c-ink:var(--hu-text); --hu-c-fill-light:var(--hu-tint)}

/* Two-shade rule as reusable boxes: .hu-solid = confirmed (strong fill + solid edge + ink); .hu-tent = tentative / pipeline / pencilled in
   (light fill + dashed edge + faint stripes). A word or icon always travels with the colour. */
.hu-solid{background:var(--hu-c-fill); color:var(--hu-c-ink); border:1px solid var(--hu-c-edge)}
.hu-tent,.is-tentative.hu-box{background:var(--hu-c-fill-light) repeating-linear-gradient(135deg,transparent 0 6px,var(--hu-c-fill) 6px 8px);
  color:var(--hu-c-ink); border:1px dashed var(--hu-c-edge)}
.hu-swatch{display:inline-block; width:12px; height:12px; border-radius:4px; flex:0 0 12px; vertical-align:-1px; background:var(--hu-c-fill); border:1px solid var(--hu-c-edge)}
.hu-swatch.is-tentative{background:var(--hu-c-fill-light) repeating-linear-gradient(135deg,transparent 0 3px,var(--hu-c-fill) 3px 4px); border-style:dashed}
/* Coloured edge strip on a column / card head (stage or phase colour) + a word beside it. */
.hu-edge-l{border-left:5px solid var(--hu-c-edge)}
.hu-edge-t{border-top:4px solid var(--hu-c-edge)}
.hu-ink{color:var(--hu-c-ink)}
/* Problem marker: the ONLY place red is used for meaning. Always paired with a word (overdue, behind, sick, expired, failed). */
.hu-problem{background:var(--hu-red-fill); color:var(--hu-red-ink); border:1px solid var(--hu-red-edge)}
.hu-problem-note{margin:4px 0 0; padding:10px 12px; background:var(--hu-red-fill); color:var(--hu-red-ink); border:1px solid var(--hu-red-edge); border-radius:var(--hu-radius-btn); font-size:14px; font-weight:600}   /* a padded red line that says what went wrong (problems only; always words) */
.hu-note{background:var(--hu-amber-fill-light); color:var(--hu-amber-ink); border:1px solid var(--hu-amber-edge); border-radius:var(--hu-radius-btn); padding:8px 11px}
.hu-ok-note{background:var(--hu-green-fill-light); color:var(--hu-green-ink); border:1px solid var(--hu-green-edge); border-radius:var(--hu-radius-btn); padding:8px 11px}

/* ---------- Frappe Gantt chart (vendored css) on the palette ----------
   app/static/vendor/frappe-gantt.css ships its own greys and purples; these rules put every chart colour on the palette / neutrals so the
   Gantt, the Programme and the Pipeline programme draw in the one look. Bars take their meaning colour (site / phase) from the page css. */
.gantt-container .gantt .grid-header{fill:var(--hu-white); stroke:var(--hu-border)}
.gantt-container .gantt .grid-row{fill:var(--hu-white)}
.gantt-container .gantt .grid-row:nth-child(even){fill:var(--hu-tint)}
.gantt-container .gantt .row-line{stroke:var(--hu-border)}
.gantt-container .gantt .tick{stroke:var(--hu-divider)}
.gantt-container .gantt .tick.thick{stroke:var(--hu-slate-edge); stroke-opacity:.5}   /* week / month lines a touch stronger than day lines (#26) */
.gantt-container .gantt .today-highlight{fill:var(--hu-action-soft); opacity:.7}
.gantt-container .gantt .arrow{stroke:var(--hu-muted)}
.gantt-container .gantt .bar{fill:var(--hu-slate-fill); stroke:var(--hu-slate-edge)}
.gantt-container .gantt .bar-progress{fill:var(--hu-slate-edge); fill-opacity:.55}
.gantt-container .gantt .bar-invalid{stroke:var(--hu-slate-edge)}
.gantt-container .gantt .bar-invalid ~ .bar-label,.gantt-container .gantt .bar-label{fill:var(--hu-slate-ink)}
.gantt-container .gantt .bar-label.big{fill:var(--hu-text)}
.gantt-container .gantt .handle{fill:var(--hu-divider)}
.gantt-container .gantt .bar-wrapper:hover .bar,.gantt-container .gantt .bar-wrapper.active .bar{fill:var(--hu-slate-fill)}
.gantt-container .gantt .bar-wrapper:hover .bar-progress,.gantt-container .gantt .bar-wrapper.active .bar-progress{fill:var(--hu-slate-edge)}
.gantt-container .gantt .upper-text{fill:var(--hu-text)}
.gantt-container .gantt .lower-text{fill:var(--hu-heading)}
.gantt-container .popup-wrapper{background:var(--hu-navy); color:var(--hu-faint)}
.gantt-container .popup-wrapper .title{border-bottom:3px solid var(--hu-blue-edge)}
.gantt-container .popup-wrapper .subtitle{color:var(--hu-border)}
.gantt-container .popup-wrapper .pointer{border-top-color:var(--hu-navy)}

/* ---------- Base ---------- */
*{box-sizing:border-box}
html,body{margin:0; padding:0}
body{font-family:var(--hu-font); color:var(--hu-text); background:var(--hu-page); -webkit-font-smoothing:antialiased}

/* ---------- Layout shell + page title card (Law 10: one plain line saying what the page is for) ---------- */
.hu-page{max-width:100%; margin:0 auto; padding:var(--hu-pad-y) var(--hu-pad-x) 40px; display:flex; flex-direction:column; gap:var(--hu-gap)}
.hu-page.narrow{max-width:100%}   /* full width like every other page (19 Oct 2026, #4) */
/* ---------- THE ONE PAGE BANNER (LAWS.md Law 4 'One banner, one button system'; build r2 #53, 20 Oct 2026) ----------
   Every page has exactly this, built by ONE component: header.ui.banner() (Python pages) or the banner macro in templates/_banner.html (templates).
   Same height, same eyebrow ("Hype Building"), same title font and size, the one plain line (Law 10) under the title, the job / period picker in ONE
   fixed place and style (.hu-banner-picker, right side, before the actions) and the page's actions right-aligned in ONE row (.hu-banner-actions).
     <header class="hu-banner"><div class="hu-banner-title"><div class="hu-pretitle">Hype Building</div><h1>Title</h1></div>
       [<div class="hu-banner-picker"><label for="x">Show job</label><select id="x">..</select></div>]
       [<div class="hu-banner-actions"><button class="btn primary">..</button></div>]
       <p class="hu-help">One plain line.</p></header>
   A page never styles its banner: no page CSS may touch .hu-banner (tests/test_ui_banner_buttons.py). */
.hu-banner{position:relative; overflow:hidden; display:grid; align-items:center; column-gap:20px; row-gap:6px;
  grid-template-columns:minmax(0,1fr) auto auto; grid-template-rows:minmax(66px,auto) auto;
  grid-template-areas:"title picker actions" "help help help";
  min-height:var(--hu-banner-h); padding:16px 24px 14px 30px;
  background:var(--hu-white); border:1px solid var(--hu-border); border-radius:var(--hu-radius-hero); box-shadow:var(--hu-shadow-hero)}
.hu-banner::before{content:""; position:absolute; left:0; top:0; bottom:0; width:6px;
  background:linear-gradient(180deg,var(--hu-action),var(--hu-blue-edge))}
.hu-banner-title{grid-area:title; display:flex; flex-direction:column; min-width:0}
.hu-pretitle{font-size:14px; font-weight:700; letter-spacing:.22em; text-transform:uppercase; color:var(--hu-action); margin-bottom:3px; line-height:1.2}
.hu-banner h1{margin:0; font-size:28px; font-weight:800; letter-spacing:-.02em; color:var(--hu-heading); line-height:1.15}
.hu-help{margin:4px 0 0; font-size:14px; color:var(--hu-muted); line-height:1.45}
.hu-banner > .hu-help{grid-area:help; margin:0; max-width:none}
/* The one picker (a job, a site, a week): a small label over one 40px control, the same height as a button. */
.hu-banner-picker{grid-area:picker; justify-self:end; display:flex; flex-direction:column; gap:4px; min-width:0}
.hu-banner-picker > label,.hu-picklabel{font-size:14px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--hu-muted); line-height:1.2}
.hu-banner-picker select,.hu-banner-picker input,.hu-banner-value{height:40px; min-width:260px; max-width:360px; padding:0 14px; border:1px solid var(--hu-ctl-edge); border-radius:var(--hu-radius-input);
  background-color:var(--hu-ctl-pale); color:var(--hu-ctl-ink); font-family:inherit; font-size:14px; font-weight:600; cursor:pointer}
.hu-banner-picker input{cursor:text}
.hu-banner-picker select:hover{border-color:var(--hu-slate-edge)}
.hu-banner-picker select:focus,.hu-banner-picker input:focus{outline:none; border-color:var(--hu-action); box-shadow:var(--hu-focus-ring-ctl)}
.hu-banner-value{display:inline-flex; align-items:center; justify-content:center; min-width:196px; cursor:default; font-variant-numeric:tabular-nums}
.hu-banner-row{display:flex; align-items:center; gap:8px; flex-wrap:wrap}
/* Nothing picked yet: the label turns amber and says so (colour = a job still to pick). */
.hu-banner-picker.needspick > label{color:var(--hu-amber-ink)}
.hu-banner-picker.needspick select{border-color:var(--hu-amber-edge); background-color:var(--hu-amber-fill-light); color:var(--hu-amber-ink)}
.hu-banner-actions{grid-area:actions; justify-self:end; align-self:end; margin-bottom:2px; display:flex; flex-wrap:wrap; justify-content:flex-end; align-items:center; gap:8px; min-width:0}
.hu-banner-actions[hidden],.hu-banner-picker[hidden]{display:none}
/* Buttons in the banner are always the normal size, even when a shared helper draws them small (e.g. Give to...). */
.hu-banner-actions .btn.sm{min-height:40px; padding:0 16px}
:root{--hu-banner-h:124px}
/* The one plain line under every section heading (Law 10 'Sections too'): what it shows and what you can do there. Always visible. */
.hu-section-line{margin:2px 0 10px; font-size:14px; font-weight:400; color:var(--hu-muted); line-height:1.45; max-width:80ch}

/* ---------- THE ONE BUTTON SYSTEM (LAWS.md Law 4; r2 #53; raised grey from John's word of 21 Oct 2026) ----------
   Four kinds, two sizes, one radius / font / weight / shadow:
     .btn            secondary / control: RAISED GREY. Fill #E2E8F0, 1px edge #CBD5E1, dark text #1E293B, radius 9, weight 600, a restrained raised look
                     (soft shadow plus a thin white highlight along the top), hover #CBD5E1, press = 1px push-down with an inner shadow, a clear Blue
                     focus ring, disabled = pale #F1F5F9 at reduced opacity. Never transparent, never white.
     .btn.primary    the ONE main action of an area: solid blue
     .btn.quiet      quiet / link: no edge, no shade, grey words (hover washes blue)
     .btn.danger     red words on the raised grey, solid red on hover: ONLY for destructive actions (delete, remove, archive, discard)
     .btn.sm         the small size, for use inside tables, rows and card heads (normal = 40px high, small = 32px high)
   A chosen option in a row of choices (Day / Week / Month) is .btn.on or aria-pressed="true": SOLID palette Blue #3B82F6 with white text (Law 4: selected =
   solid blue; it replaces the old soft wash). Choices sit together in one .hu-seg group of grey buttons; the main action sits apart from them.
   Status (green / amber / red) is a small .hu-dot beside the words on a grey control, never the whole button.
   Nothing else: no page restyles a button, and no other colour, size or shadow exists (tests/test_ui_banner_buttons.py). */
:root{--hu-btn-grey-edge:var(--hu-ctl-edge); --hu-btn-grey-hover:var(--hu-ctl-hover);
  --hu-shadow-btn:0 2px 5px rgba(15,23,42,.10), inset 0 1px 0 rgba(255,255,255,.75);
  --hu-shadow-btn-press:inset 0 2px 4px rgba(15,23,42,.18);
  --hu-shadow-btn-primary:0 2px 5px rgba(59,130,246,.35), inset 0 1px 0 rgba(255,255,255,.25)}
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  min-height:40px; padding:0 16px; border:1px solid var(--hu-ctl-edge); background:var(--hu-ctl-fill); color:var(--hu-ctl-ink);
  border-radius:var(--hu-radius-btn); font-family:inherit; font-size:14px; font-weight:600; line-height:1.2; cursor:pointer;
  box-shadow:var(--hu-shadow-btn); transition:background .12s,border-color .12s,color .12s,box-shadow .12s,transform .06s; white-space:nowrap; text-decoration:none;
}
.btn:hover{background:var(--hu-ctl-hover); border-color:var(--hu-ctl-edge); color:var(--hu-ctl-ink)}
.btn:active{transform:translateY(1px); box-shadow:var(--hu-shadow-btn-press)}
.btn:focus-visible{outline:none; box-shadow:var(--hu-shadow-btn), var(--hu-focus-ring-ctl)}
.btn.primary{background:var(--hu-action); border-color:var(--hu-action); color:var(--hu-white); box-shadow:var(--hu-shadow-btn-primary)}
.btn.primary:hover{background:var(--hu-action-hover); border-color:var(--hu-action-hover); color:var(--hu-white)}
.btn.primary:active{box-shadow:var(--hu-shadow-btn-press)}
.btn.primary:focus-visible{box-shadow:var(--hu-shadow-btn-primary), var(--hu-focus-ring-ctl)}
.btn.danger{color:var(--hu-red-ink); background:var(--hu-ctl-fill); border-color:var(--hu-ctl-edge)}
.btn.danger:hover{background:var(--hu-red-edge); color:var(--hu-white); border-color:var(--hu-red-edge)}
.btn.quiet{background:transparent; border-color:transparent; color:var(--hu-muted); box-shadow:none}
.btn.quiet:hover{background:var(--hu-action-soft); color:var(--hu-action); border-color:transparent}
.btn.quiet:active{box-shadow:none}
.btn.on,.btn[aria-pressed="true"],.btn[aria-selected="true"]{background:var(--hu-action); border-color:var(--hu-action); color:var(--hu-white); font-weight:600;
  box-shadow:var(--hu-shadow-btn-primary)}
.btn.on:hover,.btn[aria-pressed="true"]:hover,.btn[aria-selected="true"]:hover{background:var(--hu-action-hover); border-color:var(--hu-action-hover); color:var(--hu-white)}
.btn.sm{min-height:32px; padding:0 12px}
.btn.block{width:100%}
.btn:disabled,.btn[aria-disabled="true"]{background:var(--hu-ctl-pale); color:var(--hu-ctl-ink); opacity:.55; cursor:default; box-shadow:none; transform:none}
.btn.danger:disabled,.btn.danger:disabled:hover{background:var(--hu-ctl-pale); color:var(--hu-ctl-ink); border-color:var(--hu-ctl-edge)}   /* a switched-off red button never turns red on hover */
.btn[aria-disabled="true"]{pointer-events:none}
.btn[hidden]{display:none}
/* One group of choices (Day / Week / Month): joined buttons, one height and shape; selected = solid Blue, the others raised grey. */
.hu-seg{display:inline-flex; gap:0; flex-wrap:nowrap; align-items:center}
.hu-seg .btn{border-radius:0; margin-left:-1px}
.hu-seg .btn:first-child{border-radius:var(--hu-radius-btn) 0 0 var(--hu-radius-btn); margin-left:0}
.hu-seg .btn:last-child{border-radius:0 var(--hu-radius-btn) var(--hu-radius-btn) 0}
.hu-seg .btn:only-child{border-radius:var(--hu-radius-btn)}
.hu-seg .btn.on,.hu-seg .btn[aria-pressed="true"],.hu-seg .btn[aria-selected="true"]{position:relative; z-index:1}
/* Status colour on a grey control: a small dot beside the words (Law 4), never a coloured button. */
.btn .hu-dot{margin-right:0; flex:0 0 10px}

/* ---------- Cards ---------- */
.hu-card{background:var(--hu-white); border:1px solid var(--hu-divider); border-radius:var(--hu-radius-card);
  box-shadow:var(--hu-shadow-card); padding:16px 20px}
.hu-card.hu-edge{border-left:5px solid var(--hu-c-edge)}
.hu-card > h2,.hu-card-title{margin:0 0 8px; font-size:18px; font-weight:700; color:var(--hu-heading)}   /* ONE card heading size (spec 9, answer 3); the page title stays 28px */
.hu-card-head{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap}
.hu-card-head .hu-card-title{margin:0; font-size:18px}
.hu-card > .hu-card-head:first-child{background:var(--hu-page); margin:-16px -20px 10px; padding:11px 20px; border-radius:var(--hu-radius-card) var(--hu-radius-card) 0 0; border-bottom:1px solid var(--hu-border)}
.hu-card-title.hu-tinted{color:var(--hu-c-ink)}
.hu-card-body{margin-top:10px}
.hu-row{display:flex; gap:12px; align-items:center; justify-content:space-between; padding:9px 0; border-top:1px solid var(--hu-slate-fill)}
.hu-row:first-of-type{border-top:0}
.hu-label{font-weight:650; color:var(--hu-heading)}
.hu-what,.hu-muted{color:var(--hu-muted); font-size:14px; overflow-wrap:anywhere}
.hu-row > *{min-width:0}              /* a long unbroken word (a file path) wraps inside its own half of the row, never pushes the page wider than a phone */
.hu-link{color:var(--hu-action); text-decoration:none; font-weight:650}
.hu-link:hover{text-decoration:underline}
.hu-mb{margin-bottom:14px}          /* spacing utility: one stacked card's gap below */
.hu-meta{display:flex; justify-content:space-between; align-items:center}

/* ---------- Page sections: one white card holding one idea (Reports, Lock boxes, Team; new-dashboard-ui #8 + #9) ----------
   .hu-section is the card, .hu-sub the line under its heading, .hu-intro the page's opening paragraph, .hu-explain a quiet sub-panel. */
.hu-section{background:var(--hu-white); border:1px solid var(--hu-divider); border-radius:var(--hu-radius-card);
  box-shadow:var(--hu-shadow-card); padding:22px 24px}
.hu-section h2{margin:0 0 6px; font-size:18px; color:var(--hu-heading); font-weight:800}
.hu-section > h2:first-child{background:var(--hu-page); margin:-22px -24px 12px; padding:13px 24px; border-radius:var(--hu-radius-card) var(--hu-radius-card) 0 0; border-bottom:1px solid var(--hu-border)}
.hu-sub{margin:0 0 16px; font-size:14px; color:var(--hu-muted); line-height:1.5}
.hu-intro{margin:0 0 14px; font-size:14px; color:var(--hu-muted); line-height:1.55}
.hu-explain{margin:12px 0 0; padding:13px 15px; background:var(--hu-tint); border:1px solid var(--hu-border);
  border-radius:11px; font-size:14px; color:var(--hu-text); line-height:1.55}
.hu-explain strong{color:var(--hu-heading)}
/* a row of labelled controls (date range, person, Apply) */
.hu-controls{display:flex; flex-wrap:wrap; gap:16px 22px; align-items:flex-end; margin-bottom:18px}
.hu-ctl{display:flex; flex-direction:column; gap:5px}
.hu-ctl label{font-size:14px; text-transform:uppercase; letter-spacing:.05em; color:var(--hu-muted); font-weight:700}
.hu-ctl input,.hu-ctl select{padding:9px 11px; border:1px solid var(--hu-ctl-edge); border-radius:var(--hu-radius-input);
  font-family:inherit; font-size:15px; color:var(--hu-text); background:var(--hu-input); min-width:150px}
.hu-ctl input:focus,.hu-ctl select:focus{outline:none; border-color:var(--hu-action); box-shadow:var(--hu-focus-ring)}

/* ---------- Tabs: two or three views of one page, each with its count (Team: Regular lads / All subcontractors; new-dashboard-ui #14) ----------
   Markup: .hu-tabs[role=tablist] > button.hu-tab[role=tab][aria-selected] (+ .hu-pill.plain for the count), then .hu-tabpanel[role=tabpanel]. */
.hu-tabs{display:flex; gap:6px; flex-wrap:wrap; margin:0 0 14px; border-bottom:2px solid var(--hu-divider)}
.hu-setnav{display:flex; gap:6px; flex-wrap:wrap; border-bottom:2px solid var(--hu-divider)}
.hu-tab,.hu-setnav a{appearance:none; background:transparent; border:0; border-bottom:3px solid transparent; margin-bottom:-2px; padding:10px 14px;
  font-family:inherit; font-size:15px; font-weight:650; color:var(--hu-muted); cursor:pointer; display:inline-flex; align-items:center; gap:8px; min-height:var(--hu-tap)}
.hu-tab:hover,.hu-setnav a:hover{color:var(--hu-heading)}
a.hu-tab,.hu-setnav a{text-decoration:none}
.hu-tab[aria-selected="true"]{color:var(--hu-heading); border-bottom-color:var(--hu-action); font-weight:800}
.hu-tab:focus-visible{outline:none; box-shadow:var(--hu-focus-ring); border-radius:var(--hu-radius-btn)}
.hu-tabpanel{display:flex; flex-direction:column; gap:18px}
.hu-tabpanel[hidden]{display:none}

/* ---------- Settings (new-dashboard-ui #15): the section list + search box, the who-sees-what grid, exceptions, the AI meter ----------
   Meaning: blue light fill = a cell changed from its default (information); amber light fill + amber edge = a one-off
   exception for one person (look at this). Each always carries a word too ("changed", "exception"). */
.hu-setnav{margin:0 4px 14px}   /* the Settings section links ARE the shared tab row (.hu-tabs / .hu-tab rules above), r2 #20 */
table.hu-grid th,table.hu-grid td{white-space:normal; padding-left:4px; padding-right:4px}   /* compact: every profile column and the lads' column fit a laptop without sideways scrolling (r2 #20 defect 13) */
.hu-grid td:first-child,.hu-grid th:first-child{min-width:140px; max-width:170px; position:sticky; left:0; z-index:1; background:var(--hu-white)}
.hu-grid select{min-width:0; width:100%; max-width:none; padding-left:3px; padding-right:12px; text-overflow:clip}   /* the whole word shows: 'Only ones given to them' is not cut (r2 #20) */
.hu-cell-changed{background:var(--hu-blue-fill-light)}
.hu-exception{background:var(--hu-amber-fill-light); box-shadow:inset 3px 0 0 var(--hu-amber-edge)}
.hu-subhead{margin:16px 0 4px; font-size:14px; text-transform:uppercase; letter-spacing:.05em; color:var(--hu-muted); font-weight:700}
.hu-empty{padding:14px 16px; border:1px dashed var(--hu-divider); border-radius:var(--hu-radius-btn); color:var(--hu-muted); background:var(--hu-tint)}
.hu-actions{display:flex; gap:6px; flex-wrap:wrap}
.hu-meter{width:100%; height:10px; -webkit-appearance:none; appearance:none; border:1px solid var(--hu-border); border-radius:var(--hu-radius-pill);
  background:var(--hu-slate-fill); overflow:hidden; margin:6px 0 2px}
.hu-meter::-webkit-progress-bar{background:var(--hu-slate-fill)}
.hu-meter::-webkit-progress-value{background:var(--hu-action)}
.hu-meter::-moz-progress-bar{background:var(--hu-action)}
.hu-meter.is-high::-webkit-progress-value{background:var(--hu-amber-edge)}
.hu-meter.is-high::-moz-progress-bar{background:var(--hu-amber-edge)}
.hu-row[hidden],.hu-card[hidden],.hu-section[hidden]{display:none}

/* ---------- Board (Kanban): columns coloured by STAGE, cards with coloured tags (Leads; new-dashboard-ui #22) ----------
   A column takes its stage colour from a .hu-stage-<slug> class (see "Colour with meaning"): coloured top edge, a head band in the
   family fill with the stage NAME in the family ink beside a swatch, and a light wash behind the cards. A card keeps a left edge in
   the same colour. Tags on a card are .hu-pill.big (14px): source = .hu-src-<slug>, age = hu-slate (quiet) / hu-amber (ageing) /
   hu-red (stale or overdue - a real problem, always with a word such as "Idle 9 days"). Phone: one column almost fills the screen. */
.hu-board{display:flex; gap:12px; align-items:flex-start; overflow-x:auto; scroll-snap-type:x mandatory; padding-bottom:12px}
.hu-col{flex:0 0 310px; scroll-snap-align:start; display:flex; flex-direction:column; background:var(--hu-c-fill-light);
  border:1px solid var(--hu-border); border-top:5px solid var(--hu-c-edge); border-radius:var(--hu-radius-card); min-height:140px}
.hu-col.over{outline:2px dashed var(--hu-action); outline-offset:2px}
.hu-col-head{display:flex; align-items:center; gap:8px; padding:10px 12px; background:var(--hu-c-fill); color:var(--hu-c-ink);
  border-radius:9px 9px 0 0; font-size:16px; font-weight:800}
.hu-col-name{flex:1 1 auto; min-width:0}
.hu-col.legacy .hu-col-head{font-weight:650}
.hu-col-body{display:flex; flex-direction:column; gap:8px; padding:8px}
.hu-kcard{background:var(--hu-white); border:1px solid var(--hu-border); border-left:5px solid var(--hu-c-edge); border-radius:10px;
  padding:10px 12px; cursor:pointer; font-size:14px; color:var(--hu-text); display:flex; flex-direction:column; gap:6px}
.hu-kcard:hover{box-shadow:var(--hu-shadow-card); border-color:var(--hu-c-edge)}
.hu-kcard:focus-visible{outline:none; box-shadow:var(--hu-focus-ring); border-color:var(--hu-action)}
.hu-kname{font-size:16px; font-weight:750; color:var(--hu-heading); overflow-wrap:anywhere}
.hu-tags{display:flex; flex-wrap:wrap; gap:6px}
.hu-col-foot{padding:0 8px 8px}
.hu-col-foot .btn{width:100%}
/* Laptop (John, 22 Oct 2026, Q7 yes): a column scrolls INSIDE itself, no taller than the screen; head and '+ Add a lead' stay in view; sideways scroll between columns unchanged. Phone keeps Show more. */
@media (min-width:601px){
  .hu-col-body{max-height:calc(100vh - 330px); max-height:calc(100dvh - 330px); min-height:80px; overflow-y:auto}
}

/* ---------- Tables: THE ONE TABLE TEMPLATE (spec 9a, John 21 Oct 2026: depth, not a flat white block; layout unchanged) ----------
   Container: border #E2E8F0, rounded, faint card shadow. Header row: pale Blue band with dark Blue words. Rows: a very subtle alternating tint,
   a light divider, a little more room, hover highlight. Inputs and buttons inside a table are the same ones as everywhere (filled box with a #CBD5E1 edge;
   the raised grey small button). Muted small metadata ("last changed", "by ...") uses .hu-meta-text. */
.hu-table-wrap{background:var(--hu-white); border:1px solid var(--hu-border); border-radius:12px; box-shadow:var(--hu-shadow-card); overflow-x:auto}
.hu-table,table.list{border-collapse:separate; border-spacing:0; width:100%}
.hu-table th,table.list th{font-size:14px; text-transform:uppercase; letter-spacing:.05em; color:var(--hu-blue-ink); font-weight:700;
  text-align:left; padding:10px 12px; border-bottom:2px solid var(--hu-blue-edge); background:var(--hu-blue-fill)}
table.list th{padding:9px 10px}
.hu-table td,table.list td{padding:11px 12px; border-bottom:1px solid var(--hu-border); font-size:14px; color:var(--hu-text); vertical-align:middle}
table.list td{padding:11px 10px}
.hu-table tbody tr:nth-child(even) td,table.list tbody tr:nth-child(even) td{background:var(--hu-tint)}
.hu-table tbody tr:hover td,table.list tbody tr:hover td{background:var(--hu-action-soft)}
.hu-table tr:last-child td{border-bottom:none}
.hu-table td.num,.hu-table th.num{text-align:right; font-variant-numeric:tabular-nums}
table.list td a{color:var(--hu-heading); border-bottom:1px dotted var(--hu-action); text-decoration:none}
.hu-table td strong{color:var(--hu-heading); font-weight:700}
.hu-meta-text{font-size:14px; color:var(--hu-muted)}
.hu-table input:not([type="checkbox"]):not([type="radio"]),.hu-table textarea,.hu-table select{background-color:var(--hu-input); border:1px solid var(--hu-ctl-edge); border-radius:var(--hu-radius-input);
  font-family:inherit; font-size:14px; color:var(--hu-text); min-height:36px; padding:0 10px}
.hu-table select{background-color:var(--hu-ctl-pale); padding-right:34px}
.hu-table textarea{padding:8px 10px}
.hu-table input:focus,.hu-table textarea:focus,.hu-table select:focus{outline:none; border-color:var(--hu-action); box-shadow:var(--hu-focus-ring-ctl)}

/* ---------- GROWING LISTS scroll inside their own box (spec 13, John 21 Oct 2026: "a fixed-height panel ... rather than the page expanding into thousands of lines") ----------
   Markup (built by static/hu_list.js from data-hu-list): .hu-listbox > .hu-listhead (title + plain line stay put; count; search when over about 20 rows)
   + .hu-scrollbox (the ONLY part that scrolls, about ten rows tall; table column titles are pinned) + .hu-showmore (phone only).
   Laptop: the box scrolls on its own when the mouse is over it. Phone: no inner scrolling; the latest few rows show and "Show more" adds the rest.
   Exempt: the Planner grid, the Programme chart, Leads columns and the main item on a page (they scroll their own way). */
.hu-listbox{display:flex; flex-direction:column; gap:8px}
.hu-listtools{display:flex; flex-wrap:wrap; gap:8px 14px; align-items:center; justify-content:space-between}
.hu-listcount{font-size:14px; color:var(--hu-muted); font-weight:600}
.hu-listsearch{flex:1 1 220px; max-width:360px; min-height:40px; padding:0 12px; border:1px solid var(--hu-ctl-edge); border-radius:var(--hu-radius-input);
  background:var(--hu-input); font-family:inherit; font-size:14px; color:var(--hu-text)}
.hu-listsearch:focus{outline:none; border-color:var(--hu-action); box-shadow:var(--hu-focus-ring-ctl)}
.hu-scrollbox{max-height:var(--hu-list-h); overflow:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch}
.hu-scrollbox thead th{position:sticky; top:0; z-index:2}
.hu-showmore{display:none}
.hu-listrow-hidden{display:none}

/* ---------- Pills / tags + dots: two-shade rule ----------
   confirmed = strong pastel fill + solid edge;  tentative = light fill + dashed edge + faint stripes. Always carry a word. */
.hu-pill{display:inline-flex; align-items:center; gap:5px; font-size:14px; font-weight:600; line-height:1.3;
  border-radius:var(--hu-radius-pill); padding:2px 9px; background:var(--hu-c-fill); color:var(--hu-c-ink);
  border:1px solid var(--hu-c-edge); white-space:nowrap}
.hu-pill.is-tentative{background:var(--hu-c-fill-light)
    repeating-linear-gradient(135deg,transparent 0 6px,var(--hu-c-fill) 6px 8px);
  border-style:dashed}
.hu-pill.plain{border-color:transparent}
.hu-pill.big{font-size:14px; padding:3px 10px}      /* tags that must be readable at a glance (Leads cards): 14px minimum */
.hu-label + .hu-pill,.hu-pill + .hu-pill{margin-left:6px}
.hu-dot{display:inline-block; width:12px; height:12px; border-radius:50%; margin-right:8px; vertical-align:-1px; background:var(--hu-c-edge)}
.hu-dot.is-tentative{background:var(--hu-c-fill-light); border:2px dashed var(--hu-c-edge)}

/* ---------- Form controls ---------- */
.field{margin-bottom:12px}
.field label{display:block; font-size:14px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--hu-faint); margin-bottom:5px}
.field select,.field input,.field textarea,.hu-input{width:100%; padding:10px 11px; border:1px solid var(--hu-ctl-edge); border-radius:var(--hu-radius-input);
  font-family:inherit; font-size:14px; color:var(--hu-text); background:var(--hu-input)}
.hu-input{width:auto; padding:7px 10px}
.field select:focus,.field input:focus,.field textarea:focus,.hu-input:focus{outline:none; border-color:var(--hu-action); box-shadow:var(--hu-focus-ring)}
.field label.check{display:flex; align-items:center; gap:8px; text-transform:none; letter-spacing:0; font-weight:600; color:var(--hu-text); margin-bottom:8px}
.field label.check input{width:auto; margin:0}
/* ---------- Dropdowns, filters, date boxes (Law 4): pale #F1F5F9 fill, #CBD5E1 edge, button height, a clear chevron; still plainly a box, not a button ---------- */
select.hu-select,.hu-ctl select,.field select,.hu-banner-picker select{
  -webkit-appearance:none; appearance:none; min-height:40px; padding:0 34px 0 12px; background-color:var(--hu-ctl-pale);
  background-image:var(--hu-chevron); background-repeat:no-repeat; background-position:right 11px center; background-size:14px;
  border:1px solid var(--hu-ctl-edge); border-radius:var(--hu-radius-input); color:var(--hu-ctl-ink); font-family:inherit; font-size:14px; font-weight:600; line-height:1.2; cursor:pointer}
input[type="date"].hu-input,.hu-ctl input[type="date"],.field input[type="date"]{background-color:var(--hu-ctl-pale); min-height:40px; border-color:var(--hu-ctl-edge); color:var(--hu-ctl-ink); font-weight:600}
select.hu-select:hover,.hu-ctl select:hover,.field select:hover{border-color:var(--hu-slate-edge)}
select.hu-select:focus-visible,.hu-ctl select:focus-visible,.field select:focus-visible{outline:none; border-color:var(--hu-action); box-shadow:var(--hu-focus-ring-ctl)}
select:disabled,input:disabled,textarea:disabled{opacity:.55; cursor:default}

/* ---------- Pop-up (modal): title + Close/Cancel always visible, phone safe (new-dashboard-ui #23) ----------
   Markup: .modal-bg > .modal > h3 (title) + .ctx + fields + .modal-actions (Close/Cancel always present).
   Pinned variant (a big pop-up such as a lead card or a subcontractor card): .modal.pinned > .modal-head (h3 + a Close button) +
   .modal-body (the only part that scrolls) + optional .modal-actions. The head never scrolls away.
   Stacking: a pop-up sits ABOVE the left menu (900), the top strip (890), the phone menu (960) and the bell / search panels (950),
   and BELOW the confirmation toast (1000+), so its title and Close can never be hidden behind the shell.
   Phone keyboard: the sheet is sized with dvh, and sitebar.js sets --hu-vvh / --hu-vvt (the visible area) on <html> while the
   on-screen keyboard is up, so the pinned head and the actions stay on screen. */
.modal-bg{position:fixed; left:0; right:0; top:0; height:100%; height:100dvh; background:var(--hu-overlay); display:none; align-items:center; justify-content:center; z-index:980; padding:12px}
html.hu-kbd .modal-bg{top:var(--hu-vvt,0px); height:var(--hu-vvh,100dvh)}
.modal-bg.open{display:flex}
.modal{background:var(--hu-white); border-radius:14px; padding:20px; width:min(440px,93vw); box-shadow:var(--hu-shadow-pop);
  max-height:calc(100vh - 24px); max-height:calc(100dvh - 24px); overflow-y:auto; overscroll-behavior:contain}
.modal h3{position:sticky; top:-20px; z-index:1; background:var(--hu-white); margin:-20px -20px 3px; padding:20px 20px 2px;
  font-size:17px; color:var(--hu-heading)}
.modal .ctx{color:var(--hu-faint); font-size:14px; margin-bottom:14px}
.modal-actions{display:flex; gap:8px; margin-top:16px; position:sticky; bottom:-20px; z-index:1; background:var(--hu-white);
  margin-bottom:-20px; padding:4px 0 20px}
.modal-actions .btn{flex:1}
.modal-actions[hidden]{display:none}   /* a pop-up's foot bar given the hidden attribute stays hidden (the shared rule sets display) */
.modal-actions.wrap{flex-wrap:wrap}
.modal-actions.wrap .btn{flex:1 1 130px}
.modal.wide{width:min(720px,94vw)}
/* Phone keyboard, any page (29 Nov 2026, iPhone click-through): a pop-up's buttons sat under the keyboard bar. While a field in the pop-up has
   focus the sheet scrolls as ONE piece with room under it for the keyboard, and the foot bar stops sticking to the screen bottom (where the
   keyboard is), so Save / Cancel can always be scrolled into reach. Pages with the shell's keyboard sizing (html.hu-kbd) already fit the
   visible area, so they need no extra room.
   Touch screens only (30 Nov 2026, release check): on a desktop there is no on-screen keyboard, and the re-layout as focus left the box moved
   Save from under the mouse mid-click (tests/test_programme_browser.py: the empty add form never asked for a name). */
@media (hover:none) and (pointer:coarse){
.modal-bg:has(input:focus,select:focus,textarea:focus){align-items:flex-start; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; padding-bottom:60vh}
.modal-bg:has(input:focus,select:focus,textarea:focus) .modal{max-height:none; overflow:visible; margin:auto 0}
.modal-bg:has(input:focus,select:focus,textarea:focus) .modal-actions{position:static; margin-bottom:0; padding-bottom:4px}
html.hu-kbd .modal-bg:has(input:focus,select:focus,textarea:focus){padding-bottom:12px}
}
/* A file opened inside the page (the lads' Drawings on iPhone, where a web view cannot open a new window and has no back swipe): full screen,
   one big Close at the top, the document scrolls beneath it. */
.hu-viewer{position:fixed; left:0; right:0; top:0; bottom:0; z-index:990; display:flex; flex-direction:column; background:var(--hu-white)}
.hu-viewer-bar{flex:none; display:flex; align-items:center; gap:12px; padding:10px 12px; padding-top:calc(10px + env(safe-area-inset-top,0px)); border-bottom:1px solid var(--hu-border); background:var(--hu-white)}
.hu-viewer-bar .btn{flex:none; min-height:56px; min-width:120px; font-size:18px}
.hu-viewer-title{flex:1 1 auto; min-width:0; font-weight:700; color:var(--hu-heading); overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.hu-viewer-body{flex:1 1 auto; min-height:0; overflow:auto; -webkit-overflow-scrolling:touch}
.hu-viewer-body iframe{display:block; width:100%; height:100%; border:0}
.modal.pinned{display:flex; flex-direction:column; overflow:hidden; padding:0}
.modal.pinned .modal-head{flex:none; display:flex; align-items:center; gap:12px; padding:14px 18px; background:var(--hu-white);
  border-bottom:1px solid var(--hu-border)}
.modal.pinned .modal-head h3{position:static; flex:1 1 auto; min-width:0; margin:0; padding:0; font-size:19px; overflow-wrap:anywhere}
.modal.pinned .modal-head .btn{flex:none}
/* The pinned head on a laptop reads: name, pills, Close at the right. On a phone Close stays BESIDE the name and the pills drop under it (was Leads only). */
.modal.pinned .modal-head .hu-tags{order:1}
.modal.pinned .modal-head > .btn{order:2}
@media (max-width:600px){
  .modal.pinned .modal-head > .btn{order:0}
  .modal.pinned .modal-head .hu-tags{order:3; flex:1 0 100%}
}
.modal.pinned .modal-body{flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; padding:14px 18px 18px}
.modal.pinned .modal-actions{position:static; flex:none; margin:0; padding:12px 18px; border-top:1px solid var(--hu-border)}
.modal.pinned .ctx{font-size:14px; color:var(--hu-muted)}
.modal.pinned .field label{font-size:14px; text-transform:none; letter-spacing:0; font-weight:650; color:var(--hu-muted)}
.modal.pinned .field select,.modal.pinned .field input,.modal.pinned .field textarea{font-size:15px}

/* ---------- OPENED ITEMS: the branded centred pop-up (spec 10 + 11, John 21 Oct 2026; LAWS.md Law 4 'Everything you open is branded too') ----------
   Opt-in: add .branded and the area's family class (.hu-teal for Leads, .hu-blue for work, ...) to a .modal.pinned. Anatomy:
     .modal-head          the area colour: name left (h3), stage / idle pills (.hu-tags), Close as a raised grey button; never scrolls away
     .modal-body          .hu-actgroups (labelled groups of raised grey buttons: Contact / Paperwork / Next step, a danger group set apart),
                          then one .hu-card per section (grey head band, title, ONE plain line), notes as .hu-notecard (person) / .hu-notecard.system
     .hu-sysdetails       "Other details set by the system", closed by default, plain words
     .modal-actions       Save changes = the one blue main button, pinned at the foot
   Phone (390px): the pop-up fills the screen with header and Save pinned. */
.modal.branded{border-top:6px solid var(--hu-c-edge); width:min(760px,94vw)}
.modal.branded .modal-head{background:var(--hu-c-fill); border-bottom:1px solid var(--hu-c-edge); flex-wrap:wrap}
.modal.branded .modal-head h3{color:var(--hu-c-ink); background:transparent}
.modal.branded .modal-body{background:var(--hu-page); display:flex; flex-direction:column; gap:12px}
.modal.branded .hu-card{box-shadow:var(--hu-shadow-card); padding:14px 16px}
.modal.branded .hu-card > .hu-card-head:first-child{margin:-14px -16px 10px; padding:10px 16px}
.modal.branded .modal-actions{background:var(--hu-white); justify-content:flex-end}
.modal.branded .modal-actions .btn{flex:0 0 auto; min-width:140px}
.hu-actgroups{display:flex; flex-wrap:wrap; gap:12px 22px; align-items:flex-start}
.hu-actgroup{display:flex; flex-direction:column; gap:6px; min-width:0}
.hu-actgroup.apart{margin-left:auto}
.hu-actgroup-label{font-size:14px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--hu-muted)}
.hu-actgroup-btns{display:flex; flex-wrap:wrap; gap:8px}
/* Choice buttons with their own plain line under each (contract-notices-stage1 #3, John 28 Nov 2026): groups stacked, buttons in a grid. */
.hu-choice-groups{display:flex; flex-direction:column; gap:14px; margin:6px 0 10px}
.hu-choice-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:10px}
.hu-choice{display:flex; flex-direction:column; align-items:flex-start; gap:4px; padding:10px 12px; background:var(--hu-white); border:1px solid var(--hu-border); border-radius:var(--hu-radius-card); min-width:0}
.hu-choice .hu-what,.hu-choice .hu-muted{margin:0}
.hu-notecard{background:var(--hu-white); border:1px solid var(--hu-border); border-left:4px solid var(--hu-c-edge); border-radius:10px; overflow:hidden}
.hu-notecard + .hu-notecard,.hu-notecard + .field{margin-top:8px}
.hu-notecard-head{display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; padding:6px 12px; background:var(--hu-c-fill-light); color:var(--hu-c-ink); font-size:14px; font-weight:600}
.hu-notecard-body{padding:9px 12px; font-size:14px; color:var(--hu-text); overflow-wrap:anywhere}
.hu-notecard.system{border-left-color:var(--hu-slate-edge); background:var(--hu-slate-fill-light)}
.hu-notecard.system .hu-notecard-head{background:var(--hu-slate-fill); color:var(--hu-muted)}
.hu-notecard.system .hu-notecard-body{color:var(--hu-muted)}
.hu-sysdetails{border:1px solid var(--hu-border); border-radius:10px; background:var(--hu-white)}
.hu-sysdetails > summary{cursor:pointer; padding:10px 14px; font-size:14px; font-weight:600; color:var(--hu-ctl-ink); min-height:var(--hu-tap); display:flex; align-items:center}
.hu-sysdetails[open] > summary{border-bottom:1px solid var(--hu-border)}
.hu-sysdetails dl{margin:0; padding:10px 14px; display:grid; grid-template-columns:minmax(120px,max-content) 1fr; gap:6px 16px; font-size:14px}
.hu-sysdetails dt{color:var(--hu-muted); font-weight:600}
.hu-sysdetails dd{margin:0; color:var(--hu-text); overflow-wrap:anywhere}
@media (max-width:600px){
  .modal-bg:has(.modal.branded){padding:0}
  .modal.branded{width:100%; height:100vh; height:100dvh; max-height:100dvh; border-radius:0}
  .hu-actgroup.apart{margin-left:0}
  .modal.branded .modal-actions .btn{flex:1 1 auto}
}

/* ---------- Toast / confirmation (Law 10: a confirmation after every send / approve) ---------- */
.toast{position:fixed; bottom:20px; left:50%; transform:translateX(-50%); background:var(--hu-navy); color:var(--hu-white); padding:11px 18px;
  border-radius:9px; font-size:14px; z-index:1100; display:none; max-width:90vw; box-shadow:var(--hu-shadow-toast)}
.toast.show{display:block}
.toast.ok{background:var(--hu-green-ink)}
.toast.err{background:var(--hu-red-edge)}
.toast.warn{background:var(--hu-amber-ink)}

/* ---------- Narrow laptop / tablet: the picker drops to its own row under the title, actions stay top right ---------- */
@media (max-width:1100px) and (min-width:601px){
  .hu-banner{grid-template-columns:minmax(0,1fr) auto; grid-template-rows:auto auto auto;
    grid-template-areas:"title actions" "picker picker" "help help"}
  .hu-banner-picker{justify-self:start}
}
/* A WIDE picker (the Planner's week arrows, This week, Week / Month: about 580px) drops under the title earlier, so the page title keeps its size
   (John, 22 Oct 2026: at 1280px the Planner title was squeezed to about 65px). The one-control pickers (a job, a site) keep the 1100px rule above. */
@media (max-width:1439px) and (min-width:601px){
  .hu-banner:has(.hu-banner-picker .hu-banner-row){grid-template-columns:minmax(0,1fr) auto; grid-template-rows:auto auto auto;
    grid-template-areas:"title actions" "picker picker" "help help"}
  .hu-banner:has(.hu-banner-picker .hu-banner-row) .hu-banner-picker{justify-self:start}
}

/* ---------- Phone layout (390px is the test width; Law 11) ---------- */
@media (max-width:600px){
  .hu-page{padding:12px 12px 28px; gap:12px}
  .hu-banner{padding:14px 14px 12px 20px; row-gap:10px; min-height:0; grid-template-columns:minmax(0,1fr); grid-template-rows:none;
    grid-template-areas:"title" "picker" "actions" "help"}
  .hu-banner h1{font-size:22px}
  .hu-banner-picker{justify-self:stretch}
  .hu-banner-picker select,.hu-banner-picker input{min-width:0; max-width:none; width:100%; min-height:var(--hu-tap)}
  .hu-banner-value{min-width:0; flex:1 1 120px; min-height:var(--hu-tap)}
  .hu-banner-row{flex-wrap:wrap}
  .hu-banner-actions{justify-self:stretch; justify-content:flex-start}
  .hu-banner-actions .btn{flex:1 1 auto}
  .hu-card{padding:14px}
  .hu-row{flex-wrap:wrap; align-items:flex-start}
  .btn{min-height:var(--hu-tap)}
  .hu-input{min-height:var(--hu-tap); max-width:100%}
  .modal{width:100%; max-height:calc(100vh - 16px); max-height:calc(100dvh - 16px)}
  .modal-bg{padding:8px}
  .modal .field select,.modal .field input,.modal .field textarea{font-size:16px; min-height:var(--hu-tap)}   /* 16px stops the phone zooming in */
  .modal.pinned .modal-head{padding:10px 12px}
  .modal.pinned .modal-body{padding:12px}
  .modal.pinned .modal-actions{padding:10px 12px}
  .modal.wide{width:100%}
  .hu-col{flex-basis:86vw}
  .hu-scrollbox{max-height:none; overflow-y:visible; overflow-x:auto}   /* phone: the page scrolls; the latest few rows show, then Show more (spec 13) */
  .hu-showmore{display:flex; justify-content:center; padding-top:4px}
  .hu-showmore[hidden]{display:none}
  .hu-showmore .btn{width:100%}
  .hu-listsearch{max-width:none}
  .hu-table th,.hu-table td{padding:8px 9px}
  .hu-section{padding:16px 14px}
  .hu-ctl{flex:1 1 140px}
  .hu-ctl input,.hu-ctl select{min-width:0; width:100%}
}

/* ---------- Drop zone + file list (new-dashboard-ui #33: Job files, lead attachments) ----------
   Markup: .hu-dropzone[tabindex=0][role=button] (add .is-over while a file is dragged over it), then ul.hu-filelist > li.hu-fileitem
   (.hu-filemain with the download link, then a .hu-muted line: size, when, who). A result line under it is .hu-ok-note (done) or .hu-note (a file turned away). */
.hu-dropzone{display:block; width:100%; border:2px dashed var(--hu-divider); border-radius:var(--hu-radius-card); background:var(--hu-tint);
  padding:18px 16px; text-align:center; color:var(--hu-text); font-size:14px; line-height:1.5; cursor:pointer; min-height:var(--hu-tap)}
.hu-dropzone[hidden]{display:none}
.hu-dropzone:hover,.hu-dropzone.is-over{border-color:var(--hu-action); background:var(--hu-action-soft); color:var(--hu-heading)}
.hu-dropzone:focus-visible{outline:none; border-color:var(--hu-action); box-shadow:var(--hu-focus-ring)}
.hu-dropzone[aria-busy="true"]{opacity:.6; cursor:progress}
.hu-filelist{list-style:none; margin:12px 0 0; padding:0}
.hu-fileitem{display:flex; gap:6px 14px; align-items:center; justify-content:space-between; flex-wrap:wrap; padding:9px 0;
  border-top:1px solid var(--hu-slate-fill); font-size:14px; min-height:var(--hu-tap)}
.hu-fileitem:first-child{border-top:0}
.hu-filemain{min-width:0; overflow-wrap:anywhere}

/* ---------- Person photo (new-dashboard-ui #31): the round picture beside a person's name; initials on a palette colour when there is none ----------
   Markup (built by app/static/person_photo.js, never by hand): span.hu-avatar[.person-cN][.sm|.lg][role=img][aria-label] holding an <img alt> or the initials.
   The colour is only a background for the initials; the person's name is always written beside it and in the aria-label. */
.hu-avatar{display:inline-flex; align-items:center; justify-content:center; flex:0 0 28px; width:28px; height:28px; border-radius:50%; overflow:hidden;
  vertical-align:middle; background:var(--hu-c-fill); color:var(--hu-c-ink); border:1px solid var(--hu-c-edge); font-size:14px; font-weight:800; line-height:1; letter-spacing:.02em}
.hu-avatar.sm{flex-basis:22px; width:22px; height:22px; font-size:9px}
.hu-avatar.lg{flex-basis:44px; width:44px; height:44px; font-size:15px}
.hu-avatar img{display:block; width:100%; height:100%; object-fit:cover}
.hu-withphoto{display:inline-flex; align-items:center; gap:7px; min-width:0}

/* ---------- Form preview + printed answer (new-dashboard-ui-r2 #28, Web forms) ----------
   Markup: iframe.hu-frame[sandbox] (a form shown in preview mode: nothing can be sent), div.hu-shotbox > img.hu-shot (a picture of a form,
   scrolls inside its box), .hu-noprint (left off the printed page), body.hu-print-page (set by the page script: only <main> is printed). */
.hu-frame{display:block; width:100%; height:560px; border:1px solid var(--hu-divider); border-radius:var(--hu-radius-card); background:var(--hu-white)}
.hu-shotbox{max-height:560px; overflow-y:auto; border:1px solid var(--hu-divider); border-radius:var(--hu-radius-card); background:var(--hu-white)}
.hu-shot{display:block; width:100%; max-width:420px; height:auto; margin:0 auto}
@media (max-width:600px){ .hu-frame,.hu-shotbox{height:480px; max-height:480px} }
@media print{
  body.hu-print-page > *:not(main){display:none !important}
  body.hu-print-page .hu-noprint{display:none !important}
  body.hu-print-page .hu-card{box-shadow:none; border:none; padding:0}
}

/* ---------- Site forms: snag / site inspection and health and safety check (new-dashboard-ui-r2 #29) ----------
   Public phone-first pages on /forms/. Markup: main.hu-page.narrow > form.hu-card; .sf-hp = the honeypot (hidden off-screen);
   .sf-sign = the finger-drawn signature canvas; .sf-check (+ .is-fail) = one pass / fail point with .sf-tick radios and an .sf-action box. */
.sf-hp{position:absolute; left:-5000px; height:0; overflow:hidden}
.sf-turnstile{margin-top:16px}
.sf-sign{display:block; width:100%; height:180px; touch-action:none; background:var(--hu-white); border:2px dashed var(--hu-muted); border-radius:var(--hu-radius-input)}
.sf-check{border-top:1px solid var(--hu-border); padding:12px 0}
.sf-check > p{margin:0 0 8px; font-weight:600; color:var(--hu-heading)}
.sf-check.is-fail{background:var(--hu-red-fill-light); border-left:4px solid var(--hu-red-edge); padding-left:10px}
.sf-tick{display:flex; gap:10px}
.sf-tick label{flex:1; display:flex; align-items:center; justify-content:center; gap:8px; min-height:var(--hu-tap); border:1px solid var(--hu-border);
  border-radius:var(--hu-radius-btn); background:var(--hu-white); font-size:15px; font-weight:700; color:var(--hu-heading)}
.sf-tick input{width:auto; margin:0}
.sf-action{margin-top:10px}
.sf-action[hidden],.sf-msg[hidden]{display:none}
.sf-msg{border-radius:var(--hu-radius-btn); padding:12px; margin-top:14px; font-weight:600}
.sf-msg.ok{background:var(--hu-green-fill); color:var(--hu-green-ink); border:1px solid var(--hu-green-edge)}
.sf-msg.bad{background:var(--hu-red-fill); color:var(--hu-red-ink); border:1px solid var(--hu-red-edge)}
.sf-photolist{margin:6px 0 0; padding-left:20px; color:var(--hu-text)}
.sf-sign-row{display:flex; gap:10px; align-items:center; justify-content:space-between; margin-top:6px}

/* ---------- Marketing (new-dashboard-ui-r2 #40): message previews at two widths, the campaign flowchart, the audience list ----------
   Markup: .mk-previews > figure.mk-shot > iframe.hu-frame[sandbox] (+ .mk-phone = phone width) + figcaption.
   Flowchart: ol.mk-flow > li.mk-step (+ .hu-<family>) holding .mk-step-head + .mk-routes for a split; li.mk-arrow between steps (a word with it).
   Audience list: .mk-person (+ .is-greyed = may not be contacted, always with the reason written beside it). */
.mk-previews{display:flex; gap:16px; flex-wrap:wrap; align-items:flex-start; margin-top:12px}
.mk-previews[hidden]{display:none}
.mk-shot{margin:0; flex:1 1 420px; min-width:0}
.mk-shot.mk-phone-wrap{flex:0 1 390px}
.mk-shot figcaption{font-size:14px; color:var(--hu-muted); margin-top:4px}
.hu-frame.mk-phone{max-width:390px; height:640px}
.mk-flow{list-style:none; margin:10px 0; padding:0; display:flex; flex-direction:column; align-items:stretch; gap:0; max-width:560px}
.mk-step{background:var(--hu-c-fill); color:var(--hu-c-ink); border:1px solid var(--hu-c-edge); border-radius:var(--hu-radius-card); padding:10px 14px; font-size:14px}
.mk-step.is-start{background:var(--hu-c-fill-light); border-style:dashed}
.mk-step-head{display:flex; gap:8px; align-items:center; justify-content:space-between; flex-wrap:wrap; font-weight:700}
.mk-step .field{margin:8px 0 0}
.mk-routes{display:flex; gap:10px; flex-wrap:wrap; margin-top:8px}
.mk-routes .field{flex:1 1 180px}
.mk-arrow{align-self:center; font-size:14px; color:var(--hu-muted); padding:4px 0; line-height:1.2}
.mk-addrow{display:flex; gap:6px; flex-wrap:wrap; margin-top:12px}
.mk-person{display:flex; gap:10px; justify-content:space-between; flex-wrap:wrap; padding:8px 0; border-top:1px solid var(--hu-slate-fill); font-size:14px}
.mk-person.is-greyed{color:var(--hu-muted); background:var(--hu-tint)}
.mk-stats{display:flex; gap:10px; flex-wrap:wrap; margin:10px 0}
.mk-stat{background:var(--hu-tint); border:1px solid var(--hu-border); border-radius:var(--hu-radius-btn); padding:8px 12px; font-size:14px; min-width:120px}
.mk-stat strong{display:block; font-size:18px; color:var(--hu-heading)}

/* Phone: the tab row is ONE row that slides sideways (never wraps into a stack of loose links), so every page's tabs, the Job Hub shortcut row and the
   Settings section links look and behave the same (r2 #20 defects 6 and 9). */
@media (max-width:600px){
  .hu-tabs,.hu-setnav{flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; gap:2px}
  .hu-tabs::-webkit-scrollbar,.hu-setnav::-webkit-scrollbar{display:none}
  .hu-tab,.hu-setnav a{flex:none; white-space:nowrap; padding-left:12px; padding-right:12px}
  /* r14 #11: a row that is wider than the screen fades at its right edge (so a cut word reads as "more this way"), and keeps room after its last tab */
  .hu-tabs,.hu-setnav{-webkit-mask-image:linear-gradient(to right,var(--hu-white) calc(100% - 48px),transparent); mask-image:linear-gradient(to right,var(--hu-white) calc(100% - 48px),transparent); padding-right:52px}
}

/* A See-only profile is not offered change buttons (LAWS.md Law 5): a page sets data-view-only="1" on <body> (view_only.can_change) and marks every
   control that can only change something with .write-only. The server still refuses the write; this only hides the button. Also: a button
   given the hidden attribute stays hidden (the shared .btn sets display). */
[data-view-only="1"] .write-only{display:none !important}
.btn[hidden]{display:none}
[data-view-only="1"] input[readonly]{background:var(--hu-slate-fill); cursor:default}   /* a See-only profile's boxes look read-only too */

/* the one plain line under a pop-up's title sits inside the pop-up's padding (r2 #20) */
.modal > [class~="hu-section-line"]{margin:0; padding:10px 20px 0; max-width:none}

/* ---------- Template extras (item 4, 22 Oct 2026): parts the template page shows that the pages share (addendum section 4) ---------- */
/* On / off slider (Settings and Automations): Blue when on, the word beside it. <button class="hu-switch" role="switch" aria-checked="true"><span class="hu-switch-knob"></span></button> */
.hu-switch{appearance:none; position:relative; width:46px; height:26px; flex:0 0 46px; padding:0; border:1px solid var(--hu-ctl-edge); border-radius:var(--hu-radius-pill);
  background:var(--hu-ctl-fill); cursor:pointer; box-shadow:inset 0 1px 2px rgba(15,23,42,.18); transition:background .15s}
.hu-switch-knob{position:absolute; top:2px; left:2px; width:20px; height:20px; border-radius:50%; background:var(--hu-white); box-shadow:0 1px 3px rgba(15,23,42,.30); transition:left .15s}
.hu-switch[aria-checked="true"]{background:var(--hu-action); border-color:var(--hu-action)}
.hu-switch[aria-checked="true"] .hu-switch-knob{left:22px}
.hu-switch:focus-visible{outline:none; box-shadow:var(--hu-focus-ring-ctl)}
.hu-switch:disabled{opacity:.55; cursor:default}
.hu-switchrow{display:inline-flex; align-items:center; gap:10px; font-size:14px; font-weight:600; color:var(--hu-ctl-ink)}
/* Number tile: a figure with a word; the top edge takes the family colour (neutral slate for a plain figure; colour only for good / watch / bad) */
.hu-tile{background:var(--hu-white); border:1px solid var(--hu-border); border-top:4px solid var(--hu-c-edge); border-radius:var(--hu-radius-card); box-shadow:var(--hu-shadow-card); padding:12px 16px; min-width:150px}
.hu-tile-num{font-size:30px; font-weight:800; line-height:1.1; color:var(--hu-heading); font-variant-numeric:tabular-nums}
.hu-tile-word{font-size:14px; color:var(--hu-muted); font-weight:600}
@media (max-width:600px){ .hu-tile-num{font-size:26px} }
/* Gantt bar family (Programme): confirmed, tentative (two-shade rule), done, late, milestone. A word always travels with the colour. */
.hu-gbar{display:flex; align-items:center; gap:8px; height:36px; padding:0 12px; border-radius:var(--hu-radius-btn); font-size:14px; font-weight:600;
  background:var(--hu-c-fill); color:var(--hu-c-ink); border:1.5px solid var(--hu-c-edge)}
.hu-gbar.is-tentative{background:var(--hu-c-fill-light) repeating-linear-gradient(135deg,transparent 0 6px,var(--hu-c-fill) 6px 8px); border-style:dashed}
.hu-gbar.is-done{opacity:.55}
.hu-gbar.is-late{border-color:var(--hu-red-edge); border-width:2px}
.hu-gmile{display:inline-block; width:18px; height:18px; transform:rotate(45deg); background:var(--hu-c-edge); border-radius:3px; margin:0 8px}
.hu-gtoday{display:inline-block; width:2px; height:24px; background:var(--hu-action); vertical-align:middle; margin-right:6px}
/* Layout helpers for the template page and any specimen sheet */
.hu-demo-row{display:flex; flex-wrap:wrap; gap:10px; align-items:center}
.hu-demo-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:12px}
.hu-demo-stack{display:flex; flex-direction:column; gap:10px}
.hu-demo-label{font-size:14px; color:var(--hu-muted); font-weight:600; margin:0 0 4px}
.hu-icongrid{display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:10px}
.hu-iconcell{display:flex; flex-direction:column; align-items:center; gap:4px; padding:10px 6px; border:1px solid var(--hu-border); border-radius:10px; background:var(--hu-tint); font-size:14px; color:var(--hu-ctl-ink)}
.hu-iconcell .hu-ico{color:var(--hu-slate-edge)}
.hu-w60{width:60%}   /* a bar's fill at 60% (the template page's specimen; real bars set their own width from data) */


/* ---------- SETTINGS on the template (item 7, 22 Oct 2026; John: "love - love - love the template"): look only, no behaviour change ----------
   A Settings section is one .hu-card with a grey head band, its title, the ONE plain line, then its body. Inside it a group opens with a slim tinted band
   (h3.hu-subhead). Lists of rows (a switch per row, a document per row) are .hu-rows: the table surface (border, faint shadow, subtle alternate tint, hover);
   when they can grow they are .hu-rows.hu-scrollbox inside a data-hu-list box (about ten rows, scrolls inside itself, count shown). */
h3.hu-subhead{margin:20px 0 6px; padding:8px 12px; background:var(--hu-tint); border:1px solid var(--hu-border); border-radius:10px; color:var(--hu-heading); line-height:1.3}
.hu-table tbody tr td.hu-subhead{background:var(--hu-slate-fill); color:var(--hu-ctl-ink); padding:8px 12px}
.hu-rows{background:var(--hu-white); border:1px solid var(--hu-border); border-radius:12px; box-shadow:var(--hu-shadow-card); overflow-x:hidden}
.hu-rows > .hu-row{padding:11px 14px; border-top:1px solid var(--hu-border)}
.hu-rows > .hu-row:first-child{border-top:0}
.hu-rows > .hu-row:nth-of-type(even){background:var(--hu-tint)}
.hu-rows > .hu-row:hover{background:var(--hu-action-soft)}
.hu-rows > h3.hu-subhead{margin:0; border-width:1px 0; border-radius:0; position:sticky; top:0; z-index:2}
.hu-rows > h3.hu-subhead:first-child{border-top:0}
.hu-rows > .hu-empty{border:0; border-radius:0}
.hu-rows.hu-scrollbox{overflow-y:auto}
/* a row's control side: the slider with its word, and the small 'Use the standard setting' link beside it */
.hu-switchctl{display:flex; align-items:center; justify-content:flex-end; gap:6px 14px; flex-wrap:wrap}
.hu-switchctl .btn.quiet{min-height:32px; padding:0 8px; white-space:normal; text-align:right}
.hu-switch::after{content:""; position:absolute; left:-4px; right:-4px; top:-9px; bottom:-9px}   /* a 44px-tall touch area round the slider; nothing changes visually */
.hu-switch[data-busy="1"]{opacity:.55; pointer-events:none}
/* ---------- Settings: phone tidy for the standard-setting button (r32, 22 Oct 2026) ---------- */
/* Phone only (same 600px break as the rest of this file). Row = label block on the left, slider + word on the right; the small 'Use the standard setting (on|off)'
   link drops onto its own line under the label, left-aligned, one line. Disabled = quieter (no fill, smaller, paler) but the words stay. Desktop unchanged. */
@media (max-width:600px){
  .hu-rows > .hu-row:has(.hu-switchctl){display:grid; grid-template-columns:minmax(0,1fr) auto; column-gap:12px; row-gap:0; align-items:start}
  .hu-rows > .hu-row:has(.hu-switchctl) > div:last-child,.hu-rows > .hu-row:has(.hu-switchctl) .hu-switchctl{display:contents}
  .hu-rows > .hu-row:has(.hu-switchctl) > div:first-child{grid-column:1; grid-row:1; min-width:0}
  .hu-rows > .hu-row:has(.hu-switchctl) .hu-switchrow{grid-column:2; grid-row:1; align-self:start; padding-top:2px}
  .hu-rows > .hu-row:has(.hu-switchctl) .btn.quiet[data-key-std]{grid-column:1 / -1; grid-row:2; justify-self:start; margin:2px 0 0 -8px; padding:0 8px;
    min-height:40px; white-space:nowrap; text-align:left; font-size:14px; color:var(--hu-action)}
  .hu-rows > .hu-row:has(.hu-switchctl) .btn.quiet[data-key-std]:disabled{min-height:28px; background:transparent; border-color:transparent; color:var(--hu-muted); opacity:.75; font-size:14px; font-weight:500}
}
@media (min-width:601px){
  .hu-scrollbox.hu-tall{max-height:var(--hu-list-h-tall)}
}
/* the Who sees what grid scrolls inside its box: column titles stay pinned on top, the page names stay pinned on the left, the corner stays above both */
.hu-scrollbox .hu-grid thead th:first-child{z-index:4}
.hu-scrollbox .hu-grid tbody td:first-child{z-index:1}
.hu-scrollbox .hu-grid tbody tr:nth-child(even) td:first-child{background:var(--hu-tint)}
.hu-scrollbox .hu-grid tbody tr:hover td:first-child{background:var(--hu-action-soft)}
.hu-table tbody tr td.hu-cell-changed{background:var(--hu-blue-fill-light)}   /* a cell changed from its default: blue wash + the word 'changed' (kept above the row tint) */
.hu-table tbody tr.hu-exception td{background:var(--hu-amber-fill-light)}   /* a one-off exception: amber wash + edge + the word 'exception' */
.hu-table tbody tr.hu-exception td:first-child{box-shadow:inset 3px 0 0 var(--hu-amber-edge)}
/* the section search: a card hidden by the search box stays hidden (the card sets display) */
.hu-card[data-section][hidden]{display:none}

/* ---------- GIVE TO pop-up + client card on the template (r32, 22 Oct 2026): look only, no behaviour change ----------
   Both reuse the branded pop-up above (.modal.pinned.branded.hu-<family>: header band, pinned Close, .hu-card sections, .hu-notecard, .hu-actgroups,
   .hu-sysdetails). Only the generic gaps are added here:
     .hu-small      a short pop-up (a few boxes, e.g. Give to...) at 520px on a laptop; the phone full-screen rule still wins
     .hu-sysbody    the padded content inside a .hu-sysdetails box that holds rows rather than a <dl>
   The pop-up's one plain line sits at the top of the scrolling part, an empty slot (an Undo line not yet filled) takes no room, text boxes and ticks are
   a thumb-sized target on a phone, and long words wrap instead of widening the page. */
.modal.branded.hu-small{width:min(520px,94vw)}
.modal.branded .modal-body > [class~="hu-section-line"]{margin:0; padding:0; max-width:none}
.modal.branded .modal-body > div:empty{display:none}
.modal.branded .hu-row > span,.modal.branded .hu-notecard-head > span{min-width:0; overflow-wrap:anywhere}
.modal.branded .hu-card > .btn,.modal.branded .hu-card > .hu-actgroup-btns,.modal.branded .hu-card > .hu-actgroups{margin-top:10px}
.modal.branded .hu-card > .btn.sm + .hu-notecard{margin-top:12px}
.modal.branded label.check{display:inline-flex; align-items:center; gap:8px; min-height:32px; margin:0 14px 4px 0; font-weight:600; color:var(--hu-text); cursor:pointer}
.modal.branded label.check input{width:auto; margin:0; accent-color:var(--hu-action)}
.hu-sysdetails > .hu-sysbody{padding:4px 14px 10px}
@media (max-width:600px){
  .modal.branded.hu-small{width:100%}
  .modal.branded .btn.sm,.modal.branded label.check{min-height:var(--hu-tap)}
  .modal.branded a.hu-link{display:inline-block; padding:11px 0}
}
/* Phone tidy for list specimens (22 Oct 2026): a table inside a scroll box keeps a readable first column and scrolls sideways instead of squeezing it; a settings
   row whose last cell holds a small button keeps the words on the left and the button on the right on every row (never wrapping under the words). */
@media (max-width:600px){
  .hu-scrollbox .hu-table th:first-child,.hu-scrollbox .hu-table td:first-child{min-width:150px}
  .hu-rows > .hu-row:has(> div:last-child > .btn.sm):not(:has(.hu-switchctl)){flex-wrap:nowrap; align-items:center}
  .hu-rows > .hu-row:has(> div:last-child > .btn.sm):not(:has(.hu-switchctl)) > div:first-child{flex:1 1 auto; min-width:0}
  .hu-rows > .hu-row:has(> div:last-child > .btn.sm):not(:has(.hu-switchctl)) > div:last-child{flex:none}
}

/* ---------- Money on this job (go-live #39; LAWS.md Law 4): colour that means something, palette only, red = problems only, always a word or icon too ---------- */
.fin-totals{display:flex; flex-wrap:wrap; gap:8px; margin:6px 0 12px}
.fin-bar-wrap{margin-top:4px}
.fin-bar{height:6px; border-radius:3px; background:var(--hu-border); overflow:hidden}
.fin-bar span{display:block; height:100%; border-radius:3px}
.fin-bar-ok span{background:var(--hu-green-edge)}
.fin-bar-near span{background:var(--hu-amber-edge)}
.fin-bar-over span{background:var(--hu-red-edge)}
.fin-bar-word{font-size:14px; margin-top:2px; font-weight:400}
.fin-bar-word-ok{color:var(--hu-green-ink)}
.fin-bar-word-near{color:var(--hu-amber-ink)}
.fin-bar-word-over{color:var(--hu-red-ink); font-weight:600}

/* ---------- Calendar date picker (wording round item 18, 18 Nov 2026): app/static/hu_datepicker.js ----------
   A text box (dd/mm/yyyy) + a Calendar button; the pop-up month sits under it. The real value stays ISO yyyy-mm-dd on the hidden input. */
.hu-dp{position:relative; display:flex; gap:6px; align-items:stretch}
.hu-dp .hu-input{flex:1 1 auto; min-width:0}
.hu-dp-msg{margin:4px 0 0; font-size:14px; color:var(--hu-amber-ink)}
.hu-dp-pop{position:absolute; left:0; top:calc(100% + 4px); z-index:990; width:min(300px,92vw); background:var(--hu-white); border:1px solid var(--hu-border);
  border-radius:var(--hu-radius-card); box-shadow:var(--hu-shadow-pop); padding:10px}
.hu-dp-head{display:flex; align-items:center; gap:6px; margin-bottom:6px}
.hu-dp-title{flex:1 1 auto; text-align:center; font-weight:700; color:var(--hu-heading)}
.hu-dp-grid{display:grid; grid-template-columns:repeat(7,1fr); gap:2px}
.hu-dp-dow{text-align:center; font-size:14px; color:var(--hu-faint); padding:2px 0}
.hu-dp-day{height:var(--hu-tap,44px); max-height:40px; border:1px solid transparent; border-radius:var(--hu-radius-btn); background:var(--hu-white); color:var(--hu-text); font:inherit; cursor:pointer}
.hu-dp-day:hover{background:var(--hu-action-soft)}
.hu-dp-day.is-today{border-color:var(--hu-action)}
.hu-dp-day.is-sel{background:var(--hu-action); border-color:var(--hu-action); color:var(--hu-white); font-weight:700}
.hu-dp-day.is-off,.hu-dp-day:disabled{color:var(--hu-faint); opacity:.4; cursor:default; background:var(--hu-white)}
.hu-dp-day.is-wk{background:var(--hu-tint)}
.hu-dp-foot{display:flex; justify-content:space-between; margin-top:8px}

/* ---------- The HYPE HUB phone app: tile home + back arrow (29 Nov 2026, John: "B: big tiles"; app_hub MODULE.md "Tile home") ----------
   Used ONLY inside the phone app (html.hu-in-app, set by hype_app_glue.js from the app's user-agent marker + bridge). Telegram and a
   normal browser never draw these. One colour family (blue = something you can open); a count is a number with its own word read out.
   John, 29 Nov 2026: "It may be dark, cold, wet. They may be wearing gloves ... need to put glasses on. This app needs to be simple and
   clear". So inside the app: body text 18px or more, key facts 24px or more, every touch target 56px or more, no grey-on-white text,
   nothing hidden behind a Show tap. */
html.hu-in-app [data-not-in-app], html.hu-in-app #backToApp, html.hu-in-app .hu-banner a.hu-link[href="/jobs"]{display:none !important}
html.hu-in-app body{font-size:18px; line-height:1.45}
/* iPhone (29 Nov 2026 click-through): a box with text under 16px makes iOS zoom the whole page in when it is tapped (the clock's induction
   box was 15px; the page jumped to 107% and the Home button slid half off the edge). Inside the app every text box is 16px or more. */
html.hu-in-app input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), html.hu-in-app select, html.hu-in-app textarea{font-size:16px !important}
/* S2: the app's web view runs edge to edge; the page keeps clear of the status bar and the home bar by the phone's own safe areas,
   and a page-coloured strip sits behind the status bar so nothing scrolls under the clock. */
html.hu-in-app{padding-top:env(safe-area-inset-top); padding-bottom:env(safe-area-inset-bottom); background:var(--hu-page)}
html.hu-in-app body::before{content:""; position:fixed; left:0; right:0; top:0; height:env(safe-area-inset-top); background:var(--hu-page); z-index:2000; pointer-events:none}
html.hu-in-app .btn, html.hu-in-app .btn.sm{min-height:56px; font-size:18px; padding:0 18px}
html.hu-in-app .hu-muted, html.hu-in-app .hu-section-line, html.hu-in-app .hu-help, html.hu-in-app .hu-what{color:var(--hu-text); font-size:18px}
html.hu-in-app .hu-pill{font-size:16px; padding:4px 12px}
html.hu-in-app .hu-input, html.hu-in-app .field input, html.hu-in-app .field select, html.hu-in-app .field textarea{min-height:56px; font-size:18px}
html.hu-in-app .miniapp .jbtn, html.hu-in-app .miniapp .menurow{min-height:56px; font-size:18px}
html.hu-in-app .miniapp .hint, html.hu-in-app .miniapp .job .raised, html.hu-in-app .miniapp .allclear .sub,
html.hu-in-app .miniapp .field label, html.hu-in-app .miniapp .pwdates, html.hu-in-app .miniapp .jpill{font-size:18px; color:var(--hu-text)}
html.hu-in-app .miniapp .job .issue, html.hu-in-app .miniapp .pwtask{font-size:20px}
html.hu-in-app .ck-muted, html.hu-in-app .ck-card p, html.hu-in-app .ck-statusstrip{font-size:18px; color:var(--hu-text)}
.hu-appbar{position:sticky; top:env(safe-area-inset-top); z-index:950; display:flex; align-items:center; gap:8px; min-height:64px; margin:0 0 12px; padding:0 4px;
  background:var(--hu-page); border-bottom:1px solid var(--hu-divider)}
.hu-appback{display:inline-flex; align-items:center; gap:6px; min-height:56px; min-width:120px; padding:0 18px 0 8px; border-radius:var(--hu-radius-card);
  background:var(--hu-white); border:1px solid var(--hu-divider); box-shadow:var(--hu-shadow-btn);
  font-size:20px; font-weight:800; color:var(--hu-blue-ink); text-decoration:none; -webkit-tap-highlight-color:transparent}
.hu-appback svg{width:28px; height:28px; flex:none}
.hu-appback:active{background:var(--hu-action-soft)}
.hu-appbar-title{flex:1 1 auto; min-width:0; text-align:right; padding-right:8px; font-size:20px; font-weight:800; color:var(--hu-heading);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.hu-app-home{display:flex; flex-direction:column; gap:18px; padding:4px 0 calc(32px + env(safe-area-inset-bottom))}
.hu-app-clock{background:var(--hu-white); border-radius:var(--hu-radius-hero); box-shadow:var(--hu-shadow-hero); padding:20px; display:flex; flex-direction:column; gap:16px}
.hu-app-clock-state{display:flex; align-items:center; gap:12px; font-size:24px; font-weight:800; color:var(--hu-heading); line-height:1.25}
.hu-app-clock-state .hu-dot{flex:none; width:16px; height:16px; margin:0}
.hu-app-clock button.btn{width:100%; min-height:80px; font-size:26px; font-weight:800; letter-spacing:.01em; border-radius:var(--hu-radius-card)}
.hu-app-note{font-size:18px; color:var(--hu-text); line-height:1.45}
.hu-app-job{background:var(--hu-white); border:1px solid var(--hu-border); border-radius:var(--hu-radius-hero); box-shadow:var(--hu-shadow-card); padding:20px;
  display:flex; flex-direction:column; gap:14px}
.hu-app-eyebrow{font-size:18px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--hu-blue-ink)}
.hu-app-job-name{font-size:26px; font-weight:800; color:var(--hu-heading); line-height:1.2}
.hu-app-fact{display:flex; flex-direction:column; gap:2px; padding-top:12px; border-top:1px solid var(--hu-border)}
.hu-app-fact-label{font-size:18px; font-weight:700; color:var(--hu-text)}
.hu-app-fact-value{font-size:24px; font-weight:700; color:var(--hu-heading); line-height:1.3}
.hu-app-code{font-family:var(--hu-font-mono); font-size:40px; font-weight:800; letter-spacing:.14em; color:var(--hu-heading)}
.hu-app-actions{display:grid; grid-template-columns:1fr; gap:12px}
.hu-app-actions a.btn, .hu-app-job a.btn{min-height:60px; font-size:20px; font-weight:800; width:100%}
.hu-app-section{font-size:18px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--hu-heading); margin:8px 4px -4px}
.hu-app-tiles{display:grid; grid-template-columns:1fr 1fr; gap:14px}
.hu-app-tile{position:relative; display:flex; flex-direction:column; justify-content:space-between; gap:14px; min-height:132px; padding:18px;
  background:var(--hu-white); border:1px solid var(--hu-divider); border-radius:var(--hu-radius-hero); box-shadow:var(--hu-shadow-card);
  color:var(--hu-heading); text-decoration:none; -webkit-tap-highlight-color:transparent; transition:transform .08s}
.hu-app-tile:active{transform:scale(.97); background:var(--hu-tint)}
.hu-app-tile:focus-visible{outline:none; box-shadow:var(--hu-shadow-card), var(--hu-focus-ring-ctl)}
.hu-app-tile-icon{width:52px; height:52px; border-radius:14px; display:grid; place-items:center; background:var(--hu-blue-fill); color:var(--hu-blue-ink)}
.hu-app-tile-icon svg{width:30px; height:30px}
.hu-app-tile-label{font-size:20px; font-weight:800; line-height:1.2}
.hu-app-tile-count{position:absolute; top:14px; right:14px; min-width:34px; height:34px; padding:0 10px; border-radius:var(--hu-radius-pill);
  display:grid; place-items:center; background:var(--hu-blue-ink); color:var(--hu-white); font-size:18px; font-weight:800}
.hu-app-foot{display:flex; justify-content:center; padding-top:8px}
/* Get the app (/app/get, 29 Nov 2026): the store buttons and the sign-in button, one big tile each, stacked, nothing behind a tap. */
.hu-app-get{display:grid; gap:14px; margin:14px 0}
.hu-app-tile-count[hidden]{display:none}
/* The PM home's live map card (29 Nov 2026, John: owner and project manager): who is on the clock and where, on the Hub's own OS map. The
   whole card is one big tap to Who's on site; every name is written out (no reveal taps). Pins and site labels are page elements. */
.hu-app-map{display:flex; flex-direction:column; gap:14px; padding:20px; background:var(--hu-white); border:1px solid var(--hu-border);
  border-radius:var(--hu-radius-hero); box-shadow:var(--hu-shadow-hero); color:var(--hu-heading); text-decoration:none; -webkit-tap-highlight-color:transparent}
.hu-app-map:active{background:var(--hu-tint)}
.hu-app-map:focus-visible{outline:none; box-shadow:var(--hu-shadow-hero), var(--hu-focus-ring-ctl)}
.hu-app-map-headline{font-size:28px; font-weight:800; line-height:1.2; color:var(--hu-heading)}
.hu-app-map-box{display:block; height:260px; border-radius:var(--hu-radius-card); overflow:hidden; background:var(--hu-tint); border:1px solid var(--hu-divider)}
.hu-app-map-box[hidden]{display:none}
.hu-app-map-names{font-size:20px; font-weight:700; color:var(--hu-heading); line-height:1.35}
.hu-app-map-open{display:flex; align-items:center; justify-content:center; min-height:60px; border-radius:var(--hu-radius-card);
  background:var(--hu-action); color:var(--hu-white); font-size:20px; font-weight:800}
.hu-app-map-pin{padding:4px 10px; border-radius:var(--hu-radius-pill); background:var(--hu-blue-ink); color:var(--hu-white); border:2px solid var(--hu-white);
  font-size:16px; font-weight:800; white-space:nowrap; box-shadow:var(--hu-shadow-card)}
.hu-app-map-site{padding:3px 8px; border-radius:var(--hu-radius-btn); background:var(--hu-white); color:var(--hu-heading); border:1px solid var(--hu-divider);
  font-size:16px; font-weight:700; white-space:nowrap}
html.hu-in-app .miniapp .hu-help{font-size:20px; font-weight:700; color:var(--hu-heading); margin:4px 4px 0}
