/* ==========================================================================
   DP Electric - Safety Forms
   The mockup's design system, unchanged: assets/dpe.css followed by
   assets/sq.css from dpe_kpa. Frappe injects this file inline when the
   Single loads (the /assets path 404s for doctype folders), which is why
   it is one file rather than two links.
   ========================================================================== */
/* ==========================================================================
   DP Electric - Tool Center
   Shared design system. 2026 Brand Standards.
   Brand palette: DP Red #c8102e | DP Navy #212b39 | DP Gray #75787d
                  Safety Green #d5ff4d (sparingly) | White #ffffff

   NOTE: the muted status colors (--ok / --warn / --info) sit outside the brand
   palette. They exist because status must never be carried by red/navy alone
   (WCAG "color-not-only" + colorblind safety). Flag with Marketing before this
   mockup becomes production UI.
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root{
  /* Brand */
  --red:#c8102e;
  --red-700:#a80d26;
  --red-050:#fdeff2;
  --red-100:#f8d7dd;
  --navy:#212b39;
  --navy-800:#2c3849;
  --navy-700:#3c4a5e;
  --gray:#75787d;
  --safety:#d5ff4d;

  /* Neutrals (navy-tinted, keeps the whole UI on-brand) */
  --ink:#212b39;
  --ink-2:#525d6d;
  --ink-3:#75787d;
  --line:#e2e6eb;
  --line-2:#eef1f4;
  --surface:#ffffff;
  --surface-2:#f7f9fb;
  --bg:#f2f5f8;

  /* Functional status (muted, always paired with an icon or text) */
  --ok:#137a4e;      --ok-bg:#e7f4ee;
  --warn:#9a6100;    --warn-bg:#fdf1de;
  --info:#1f4f7a;    --info-bg:#e8f1f8;

  /* Type */
  --font-head:'Montserrat','Segoe UI',system-ui,sans-serif;
  --font-body:'Acumin Variable Concept','Acumin Pro',system-ui,-apple-system,'Segoe UI',Roboto,Arial,sans-serif;

  /* Type scale. 23 sizes were in use across the small-text range, six of
     them on half pixels, which is what made a step read as a pile of parts
     rather than one form. Nothing here moved by more than 1px.
     --fs-ctl stays at 16px on purpose: below it, iOS zooms on focus. */
  --fs-3xs:10px; --fs-2xs:11px; --fs-xs:12px; --fs-sm:13px;
  --fs-md:14px;  --fs-lg:15px;  --fs-ctl:16px; --fs-xl:17px;

  /* Space - 4pt rhythm */
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:20px; --s6:24px;
  --s7:32px; --s8:40px; --s9:56px; --s10:72px;

  /* Radius + elevation */
  --r-xs:6px; --r-sm:8px; --r:12px; --r-lg:16px; --r-xl:22px; --r-full:999px;
  /* One border weight for anything a finger or a caret lands in, so a
     button beside a text box does not wear a lighter edge than it. */
  --bw-ctl:1.5px;
  /* One HEIGHT, for the same reason. Four were in use at the desk
     breakpoint - inputs and buttons at 36, Yes/No at 34, pills,
     Pass/Fail and checkboxes at 32 - so a row mixing them stepped up
     and down by two pixels at a time. That is what "mismatched button
     sizes" was. Every control a person clicks or types into now reads
     this; touch targets stay at --tap, which is a different question.
     Radius is --r-sm everywhere for the same reason: a pill was the
     only control still fully round, beside square-ish everything. */
  --ctl-h:36px;
  --e1:0 1px 2px rgba(33,43,57,.06), 0 1px 3px rgba(33,43,57,.05);
  --e2:0 2px 4px rgba(33,43,57,.05), 0 6px 16px rgba(33,43,57,.08);
  --e3:0 10px 24px rgba(33,43,57,.12), 0 2px 6px rgba(33,43,57,.08);

  /* Motion */
  --fast:140ms cubic-bezier(.2,.8,.3,1);
  --base:220ms cubic-bezier(.2,.8,.3,1);

  /* Layout */
  --rail-w:76px;
  --topbar-h:60px;
  --bottombar-h:64px;
  --tap:44px;

  /* z-scale */
  --z-rail:40; --z-topbar:45; --z-bottom:45; --z-drawer:60; --z-modal:80;
  /* Above the modal, below a toast: a picker opened inside a dialog has
     to paint over the dialog, and a message about what just happened
     has to paint over both. */
  --z-popover:90; --z-toast:95;
}

*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:var(--font-body); font-size:var(--fs-ctl); line-height:1.55;
  font-weight:400; -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4,h5{font-family:var(--font-head);font-weight:700;letter-spacing:-.012em;margin:0;line-height:1.2}
h1{font-size:26px} h2{font-size:20px} h3{font-size:var(--fs-xl)} h4{font-size:var(--fs-lg)}
p{margin:0 0 var(--s3)}
a{color:var(--red);text-decoration:none}
a:hover{text-decoration:underline}
img{max-width:100%}
/* Icons get their real size from their container (.btn svg, .chip svg, ...).
   This is the floor, so an icon dropped into plain running text inherits a
   sane inline size instead of stretching to the full column width.

   CAUTION, and it has bitten once: this is a BARE element selector, so it
   also reaches any <svg> a library draws into this page. An SVG's width and
   height ATTRIBUTES are presentation attributes, which sort below every
   author rule - so this wins, and the library's own canvas collapses to
   18x18 with its viewBox intact. That is what hid the map pin: Leaflet's
   default SVG renderer sized its overlay by attribute, this squashed it,
   and the pin drew at a third of a pixel while every coordinate stayed
   correct. The map now asks for `L.canvas()` instead (wizard.js). Anything
   else that draws vectors into this page needs the same treatment, or its
   own width/height declared louder than this line. */
svg{max-width:100%;width:18px;height:18px;vertical-align:-3px;flex:none}
button,input,select,textarea{font:inherit;color:inherit}
button{background:none;border:0;padding:0;cursor:pointer}
:focus-visible{outline:3px solid var(--red);outline-offset:2px;border-radius:var(--r-xs)}
::selection{background:var(--red-100)}

/* ---------- 2. App shell ------------------------------------------------- */

/* Left rail - desktop / big tablet only */
.rail{
  position:fixed;inset:0 auto 0 0;width:var(--rail-w);z-index:var(--z-rail);
  background:var(--navy);display:none;flex-direction:column;align-items:center;
  padding:var(--s3) 0 var(--s4);gap:var(--s1);
  padding-bottom:calc(var(--s4) + env(safe-area-inset-bottom));
}
.rail__logo{display:block;width:44px;margin-bottom:var(--s4);flex:none}
.rail__logo img{width:100%;display:block}
.rail__scroll{flex:1;width:100%;overflow-y:auto;display:flex;flex-direction:column;align-items:center;gap:2px;scrollbar-width:none}
.rail__scroll::-webkit-scrollbar{display:none}
.rail__item{
  position:relative;width:58px;height:54px;border-radius:var(--r-sm);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  color:rgba(255,255,255,.64);transition:background var(--fast),color var(--fast);
}
.rail__item:hover{background:rgba(255,255,255,.09);color:#fff;text-decoration:none}
.rail__item svg{width:21px;height:21px;stroke-width:1.7}
.rail__item span{font-size:var(--fs-3xs);font-family:var(--font-head);font-weight:600;letter-spacing:.01em;line-height:1;text-align:center}
.rail__item.is-active{background:var(--red);color:#fff}
.rail__item .dot{position:absolute;top:6px;right:10px;width:7px;height:7px;border-radius:50%;background:var(--safety);box-shadow:0 0 0 2px var(--navy)}

/* Top bar */
.topbar{
  position:sticky;top:0;z-index:var(--z-topbar);min-height:var(--topbar-h);
  background:var(--surface);border-bottom:1px solid var(--line);
  display:flex;align-items:center;gap:var(--s3);padding:0 var(--s4);
  padding-top:env(safe-area-inset-top);
}
.topbar__back{
  width:var(--tap);height:var(--tap);margin-left:-10px;border-radius:var(--r-sm);
  display:flex;align-items:center;justify-content:center;color:var(--ink);flex:none;
}
.topbar__back:hover{background:var(--surface-2);text-decoration:none}
.topbar__back svg{width:24px;height:24px}
.topbar__logo{width:34px;flex:none;display:block}
.topbar__titles{min-width:0;flex:1}
.topbar__title{font-family:var(--font-head);font-weight:700;font-size:var(--fs-ctl);line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar__sub{font-size:var(--fs-xs);color:var(--ink-3);line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar__actions{display:flex;align-items:center;gap:var(--s1);flex:none}

/* Role chip */
.rolechip{
  display:inline-flex;align-items:center;gap:var(--s2);height:42px;padding:0 var(--s1);
  border:1px solid var(--line);border-radius:var(--r-full);background:var(--surface);
  cursor:pointer;transition:border-color var(--fast);
}
.rolechip:hover{border-color:var(--ink-3)}
.rolechip__av{
  width:32px;height:32px;border-radius:50%;background:var(--navy);color:#fff;flex:none;
  display:grid;place-items:center;font-family:var(--font-head);font-weight:700;font-size:var(--fs-2xs);
}
.rolechip__txt{display:none;font-size:var(--fs-sm);font-weight:600;font-family:var(--font-head);line-height:1.15;text-align:left;max-width:160px}
.rolechip__txt small{display:block;font-family:var(--font-body);font-weight:400;color:var(--ink-3);font-size:var(--fs-2xs);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rolechip__caret{display:none;width:16px;height:16px;color:var(--ink-3);margin-right:6px;flex:none}

/* Icon button */
.iconbtn{
  width:var(--tap);height:var(--tap);border-radius:var(--r-sm);border:0;background:transparent;
  display:inline-grid;place-items:center;color:var(--ink-2);cursor:pointer;position:relative;
  transition:background var(--fast),color var(--fast);
}
.iconbtn:hover{background:var(--surface-2);color:var(--ink);text-decoration:none}
.iconbtn svg{width:21px;height:21px}
.iconbtn__badge{
  position:absolute;top:4px;right:3px;min-width:18px;height:18px;padding:0 var(--s1);border-radius:var(--r-full);
  background:var(--red);color:#fff;font-size:var(--fs-3xs);font-weight:700;font-family:var(--font-head);
  display:grid;place-items:center;border:2px solid var(--surface);line-height:1;
}

/* Main */
.main{min-height:calc(100dvh - var(--topbar-h));padding-bottom:calc(var(--bottombar-h) + var(--s6) + env(safe-area-inset-bottom))}
.container{width:100%;max-width:1360px;margin:0 auto;padding:var(--s5) var(--s4)}
.container--narrow{max-width:780px}
.container--wide{max-width:1680px}

/* Bottom bar - phones & tablets */
.bottombar{
  position:fixed;left:0;right:0;bottom:0;z-index:var(--z-bottom);
  background:var(--surface);border-top:1px solid var(--line);
  display:flex;padding-bottom:env(safe-area-inset-bottom);
  box-shadow:0 -1px 12px rgba(33,43,57,.06);
}
.bottombar__item{
  flex:1;min-width:0;height:var(--bottombar-h);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  color:var(--ink-3);font-size:var(--fs-3xs);font-family:var(--font-head);font-weight:600;position:relative;
}
.bottombar__item:hover{text-decoration:none}
.bottombar__item svg{width:22px;height:22px;stroke-width:1.8}
.bottombar__item span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;padding:0 2px}
.bottombar__item.is-active{color:var(--red)}
.bottombar__item .dot{position:absolute;top:8px;right:calc(50% - 18px);width:8px;height:8px;border-radius:50%;background:var(--red)}

/* ---------- 3. Page furniture -------------------------------------------- */
.page-head{display:flex;flex-wrap:wrap;gap:var(--s4);align-items:flex-end;justify-content:space-between;margin-bottom:var(--s5)}
.page-head__title{font-size:24px}
.page-head__sub{color:var(--ink-3);font-size:var(--fs-md);margin-top:2px}
.page-head__actions{display:flex;gap:var(--s2);flex-wrap:wrap}

.section-title{
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-xs);letter-spacing:.08em;
  text-transform:uppercase;color:var(--ink-3);margin:var(--s6) 0 var(--s3);
  display:flex;align-items:center;gap:var(--s2);
}
.section-title:first-child{margin-top:0}
.section-title .count{
  background:var(--line-2);color:var(--ink-2);border-radius:var(--r-full);
  padding:1px var(--s2);font-size:var(--fs-2xs);letter-spacing:0;
}

/* ---------- 4. Cards ------------------------------------------------------ */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);box-shadow:var(--e1)}
.card--flat{box-shadow:none}
.card--pad{padding:var(--s5)}
.card__head{
  display:flex;align-items:center;gap:var(--s3);justify-content:space-between;
  padding:var(--s4) var(--s5);border-bottom:1px solid var(--line-2);
}
.card__title{font-family:var(--font-head);font-weight:700;font-size:var(--fs-lg);display:flex;align-items:center;gap:var(--s2)}
.card__title svg{width:18px;height:18px;color:var(--red);flex:none}
.card__body{padding:var(--s5)}
.card__body--tight{padding:var(--s3) var(--s4)}
.card__body--flush{padding:0}
.card__foot{padding:var(--s4) var(--s5);border-top:1px solid var(--line-2);display:flex;gap:var(--s2);flex-wrap:wrap;justify-content:flex-end;background:var(--surface-2);border-radius:0 0 var(--r-lg) var(--r-lg)}

/* ---------- 5. Buttons ---------------------------------------------------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:var(--s2);
  min-height:var(--tap);padding:0 var(--s4);border-radius:var(--r-sm);border:var(--bw-ctl) solid var(--line);
  background:var(--surface);color:var(--ink);font-family:var(--font-head);font-weight:600;font-size:var(--fs-md);
  cursor:pointer;white-space:nowrap;text-decoration:none;
  transition:background var(--fast),border-color var(--fast),color var(--fast),box-shadow var(--fast);
  touch-action:manipulation;-webkit-tap-highlight-color:transparent;
}
.btn:hover{background:var(--surface-2);border-color:var(--ink-3);text-decoration:none;color:var(--ink)}
.btn svg{width:18px;height:18px;flex:none}
.btn--primary{background:var(--red);border-color:var(--red);color:#fff;box-shadow:var(--e1)}
.btn--primary:hover{background:var(--red-700);border-color:var(--red-700);color:#fff}
.btn--navy{background:var(--navy);border-color:var(--navy);color:#fff}
.btn--navy:hover{background:var(--navy-800);border-color:var(--navy-800);color:#fff}
.btn--ghost{background:transparent;border-color:transparent;color:var(--ink-2)}
.btn--ghost:hover{background:var(--surface-2);border-color:transparent;color:var(--ink)}
.btn--danger{background:var(--surface);border-color:var(--red-100);color:var(--red)}
.btn--danger:hover{background:var(--red-050);border-color:var(--red);color:var(--red)}
.btn--ok{background:var(--ok);border-color:var(--ok);color:#fff}
.btn--ok:hover{background:#0f6641;border-color:#0f6641;color:#fff}
.btn--lg{min-height:56px;padding:0 var(--s6);font-size:var(--fs-ctl);border-radius:var(--r)}
.btn--sm{min-height:40px;padding:0 var(--s3);font-size:var(--fs-sm)}
.btn--block{width:100%}
.btn[disabled],.btn.is-disabled{opacity:.42;pointer-events:none}
.btn--icon{padding:0;width:var(--tap)}

.fab{
  position:fixed;right:var(--s4);z-index:var(--z-rail);
  bottom:calc(var(--bottombar-h) + var(--s4) + env(safe-area-inset-bottom));
  height:56px;padding:0 var(--s5);border-radius:var(--r-full);border:0;
  background:var(--red);color:#fff;box-shadow:var(--e3);
  display:inline-flex;align-items:center;gap:var(--s2);
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-lg);cursor:pointer;
}
.fab:hover{background:var(--red-700);text-decoration:none;color:#fff}
.fab svg{width:22px;height:22px}

/* ---------- 6. Home tiles ------------------------------------------------- */
.tiles{display:grid;gap:var(--s3);grid-template-columns:repeat(2,minmax(0,1fr))}
.tile{
  position:relative;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);
  padding:var(--s4);min-height:134px;display:flex;flex-direction:column;box-shadow:var(--e1);
  color:var(--ink);transition:transform var(--fast),box-shadow var(--fast),border-color var(--fast);
  -webkit-tap-highlight-color:transparent;
}
.tile:hover{text-decoration:none;box-shadow:var(--e2);border-color:#d3d9e0;transform:translateY(-2px);color:var(--ink)}
.tile:active{transform:translateY(0)}
.tile__icon{
  width:46px;height:46px;border-radius:var(--r);display:grid;place-items:center;
  background:var(--navy);color:#fff;flex:none;
}
.tile__icon svg{width:24px;height:24px;stroke-width:1.8}
.tile__icon--red{background:var(--red)}
.tile__icon--navy{background:var(--navy)}
.tile__icon--gray{background:var(--gray)}
.tile__icon--outline{background:var(--surface-2);color:var(--navy);border:1px solid var(--line)}
.tile__count{
  position:absolute;top:var(--s4);right:var(--s4);
  font-family:var(--font-head);font-weight:700;font-size:22px;color:var(--ink);line-height:1;text-align:right;
  font-variant-numeric:tabular-nums;
}
.tile__count small{display:block;font-size:var(--fs-3xs);font-weight:600;color:var(--ink-3);margin-top:4px;letter-spacing:.04em;text-transform:uppercase;font-family:var(--font-head)}
.tile__name{font-family:var(--font-head);font-weight:700;font-size:var(--fs-lg);margin-top:auto;padding-top:var(--s4);line-height:1.25}
.tile__meta{font-size:var(--fs-sm);color:var(--ink-3);line-height:1.3;margin-top:2px}
.tile--alert{border-color:var(--red-100);background:linear-gradient(180deg,var(--red-050),var(--surface) 62%)}
.tile--alert .tile__count{color:var(--red)}
.tile__live{
  position:absolute;top:11px;left:11px;width:8px;height:8px;border-radius:50%;
  background:var(--safety);box-shadow:0 0 0 3px rgba(213,255,77,.4);
}

/* ---------- 7. KPI ------------------------------------------------------- */
.kpis{display:grid;gap:var(--s3);grid-template-columns:repeat(2,minmax(0,1fr))}
.kpi{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:var(--s4);box-shadow:var(--e1)}
.kpi__value{font-family:var(--font-head);font-weight:700;font-size:28px;line-height:1.05;font-variant-numeric:tabular-nums}
.kpi__label{font-size:var(--fs-sm);color:var(--ink-3);margin-top:var(--s1);line-height:1.3}
.kpi__trend{font-size:var(--fs-xs);font-weight:600;margin-top:var(--s2);display:inline-flex;align-items:center;gap:var(--s1);font-family:var(--font-head)}
.kpi--red .kpi__value{color:var(--red)}
.kpi--ok .kpi__value{color:var(--ok)}
.kpi--warn .kpi__value{color:var(--warn)}

/* ---------- 8. Chips / status -------------------------------------------- */
.chip{
  display:inline-flex;align-items:center;gap:var(--s1);min-height:24px;padding:2px var(--s2);border-radius:var(--r-full);
  background:var(--line-2);color:var(--ink-2);font-size:var(--fs-xs);font-weight:600;font-family:var(--font-head);
  white-space:nowrap;letter-spacing:.005em;line-height:1.5;
}
.chip svg{width:13px;height:13px;stroke-width:2.2;flex:none}
.chip--ok{background:var(--ok-bg);color:var(--ok)}
.chip--warn{background:var(--warn-bg);color:var(--warn)}
.chip--danger{background:var(--red-050);color:var(--red)}
.chip--info{background:var(--info-bg);color:var(--info)}
.chip--navy{background:var(--navy);color:#fff}
.chip--muted{background:var(--line-2);color:var(--ink-3)}
.chip--live{background:var(--safety);color:var(--navy)}
.chip--lg{min-height:30px;padding:3px var(--s3);font-size:var(--fs-sm)}
.chip--dot::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor;flex:none}

.prio{display:inline-flex;align-items:center;gap:var(--s1);font-size:var(--fs-xs);font-weight:700;font-family:var(--font-head)}
.prio svg{width:14px;height:14px}
.prio--emergency{color:var(--red)}
.prio--high{color:var(--warn)}
.prio--normal{color:var(--ink-3)}

/* ---------- 9. Forms ------------------------------------------------------ */
.field{margin-bottom:var(--s4)}
.field__label{display:block;font-family:var(--font-head);font-weight:600;font-size:var(--fs-md);margin-bottom:6px}
.field__label .req{color:var(--red);margin-left:2px}
.field__hint{font-size:var(--fs-sm);color:var(--ink-3);margin-top:6px;line-height:1.4}
.field__error{font-size:var(--fs-sm);color:var(--red);margin-top:6px;display:flex;align-items:center;gap:var(--s1);font-weight:600}
.field__error svg{width:14px;height:14px;flex:none}
.input,.select,.textarea{
  width:100%;min-height:var(--tap);padding:10px var(--s3);border:var(--bw-ctl) solid var(--line);
  border-radius:var(--r-sm);background:var(--surface);font-size:var(--fs-ctl);line-height:1.4;
  transition:border-color var(--fast),box-shadow var(--fast);font-family:var(--font-body);
}
/* A date, time or date-and-time box rendered 2px taller than the text box
   beside it - "Date and time it happened" sitting half a row high next to
   its neighbour on every phone. Same font, same padding, same border, same
   min-height: the 2px is Chrome's own 1px top and bottom padding on the
   wrapper INSIDE the control, which no rule on the control itself can
   reach. Found while measuring the picker's 2.4px, and it is the same
   defect - controls on one row that are not the same height.
   WebKit-only pseudo-element, so it changes nothing anywhere else.
   Measured: 46.39px against 44.39px; 44.39 against 44.39 now. */
.input::-webkit-datetime-edit-fields-wrapper{padding:0}
.input:hover,.select:hover,.textarea:hover{border-color:#c9d0d8}
.input:focus,.select:focus,.textarea:focus{outline:0;border-color:var(--red);box-shadow:0 0 0 3px var(--red-050)}
.textarea{min-height:96px;resize:vertical}
.select{appearance:none;-webkit-appearance:none;padding-right:38px;cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2375787d' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 12px center;background-size:18px;
}
.field.has-error .input,.field.has-error .select,.field.has-error .textarea{border-color:var(--red);background:var(--red-050)}
.input[readonly]{background:var(--surface-2);color:var(--ink-2)}
.inline-fields{display:grid;gap:var(--s3);grid-template-columns:1fr}

/* Big tappable choice cards - the low-tech friendly radio */
.choices{display:grid;gap:var(--s2);grid-template-columns:1fr}
.choice{
  display:flex;align-items:center;gap:var(--s3);padding:var(--s3) var(--s4);min-height:62px;
  border:var(--bw-ctl) solid var(--line);border-radius:var(--r);background:var(--surface);cursor:pointer;
  transition:border-color var(--fast),background var(--fast);text-align:left;width:100%;
}
.choice:hover{border-color:var(--ink-3)}
.choice__icon{width:38px;height:38px;border-radius:var(--r-sm);display:grid;place-items:center;background:var(--surface-2);color:var(--navy);flex:none;transition:background var(--fast),color var(--fast)}
.choice__icon svg{width:20px;height:20px}
.choice__body{min-width:0;flex:1}
.choice__title{font-family:var(--font-head);font-weight:700;font-size:var(--fs-lg);line-height:1.25}
.choice__desc{font-size:var(--fs-sm);color:var(--ink-3);line-height:1.35}
/* A form this person already holds the most of. Not disabled - pressing it
   opens the drafts with a bin beside each, which is the way out - but it
   stops reading as an ordinary choice, and it says the number. */
.choice.is-full{background:var(--surface-2)}
.choice.is-full .choice__icon{color:var(--ink-3)}
.choice.is-full .choice__title,.choice.is-full .choice__desc{color:var(--ink-3)}
.choice__full{
  flex:none;font-size:var(--fs-2xs);font-weight:700;font-variant-numeric:tabular-nums;
  color:var(--red);background:var(--red-050);border:1px solid var(--red-100);
  border-radius:var(--r-full);padding:2px 9px;
}
.choice__mark{width:24px;height:24px;border-radius:50%;border:2px solid var(--line);flex:none;display:grid;place-items:center;color:transparent}
.choice__mark svg{width:14px;height:14px;stroke-width:3.2}
.choice.is-selected{border-color:var(--red);background:var(--red-050)}
.choice.is-selected .choice__icon{background:var(--red);color:#fff}
.choice.is-selected .choice__mark{border-color:var(--red);background:var(--red);color:#fff}

/* Steps */
.steps{display:flex;align-items:center;gap:var(--s2);margin-bottom:var(--s5);overflow-x:auto;padding-bottom:var(--s1);scrollbar-width:none}
.steps::-webkit-scrollbar{display:none}
.step{display:flex;align-items:center;gap:var(--s2);flex:none}
.step__num{
  width:30px;height:30px;border-radius:50%;display:grid;place-items:center;flex:none;
  background:var(--line-2);color:var(--ink-3);font-family:var(--font-head);font-weight:700;font-size:var(--fs-sm);
}
.step__num svg{width:15px;height:15px;stroke-width:3}
.step__label{font-family:var(--font-head);font-weight:600;font-size:var(--fs-sm);color:var(--ink-3);white-space:nowrap}
.step__bar{width:22px;height:2px;background:var(--line);flex:none;border-radius:2px}
.step--current .step__num{background:var(--red);color:#fff}
.step--current .step__label{color:var(--ink)}
.step--done .step__num{background:var(--ok);color:#fff}
.step--done .step__label{color:var(--ink-2)}

/* Search + scan */
.search{position:relative;flex:1;min-width:0}
.search svg{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:19px;height:19px;color:var(--ink-3);pointer-events:none}
.search .input{padding-left:40px}
.scanbar{
  display:flex;align-items:center;gap:var(--s3);width:100%;min-height:54px;padding:0 var(--s4);
  border:1.5px dashed var(--navy);border-radius:var(--r);background:#fbfcfd;color:var(--navy);
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-lg);cursor:pointer;text-align:left;
}
.scanbar:hover{background:var(--surface-2)}
.scanbar svg{width:24px;height:24px;flex:none}
.scanbar small{font-family:var(--font-body);font-weight:400;color:var(--ink-3);font-size:var(--fs-sm);margin-left:auto;white-space:nowrap}

.toolbar{display:flex;gap:var(--s2);align-items:center;flex-wrap:wrap;margin-bottom:var(--s4)}
.filters{display:flex;gap:var(--s2);overflow-x:auto;padding-bottom:2px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.filters::-webkit-scrollbar{display:none}
.filter{
  min-height:42px;padding:0 var(--s3);border:1px solid var(--line);border-radius:var(--r-full);
  background:var(--surface);font-family:var(--font-head);font-weight:600;font-size:var(--fs-sm);color:var(--ink-2);
  cursor:pointer;white-space:nowrap;display:inline-flex;align-items:center;gap:6px;flex:none;
}
.filter:hover{border-color:var(--ink-3)}
.filter.is-active{background:var(--navy);border-color:var(--navy);color:#fff}
.filter .n{background:rgba(0,0,0,.08);border-radius:var(--r-full);padding:0 6px;font-size:var(--fs-2xs)}
.filter.is-active .n{background:rgba(255,255,255,.22)}

/* Switch */
.switch{display:inline-flex;align-items:center;gap:var(--s3);cursor:pointer;min-height:var(--tap)}
.switch input{position:absolute;opacity:0;width:0;height:0}
.switch__track{width:46px;height:27px;border-radius:var(--r-full);background:var(--line);position:relative;transition:background var(--fast);flex:none}
.switch__track::after{content:"";position:absolute;top:3px;left:3px;width:21px;height:21px;border-radius:50%;background:#fff;box-shadow:var(--e1);transition:transform var(--fast)}
.switch input:checked + .switch__track{background:var(--ok)}
.switch input:checked + .switch__track::after{transform:translateX(19px)}
.switch input:focus-visible + .switch__track{outline:3px solid var(--red);outline-offset:2px}

/* Checkbox - oversized for gloves */
.check{display:flex;align-items:center;gap:var(--s3);cursor:pointer;min-height:var(--tap);user-select:none}
.check input{position:absolute;opacity:0;width:0;height:0}
.check__box{
  width:26px;height:26px;border-radius:var(--r-xs);border:2px solid var(--line);background:var(--surface);
  flex:none;display:grid;place-items:center;color:#fff;transition:background var(--fast),border-color var(--fast);
}
.check__box svg{width:16px;height:16px;stroke-width:3.2;opacity:0;transition:opacity var(--fast)}
.check input:checked + .check__box{background:var(--ok);border-color:var(--ok)}
.check input:checked + .check__box svg{opacity:1}
.check input:focus-visible + .check__box{outline:3px solid var(--red);outline-offset:2px}
.check__label{min-width:0}
.check.is-checked .check__label{color:var(--ink-3)}

/* ---------- 10. Lists & tables -------------------------------------------- */
.list{list-style:none;margin:0;padding:0}
.list__item{
  display:flex;align-items:center;gap:var(--s3);padding:var(--s3) var(--s4);
  border-bottom:1px solid var(--line-2);color:var(--ink);min-height:66px;
  transition:background var(--fast);width:100%;text-align:left;
}
.list__item:last-child{border-bottom:0}
a.list__item:hover,button.list__item:hover,.list__item--link:hover{background:var(--surface-2);text-decoration:none;cursor:pointer;color:var(--ink)}
.list__thumb{
  width:44px;height:44px;border-radius:var(--r-sm);background:var(--surface-2);border:1px solid var(--line);
  display:grid;place-items:center;color:var(--navy);flex:none;
}
.list__thumb svg{width:22px;height:22px}
.list__thumb--red{background:var(--red-050);border-color:var(--red-100);color:var(--red)}
.list__thumb--ok{background:var(--ok-bg);border-color:#c6e5d5;color:var(--ok)}
.list__thumb--warn{background:var(--warn-bg);border-color:#f0dcb8;color:var(--warn)}
.list__body{min-width:0;flex:1}
.list__title{font-family:var(--font-head);font-weight:600;font-size:var(--fs-lg);line-height:1.3}
.list__sub{font-size:var(--fs-sm);color:var(--ink-3);line-height:1.35;display:flex;flex-wrap:wrap;gap:0 var(--s2);align-items:center}
.list__sub .sep{color:var(--line)}
.list__end{margin-left:auto;text-align:right;flex:none;display:flex;align-items:center;gap:var(--s2)}
.list__chevron{color:var(--ink-3);flex:none;display:flex}
.list__chevron svg{width:20px;height:20px;display:block}

.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
.table{width:100%;border-collapse:collapse;font-size:var(--fs-md);min-width:660px}
.table th{
  text-align:left;font-family:var(--font-head);font-weight:700;font-size:var(--fs-2xs);letter-spacing:.055em;
  text-transform:uppercase;color:var(--ink-3);padding:var(--s3) var(--s4);border-bottom:1px solid var(--line);
  background:var(--surface-2);white-space:nowrap;
}
.table td{padding:var(--s3) var(--s4);border-bottom:1px solid var(--line-2);vertical-align:middle}
.table tbody tr:last-child td{border-bottom:0}
.table tbody tr:hover{background:var(--surface-2)}
.table .num{text-align:right;font-variant-numeric:tabular-nums}
.table .nowrap{white-space:nowrap}
.table__main{font-weight:600;font-family:var(--font-head);font-size:var(--fs-md)}
.table__sub{font-size:var(--fs-xs);color:var(--ink-3)}

/* ---------- 11. Timeline -------------------------------------------------- */
.timeline{list-style:none;margin:0;padding:0;position:relative}
.timeline::before{content:"";position:absolute;left:11px;top:12px;bottom:12px;width:2px;background:var(--line)}
.timeline__item{position:relative;padding:0 0 var(--s5) var(--s7);min-height:38px}
.timeline__item:last-child{padding-bottom:0}
.timeline__dot{
  position:absolute;left:0;top:1px;width:24px;height:24px;border-radius:50%;background:var(--surface);
  border:2px solid var(--line);display:grid;place-items:center;color:var(--ink-3);z-index:1;
}
.timeline__dot svg{width:13px;height:13px;stroke-width:2.6}
.timeline__item--done .timeline__dot{background:var(--ok);border-color:var(--ok);color:#fff}
.timeline__item--current .timeline__dot{background:var(--red);border-color:var(--red);color:#fff}
.timeline__item--blocked .timeline__dot{background:var(--warn);border-color:var(--warn);color:#fff}
.timeline__title{font-family:var(--font-head);font-weight:600;font-size:var(--fs-md);line-height:1.3}
.timeline__meta{font-size:var(--fs-sm);color:var(--ink-3);line-height:1.4}

/* ---------- 12. Overlays -------------------------------------------------- */
.scrim{
  position:fixed;inset:0;background:rgba(33,43,57,.52);z-index:var(--z-modal);
  display:flex;align-items:flex-end;justify-content:center;
  opacity:0;animation:fadeIn var(--base) forwards;
}
.scrim--drawer{z-index:var(--z-drawer);align-items:stretch;justify-content:flex-end}
.modal__panel{
  background:var(--surface);width:100%;max-width:580px;max-height:92dvh;overflow:auto;
  border-radius:var(--r-xl) var(--r-xl) 0 0;box-shadow:var(--e3);
  transform:translateY(18px);animation:slideUp var(--base) forwards;
  padding-bottom:env(safe-area-inset-bottom);
}
.modal__panel--wide{max-width:840px}
.modal__grab{width:40px;height:4px;border-radius:2px;background:var(--line);margin:10px auto 0}
.modal__head{display:flex;align-items:center;gap:var(--s3);padding:var(--s4) var(--s5);border-bottom:1px solid var(--line-2);position:sticky;top:0;background:var(--surface);z-index:2}
.modal__title{font-family:var(--font-head);font-weight:700;font-size:var(--fs-xl);flex:1;line-height:1.25}
.modal__body{padding:var(--s5)}
.modal__foot{padding:var(--s4) var(--s5);border-top:1px solid var(--line-2);display:flex;gap:var(--s2);justify-content:flex-end;flex-wrap:wrap;background:var(--surface);position:sticky;bottom:0}
.modal__foot .btn{flex:1;min-width:130px}
/* A dialog with nothing to say is a title and its buttons, and it reads as one
   card rather than three stacked sections. Without this the head's hairline
   and the foot's would sit against each other as a 2px double rule, now that
   the body section is not drawn at all when it would be empty. */
.modal__panel--bare .modal__head{border-bottom:0}
.modal__panel--bare .modal__foot{border-top:0}
.drawer__panel{
  background:var(--surface);width:100%;max-width:540px;height:100dvh;overflow:auto;box-shadow:var(--e3);
  transform:translateX(20px);animation:slideIn var(--base) forwards;
}
@keyframes fadeIn{to{opacity:1}}
@keyframes slideUp{to{transform:translateY(0)}}
@keyframes slideIn{to{transform:translateX(0)}}

.toasts{position:fixed;left:var(--s4);right:var(--s4);bottom:calc(var(--bottombar-h) + var(--s4) + env(safe-area-inset-bottom));z-index:var(--z-toast);display:flex;flex-direction:column;gap:var(--s2);pointer-events:none}
.toast{
  background:var(--navy);color:#fff;border-radius:var(--r);padding:var(--s3) var(--s4);
  box-shadow:var(--e3);display:flex;align-items:center;gap:var(--s3);font-size:var(--fs-md);
  animation:slideUp var(--base) backwards;pointer-events:auto;max-width:520px;margin:0 auto;width:100%;
}
.toast svg{width:20px;height:20px;flex:none}
.toast--ok svg{color:var(--safety)}
.toast--warn svg{color:#ffc46b}
.toast--err,.toast--danger{background:var(--red)}

/* ---------- 13. Misc ------------------------------------------------------ */
.empty{text-align:center;padding:var(--s9) var(--s5);color:var(--ink-3)}
.empty__icon{
  width:64px;height:64px;border-radius:50%;background:var(--surface-2);border:1px solid var(--line);
  display:grid;place-items:center;margin:0 auto var(--s4);color:var(--ink-3);
}
.empty__icon svg{width:28px;height:28px}
.empty h3{color:var(--ink);margin-bottom:var(--s2)}
.empty p{max-width:400px;margin:0 auto var(--s4)}

.alert{display:flex;gap:var(--s3);padding:var(--s4);border-radius:var(--r);border:1px solid;font-size:var(--fs-md);line-height:1.45}
.alert svg{width:20px;height:20px;flex:none;margin-top:1px}
.alert strong{font-family:var(--font-head);display:block;margin-bottom:2px}
.alert--warn{background:var(--warn-bg);border-color:#f0dcb8;color:#6b4400}
.alert--warn svg{color:var(--warn)}
.alert--danger{background:var(--red-050);border-color:var(--red-100);color:#8a0c20}
.alert--danger svg{color:var(--red)}
.alert--info{background:var(--info-bg);border-color:#cfe0ee;color:#173d5e}
.alert--info svg{color:var(--info)}
.alert--ok{background:var(--ok-bg);border-color:#c6e5d5;color:#0c5637}
.alert--ok svg{color:var(--ok)}

.meta-grid{display:grid;gap:var(--s3) var(--s5);grid-template-columns:repeat(2,minmax(0,1fr));margin:0}
.meta-grid dt{font-size:var(--fs-2xs);letter-spacing:.05em;text-transform:uppercase;color:var(--ink-3);font-family:var(--font-head);font-weight:600}
.meta-grid dd{margin:2px 0 0;font-size:var(--fs-md);font-weight:500}

.avatar{width:34px;height:34px;border-radius:50%;background:var(--navy);color:#fff;display:grid;place-items:center;font-family:var(--font-head);font-weight:700;font-size:var(--fs-xs);flex:none}
.avatar--red{background:var(--red)}
.avatar--gray{background:var(--gray)}
.avatar--sm{width:26px;height:26px;font-size:var(--fs-3xs)}

.progress{height:8px;border-radius:var(--r-full);background:var(--line-2);overflow:hidden}
.progress__bar{height:100%;background:var(--ok);border-radius:var(--r-full);transition:width var(--base)}
.progress__bar--red{background:var(--red)}
.progress__bar--navy{background:var(--navy)}

.photo-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(92px,1fr));gap:var(--s2)}
/* The small print under an attach control saying what it takes. Quiet enough
   not to compete with the question, present enough to be read before a file
   is chosen rather than after it has been refused. */
.attach-note{color:var(--ink-3)}
.photo{aspect-ratio:1;border-radius:var(--r-sm);border:1px solid var(--line);background:var(--surface-2);display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--ink-3);font-size:var(--fs-2xs);text-align:center;padding:var(--s2);overflow:hidden;line-height:1.25}
.photo svg{width:22px;height:22px;margin-bottom:4px}
.photo--add{border-style:dashed;border-color:var(--navy);color:var(--navy);cursor:pointer;font-weight:600;font-family:var(--font-head)}

/* Full width, always. Inside the capture sheet the control cell is a flex
   column that sizes its children to their content, and a signature pad has
   no content to size to - it collapsed to 222px of a 894px sheet, a strip
   too narrow to sign a name across. The canvas measures its own box when it
   is built and on every resize, so the drawing surface follows. */
.sig-pad{width:100%;border:1.5px dashed var(--line);border-radius:var(--r);background:var(--surface-2);height:160px;position:relative;touch-action:none;overflow:hidden}
.sig-pad canvas{width:100%;height:100%;display:block;cursor:crosshair;touch-action:none}
/* The body sketch: same pad, taller, with the silhouette painted behind the
   strokes. Contain keeps both figures on screen at any width. */
/* Novara's diagram is square (612x612), so the pad is too - a landscape
   pad letterboxed it into the middle third and left most of the drawing
   surface off the body. */
.sig-pad--sketch{
  height:min(62dvh,480px);width:min(100%,480px);margin-inline:auto;
  background-color:#fff;background-size:contain;background-repeat:no-repeat;background-position:center;
}
.sig-pad__hint{position:absolute;inset:0;display:grid;place-items:center;color:var(--ink-3);font-size:var(--fs-sm);pointer-events:none}
/* D6 - signing happens in its own window, so the step shows the signature
   rather than a pad to make one in. The window's pad is taller than the
   inline strip ever was: it is the whole point of moving it. */
.sig-pad--window{height:min(46dvh,320px);background-color:#fff}
/* The marked body diagram. This carried its own inline style - a hardcoded
   8px radius and a 1px border - which is how a control drifts away from the
   rest: the tokens move and the inline copy does not. */
.sketch__preview{
  display:block;max-height:200px;background:#fff;padding:var(--s2);
  border:1px solid var(--line);border-radius:var(--r-sm);
}
.sigbox__img{
  display:block;max-width:100%;height:96px;object-fit:contain;object-position:left center;
  border:1px solid var(--line);border-radius:var(--r-sm);background:#fff;padding:var(--s2);
}
.sigbox__empty{
  height:96px;display:grid;place-items:center;border:1.5px dashed var(--line);
  border-radius:var(--r-sm);background:var(--surface-2);color:var(--ink-3);font-size:var(--fs-sm);
}

.stack{display:flex;flex-direction:column;gap:var(--s3)}
.stack--sm{gap:var(--s2)}
.stack--lg{gap:var(--s5)}
.row{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap}
.row--nowrap{flex-wrap:nowrap}
.spread{display:flex;align-items:center;justify-content:space-between;gap:var(--s3)}
/* ---------- Dense dashboard ----------------------------------------------
   The operational screens are built for a phone in a warehouse. The money
   screens are read by one person at a desk on a 27 inch monitor, and there
   the job is the opposite: get the whole board on one screen. Wider bound,
   tighter padding, smaller type, no prose where a column will do. */
.container--dash{max-width:2560px;padding:var(--s4) var(--s5)}
.table--dense{min-width:0}
.table--dense th{padding:var(--s2) var(--s3);font-size:var(--fs-3xs);letter-spacing:.045em}
.table--dense td{padding:6px var(--s3);font-size:var(--fs-sm)}
.table--dense .table__main{font-size:var(--fs-sm)}
.table--dense tbody tr.is-flagged{background:var(--red-050)}
.kpis--wide{grid-template-columns:repeat(2,minmax(0,1fr))}
.kpi--sm{padding:var(--s3)}
.kpi--sm .kpi__value{font-size:19px}
.kpi--sm .kpi__label{font-size:var(--fs-2xs);margin-top:1px;line-height:1.25}
.progress--cell{width:52px;height:6px;display:inline-block;vertical-align:middle;margin-right:6px}
.panel-head{display:flex;align-items:baseline;justify-content:space-between;gap:var(--s3);margin-bottom:var(--s2)}
@media (min-width:768px){ .kpis--wide{grid-template-columns:repeat(4,minmax(0,1fr))} }
@media (min-width:1366px){ .kpis--wide{grid-template-columns:repeat(8,minmax(0,1fr))} }

.grid{display:grid;gap:var(--s4);grid-template-columns:1fr}
/* Grid and flex children default to min-width:auto, so one long label can push
   a whole column wider than the viewport. Let them shrink. */
.grid>*,.kpis>*,.tiles>*,.choices>*,.inline-fields>*{min-width:0}  /* grid-shrink */
.divider{height:1px;background:var(--line-2);margin:var(--s4) 0}

.muted{color:var(--ink-3)}
.small{font-size:var(--fs-sm)}
.tnum{font-variant-numeric:tabular-nums}
.bold{font-weight:700;font-family:var(--font-head)}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.92em;letter-spacing:-.01em}
.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;display:block}
.red{color:var(--red)} .ok{color:var(--ok)} .warn{color:var(--warn)}
.mt0{margin-top:0}.mt2{margin-top:var(--s2)}.mt3{margin-top:var(--s3)}.mt4{margin-top:var(--s4)}.mt5{margin-top:var(--s5)}.mt6{margin-top:var(--s6)}
.mb0{margin-bottom:0}.mb2{margin-bottom:var(--s2)}.mb3{margin-bottom:var(--s3)}.mb4{margin-bottom:var(--s4)}.mb5{margin-bottom:var(--s5)}
.p0{padding:0}
.flex1{flex:1;min-width:0}
.hide{display:none !important}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* ---------- 14. Responsive ------------------------------------------------ */
/* Large phone */
@media (min-width:480px){
  .tiles{grid-template-columns:repeat(3,minmax(0,1fr))}
  .inline-fields{grid-template-columns:1fr 1fr}
  .modal__foot .btn{flex:none}
}
/* iPad portrait (768x1024) */
@media (min-width:768px){
  .container{padding:var(--s6)}
  .tiles{grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--s4)}
  .tile{min-height:152px;padding:var(--s5)}
  .kpis{grid-template-columns:repeat(4,minmax(0,1fr))}
  .grid--2{grid-template-columns:repeat(2,minmax(0,1fr))}
  .choices--2{grid-template-columns:1fr 1fr}
  .meta-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .page-head__title{font-size:28px}
  .scrim{align-items:center;padding:var(--s5)}
  .modal__panel{border-radius:var(--r-xl);max-height:88dvh}
  .modal__grab{display:none}
  .toasts{left:auto;right:var(--s5);max-width:420px}
  .toast{margin:0 0 0 auto}
  .topbar{padding:0 var(--s5)}
}
/* iPad landscape / iPad Pro portrait (1024x1366) - switch to rail */
@media (min-width:1024px){
  .rail{display:flex}
  .topbar,.main,.toasts{margin-left:var(--rail-w)}
  .bottombar{display:none}
  .main{min-height:calc(100dvh - var(--topbar-h));padding-bottom:var(--s8)}
  .topbar__back{display:none}
  .topbar__logo{display:none}
  .rolechip__txt,.rolechip__caret{display:block}
  .fab{display:none}
  .toasts{left:auto;right:var(--s6);bottom:var(--s6)}
  .tiles{grid-template-columns:repeat(4,minmax(0,1fr))}
  .grid--3{grid-template-columns:repeat(3,minmax(0,1fr))}
  .grid--sidebar{grid-template-columns:minmax(0,1fr) 340px}
  .inline-fields--3{grid-template-columns:repeat(3,1fr)}
  .container{padding:var(--s7)}
  .hide-lg{display:none !important}
}
/* iPad Pro landscape / desktop */
@media (min-width:1366px){
  .grid--4{grid-template-columns:repeat(4,minmax(0,1fr))}
  .grid--sidebar{grid-template-columns:minmax(0,1fr) 380px}
  .tiles--home{grid-template-columns:repeat(4,minmax(0,1fr))}
}
@media (min-width:1600px){
  .tiles--home{grid-template-columns:repeat(5,minmax(0,1fr))}
}
@media (max-width:1023px){ .hide-sm{display:none !important} }

/* Landscape phones - keep the bar out of the way */
@media (max-height:500px) and (orientation:landscape){
  :root{--bottombar-h:52px}
  .bottombar__item span{display:none}
  .bottombar__item{height:52px}
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}
  .tile:hover{transform:none}
}

@media print{
  .rail,.topbar,.bottombar,.fab,.toasts{display:none !important}
  .main{margin-left:0;padding:0}
  .card{box-shadow:none;break-inside:avoid}
}

/* ==========================================================================
   DP Electric - Safety & Quality Forms
   Everything this module needs on top of dpe.css. Nothing here redefines a
   token or overrides a Tool Center component - it only adds the pieces that
   app does not have: the wizard, the inspection item, the repeating table,
   the four chart shapes, the form builder and the OSHA paperwork.

   Breakpoints match dpe.css exactly:
     base    phones                      (iPhone 390)
     >=768   large phone / small tablet
     >=1024  rail appears                (iPad Pro portrait, iPad Air landscape)
     >=1366  wide desktop                (iPad Pro landscape, 1440 desktop)
   The forms table becomes a card list below 1024 - nine columns on an iPad Air
   in portrait is a sideways scroll nobody performs twice.
   ========================================================================== */

/* ---------- 1. Segmented control ------------------------------------------ */
.seg{
  display:inline-flex;padding:3px;gap:2px;background:var(--line-2);border-radius:var(--r-sm);
  border:1px solid var(--line);max-width:100%;overflow-x:auto;scrollbar-width:none;
}
.seg::-webkit-scrollbar{display:none}
.seg__item{
  display:inline-flex;align-items:center;gap:6px;min-height:38px;padding:0 var(--s3);
  border-radius:var(--r-xs);font-family:var(--font-head);font-weight:600;font-size:var(--fs-md);
  color:var(--ink-2);white-space:nowrap;flex:none;transition:background var(--fast),color var(--fast);
}
.seg__item:hover{color:var(--ink);text-decoration:none}
.seg__item svg{width:17px;height:17px}
.seg__item.is-active{background:var(--surface);color:var(--ink);box-shadow:var(--e1)}
.seg__item .n{
  background:var(--line);color:var(--ink-2);border-radius:var(--r-full);
  padding:0 6px;font-size:var(--fs-2xs);line-height:1.6;
}
.seg__item.is-active .n{background:var(--red);color:#fff}

/* ---------- 2. Toolbar that survives a phone ------------------------------ */
.subbar{
  position:sticky;top:var(--topbar-h);z-index:30;background:var(--bg);
  padding:var(--s3) 0 var(--s2);margin-bottom:var(--s3);
}
.subbar__row{display:flex;gap:var(--s2);align-items:center;flex-wrap:wrap}
.subbar .search{flex:1 1 220px}

.filterset{display:flex;gap:var(--s2);align-items:center;overflow-x:auto;padding-bottom:2px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.filterset::-webkit-scrollbar{display:none}
.filterset__label{
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-3xs);letter-spacing:.06em;
  text-transform:uppercase;color:var(--ink-3);flex:none;padding-right:2px;
}
.filter--sel{padding-right:var(--s2)}
.filter svg{width:15px;height:15px}
.applied{display:flex;gap:var(--s2);flex-wrap:wrap;align-items:center;margin-top:var(--s2)}
.applied:empty{display:none}
.applied .chip{padding-right:4px}
.applied .chip button{
  width:20px;height:20px;border-radius:50%;display:grid;place-items:center;color:inherit;opacity:.7;
}
.applied .chip button:hover{opacity:1;background:rgba(0,0,0,.08)}
.applied .chip svg{width:12px;height:12px}

/* ---------- 3. Forms table + its phone twin ------------------------------- */
.table--forms{min-width:1080px}
.table--forms td{vertical-align:top}
.table tbody tr.is-clickable{cursor:pointer}
.table__code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:var(--fs-xs);color:var(--ink-3);letter-spacing:-.01em}
.cellstack{display:flex;flex-direction:column;gap:3px}
.cellchips{display:flex;gap:var(--s1);flex-wrap:wrap}
.sortable{cursor:pointer;user-select:none;position:relative}
.sortable:hover{color:var(--ink)}
.sortable svg{width:13px;height:13px;opacity:.35;vertical-align:-2px;margin-left:3px}
.sortable[aria-sort="ascending"] svg,.sortable[aria-sort="descending"] svg{opacity:1;color:var(--red)}

/* The card the table turns into under 1024px. */
.fcards{display:grid;gap:var(--s3);grid-template-columns:1fr}
.fcard{
  display:block;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);
  padding:var(--s4);box-shadow:var(--e1);color:var(--ink);position:relative;
  transition:box-shadow var(--fast),border-color var(--fast);
}
.fcard:hover{text-decoration:none;color:var(--ink);box-shadow:var(--e2);border-color:#d3d9e0}
/* A card that wants attention is tinted evenly, not striped down one edge.
   The stripe was colour doing the whole job: it said "something here" without
   saying what, it said nothing at all to anybody who cannot separate red from
   grey, and it restated a status chip that is already on the card in words.
   The even border is a second cue behind the chip, never the only one. */
.fcard--alert{border-color:var(--red-100)}
.fcard--alert:hover{border-color:var(--red)}

/* Severity leads the card. On a worklist the question is "how bad", and the
   answer has to survive being scanned down a column of cards - so it sits in
   the same place on every one, carries its own icon per level, and says the
   word. Colour is the third signal, not the first. */
.fcard__sev{margin-right:var(--s1)}
.fcard--draft{border-style:dashed}
.fcard__top{display:flex;align-items:center;gap:var(--s2);margin-bottom:var(--s2);flex-wrap:wrap}
.fcard__code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:var(--fs-2xs);color:var(--ink-3)}
.fcard__title{font-family:var(--font-head);font-weight:700;font-size:var(--fs-lg);line-height:1.3;margin-bottom:var(--s1)}
.fcard__meta{font-size:var(--fs-sm);color:var(--ink-3);line-height:1.45;display:flex;flex-wrap:wrap;gap:0 var(--s2);align-items:center}
.fcard__meta .sep{color:var(--line)}
.fcard__foot{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap;margin-top:var(--s3);padding-top:var(--s3);border-top:1px solid var(--line-2)}
.fcard__chev{position:absolute;top:var(--s4);right:var(--s4);color:var(--line);display:none}

@media (min-width:1024px){
  .fcards{display:none}
  .forms-table{display:block}
}
@media (max-width:1023px){
  .forms-table{display:none}
}

/* ---------- 4. Wizard ------------------------------------------------------
   Bare shell: no rail, no bottom bar. On a phone the whole viewport is the
   form, with one sticky action bar at the bottom that clears the home
   indicator. */
body.is-bare .main{margin-left:0;padding-bottom:0;min-height:calc(100dvh - var(--topbar-h))}
body.is-bare .toasts{margin-left:0;bottom:calc(var(--wizfoot-h) + var(--s4) + env(safe-area-inset-bottom))}
:root{--wizfoot-h:76px}

.wizard{padding-bottom:calc(var(--wizfoot-h) + var(--s6) + env(safe-area-inset-bottom))}
.wizard__progress{
  position:sticky;top:var(--topbar-h);z-index:32;background:var(--bg);
  padding:var(--s3) 0 var(--s2);margin-bottom:var(--s4);
}
.wizard__bar{height:4px;border-radius:var(--r-full);background:var(--line);overflow:hidden;margin-bottom:var(--s3)}
.wizard__bar i{display:block;height:100%;background:var(--red);border-radius:var(--r-full);transition:width var(--base)}
.wizard__stepline{display:flex;align-items:baseline;justify-content:space-between;gap:var(--s3);font-size:var(--fs-sm);color:var(--ink-3)}
.wizard__stepline b{font-family:var(--font-head);font-size:var(--fs-md);color:var(--ink)}

.wizard__foot{
  position:fixed;left:0;right:0;bottom:0;z-index:45;background:var(--surface);
  border-top:1px solid var(--line);box-shadow:0 -1px 12px rgba(33,43,57,.08);
  padding:var(--s3) var(--s4);padding-bottom:calc(var(--s3) + env(safe-area-inset-bottom));
  display:flex;gap:var(--s2);align-items:center;
}
.wizard__foot .grow{flex:1;min-width:0}
.wizard__saved{font-size:var(--fs-xs);color:var(--ink-3);display:flex;align-items:center;gap:var(--s1);white-space:nowrap}
.wizard__saved svg{width:14px;height:14px;color:var(--ok)}
@media (min-width:1024px){
  .wizard__foot{left:0;padding-left:var(--s7);padding-right:var(--s7)}
  .wizard__foot .inner{width:100%;max-width:780px;margin:0 auto;display:flex;gap:var(--s2);align-items:center}
}

/* Section header inside a step */
.fsection{margin-bottom:var(--s6)}
.fsection__head{margin-bottom:var(--s4)}
.fsection__title{font-family:var(--font-head);font-weight:700;font-size:19px;line-height:1.25}
.fsection__help{font-size:var(--fs-md);color:var(--ink-3);margin-top:4px;line-height:1.45;max-width:62ch}

/* ---------- 5. Inspection item (Pass / Fail / N/A) -------------------------
   The single most-used control in the whole module. Big targets, the state is
   never carried by colour alone, and the note and photo only appear once the
   answer needs them. */
.citem{
  border:var(--bw-ctl) solid var(--line);border-radius:var(--r);background:var(--surface);
  padding:var(--s3) var(--s4);margin-bottom:var(--s2);transition:border-color var(--fast),background var(--fast);
}
.citem__row{display:flex;gap:var(--s3);align-items:flex-start;flex-wrap:wrap}
.citem__label{flex:1 1 220px;min-width:0;font-size:var(--fs-lg);line-height:1.4;padding-top:6px}
.citem__num{
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-2xs);color:var(--ink-3);
  display:inline-block;min-width:26px;
}
.citem__opts{display:flex;gap:var(--s1);flex:none}
.citem__opt{
  min-width:58px;min-height:var(--tap);padding:0 var(--s2);border:var(--bw-ctl) solid var(--line);
  border-radius:var(--r-sm);background:var(--surface);display:inline-flex;align-items:center;
  justify-content:center;gap:var(--s1);font-family:var(--font-head);font-weight:700;font-size:var(--fs-sm);
  color:var(--ink-2);cursor:pointer;transition:all var(--fast);
}
.citem__opt svg{width:15px;height:15px}
.citem__opt:hover{border-color:var(--ink-3)}
.citem__opt[aria-pressed="true"][data-v="pass"]{background:var(--ok);border-color:var(--ok);color:#fff}
.citem__opt[aria-pressed="true"][data-v="fail"]{background:var(--red);border-color:var(--red);color:#fff}
.citem__opt[aria-pressed="true"][data-v="na"]{background:var(--gray);border-color:var(--gray);color:#fff}
.citem.is-fail{border-color:var(--red-100);background:var(--red-050)}
.citem.is-pass{border-color:#cfe3d8}
.citem__extra{margin-top:var(--s3);padding-top:var(--s3);border-top:1px dashed var(--line);display:none}
.citem.is-fail .citem__extra{display:block}
.citem__extra .field{margin-bottom:var(--s3)}
.citem__extra .field:last-child{margin-bottom:0}
.citem__flag{
  display:inline-flex;align-items:center;gap:var(--s1);font-size:var(--fs-xs);font-weight:600;color:var(--red);
  font-family:var(--font-head);margin-top:var(--s2);
}
.citem__flag svg{width:14px;height:14px}
@media (max-width:479px){
  .citem__opts{width:100%}
  .citem__opt{flex:1}
}

.checkscore{display:flex;gap:var(--s2);align-items:center;flex-wrap:wrap;font-size:var(--fs-sm)}
.checkscore .chip{font-variant-numeric:tabular-nums}

/* ---------- 6. Repeating table -------------------------------------------- */
.rep{border:1px solid var(--line);border-radius:var(--r);overflow:hidden;background:var(--surface)}
.rep__row{padding:var(--s3) var(--s4);border-bottom:1px solid var(--line-2);position:relative}
.rep__row:last-of-type{border-bottom:0}
.rep__rowhead{
  display:flex;align-items:center;justify-content:space-between;gap:var(--s2);margin-bottom:var(--s2);
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-2xs);letter-spacing:.05em;
  text-transform:uppercase;color:var(--ink-3);
}
.rep__grid{display:grid;gap:var(--s3);grid-template-columns:1fr}
/* The rows scroll inside the card - a body map with fourteen parts must not
   stretch the whole step - while the Add button stays parked below the list,
   reachable no matter how many rows there are. */
.rep__scroll{max-height:420px;overflow-y:auto;overscroll-behavior:contain}
/* One pill per saved entry: its name opens it in the form, its × removes it. */
.rep__pills{display:flex;flex-wrap:wrap;gap:var(--s2);padding:var(--s3) var(--s4);border-bottom:1px solid var(--line-2);background:var(--surface-2)}
.rpill{display:inline-flex;align-items:center;border:1px solid var(--line);border-radius:var(--r-full);background:var(--surface);overflow:hidden}
.rpill--on{border-color:var(--navy);box-shadow:inset 0 0 0 1px var(--navy)}
.rpill__t{border:0;background:none;padding:6px var(--s1) 6px var(--s3);font:inherit;font-size:var(--fs-sm);font-weight:600;color:var(--ink);cursor:pointer}
.rpill__x{border:0;background:none;padding:6px 10px 6px var(--s1);color:var(--ink-3);font-size:var(--fs-lg);line-height:1;cursor:pointer}
.rpill__x:hover{color:var(--red)}
.rep__foot{padding:var(--s3) var(--s4);background:var(--surface-2);border-top:1px solid var(--line-2)}
.rep__empty{padding:var(--s5) var(--s4);text-align:center;color:var(--ink-3);font-size:var(--fs-md)}
.rep .field{margin-bottom:0}
@media (min-width:768px){ .rep__grid{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (min-width:1024px){ .rep__grid--4{grid-template-columns:repeat(4,minmax(0,1fr))} }
@media (min-width:1024px){ .rep__grid--3{grid-template-columns:repeat(3,minmax(0,1fr))} }

/* ---------- 7. Review step ------------------------------------------------- */
.review__sec{border:1px solid var(--line);border-radius:var(--r);margin-bottom:var(--s3);overflow:hidden}
.review__head{
  display:flex;align-items:center;justify-content:space-between;gap:var(--s2);
  padding:var(--s3) var(--s4);background:var(--surface-2);border-bottom:1px solid var(--line-2);
}
.review__title{font-family:var(--font-head);font-weight:700;font-size:var(--fs-md)}
.review__body{padding:var(--s3) var(--s4);background:var(--surface)}
.review__pair{display:flex;gap:var(--s3);padding:6px 0;border-bottom:1px dashed var(--line-2);font-size:var(--fs-md)}
.review__pair:last-child{border-bottom:0}
.review__k{flex:0 0 40%;max-width:220px;color:var(--ink-3);font-size:var(--fs-sm)}
.review__v{flex:1;min-width:0;font-weight:500;word-break:break-word}
.review__v .chip{margin:1px 2px 1px 0}
@media (min-width:768px){ .review__k{flex-basis:34%} }

/* ---------- 8. Charts ------------------------------------------------------ */
.chart{width:100%;height:auto;display:block;overflow:visible}
.spark{width:120px;height:34px;display:block}

.rowchart{display:flex;flex-direction:column;gap:var(--s2)}
.rowchart__row{display:flex;align-items:center;gap:var(--s3)}
.rowchart__label{flex:0 0 40%;max-width:230px;font-size:var(--fs-sm);line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rowchart__track{flex:1;min-width:0;height:16px;background:var(--line-2);border-radius:var(--r-full);overflow:hidden}
.rowchart__bar{height:100%;border-radius:var(--r-full);transition:width var(--base)}
.rowchart__val{flex:none;width:46px;text-align:right;font-family:var(--font-head);font-weight:700;font-size:var(--fs-sm)}

.donutwrap{display:flex;gap:var(--s5);align-items:center;flex-wrap:wrap}
.donut{width:140px;height:140px;flex:none}
.legend{list-style:none;margin:0;padding:0;flex:1;min-width:150px;display:flex;flex-direction:column;gap:6px}
.legend li{display:flex;align-items:center;gap:var(--s2);font-size:var(--fs-sm)}
.legend i{width:10px;height:10px;border-radius:3px;flex:none}
.legend span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.legend b{font-family:var(--font-head);font-size:var(--fs-sm)}

.chartlegend{display:flex;gap:var(--s4);flex-wrap:wrap;margin-top:var(--s2);font-size:var(--fs-sm);color:var(--ink-2)}
.chartlegend i{width:10px;height:10px;border-radius:3px;display:inline-block;margin-right:6px;vertical-align:-1px}

.kpi__spark{margin-top:var(--s2)}
.statline{display:flex;gap:var(--s5);flex-wrap:wrap;margin-top:var(--s3)}
.statline div{min-width:0}
.statline dt{font-size:var(--fs-2xs);letter-spacing:.05em;text-transform:uppercase;color:var(--ink-3);font-family:var(--font-head);font-weight:600}
.statline dd{margin:2px 0 0;font-family:var(--font-head);font-weight:700;font-size:18px;font-variant-numeric:tabular-nums}

/* Heat grid - hazard by severity */
.heat{display:grid;gap:3px;grid-template-columns:minmax(110px,1.4fr) repeat(4,minmax(38px,1fr));font-size:var(--fs-xs);overflow-x:auto}
.heat__h{
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-3xs);letter-spacing:.04em;text-transform:uppercase;
  color:var(--ink-3);padding:var(--s1) 2px;text-align:center;
}
.heat__r{padding:6px var(--s2) 6px 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.3}
.heat__c{
  border-radius:5px;min-height:30px;display:grid;place-items:center;
  font-family:var(--font-head);font-weight:700;font-variant-numeric:tabular-nums;
}

/* ---------- 9. Role and permission matrix ---------------------------------- */
.matrix th.rot{text-align:center;vertical-align:bottom;padding-bottom:var(--s3)}
.matrix td.mid{text-align:center}
.matrix .switch{justify-content:center;min-height:36px}
.matrix .switch__track{width:40px;height:24px}
.matrix .switch__track::after{width:18px;height:18px}
.matrix .switch input:checked + .switch__track::after{transform:translateX(16px)}

/* ---------- 10. Form builder ----------------------------------------------- */
.tplcard{display:flex;gap:var(--s3);align-items:flex-start;padding:var(--s4);border-bottom:1px solid var(--line-2);width:100%;text-align:left}
.tplcard:last-child{border-bottom:0}
.tplcard:hover{background:var(--surface-2);cursor:pointer}
.tplcard__icon{
  width:42px;height:42px;border-radius:var(--r-sm);display:grid;place-items:center;flex:none;
  background:var(--surface-2);border:1px solid var(--line);color:var(--navy);
}
.tplcard__icon--red{background:var(--red-050);border-color:var(--red-100);color:var(--red)}
.tplcard__icon svg{width:21px;height:21px}
.tplcard__body{flex:1;min-width:0}
.tplcard__name{font-family:var(--font-head);font-weight:700;font-size:var(--fs-lg);line-height:1.3}
.tplcard__desc{font-size:var(--fs-sm);color:var(--ink-3);line-height:1.4;margin-top:2px}
.tplcard__meta{display:flex;gap:var(--s2);flex-wrap:wrap;margin-top:var(--s2)}

.bsec{border:1px solid var(--line);border-radius:var(--r);margin-bottom:var(--s3);overflow:hidden;background:var(--surface)}
.bsec__head{
  display:flex;align-items:center;gap:var(--s2);padding:var(--s3) var(--s4);
  background:var(--surface-2);border-bottom:1px solid var(--line-2);
}
.bsec__grip{color:var(--ink-3);cursor:grab;display:flex;flex:none}
.bsec__name{font-family:var(--font-head);font-weight:700;font-size:var(--fs-md);flex:1;min-width:0}
.bfield{
  display:flex;align-items:center;gap:var(--s3);padding:var(--s2) var(--s4);
  border-bottom:1px solid var(--line-2);font-size:var(--fs-md);
}
.bfield:last-child{border-bottom:0}
.bfield:hover{background:var(--surface-2)}
.bfield__type{
  font-family:var(--font-head);font-weight:600;font-size:var(--fs-3xs);letter-spacing:.04em;text-transform:uppercase;
  color:var(--ink-3);background:var(--line-2);border-radius:var(--r-full);padding:2px var(--s2);flex:none;
}
.bfield__label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bfield__flags{display:flex;gap:var(--s1);flex:none;align-items:center}

/* ---------- 11. OSHA paperwork ---------------------------------------------
   These print. The screen version is a faithful-enough facsimile that a safety
   manager recognises the form, and @media print strips everything else off the
   page so the paper copy is the form and nothing else. */
.gov{background:#fff;border:1px solid var(--line);border-radius:var(--r);overflow:hidden}
.gov__head{
  padding:var(--s4) var(--s5);border-bottom:2px solid var(--navy);
  display:flex;gap:var(--s4);align-items:flex-start;justify-content:space-between;flex-wrap:wrap;
}
.gov__form{font-family:var(--font-head);font-weight:700;font-size:20px;line-height:1.1}
.gov__sub{font-size:var(--fs-xs);color:var(--ink-2);margin-top:3px;max-width:52ch;line-height:1.4}
.gov__agency{text-align:right;font-size:var(--fs-2xs);color:var(--ink-3);line-height:1.4;flex:none}
.gov__agency b{display:block;font-family:var(--font-head);font-size:var(--fs-sm);color:var(--ink)}
.gov__body{padding:var(--s4) var(--s5)}
.gov__estab{
  display:flex;gap:var(--s5);flex-wrap:wrap;padding:var(--s3) var(--s5);
  background:var(--surface-2);border-bottom:1px solid var(--line);font-size:var(--fs-sm);
}
.gov__estab div{min-width:0}
.gov__estab dt{font-size:var(--fs-3xs);letter-spacing:.05em;text-transform:uppercase;color:var(--ink-3);font-family:var(--font-head);font-weight:700}
.gov__estab dd{margin:1px 0 0;font-weight:600}

.log{width:100%;border-collapse:collapse;font-size:var(--fs-2xs);min-width:1000px}
.log th,.log td{border:1px solid var(--line);padding:var(--s1) 6px;vertical-align:top}
.log thead th{background:var(--surface-2);font-family:var(--font-head);font-weight:700;font-size:var(--fs-3xs);letter-spacing:.03em;text-transform:uppercase;color:var(--ink-2);text-align:left}
.log thead th.mid{text-align:center}
.log td.mid{text-align:center}
.log tfoot td{background:var(--surface-2);font-weight:700;font-family:var(--font-head)}
.log .tick{display:inline-grid;place-items:center;width:16px;height:16px;border:1.5px solid var(--ink-3);border-radius:3px}
.log .tick svg{width:11px;height:11px;stroke-width:3.4;color:var(--navy)}
.log .tick--on{border-color:var(--navy);background:var(--navy)}
.log .tick--on svg{color:#fff}

.g301{display:grid;gap:0;grid-template-columns:1fr;border:1px solid var(--line)}
.g301__cell{padding:var(--s3) var(--s4);border-bottom:1px solid var(--line);min-height:62px}
.g301__cell:last-child{border-bottom:0}
.g301__k{font-size:var(--fs-3xs);letter-spacing:.04em;text-transform:uppercase;color:var(--ink-3);font-family:var(--font-head);font-weight:700;margin-bottom:3px}
.g301__v{font-size:var(--fs-md);line-height:1.45;white-space:pre-wrap}
@media (min-width:768px){
  .g301{grid-template-columns:1fr 1fr}
  .g301__cell{border-right:1px solid var(--line)}
  .g301__cell:nth-child(2n){border-right:0}
  .g301__cell--full{grid-column:1 / -1;border-right:0}
}

.rate{display:grid;gap:var(--s3);grid-template-columns:repeat(2,minmax(0,1fr))}
.rate__box{border:1px solid var(--line);border-radius:var(--r);padding:var(--s4);background:var(--surface)}
.rate__v{font-family:var(--font-head);font-weight:700;font-size:30px;line-height:1;font-variant-numeric:tabular-nums}
.rate__n{font-family:var(--font-head);font-weight:700;font-size:var(--fs-xs);margin-top:var(--s2)}
.rate__d{font-size:var(--fs-2xs);color:var(--ink-3);line-height:1.4;margin-top:3px}
@media (min-width:1024px){ .rate{grid-template-columns:repeat(4,minmax(0,1fr))} }

/* ---------- 12. Team board -------------------------------------------------- */
.person{display:flex;gap:var(--s3);align-items:center;padding:var(--s3) var(--s4);border-bottom:1px solid var(--line-2)}
.person:last-child{border-bottom:0}
.person__body{flex:1;min-width:0}
.person__name{font-family:var(--font-head);font-weight:700;font-size:var(--fs-lg)}
.person__title{font-size:var(--fs-sm);color:var(--ink-3)}
.person__stats{display:flex;gap:var(--s4);flex:none;flex-wrap:wrap;justify-content:flex-end}
.person__stat{text-align:right;min-width:52px}
.person__stat b{display:block;font-family:var(--font-head);font-weight:700;font-size:var(--fs-ctl);font-variant-numeric:tabular-nums;line-height:1.1}
.person__stat span{font-size:var(--fs-3xs);letter-spacing:.04em;text-transform:uppercase;color:var(--ink-3);font-family:var(--font-head);font-weight:600}
@media (max-width:639px){
  .person{flex-wrap:wrap}
  .person__stats{width:100%;justify-content:flex-start;padding-left:calc(34px + var(--s3))}
  .person__stat{text-align:left}
}

/* ---------- 13. Responsive preview harness ---------------------------------- */
.devicebar{display:flex;gap:var(--s2);flex-wrap:wrap;margin-bottom:var(--s4)}
.devices{display:flex;gap:var(--s5);align-items:flex-start;overflow-x:auto;padding-bottom:var(--s5)}
.device{flex:none}
.device__label{
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-sm);margin-bottom:var(--s2);
  display:flex;align-items:center;gap:6px;
}
.device__label svg{width:16px;height:16px;color:var(--ink-3)}
.device__label small{font-family:var(--font-body);font-weight:400;color:var(--ink-3);font-size:var(--fs-2xs)}
.device__frame{
  border:10px solid var(--navy);border-radius:26px;background:var(--navy);
  box-shadow:var(--e3);overflow:hidden;position:relative;
}
.device__frame--desktop{border-width:12px 12px 26px;border-radius:12px}
.device__frame iframe{display:block;border:0;background:var(--bg)}
.device__notch{
  position:absolute;top:0;left:50%;transform:translateX(-50%);width:92px;height:18px;
  background:var(--navy);border-radius:0 0 11px 11px;z-index:2;
}
.device__foot{
  height:14px;background:var(--navy);display:grid;place-items:center;
}
.device__foot i{display:block;width:80px;height:3px;border-radius:2px;background:rgba(255,255,255,.45)}

/* ---------- 14. Odds and ends ------------------------------------------------ */
/* A note to the reader. It was a red rule down one edge and a card with two
   square corners; it is an ordinary card now, tinted, with the whole shape
   intact. Nothing about a note is urgent enough to earn the loudest colour in
   the palette. */
.notecard{
  border:1px solid var(--line);background:var(--surface-2);border-radius:var(--r);
  padding:var(--s3) var(--s4);font-size:var(--fs-md);line-height:1.5;color:var(--ink-2);
}
.kv{display:grid;gap:var(--s2) var(--s5);grid-template-columns:1fr}
.kv dt{font-size:var(--fs-2xs);letter-spacing:.05em;text-transform:uppercase;color:var(--ink-3);font-family:var(--font-head);font-weight:700}
.kv dd{margin:0 0 var(--s2);font-size:var(--fs-md)}
@media (min-width:640px){ .kv{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (min-width:1024px){ .kv--3{grid-template-columns:repeat(3,minmax(0,1fr))} }

.photostub{
  aspect-ratio:4/3;border-radius:var(--r-sm);border:1px solid var(--line);
  background:linear-gradient(135deg,var(--surface-2) 0%,#eaeef3 100%);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--s1);
  color:var(--ink-3);font-size:var(--fs-2xs);text-align:center;padding:var(--s2);
}
.photostub svg{width:22px;height:22px}

.tasklink{
  display:flex;align-items:center;gap:var(--s3);padding:var(--s3) var(--s4);
  border:1px solid var(--line);border-radius:var(--r);background:var(--surface);
  margin-bottom:var(--s2);color:var(--ink);width:100%;text-align:left;
}
.tasklink:hover{background:var(--surface-2);text-decoration:none;color:var(--ink)}
.tasklink--overdue{border-color:var(--red-100);background:var(--red-050)}
.tasklink__body{flex:1;min-width:0}
.tasklink__t{font-family:var(--font-head);font-weight:600;font-size:var(--fs-md);line-height:1.3}
.tasklink__m{font-size:var(--fs-xs);color:var(--ink-3);margin-top:2px;display:flex;gap:var(--s2);flex-wrap:wrap;align-items:center}

.bigpick{display:grid;gap:var(--s3);grid-template-columns:1fr}
@media (min-width:768px){ .bigpick{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (min-width:1366px){ .bigpick--3{grid-template-columns:repeat(3,minmax(0,1fr))} }

.mini{font-size:var(--fs-2xs);color:var(--ink-3);line-height:1.4}
.pad-lg{padding:var(--s6) var(--s5)}
.gap2{gap:var(--s2)}
.wrap{flex-wrap:wrap}
.nowrap{white-space:nowrap}
.right{text-align:right}
.center{text-align:center}
.w-100{width:100%}

/* ---------- 15. Print --------------------------------------------------------- */
@media print{
  .subbar,.seg,.wizard__foot,.wizard__progress,.devicebar,.no-print{display:none !important}
  .gov{border:0}
  .gov__head{border-bottom:2px solid #000}
  .log{min-width:0;font-size:var(--fs-3xs)}
  .log th,.log td{border-color:#666}
  .card{border:1px solid #999}
  a[href]::after{content:''}
  @page{size:landscape;margin:12mm}
}

/* ---------- 16. Field grid ----------------------------------------------
   Sections lay out one column on a phone and two from 768 up. A field marked
   half:true takes one cell; everything else spans the row. Narratives,
   multiselects and repeaters are always full width - a paragraph in a half
   column is a paragraph nobody reads. */
.fgrid{display:grid;gap:0 var(--s4);grid-template-columns:1fr}
.fgrid > *{min-width:0}
@media (min-width:768px){
  .fgrid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .fgrid > .full{grid-column:1 / -1}
}

/* Toggle pills used by multiselect and checkgroup */
.pillset{display:flex;flex-wrap:wrap;gap:var(--s2)}
.pill{
  min-height:var(--tap);padding:0 var(--s3);border:var(--bw-ctl) solid var(--line);border-radius:var(--r-sm);
  background:var(--surface);font-family:var(--font-head);font-weight:600;font-size:var(--fs-sm);color:var(--ink-2);
  display:inline-flex;align-items:center;gap:0;cursor:pointer;transition:all var(--fast);
}
.pill:hover{border-color:var(--ink-3)}
/* The tick takes room only when it is shown. Hidden with opacity alone it
   still held 15px plus the flex gap, so the label of every unpressed pill sat
   21px right of centre while a pressed one read straight - which is what
   "the text is off centre" was. */
.pill svg{
  width:0;height:15px;opacity:0;margin-right:0;flex:none;
  transition:width var(--fast),opacity var(--fast),margin var(--fast);
}
.pill[aria-pressed="true"]{background:var(--navy);border-color:var(--navy);color:#fff}
.pill[aria-pressed="true"] svg{width:15px;opacity:1;margin-right:6px}
@media (min-width:768px) and (pointer:fine){
  .pill{min-height:var(--ctl-h);padding:0 var(--s3);font-size:var(--fs-sm)}
  /* Height only. Setting a width here put the hidden tick back into the
     layout at this breakpoint, which is where the off-centre labels were
     actually being seen - the width belongs to the pressed state alone. */
  .pill svg{height:13px}
  .pill[aria-pressed="true"] svg{width:13px}
  .pillset{gap:6px}
}

/* Yes / No pair.
   Two 52px slabs half the panel wide was a lot of furniture for one bit of
   information, and a section of nine of them scrolled for a screen and a
   half. Sized to its content now, and tightened further where there is a real
   pointer - on a touch screen it stays at the full tap target, because a
   mis-tap here answers an OSHA question wrongly. */
.yesno{display:inline-grid;grid-template-columns:auto auto;gap:6px;max-width:none}
.yesno button{
  min-height:var(--tap);padding:0 var(--s5);
  border:var(--bw-ctl) solid var(--line);border-radius:var(--r-sm);background:var(--surface);
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-md);color:var(--ink-2);
  display:inline-flex;align-items:center;justify-content:center;gap:6px;cursor:pointer;transition:all var(--fast);
}
.yesno button svg{width:18px;height:18px}
.yesno button:hover{border-color:var(--ink-3)}
.yesno button[aria-pressed="true"][data-v="yes"]{background:var(--ok);border-color:var(--ok);color:#fff}
.yesno button[aria-pressed="true"][data-v="no"]{background:var(--navy);border-color:var(--navy);color:#fff}
/* After the base rules, not before them, or the 18px icon above wins. */
@media (min-width:768px) and (pointer:fine){
  .yesno button{min-height:var(--ctl-h);padding:0 var(--s4);font-size:var(--fs-sm)}
  .yesno button svg{width:14px;height:14px}
}

/* Conditional reveal.
   No bar, no indent. A revealed field was marked with a 3px red-pink rule
   and shifted 18px right of its neighbours, which did three unwanted
   things: it read as an error in a palette where red IS the error colour,
   it left a ragged left edge wherever some fields in a section were
   conditional and others were not, and - because `animation: ... both`
   holds a transform on the element for good - it made every revealed field
   a containing block, which is half of why the pickers inside one were
   clipped. The field appearing is the signal; it does not also need a
   stripe. The fade stays, without the transform. */
.field--when{animation:revealFade var(--base) both}
@keyframes revealFade{from{opacity:0}to{opacity:1}}
@media (prefers-reduced-motion:reduce){ .field--when{animation:none} }

/* Follow-up questions.
   A question and the question it opens are ONE question, so the follow-up
   is drawn inside its own question's cell rather than as the next cell of
   the grid. The injury report's Cause of Incident was nine Yes/No pills
   with nine empty cells between them, rearranging itself nine times as
   somebody answered; now answering one grows one cell.

   No bar and no indent, for the reason the note above gives: a rule down
   the side reads as an error in a palette where red IS the error colour,
   and an indent leaves a ragged left edge. The grouping is carried by
   proximity instead - tight under its parent, a full gap to the next
   question - which is the one signal that cannot be misread as a state. */
/* A yes/no question, asked and answered on one line.
   The label takes the room it needs and the two pills sit at the end of
   the same line; below 480px, or behind a long question, the label wraps
   and the pills drop under it on their own line, which is the phone
   layout unchanged. The follow-up is a sibling of the control rather
   than a child, so it always breaks to its own full-width line.

   Carries the `.fgrid >` prefix for the reason this stylesheet keeps
   relearning: the density block declares `.wz .fgrid > .field{display:
   block}`, which is three classes deep and beats a plainer selector
   however far down the file it sits. */
.wz .fgrid > .field.field--inline{display:flex;flex-wrap:wrap;align-items:center;column-gap:var(--s4)}
/* The answer sits WITH its question, not at the far edge of the row.
   The label grew to fill first, which pushed Yes/No nine hundred pixels
   away from the words it answers and left the eye to travel the gap -
   Saad, 2026-11-05: "the buttons are too far away from their questions".
   It takes the width it needs instead, and the pills follow it. A long
   question takes the line and the pills drop underneath, which is the
   same wrap the phone already does. */
.wz .fgrid > .field.field--inline > .field__label{flex:0 1 auto;margin:0;max-width:72ch}
.wz .fgrid > .field.field--inline > .field__c{flex:0 0 auto}
.wz .fgrid > .field.field--inline > .field__follow{flex:1 0 100%}

.field__follow{margin-top:var(--s3)}
.field__follow > .field{margin-bottom:var(--s3)}
.field__follow > .field:last-child{margin-bottom:0}
/* The wizard's own density, which the grid rules only reach for a direct
   child of .fgrid - a follow-up is one level deeper. */
.field__follow .field__label{font-size:var(--fs-sm);line-height:1.35;margin:0 0 var(--s1)}
.wz .field__follow .textarea{min-height:64px}

/* Error summary at the top of a step */
.errsum ol{margin:var(--s2) 0 0;padding-left:var(--s5);font-size:var(--fs-sm)}
.errsum a{font-weight:600}

/* Suggested corrective action card */
.sug{
  border:var(--bw-ctl) solid var(--line);border-radius:var(--r);background:var(--surface);
  padding:var(--s4);margin-bottom:var(--s3);transition:border-color var(--fast),background var(--fast);
}
.sug.is-on{border-color:var(--red);background:var(--red-050)}
.sug__head{display:flex;gap:var(--s3);align-items:flex-start}
.sug__body{flex:1;min-width:0}
.sug__why{font-size:var(--fs-xs);color:var(--ink-3);margin-top:2px}
.sug__fields{margin-top:var(--s3);padding-top:var(--s3);border-top:1px dashed var(--line);display:none}
.sug.is-on .sug__fields{display:block}
.sug .field{margin-bottom:var(--s3)}

/* ---------- 17. The wizard, as a modal ------------------------------------
   Filling a form is an overlay over the list you came from, not a page you
   navigate away to. That buys two things: the list stays behind it, and the
   panel can use the full width of a desktop instead of the 780px reading
   column a standalone page wants.

   Density: margins tighten everywhere, but type and hit areas tighten only
   from 768px up AND only where there is a real pointer. On a phone, or a
   gloved hand on an iPad, targets stay at 44px and inputs stay at 16px -
   under 16px iOS zooms the page on focus, and under 44px things get
   mis-tapped. Density is for the desk, not for the deck.
   ========================================================================== */
.modal__panel--wz{
  max-width:1180px;max-height:96dvh;overflow:hidden;
  display:flex;flex-direction:column;
}
.modal__panel--wz .modal__body{
  padding:0;flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden;
}

.wz{display:flex;flex-direction:column;min-height:0;flex:1}

/* Header: what you are filling, where you are, and the live tally */
.wz__head{
  display:flex;align-items:center;gap:var(--s3);padding:var(--s3) var(--s4);
  border-bottom:1px solid var(--line-2);background:var(--surface);flex:none;
}
.wz__titles{min-width:0;flex:1}
.wz__title{
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-lg);line-height:1.2;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.wz__sub{
  font-size:var(--fs-2xs);color:var(--ink-3);line-height:1.3;display:flex;gap:var(--s2);
  flex-wrap:wrap;align-items:center;margin-top:2px;
}
.wz__tally{display:flex;gap:var(--s1);flex:none;flex-wrap:wrap;justify-content:flex-end}
.wz__tally .chip{min-height:22px;font-size:var(--fs-2xs);padding:1px var(--s2)}
.wz__bar{height:3px;background:var(--line-2);flex:none}
.wz__bar i{display:block;height:100%;background:var(--red);transition:width var(--base)}

/* Body: the index rail plus the step itself */
.wz__body{display:flex;min-height:0;flex:1;overflow:hidden}
.wz__nav{
  display:none;width:236px;flex:none;border-right:1px solid var(--line-2);
  background:var(--surface-2);overflow-y:auto;padding:var(--s2) 0;
}
.wz__navhead{
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-3xs);letter-spacing:.07em;
  text-transform:uppercase;color:var(--ink-3);padding:var(--s2) var(--s3) var(--s1);
}
.wz__step{
  display:flex;align-items:flex-start;gap:var(--s2);width:100%;text-align:left;
  padding:var(--s2) var(--s3);font-size:var(--fs-sm);line-height:1.35;color:var(--ink-2);
  border-left:3px solid transparent;transition:background var(--fast),color var(--fast);
}
.wz__step:hover{background:rgba(33,43,57,.05);color:var(--ink)}
.wz__step.is-current{
  background:var(--surface);border-left-color:var(--red);color:var(--ink);
  font-weight:600;font-family:var(--font-head);
}
.wz__step.is-locked{opacity:.45;pointer-events:none}
.wz__step__mark{
  width:17px;height:17px;border-radius:50%;flex:none;margin-top:1px;display:grid;place-items:center;
  border:var(--bw-ctl) solid var(--line);background:var(--surface);color:transparent;font-size:var(--fs-3xs);
  font-family:var(--font-head);font-weight:700;
}
.wz__step__mark svg{width:10px;height:10px;stroke-width:3.4}
.wz__step.is-done .wz__step__mark{background:var(--ok);border-color:var(--ok);color:#fff}
.wz__step.is-error .wz__step__mark{background:var(--red);border-color:var(--red);color:#fff}
.wz__step__t{min-width:0;flex:1}
.wz__step__n{display:block;font-size:var(--fs-3xs);color:var(--ink-3);font-weight:400;font-family:var(--font-body)}
.wz__main{flex:1;min-width:0;overflow-y:auto;padding:var(--s4);-webkit-overflow-scrolling:touch}

.wz__foot{
  display:flex;align-items:center;gap:var(--s2);padding:var(--s3) var(--s4);flex:none;
  border-top:1px solid var(--line-2);background:var(--surface);
  padding-bottom:calc(var(--s3) + env(safe-area-inset-bottom));
}
.wz__foot .grow{flex:1;min-width:0}
.wz__saved{
  font-size:var(--fs-2xs);color:var(--ink-3);display:flex;align-items:center;gap:var(--s1);
  white-space:nowrap;opacity:.55;transition:opacity var(--fast);
}
.wz__saved svg{width:13px;height:13px;color:var(--ok)}
/* Beside Save draft, and the same size as it. This was a borderless ghost
   with an 18px glyph in a 36px box, which beside a full-height button with a
   word in it read as an afterthought - "why is the trash so small" was the
   first thing said about it. It keeps a button's footprint and border now,
   and its glyph is the larger of the two, so the two controls in that corner
   look like the pair of choices they are. Still not red at rest: it is the
   destructive one and should not be the loudest thing in the bar until it is
   pointed at. */
.wz__del{width:var(--tap);min-width:var(--tap)}
.wz__del svg{width:21px;height:21px}
.wz__del:hover{background:var(--red-050);border-color:var(--red);color:var(--red)}

@media (min-width:1024px){
  .wz__nav{display:block}
  .wz__main{padding:var(--s5) var(--s6)}
}

/* ---- density ---- */
.wz .field{margin-bottom:10px}
/* A paired row is a grid child too, and it is not a .field, so it was the
   one thing on a phone with no space under it. Below 768px the grid's row
   gap is 0 and every cell pays for its own margin; `.row` paid nothing, so
   Job Title ran straight into Employee ID, Date and Time into Date of Hire,
   and Supervisor into the name beneath it. Measured at 390: four 0px gaps
   among nineteen 10px ones. Reset again at 768px, where the grid supplies
   the gap and a margin here would make rows 30px where fields are 20px. */
.wz .fgrid > .row{margin-bottom:10px}
.wz .fgrid{gap:0 var(--s3)}
.wz .fsection{margin-bottom:var(--s4)}
.wz .fsection__head{margin-bottom:var(--s3)}
.wz .fsection__title{font-size:var(--fs-ctl)}
.wz .fsection__help{font-size:var(--fs-sm);max-width:80ch}
.wz .field__label{font-size:var(--fs-sm);margin-bottom:4px}
.wz .field__hint{font-size:var(--fs-2xs);margin-top:3px}
.wz .citem{padding:var(--s2) var(--s3);margin-bottom:5px}
.wz .citem__label{font-size:var(--fs-md);padding-top:4px}
.wz .choices{gap:6px}
.wz .choice{min-height:54px;padding:var(--s2) var(--s3)}
.wz .choice__title{font-size:var(--fs-md)}
.wz .choice__desc{font-size:var(--fs-xs)}
.wz .rep__row{padding:var(--s2) var(--s3)}
.wz .rep__grid{gap:var(--s2)}
.wz .sug{padding:var(--s3);margin-bottom:var(--s2)}
.wz .review__sec{margin-bottom:var(--s2)}
.wz .review__head{padding:var(--s2) var(--s3)}
.wz .review__body{padding:var(--s2) var(--s3)}
.wz .review__pair{padding:var(--s1) 0;font-size:var(--fs-sm)}
.wz .alert{padding:var(--s3);font-size:var(--fs-sm)}
.wz .section-title{margin:var(--s4) 0 var(--s2)}
.wz .photo-grid{grid-template-columns:repeat(auto-fill,minmax(74px,1fr));gap:6px}
.wz .sig-pad{height:112px}
/* A signature inside a repeater row takes the whole row. */
.wz .rep__sig{grid-column:1/-1}
.wz .sig-pad--sketch{height:340px}
.wz .notecard{padding:var(--s2) var(--s3);font-size:var(--fs-sm)}

@media (min-width:768px) and (pointer:fine){
  .wz{--tap:36px}
  /* The picker belongs in this list. Left out of it, it kept the full-size
     padding and type while every field beside it tightened, and rendered
     eleven pixels taller than its neighbours on the same row.

     Carries the body[data-module] prefix so it outranks the module-wide
     control block near the end of this file. That block exists to beat the
     desk theme, not to beat the wizard's own density - without the prefix it
     won on specificity and forced every field back to full size in here. */
  body[data-module] .wz .input,
  body[data-module] .wz .select,
  body[data-module] .wz .textarea,
  body[data-module] .wz .combo__input{
    font-size:var(--fs-md);padding:6px 10px;min-height:var(--ctl-h);
  }
  /* ...except the two that draw an arrow, or the text runs under it. */
  body[data-module] .wz .select,
  body[data-module] .wz .combo__input{padding-right:34px;background-size:15px;background-position:right 10px center}
  /* Same reason as above: these set properties the module-wide control block
     also sets, so they carry the prefix to stay ahead of it. */
  body[data-module] .wz .textarea{min-height:64px}
  .wz .select{padding-right:32px;background-size:15px;background-position:right 9px center}
  body[data-module] .wz .btn{min-height:var(--ctl-h);font-size:var(--fs-sm);padding:0 var(--s3)}
  /* ...except a button that is only an icon. The line above is for buttons
     with a word in them, and it beat `.btn--icon{padding:0}` on specificity:
     12px of padding each side of a 36px box left the glyph TEN pixels to
     draw itself in, squashed from 21 wide to 10 while keeping its height.
     That - not the icon's own size - is why the trash in the wizard footer
     looked wrong, and it was doing the same to every icon-only button in
     here. Same prefix as the line above, so it can actually win. */
  body[data-module] .wz .btn--icon{padding:0;width:var(--tap)}
  .wz .btn--lg{min-height:40px;font-size:var(--fs-md);padding:0 var(--s5)}
  .wz .pill{min-height:var(--ctl-h);font-size:var(--fs-sm);padding:0 var(--s3)}
  .wz .citem__opt{min-height:var(--ctl-h);min-width:52px;font-size:var(--fs-sm)}
  .wz .yesno button{min-height:var(--ctl-h);font-size:var(--fs-sm);padding:0 var(--s4)}
  .wz .yesno button svg{width:14px;height:14px}
  /* The Attachments / Notes tabs. The track is the item plus 3px padding
     top and bottom plus its border, so the item is sized to make the whole
     control --ctl-h and sit level with the buttons beside it. It was 46px
     against their 36. The inner radius stays one step under the track's,
     which is how a segmented control is supposed to nest. */
  .wz .seg__item{min-height:calc(var(--ctl-h) - 8px);font-size:var(--fs-sm)}
  .wz .seg__item svg{width:15px;height:15px}
  .wz .check{min-height:var(--ctl-h)}
  .wz .check__box{width:22px;height:22px}
  .wz .choice{min-height:46px}
  .wz .choice__icon{width:32px;height:32px}
  .wz .choice__mark{width:20px;height:20px}
}

/* Three columns of fields once the panel has room for them — but only where
   the label sits above its control. With the label beside it (below) a third
   of the panel holds a 150px label and a 200px input, and every second label
   wraps to three lines. Two wide columns of aligned rows beat three narrow
   columns of cramped ones, so three is kept for touch, where labels stack. */
@media (min-width:1200px) and (pointer:coarse){
  .wz .fgrid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .wz .fgrid > .full{grid-column:1 / -1}
  .wz .fgrid > .span2{grid-column:span 2}
}

/* ---- the capture sheet ---------------------------------------------------
   One layout, top-aligned, for every field on every step.

   Two earlier attempts are worth recording, because this is the third. The
   first put each label beside its own control inside a two-column grid: every
   cell worked out its own label width, so no two labels ended on one edge and
   no two controls began on one. The second made it one grid per section with
   `display:contents` on the field, which did straighten those two edges - but
   only for the fields that stayed in the table. A narrative, a repeater, a
   signature or a two-up row all need the full width, so each one broke out as
   a full-width block with its label above it, left-aligned, untinted and
   unruled.

   Measured on the Injury step, that came to six fields in the table and six
   broken out of it - half and half, so neither mode read as the rule and the
   page looked like two forms spliced together. Labels began at two different
   x positions, controls at two more, and control widths came in four sizes
   between 159px and 630px.

   So the table goes. Labels sit above their controls, every field starts on
   the same left edge, every control fills its cell, and the fields that need
   width take two columns instead of changing shape. Top-aligned is also the
   faster of the two to complete when label lengths vary, and these run from
   "Report Date" to "At the time of the incident the employee was...".

   The phone layout was already this; it is now the only layout, which is why
   there is far less of it. */
@media (min-width:768px){
  .wz .fgrid{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
    gap:var(--s5) var(--s5);
    border:0;background:none;padding:0;
  }
  /* A real box again, not display:contents - the field owns its own cell, so
     `span 2` means something and the label cannot drift from its control. */
  .wz .fgrid > .field{display:block;margin:0;min-width:0}
  /* The grid owns the spacing from here up; the phone margin would stack on
     top of it and make a paired row sit 30px below where a field sits 20. */
  .wz .fgrid > .row{margin:0}

  .wz .fgrid > .field > .field__label{
    display:block;text-align:left;
    margin:0 0 var(--s1);padding:0;
    background:none;border:0;
    font-size:var(--fs-sm);line-height:1.35;
  }
  .wz .fgrid > .field > .field__c{
    display:block;padding:0;border:0;min-width:0;
  }
  /* One width rule: a control fills the cell it was given. The cell is half
     the sheet, which is the readable width the 340px cap was reaching for -
     and unlike the cap it keeps its edge aligned with everything above it. */
  .wz .fgrid > .field > .field__c > .input,
  .wz .fgrid > .field > .field__c > .select,
  .wz .fgrid > .field > .field__c > .textarea,
  .wz .fgrid > .field > .field__c > .combo,
  .wz .fgrid > .field > .field__c > .combo > .combo__input{
    max-width:none;width:100%;
  }
  .wz .fgrid .field__hint{font-size:var(--fs-2xs);margin:var(--s1) 0 0}

  /* What needs the width takes two columns. It does not change shape to get
     it: same label position, same left edge, same everything. */
  .wz .fgrid > .full,
  .wz .fgrid > .row{grid-column:1 / -1}
  .wz .fgrid > .full{display:block;padding:0;border:0}
  .wz .fgrid > .full > .field__label{
    text-align:left;background:none;border:0;padding:0 0 var(--s1);margin:0;
  }
  .wz .fgrid > .full > .field__c{padding:0;border:0}

  /* The two-up row carries the SAME two columns and the same gap as the grid
     it sits in, so a field inside one lines up with the field above it.

     It used to keep Bootstrap's flex columns and merely zero their gutters,
     then add a 20px right pad to the first - which left a control in a row
     ten pixels narrower than a control in a plain cell, on every row. Ten
     pixels is small enough to read as "not quite aligned" rather than as a
     different width, which is the worst size for it to be. */
  .wz .fgrid > .row{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
    gap:var(--s5) var(--s5);
    margin-left:0;margin-right:0;padding:0;border:0;
  }
  .wz .fgrid > .row > [class*="col-"]{
    padding-left:0;padding-right:0;
    flex:none;width:auto;max-width:none;min-width:0;
  }
  .wz .fgrid > .row .field{display:block;margin:0}
  .wz .fgrid > .row .field > .field__label{
    text-align:left;background:none;border:0;padding:0 0 var(--s1);margin:0;
  }
  .wz .fgrid > .row .field > .field__c{padding:0;border:0}

  /* A revealed field is marked where it now has an edge to mark: beside the
     whole field, not between a label cell and a control cell that no longer
     exist. */
  .wz .fgrid > .field--when{animation:none}
}

/* ---- a tone per stage ----------------------------------------------------
   Fifteen sections of grey is one wall. A tone per stage gives the eye
   somewhere to be, and the same tone appears on the index so the left rail
   doubles as the legend. Every one of these is already in the palette.

   The tone is decoration over a signal that is already there: the stage is
   named in its header and numbered in the index, so this survives a printout
   and a colour-blind reader with nothing lost. */
.fsection{--sec:var(--navy); --sec-bg:var(--surface-2)}
.fsection[data-tone="0"]{--sec:var(--red);   --sec-bg:var(--red-050)}
.fsection[data-tone="1"]{--sec:var(--info);  --sec-bg:var(--info-bg)}
.fsection[data-tone="2"]{--sec:var(--ok);    --sec-bg:var(--ok-bg)}
.fsection[data-tone="3"]{--sec:var(--warn);  --sec-bg:var(--warn-bg)}
.fsection[data-tone="4"]{--sec:var(--navy);  --sec-bg:#eef1f4}
.fsection[data-tone="5"]{--sec:#0f6659;      --sec-bg:#e1f1ee}
/* A caption over the sheet, not a slab of colour. The tint was doing the
   shouting and the title could not be read over it; the rule does the same
   job in 3px. */
.fsection__head{
  border-left:3px solid var(--sec);background:var(--sec-bg);
  border-radius:var(--r-sm) var(--r-sm) 0 0;padding:6px var(--s4);
  display:flex;align-items:baseline;gap:var(--s3);flex-wrap:wrap;
}
/* `.wz .fsection__title` above sets 16px, so the caption has to match that
   specificity or it stays a heading sitting in a caption's space. */
.fsection__title,
.wz .fsection__title{
  color:var(--sec);font-size:var(--fs-xs);letter-spacing:.06em;text-transform:uppercase;line-height:1.3;
}
.fsection__help,
.wz .fsection__help{color:var(--ink-2);font-size:var(--fs-2xs);margin:0}
/* The caption sits ON the sheet, so their corners meet.

   This was already here and did nothing: it lived in a
   `(min-width:1024px) and (pointer:fine)` block at `.fsection__head`
   specificity, and `.wz .fsection__head` further up sets
   `margin-bottom:var(--s3)` - a class more, which a media query does not
   make up for. So the caption floated 12px above the sheet with its top
   corners rounded and its bottom squared, over a sheet whose top corners
   were squared to meet it: two curves and two square corners, none of them
   meeting. Measured at 1440px, where the rule was supposed to be winning.

   It applies at every width now, and carries the same specificity as the
   rule it has to beat. */
.fsection__head,
.wz .fsection__head{margin-bottom:0;border-bottom:0}
.fsection__head + .fgrid,
.fsection__head ~ .fgrid,
.wz .fsection__head + .fgrid,
.wz .fsection__head ~ .fgrid{border-top-left-radius:0;border-top-right-radius:0}
/* ...and the caption needs air under it. It is MEANT to sit on the sheet,
   which is why it carries no bottom margin - but with the margin at zero
   the first question's label was pressed against the underside of the
   caption bar with nothing between them (Saad, 2026-11-05: "the section
   headers touching the next element below it"). The room goes INSIDE the
   grid, so the caption and the sheet still meet. */
.fsection__head + .fgrid,
.wz .fsection__head + .fgrid{padding-top:var(--s4)}

.wz__step[data-tone] .wz__step__mark{border-color:var(--st,var(--line))}
.wz__step[data-tone="0"]{--st:var(--red)}
.wz__step[data-tone="1"]{--st:var(--info)}
.wz__step[data-tone="2"]{--st:var(--ok)}
.wz__step[data-tone="3"]{--st:var(--warn)}
.wz__step[data-tone="4"]{--st:var(--navy)}
.wz__step[data-tone="5"]{--st:#0f6659}
.wz__step[data-tone].is-current{box-shadow:inset 3px 0 0 var(--st)}

/* Phone and small tablet: the sheet is the screen, and the index becomes a
   scrolling strip of pips above the fields. */
.wz__navstrip{display:none}
@media (max-width:1023px){
  .modal__panel--wz{max-height:100dvh;height:100dvh;border-radius:0;max-width:none}
  .wz__navstrip{
    display:flex;gap:6px;overflow-x:auto;padding:var(--s2) var(--s4);flex:none;
    border-bottom:1px solid var(--line-2);background:var(--surface-2);scrollbar-width:none;
  }
  .wz__navstrip::-webkit-scrollbar{display:none}
  .wz__pip{
    flex:none;min-height:26px;padding:0 10px;border-radius:var(--r-full);border:1px solid var(--line);
    background:var(--surface);font-family:var(--font-head);font-weight:600;font-size:var(--fs-2xs);
    color:var(--ink-3);display:inline-flex;align-items:center;justify-content:center;gap:var(--s1);
    /* Below 1024px this strip is the ONLY way to jump between steps - the
       .wz__nav list that does it above that width is not rendered - and
       the pills were 26px tall, one of them 22px wide with nothing in it
       but an icon. That is a finger-sized job done with a pinhead.

       The pill keeps its size and the HIT AREA grows instead: 26 + 9 above
       + 9 below is 44, and making the pill itself 44 would put another 18
       pixels of chrome across the top of a phone screen that is already
       showing a form. The strip's own 8px padding absorbs most of it.
       Sideways it reaches 3px each way into the 6px gap, so two
       neighbours' hit areas meet and never overlap. */
    position:relative;min-width:44px;
  }
  .wz__pip::after{
    content:'';position:absolute;top:-9px;bottom:-9px;left:-3px;right:-3px;
  }
  .wz__pip.is-current{background:var(--navy);border-color:var(--navy);color:#fff}
  .wz__pip.is-done{border-color:var(--ok);color:var(--ok)}
  .wz__pip.is-error{border-color:var(--red);color:var(--red)}
  .wz__pip svg{width:12px;height:12px}
}

/* ---------- 18. Compact table with spreadsheet column filters -------------
   The forms list is a worklist people scan, not a document they read. Fixed
   layout, one line per cell, 12.5px, ~30px rows, and every column carries its
   own filter the way a spreadsheet does: sort, search the values, tick the
   ones you want. Nothing above the table competes with it - no status pill
   row, no banners, just four small counters.
   ========================================================================== */
.xt-wrap{
  overflow:auto;-webkit-overflow-scrolling:touch;
  max-height:min(66dvh,760px);border-radius:var(--r-lg);
  border:1px solid var(--line);background:var(--surface);
}
.xt{
  width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;
  font-size:var(--fs-sm);line-height:1.35;
}
.xt th{
  position:sticky;top:0;z-index:2;background:var(--surface-2);padding:0;
  border-bottom:1px solid var(--line);border-right:1px solid var(--line-2);
  text-align:left;font-family:var(--font-head);font-weight:700;font-size:var(--fs-3xs);
  letter-spacing:.05em;text-transform:uppercase;color:var(--ink-3);white-space:nowrap;
}
.xt th:last-child,.xt td:last-child{border-right:0}
.xt__h{display:flex;align-items:center;gap:2px;padding:var(--s1) var(--s1) var(--s1) var(--s2);min-height:32px}
.xt__lab{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;cursor:pointer}
.xt__lab:hover{color:var(--ink)}
.xt__sort{width:11px;height:11px;flex:none;color:var(--red);opacity:0}
.xt th.is-sorted .xt__sort{opacity:1}
.xt__fbtn{
  width:22px;height:22px;border-radius:var(--r-xs);display:grid;place-items:center;flex:none;
  color:var(--ink-3);transition:background var(--fast),color var(--fast);
}
.xt__fbtn svg{width:13px;height:13px}
.xt__fbtn:hover{background:rgba(33,43,57,.09);color:var(--ink)}
.xt__fbtn.is-on{background:var(--red);color:#fff}

.xt td{
  padding:var(--s1) var(--s2);border-bottom:1px solid var(--line-2);border-right:1px solid var(--line-2);
  vertical-align:middle;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.xt tbody tr:nth-child(even){background:#fbfcfd}
.xt tbody tr:hover{background:var(--surface-2);cursor:pointer}
.xt tbody tr:last-child td{border-bottom:0}
.xt .chip{min-height:20px;font-size:var(--fs-2xs);padding:0 var(--s2);line-height:1.6}
.xt .chip svg{width:11px;height:11px}
.xt .avatar--sm{width:20px;height:20px;font-size:var(--fs-3xs)}
.xt__code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:var(--fs-2xs);color:var(--ink-2)}
.xt__t{font-weight:600;font-family:var(--font-head);font-size:var(--fs-sm);color:var(--ink)}
.xt__cell{display:flex;align-items:center;gap:var(--s1);min-width:0}
.xt__cell > span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.xt__num{text-align:right;font-variant-numeric:tabular-nums}
.xt tbody tr.is-draft td:first-child{box-shadow:inset 3px 0 0 var(--warn)}
.xt tbody tr.is-alert td:first-child{box-shadow:inset 3px 0 0 var(--red)}
.xt__none{padding:var(--s7) var(--s5);text-align:center;color:var(--ink-3)}
/* The worklist pages its render once a filter leaves more rows than one
   screenful. Scoped under the module like every other control here, so
   the desk theme's own .btn cannot reach it. */
/* A standing notice above the worklist - today, that the list has been cut.
   Scoped under the module like every other control here: the desk theme
   defines plenty of bare class names and a shorthand beside ours would win
   properties we never declared. */
body[data-module] .note{padding:var(--s3) var(--s4);border-radius:var(--r-sm);
  border:1px solid var(--line);background:var(--surface-2);color:var(--ink-1);
  font-size:.8125rem;line-height:1.45}
body[data-module] .note--warn{border-color:var(--warn);background:var(--warn-bg)}
.xt__pager{display:flex;align-items:center;justify-content:center;gap:var(--s4);
  padding:var(--s4) var(--s5);border-top:1px solid var(--line)}
.xt__pager button[disabled]{opacity:.45;cursor:default}

/* Column filter popover */
.xpop{
  position:fixed;z-index:88;width:274px;max-width:calc(100vw - 20px);
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  box-shadow:var(--e3);overflow:hidden;font-size:var(--fs-sm);
  /* place() caps the height to the room actually available, so the sheet is
     laid out as a column and the value list is the part that gives way. Left
     as a plain block, a capped sheet clipped its own Clear/Done buttons. */
  display:flex;flex-direction:column;
}
.xpop__sort{padding:var(--s1)}
.xpop__item{
  display:flex;align-items:center;gap:var(--s2);width:100%;padding:var(--s2) var(--s2);border-radius:var(--r-xs);
  text-align:left;font-size:var(--fs-sm);color:var(--ink);
}
.xpop__item:hover{background:var(--surface-2)}
.xpop__item svg{width:15px;height:15px;color:var(--ink-3);flex:none}
.xpop__item.is-on{font-weight:600;font-family:var(--font-head)}
.xpop__item.is-on svg{color:var(--red)}
.xpop__sep{height:1px;background:var(--line-2)}
.xpop__search{padding:var(--s2) var(--s2) var(--s1)}
.xpop__search .input{min-height:34px;font-size:var(--fs-sm);padding:6px 10px}
.xpop__all{padding:2px var(--s1)}
/* `flex:0 1 auto;min-height:0` is what lets the list - and only the list -
   give way when place() caps the sheet's height. Without min-height:0 a flex
   item refuses to shrink below its content and the foot is pushed out. */
.xpop__list{max-height:212px;overflow-y:auto;padding:0 var(--s1) var(--s1);overscroll-behavior:contain;flex:0 1 auto;min-height:0}
.xpop__foot{flex:none}
.xpop__opt{
  display:flex;align-items:center;gap:var(--s2);width:100%;padding:var(--s1) 6px;border-radius:var(--r-xs);
  text-align:left;font-size:var(--fs-sm);color:var(--ink);
}
.xpop__opt:hover{background:var(--surface-2)}
.xpop__tick{
  width:17px;height:17px;border-radius:50%;border:var(--bw-ctl) solid var(--line);flex:none;
  display:grid;place-items:center;color:transparent;background:var(--surface);
}
.xpop__tick svg{width:10px;height:10px;stroke-width:3.6}
.xpop__opt.is-on .xpop__tick{background:var(--red);border-color:var(--red);color:#fff}
.xpop__t{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.xpop__n{color:var(--ink-3);font-size:var(--fs-2xs);font-variant-numeric:tabular-nums;flex:none}
.xpop__empty{padding:var(--s4);text-align:center;color:var(--ink-3);font-size:var(--fs-sm)}
.xpop__foot{display:flex;gap:6px;padding:var(--s2);border-top:1px solid var(--line-2);background:var(--surface-2)}
.xpop__foot .btn{flex:1;min-height:34px;font-size:var(--fs-sm);padding:0 var(--s2)}

/* Small counters. Four facts, not four billboards. */
.kpis--mini{grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--s2)}
.kpi--mini{padding:var(--s2) var(--s3);border-radius:var(--r-sm);text-align:left}
.kpi--mini .kpi__value{font-size:19px;line-height:1.1}
.kpi--mini .kpi__label{font-size:var(--fs-2xs);margin-top:0;line-height:1.25}
@media (min-width:640px){ .kpis--mini{grid-template-columns:repeat(4,minmax(0,1fr))} }

/* Toolbar above the table */
.xbar{display:flex;gap:var(--s2);align-items:center;flex-wrap:wrap;margin-bottom:var(--s3)}
.xbar .search{flex:1 1 240px}
.xbar .search .input{min-height:38px;font-size:var(--fs-md)}
.xbar__count{font-size:var(--fs-sm);color:var(--ink-3);white-space:nowrap}
.xbar__count b{font-family:var(--font-head);color:var(--ink)}

/* The same filter body, reused inside the phone sheet: no floating frame, no
   shadow, and it fills the modal instead of hovering over the page. */
.xpop--sheet{
  position:static;width:auto;max-width:none;border:0;border-radius:0;box-shadow:none;
  margin:calc(var(--s5) * -1);
}
.xpop--sheet .xpop__list{max-height:46dvh}
.xpop--sheet .xpop__foot{position:sticky;bottom:0}
.xpop__allt{
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-2xs);
  letter-spacing:.05em;text-transform:uppercase;
}

/* ---------- 19. Two layout corrections ------------------------------------ */

/* A field that is neither half-width nor a full-width block spans two cells.
   In the two-column grid that is the whole row; in the wizard's three-column
   grid at 1200px it is two thirds. Without this rule such a field sat in one
   narrow cell from 768px up. */
@media (min-width:768px){
  .fgrid > .span2{grid-column:span 2}
}

/* Thirteen columns do not fit a 1440 desktop, and they should not have to -
   sideways scroll is what a spreadsheet does. What must not happen is the
   folio scrolling out of sight with it, so the first column is pinned.
   Sticky cells need an opaque background of their own, and the row stripe has
   to travel with them, hence the per-row custom property. */
.xt tbody tr{--rowbg:var(--surface)}
.xt tbody tr:nth-child(even){--rowbg:#fbfcfd;background:var(--rowbg)}
.xt tbody tr:hover{--rowbg:var(--surface-2)}
.xt th:first-child,
.xt td:first-child{position:sticky;left:0;z-index:1;background:var(--rowbg)}
.xt th:first-child{background:var(--surface-2);z-index:3}
.xt th:first-child::after,
.xt td:first-child::after{
  content:"";position:absolute;top:0;right:-1px;bottom:0;width:1px;background:var(--line);
}

/* ---------- 20. Coverage: who is on which site ---------------------------
   The screen that replaces the Lucid org chart. The chart's problem is not
   that it is ugly - it is that a move is a dragged box and a hand-routed
   connector, and the only record of who is where is the picture.

   So: the board reads like the chart (manager, then their sites, then the
   crew on each), but every move is a button as well as a drag, several people
   can move at once, and nothing is ever said in colour alone.
   ========================================================================== */

/* A person, everywhere they appear */
.pl{display:flex;align-items:center;gap:var(--s2);min-width:0}
.pl__body{min-width:0;flex:1}
.pl__name{font-family:var(--font-head);font-weight:600;font-size:var(--fs-md);line-height:1.25;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pl__sub{font-size:var(--fs-2xs);color:var(--ink-3);line-height:1.3;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pl__av{
  width:26px;height:26px;border-radius:50%;flex:none;display:grid;place-items:center;
  background:var(--line-2);color:var(--ink-3);border:1.5px dashed var(--line);
}
.pl__av--open{border-color:var(--red);color:var(--red);background:var(--red-050)}
.pl__av svg{width:14px;height:14px}

/* ---- the board ---- */
.board{display:flex;flex-direction:column;gap:var(--s5)}
.bmgr{border:1px solid var(--line);border-radius:var(--r-lg);background:var(--surface);overflow:hidden;box-shadow:var(--e1)}
.bmgr__head{
  display:flex;align-items:center;gap:var(--s3);padding:var(--s3) var(--s4);
  background:var(--navy);color:#fff;
}
.bmgr__head .avatar{background:rgba(255,255,255,.18)}
.bmgr__name{font-family:var(--font-head);font-weight:700;font-size:var(--fs-lg);line-height:1.2}
.bmgr__sub{font-size:var(--fs-2xs);opacity:.75;line-height:1.3}
.bmgr__tally{margin-left:auto;display:flex;gap:var(--s1);flex-wrap:wrap;justify-content:flex-end}
.bmgr__tally .chip{background:rgba(255,255,255,.16);color:#fff}
.bmgr__body{display:grid}

/* The card-and-row layout that first replaced the chart lived here. It is
   gone: a site is a small table now (.st / .cw, section 21), because cards
   at three columns showed two managers on a 1900px screen. */

/* ---- bulk selection bar ---- */
.selbar{
  position:sticky;bottom:0;z-index:40;margin-top:var(--s4);
  display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap;
  padding:var(--s3) var(--s4);border-radius:var(--r-lg);
  background:var(--navy);color:#fff;box-shadow:var(--e3);
}
.selbar__n{font-family:var(--font-head);font-weight:700;font-size:var(--fs-md)}
.selbar .btn{min-height:38px}
.selbar .btn--ghost{color:#fff;border-color:rgba(255,255,255,.25)}
.selbar .btn--ghost:hover{background:rgba(255,255,255,.12);color:#fff}

/* ---- move sheet ---- */
.movewho{
  display:flex;flex-direction:column;gap:6px;padding:var(--s3);margin-bottom:var(--s3);
  background:var(--surface-2);border:1px solid var(--line);border-radius:var(--r);
  max-height:150px;overflow-y:auto;
}
.movegrp{margin-bottom:var(--s3)}
.movegrp__h{
  display:flex;align-items:center;gap:6px;font-family:var(--font-head);font-weight:700;
  font-size:var(--fs-3xs);letter-spacing:.06em;text-transform:uppercase;color:var(--ink-3);
  padding:var(--s2) 0 6px;
}
.movegrp__h svg{width:13px;height:13px}
.movegrp .choice{min-height:52px}

/* ---- my sites modal ---- */
.mj__me{display:flex;align-items:center;gap:var(--s3);padding-bottom:var(--s4);border-bottom:1px solid var(--line-2)}
.mj__name{font-family:var(--font-head);font-weight:700;font-size:var(--fs-xl);line-height:1.2}
.mj__site{
  border:1px solid var(--line);border-radius:var(--r);padding:var(--s4);margin-bottom:var(--s3);
  background:var(--surface);
}
.mj__sitehead{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap}
.mj__sitename{font-family:var(--font-head);font-weight:700;font-size:var(--fs-lg);flex:1;min-width:0}

/* ---- toast with an action ---- */
.toast__action{
  flex:none;min-height:32px;padding:0 var(--s3);border-radius:var(--r-sm);
  background:rgba(255,255,255,.16);color:#fff;font-family:var(--font-head);font-weight:700;
  font-size:var(--fs-sm);letter-spacing:.02em;
}
.toast__action:hover{background:rgba(255,255,255,.28)}
.toast--err .toast__action,.toast--danger .toast__action{background:rgba(0,0,0,.2)}

/* ---- the org tree, for the reporting view ---- */
.tree{list-style:none;margin:0;padding:0}
.tree ul{list-style:none;margin:0;padding:0 0 0 var(--s5);position:relative}
.tree ul::before{content:"";position:absolute;left:10px;top:0;bottom:14px;width:1px;background:var(--line)}
.tree li{position:relative;padding:2px 0}
.tree ul li::before{content:"";position:absolute;left:calc(var(--s5) * -1 + 10px);top:22px;width:12px;height:1px;background:var(--line)}
.tree__node{
  display:flex;align-items:center;gap:var(--s2);padding:var(--s1) var(--s2);border-radius:var(--r-sm);
  border:1px solid var(--line-2);background:var(--surface);min-height:42px;
}
.tree__node:hover{border-color:var(--line);background:var(--surface-2)}
.tree__node .chip{flex:none}
.tree__sites{margin-left:auto;display:flex;gap:var(--s1);flex-wrap:wrap;justify-content:flex-end}

/* ---- gaps ---- */
.gap{
  display:flex;align-items:flex-start;gap:var(--s3);padding:var(--s3) var(--s4);
  border-bottom:1px solid var(--line-2);
}
.gap:last-child{border-bottom:0}
.gap__icon{
  width:34px;height:34px;border-radius:var(--r-sm);flex:none;display:grid;place-items:center;
  background:var(--red-050);border:1px solid var(--red-100);color:var(--red);
}
.gap__icon--warn{background:var(--warn-bg);border-color:#f0dcb8;color:var(--warn)}
.gap__icon svg{width:17px;height:17px}
.gap__body{flex:1;min-width:0}
.gap__t{font-family:var(--font-head);font-weight:600;font-size:var(--fs-md)}
.gap__d{font-size:var(--fs-sm);color:var(--ink-3);line-height:1.4;margin-top:2px}

/* ---------- 21. Coverage, dense ------------------------------------------
   The first cut showed two managers on a 1900px screen. For a department of
   37 across nine sites that is a scrolling exercise, not a board.

   So: a site is a small table, not a card. The lane header is one row. The
   columns are computed from the width rather than fixed at three, which gives
   six on a wide monitor and two on a tablet without another breakpoint.

   Hit areas follow the same rule as the wizard: rows tighten to 26px only
   from 768px up AND only where there is a real pointer. On a touch screen
   they stay at 40px, because a mis-tap here moves a person to the wrong job.
   ========================================================================== */

/* ---- the counter strip: one row, not two ---- */
.kpis--strip{
  display:grid;gap:6px;grid-template-columns:repeat(2,minmax(0,1fr));
}
@media (min-width:560px){ .kpis--strip{grid-template-columns:repeat(3,minmax(0,1fr))} }
@media (min-width:900px){ .kpis--strip{grid-template-columns:repeat(6,minmax(0,1fr))} }
.kpi--strip{
  padding:6px 10px;border-radius:var(--r-sm);display:flex;align-items:baseline;gap:6px;
}
.kpi--strip .kpi__value{font-size:var(--fs-xl);line-height:1.1}
.kpi--strip .kpi__label{font-size:var(--fs-3xs);margin:0;line-height:1.2;color:var(--ink-3)}

/* ---- the provenance note, folded away ---- */
.fold{border:1px solid var(--line);border-radius:var(--r-sm);background:var(--surface)}
.fold > summary{
  list-style:none;cursor:pointer;padding:6px 10px;font-size:var(--fs-xs);color:var(--ink-2);
  display:flex;align-items:center;gap:6px;min-height:32px;
}
.fold > summary::-webkit-details-marker{display:none}
.fold > summary svg{width:14px;height:14px;color:var(--ink-3);flex:none}
.fold > summary:hover{background:var(--surface-2)}
.fold__body{padding:0 10px 10px;font-size:var(--fs-sm);line-height:1.5;color:var(--ink-2)}

/* ---- manager lane ---- */
.bmgr{margin-bottom:var(--s3)}
.bmgr__head{padding:6px var(--s3);min-height:40px;cursor:pointer;user-select:none}
.bmgr__head .avatar{width:26px;height:26px;font-size:var(--fs-3xs)}
.bmgr__name{font-size:var(--fs-md);display:flex;align-items:center;gap:6px}
.bmgr__sub{display:none}
.bmgr__fold{color:rgba(255,255,255,.7);display:flex;flex:none}
.bmgr__fold svg{width:16px;height:16px;transition:transform var(--fast)}
.bmgr.is-folded .bmgr__fold svg{transform:rotate(-90deg)}
.bmgr.is-folded .bmgr__body{display:none}
.bmgr__tally .chip{min-height:20px;font-size:var(--fs-3xs);padding:0 var(--s2)}
.bmgr__tally .chip svg{width:11px;height:11px}
.bmgr__body{
  padding:var(--s2);gap:var(--s2);
  grid-template-columns:repeat(auto-fill,minmax(268px,1fr));
}

/* ---- a site is a small table ---- */
.st{
  border:1px solid var(--line);border-radius:var(--r-sm);background:var(--surface);
  display:flex;flex-direction:column;min-width:0;overflow:hidden;
  transition:border-color var(--fast),box-shadow var(--fast);
}
.st--child{border-left:3px solid var(--navy)}
.st--future{border-style:dashed;background:var(--surface-2)}
.st--bare{border-color:var(--red-100)}
.st.is-drop{border-color:var(--red);box-shadow:0 0 0 2px var(--red-050)}
.st__h{
  display:flex;align-items:center;gap:6px;padding:var(--s1) 6px var(--s1) var(--s2);
  background:var(--surface-2);border-bottom:1px solid var(--line-2);min-height:32px;
}
.st--bare .st__h{background:var(--red-050)}
.st__name{
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-sm);line-height:1.2;
  flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.st__n{
  font-family:var(--font-head);font-weight:700;font-size:var(--fs-2xs);color:var(--ink-3);
  background:var(--line-2);border-radius:var(--r-full);padding:0 6px;flex:none;
}
.st__add{
  width:26px;height:26px;border-radius:var(--r-xs);display:grid;place-items:center;flex:none;
  color:var(--ink-3);
}
.st__add:hover{background:var(--line);color:var(--ink)}
.st__add svg{width:14px;height:14px}
.st__sub{
  display:flex;align-items:center;gap:var(--s1);flex-wrap:wrap;padding:var(--s1) var(--s2);
  font-size:var(--fs-3xs);color:var(--ink-3);border-bottom:1px solid var(--line-2);
}
.st__sub .chip{min-height:18px;font-size:var(--fs-3xs);padding:0 6px}
.st__sub .chip svg{width:10px;height:10px}
.st__t{width:100%;border-collapse:collapse;font-size:var(--fs-xs)}
.st__t td{padding:0;vertical-align:middle}
.st__empty{padding:var(--s2);font-size:var(--fs-2xs);color:var(--ink-3);text-align:center}

/* ---- a crew row ---- */
.cw{border-bottom:1px solid var(--line-2)}
.cw:last-child{border-bottom:0}
.cw:hover{background:var(--surface-2)}
.cw.is-sel{background:var(--red-050)}
.cw.is-lead{box-shadow:inset 3px 0 0 var(--navy)}
.cw.is-open{background:repeating-linear-gradient(45deg,transparent,transparent 5px,var(--line-2) 5px,var(--line-2) 6px)}
.cw.is-dragging{opacity:.4}
.cw__pick{width:26px;text-align:center}
.cw__pick button{
  width:18px;height:18px;border-radius:var(--r-xs);border:var(--bw-ctl) solid var(--line);background:var(--surface);
  display:grid;place-items:center;color:transparent;
}
.cw__pick button svg{width:11px;height:11px;stroke-width:3.4}
.cw.is-sel .cw__pick button{background:var(--red);border-color:var(--red);color:#fff}
.cw__nm{
  padding:3px var(--s1) 3px 0;min-width:0;max-width:0;width:100%;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  font-weight:600;font-family:var(--font-head);font-size:var(--fs-xs);
}
.cw__lv{
  padding:3px var(--s1);white-space:nowrap;font-size:var(--fs-3xs);color:var(--ink-3);
  font-family:var(--font-head);font-weight:600;letter-spacing:.02em;text-align:right;
}
.cw__lv b{color:var(--navy)}
.cw__lv .warn{color:var(--warn)}
.cw__lv .red{color:var(--red)}
.cw__mv{width:28px;text-align:center}
.cw__mv button{
  width:24px;height:24px;border-radius:var(--r-xs);display:grid;place-items:center;color:var(--line);
}
.cw__mv button:hover{background:var(--line-2);color:var(--ink)}
.cw__mv button svg{width:13px;height:13px}
.cw__grab{display:none}

/* Touch keeps its targets. Density is for the desk. */
.cw__pick button,.cw__mv button{min-height:36px;min-width:36px}
.cw__nm{padding-top:8px;padding-bottom:8px}
@media (min-width:768px) and (pointer:fine){
  .cw__pick button{min-height:18px;min-width:18px}
  .cw__mv button{min-height:24px;min-width:24px}
  .cw__nm{padding-top:3px;padding-bottom:3px}
  .cw__grab{display:table-cell;width:14px;color:var(--line);cursor:grab}
  .cw__grab svg{width:12px;height:12px;display:block}
}

/* ---- a wider board deserves the wider container ---- */
.cov .container--dash{max-width:none}
.cov .page-head{margin-bottom:var(--s3)}
.cov .page-head__sub{display:none}
@media (min-width:1200px){ .cov .page-head__sub{display:block;font-size:var(--fs-sm)} }

/* ==========================================================================
   Addendum - two rules that are NOT in the mockup's stylesheet
   ==========================================================================
   Everything above this line is dpe.css and sq.css byte for byte. These two
   rules fix a defect that is visible in the mockup itself: .choice__title and
   .choice__desc are styled but left as inline spans, so a form's name runs
   straight into its description - "Injury Illness ReportAnybody hurt or made
   ill at work" - on the wizard's first step, which is the first thing anybody
   filing a form reads. Kept here, separately and labelled, so the copied
   stylesheet stays a clean copy and a re-import does not silently drop them.
   ========================================================================== */
.choice__title{display:block}
.choice__desc{display:block}

/* ==========================================================================
   Addendum - holding the desk's own stylesheets off six class names
   ==========================================================================
   The module runs inside the Frappe desk, which has already loaded
   desk.bundle.css and business_theme_v14.css. Six class names collide with
   them: container, btn, card, page-head, avatar and search. Same-specificity
   rules are won by whichever comes last and this stylesheet is injected
   inline after both, so the collisions only bite where the desk declares a
   property the mockup's stylesheet does not.

   That is exactly what happened to page-head: business_theme_v14 pins it to
   height:50px, the mockup never sets a height, and the New rule button
   dropped out of the header and landed on top of the counters below it.

   Scoped to body[data-module], which every screen carries and nothing else in
   the desk does, and listed one property at a time so it stays obvious what is
   being undone. (It used to key off a .sf-body class, which stopped applying
   the moment the pages started setting their own body class - `cov` on
   Coverage, `ntf` on Notifications - and the Notifications header went back to
   sitting on top of its counters.)
   ========================================================================== */
body[data-module] .page-head{height:auto;min-height:0}
/* ...and makes it sticky (position:sticky; top:var(--navbar-height)), with no
   background of its own: once the page scrolled, the title and its buttons
   floated over the counters and the rows going under them. The mockup's head
   scrolls with the page, like any other heading. */
body[data-module] .page-head{position:static;top:auto;z-index:auto}
/* ...and on scroll the desk's own script adds .drop-shadow to every
   .page-head, whose rule is a white background with !important and a shadow:
   the title band turned into a white box the moment anybody scrolled. The
   heading sits on the page like the rest of it, scrolled or not. */
body[data-module] .page-head,
body[data-module] .page-head.drop-shadow{background-color:transparent !important;box-shadow:none !important;transition:none}
body[data-module] .container,
body[data-module] .container--dash{width:auto;max-width:none;margin-left:0;margin-right:0}
body[data-module] .card{display:block}

/* --------------------------------------------------------------------------
   The properties the desk sets and the mockup does not.

   Measured, not guessed: the module was rendered side by side with the mockup
   served standalone and every computed property compared. All 13 design tokens
   came back identical - the stylesheet is whole - and only these differed,
   every one a property dpe.css/sq.css never declares, so the desk's value
   survived to the end of the cascade.

   Re-measure with scripts/verify-styles.js after touching anything here.
   -------------------------------------------------------------------------- */

/* desk.bundle: .page-head{background:var(--bg-color)} - paints a near-white
   band behind the page title that the mockup does not have. */
body[data-module] .page-head{background:transparent}

/* business_theme_v14: heading colour #1f272e, one shade off the brand ink -
   enough to see when a heading sits beside body text. */
body[data-module] .page-head__title{color:var(--ink)}

/* desk.bundle: .btn{box-shadow:...; line-height:1.5}. The desk's buttons are
   raised where the mockup's are flat, and the line-height shifts the label off
   centre inside a 44px target. */
body[data-module] .btn{box-shadow:none;line-height:1.55}
body[data-module] .btn--primary{box-shadow:var(--e1)}

/* business_theme_v14: `input{border-radius:0 !important}` - a bare element
   selector with !important, so squaring off the search field is the one place
   the module has to answer in kind. This is the most visible single
   difference on the worklist. */
body[data-module] .input,
body[data-module] .select,
body[data-module] .textarea,
/* The picker is an <input> too, and it was the one field this list missed -
   so it sat square-cornered beside rounded boxes on every step that asks for
   a Project, an Employee or a Supervisor. It is the single most visible
   mismatch in the forms, and it is the one reported from the build. */
body[data-module] .combo__input{border-radius:var(--r-sm) !important}

/* Frappe injects its favourite-page star into what it takes to be the page
   header, and .page-head is laid out with space-between - so a third child
   pushes the actions into the middle of the row instead of flush right. That
   is the whole of why "New form" sat in the middle. */
body[data-module] .mytime-fav-page-star,
body[data-module] .page-head > .fav-page-star{display:none !important}

/* desk.bundle: `button:focus{outline:-webkit-focus-ring-color auto 5px}`.

   Two things going on, and only measuring separated them. The desk's rule is
   plain :focus where the mockup's ring is :focus-visible, so it paints for a
   programmatic focus too - and every overlay focuses its first control on
   open, which is why a heavy black box sat around the close button of every
   modal the moment it appeared.

   It also wins on specificity: `button:focus` is (0,1,1) against the mockup's
   `:focus-visible` at (0,1,0), so even when the ring should have been red it
   came out black. Both halves are answered here: the plain focus outline is
   dropped, and the mockup's keyboard ring is restated above the desk's weight
   so it still appears for somebody tabbing through. */
body[data-module] :focus{outline:none}
body[data-module] button:focus-visible,
body[data-module] a:focus-visible,
body[data-module] input:focus-visible,
body[data-module] select:focus-visible,
body[data-module] textarea:focus-visible,
body[data-module] [tabindex]:focus-visible{
  /* The ring follows the shape of what it rings; a flat 4px corner around an
     8px control reads as a second, mismatched outline. */
  outline:3px solid var(--red);outline-offset:2px;border-radius:var(--r-xs);
}

/* The Home button added to the topbar (see patch_runtime.py). The mockup's
   chrome up there is icon buttons and a role chip, so this is tightened to sit
   among them rather than read as a page action.

   Its height is deliberately left alone: .btn carries min-height:var(--tap),
   which keeps it at 44px and level with the search and bell beside it. An
   earlier version set height:36px here, which did nothing - min-height won -
   and a rule that does not do what it says is worse than no rule. */
body[data-module] .topbar__home{padding:0 var(--s3);font-size:var(--fs-sm);gap:6px;flex:none}
body[data-module] .topbar__home svg{width:15px;height:15px}

/* The printed-form preview, the wizard's last stop for a permit (see
   stepPreview in wizard.js).

   The document arrives as a whole HTML page with its own stylesheet - the
   print format the desk uses - so it renders inside an iframe. Dropped into
   the modal directly its rules would restyle the wizard around it, which is
   exactly the collision the .sf-body scoping elsewhere in this file exists to
   undo. white background because a print format is written for paper and
   assumes one. */
body[data-module] .wz__previewhead{
  display:flex;align-items:flex-start;justify-content:space-between;gap:var(--s3);
  margin-bottom:12px;
}
body[data-module] .wz__previewhead .muted{font-size:var(--fs-sm);margin-top:2px}
body[data-module] .wz__previewdoc{
  display:block;width:100%;height:min(70vh,760px);
  border:1px solid var(--line);border-radius:10px;background:#fff;
}

/* ---- To sign -------------------------------------------------------------
   The signing screen (templates/pages/sign.html). Written against the
   mockup's own card and chip vocabulary rather than a palette of its own, so
   a superintendent who only ever opens this screen still lands somewhere that
   looks like the rest of the app. */
body[data-module="sign"] .signlist{display:grid;gap:var(--s2)}
body[data-module="sign"] .signrow{
  display:flex;align-items:center;gap:var(--s3);width:100%;text-align:left;
  padding:var(--s3) 14px;min-height:var(--tap);
  background:var(--surface);border:1px solid var(--line);border-radius:12px;
  cursor:pointer;
}
body[data-module="sign"] .signrow:hover{border-color:var(--red);background:var(--surface-2)}
body[data-module="sign"] .signrow__icon{
  display:grid;place-items:center;flex:none;width:38px;height:38px;border-radius:10px;
  background:var(--bg-soft,#f2f4f7);
}
body[data-module="sign"] .signrow__icon svg{width:18px;height:18px}
body[data-module="sign"] .signrow__body{display:grid;gap:2px;min-width:0;flex:1}
body[data-module="sign"] .signrow__title{font-weight:600}
body[data-module="sign"] .signrow__sub{font-size:var(--fs-sm);color:var(--muted);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body[data-module="sign"] .signrow__auth{
  display:inline-flex;align-items:center;gap:6px;font-size:var(--fs-sm);color:var(--ink)}
body[data-module="sign"] .signrow__auth svg{width:14px;height:14px}
body[data-module="sign"] .signrow__end{display:flex;align-items:center;gap:var(--s2);flex:none}

/* The permit itself, framed: the print format's stylesheet is written for a
   sheet of paper and would restyle the dialog around it. */
.signdoc{
  display:block;width:100%;height:min(52vh,560px);
  border:1px solid var(--line);border-radius:10px;background:#fff;margin-bottom:14px;
}
.signlines{display:grid;gap:6px;margin-bottom:14px}
.signline{
  display:flex;align-items:center;justify-content:space-between;gap:var(--s3);
  padding:10px var(--s3);border:1px solid var(--line);border-radius:10px;
}
.signpad{border:1px solid var(--line);border-radius:12px;padding:var(--s3);background:var(--surface)}
.signpad__head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--s3)}
.signpad__head .muted{font-size:var(--fs-sm);margin-top:2px;max-width:62ch}
.signpad__canvas{
  display:block;width:100%;height:180px;margin:10px 0;
  border:1px dashed var(--line);border-radius:10px;background:#fff;
  touch-action:none;cursor:crosshair;
}
.signpad__foot{display:flex;align-items:center;justify-content:space-between;gap:var(--s3);flex-wrap:wrap}

/* ---- The searchable pickers ----------------------------------------------
   Jobs and people are the two lists that are long in the real app - over a
   thousand each - so both are a type-ahead rather than a select (see
   comboHTML in wizard.js). Styled off .select so a step that mixes the two
   does not look like it was built by two people. */
.combo{position:relative}
/* Two-to-a-row outside the capture sheet: a Bootstrap row of two col-md-6,
   stacking on a phone via Bootstrap's own breakpoint. The fgrid is a CSS
   grid, so the row has to claim the whole track; the cols' 15px gutters
   cancel against the row's -15px margins, keeping edges flush. Our own .row
   utility (line ~589) collides with Bootstrap's - its 8px gap makes the two
   exact-50% cols overflow the line and wrap, and its align-items:center
   floats the shorter field - so both are reset to Bootstrap's values here. */
.fgrid > .row{grid-column:1 / -1;gap:0;align-items:stretch}
/* ...but only THAT row wants Bootstrap's negative margins. `.row` is one of
   the bare names desk.bundle.css also defines, and its -15px gutters were
   landing on our own little button rows inside a field - which is why Mark
   affected area(s) sat 15px left of every other control on the step, and
   why the signature and attachment buttons did too. Measured: -15px on
   every `.row` in the panel. A row inside a field is ours, not the grid's. */
body[data-module] .field .row{margin-left:0;margin-right:0}
/* Not scoped to `.wz`: the same fields are drawn on the detail page and
   in the permit views, and Bootstrap's gutters reach those too. */
/* A combo shown read-only: greyed, no pointer, no caret. */
.combo--ro .combo__input{background:var(--surface-2);color:var(--ink-3);cursor:not-allowed}
/* The picker wears exactly what .input wears. It had its own dress - a 1px
   border where every box beside it has 1.5px, a hardcoded 10px corner against
   their 8px, and a hard outline on focus instead of the soft ring - and
   because the picker is how Project, Employee and Supervisor are answered, it
   sits next to an ordinary text box on nearly every step. Two controls doing
   the same job should not look like two different controls. */
/* The searchable picker IS a dropdown and now looks like one. It and the
   native select were the same box to the pixel - same height, border,
   radius, background and type - and differed only in that one of them
   carried an arrow saying it opens a list. Same arrow, same room for it,
   so "type of incident" and "body part(s) affected" are one control. */
.combo__input{
  width:100%;min-height:var(--tap);padding:10px var(--s3);
  padding-right:38px;
  border:var(--bw-ctl) solid var(--line);border-radius:var(--r-sm);
  background-color:var(--surface);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2375787d' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 12px center;background-size:18px;
  font:inherit;font-size:var(--fs-ctl);color:var(--ink);
  /* `font:inherit` is a SHORTHAND, so it brings the body's line-height
     (1.55) in with it, while `.input,.select,.textarea` three rules up
     declare 1.4. Same font, same padding, same border, same min-height -
     and the picker still rendered 2.4px taller than the box beside it on
     every phone-width step. Only below 768px: above that the density block
     gives all four an explicit min-height and the difference is absorbed.
     The third of this family in this file - a shorthand resetting the
     longhand next to it - after `background:` wiping the select's chevron
     and Bootstrap's `margin:0 -15px`. Measured: 46.80px against 44.39px at
     390px wide; 44.39 against 44.39 now. */
  line-height:1.4;
}
.combo__input:hover{border-color:#c9d0d8}
.combo__input:focus{outline:0;border-color:var(--red);box-shadow:0 0 0 3px var(--red-050)}
.combo__list{
  /* Opened, the list is moved to the body so no transformed or
     overflow:hidden ancestor can clip it (see wizard.js portal()). Out
     there it is no longer inside the modal's stacking context, so it needs
     a z-index above the scrim or the dialog it belongs to paints over it -
     which is what happened the first time this was moved. */
  position:fixed;z-index:var(--z-popover);
  max-height:min(46vh,320px);overflow-y:auto;
  /* A wheel that reaches the list's edge must stop there. Without this it
     chains into the step's scroller, the field slides under the open list,
     and the matches reposition mid-wheel - unusable. */
  overscroll-behavior:contain;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-sm);
  box-shadow:0 12px 28px rgba(33,43,57,.16);
}
.combo__opt{
  display:flex;align-items:center;justify-content:space-between;gap:var(--s3);
  width:100%;text-align:left;padding:10px var(--s3);min-height:var(--tap);
  background:none;border:0;border-bottom:1px solid var(--line);
  font:inherit;color:var(--ink);cursor:pointer;
}
.combo__opt:last-child{border-bottom:0}
.combo__opt:hover,.combo__opt.is-active{background:var(--bg-soft,#f2f4f7)}
.combo__opt.is-active{box-shadow:inset 3px 0 0 var(--red)}
.combo__opt-l{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.combo__opt-m{flex:none;font-size:var(--fs-xs);color:var(--muted)}
.combo__none{padding:var(--s3);color:var(--muted);font-size:var(--fs-sm)}

/* ---- audit 2026-09-28 --------------------------------------------------- */
/* 5a - a long definition sits behind an icon beside its label. */
.guide{display:inline-flex;position:relative;vertical-align:middle;margin-left:6px}
.guide__btn{
  display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;
  padding:0;border:1px solid var(--line);border-radius:50%;background:var(--surface);
  color:var(--navy);cursor:help;flex:none;
}
.guide__btn svg{width:14px;height:14px}
.guide__btn:hover,.guide.is-open .guide__btn{border-color:var(--navy);background:var(--surface-2)}
.guide__pop{
  display:none;position:fixed;z-index:70;width:min(380px,80vw);
  padding:var(--s3);border:1px solid var(--line);border-radius:var(--r);background:var(--surface);
  box-shadow:0 12px 28px rgba(33,43,57,.16);
  font-family:var(--font-body,inherit);font-weight:400;font-size:var(--fs-sm);line-height:1.45;
  color:var(--ink);text-align:left;white-space:normal;
}
.guide.is-open .guide__pop{display:block}
.guide__line{display:block}
.guide__line + .guide__line{margin-top:6px;padding-top:6px;border-top:1px solid var(--line-2,var(--line))}

/* 5c - the field that is missing is marked, not only listed. The wizard's
   sheet lays a field out with display:contents, so the marks go on its
   parts rather than on the field box. */
.field.is-invalid > .field__label{color:var(--red)}
.field.is-invalid .input,.field.is-invalid .select,.field.is-invalid .textarea,
.field.is-invalid .combo__input{border-color:var(--red);background:var(--red-050)}
/* No inset bar down the left of the control. It was drawn for the ruled table
   layout, where .field__c was a bordered cell and the bar sat on its edge;
   with the cell gone it floated to the left of the box as a red line attached
   to nothing. The red border and the red label already say it, twice. */
.field.is-invalid .yesno,.field.is-invalid .pillset,.field.is-invalid .rep,
.field.is-invalid .sig-pad,.field.is-invalid .photo-grid{outline:2px solid var(--red);outline-offset:2px;border-radius:var(--r-sm)}
/* The tinted label was the table's doing too: the label had a cell of its own
   to tint. Stacked above its control it is just a pink block behind one line
   of text, so the label states it in red and stops there. */

/* PR-01 - drafts offered back when the wizard opens. */
/* The limits line says nothing unless a limit is actually biting, and an
   empty <p> would still push the list down by its own margin. */
[data-draftlimits]:empty{display:none}
/* Drafts, gathered under the form they belong to. The heading carries the
   count against the per-form ceiling (2/5), because that ceiling is the only
   number in this list anybody has to act on - and it is counted per form, so
   a flat list could never show it. */
.draftgroup{display:flex;flex-direction:column;gap:var(--s2)}
.draftgroup + .draftgroup{margin-top:var(--s4)}
.draftgroup__head{
  display:flex;align-items:center;gap:var(--s2);
  padding-bottom:var(--s1);border-bottom:1px solid var(--line-2);
}
.draftgroup__icon{display:inline-flex;color:var(--ink-3);flex:none}
.draftgroup__icon svg{width:16px;height:16px}
.draftgroup__name{
  margin:0;font-family:var(--font-head);font-size:var(--fs-sm);font-weight:700;
  color:var(--ink);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.draftgroup__tally{display:inline-flex;align-items:center;gap:var(--s2);flex:none}
.draftgroup__count{
  font-size:var(--fs-2xs);font-weight:700;font-variant-numeric:tabular-nums;
  color:var(--ink-2);background:var(--surface-2);border:1px solid var(--line);
  border-radius:var(--r-full);padding:1px 8px;
}
/* At the ceiling it stops being a statistic and becomes the reason the next
   one will be refused, so it is allowed to look like a warning. */
.draftgroup__count.is-full{color:var(--red);border-color:var(--red-100);background:var(--red-050)}
.draftgroup__full{
  font-size:var(--fs-2xs);font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--red);
}
.draftgroup__note{margin:0;font-size:var(--fs-2xs);color:var(--ink-3)}
.draftgroup__note:empty{display:none}
/* A row in the "free up a slot" dialog: the same shape as a draft row, but
   it is not a button, because continuing one from there would walk away from
   the unsaved work that opened the dialog. */
.draftlist__item.is-static{cursor:default;background:none}
.draftlist__item.is-static:hover{background:none}

.draftlist{display:flex;flex-direction:column;gap:var(--s2)}
.draftlist__item{
  display:flex;align-items:center;gap:var(--s3);width:100%;text-align:left;
  padding:var(--s3);border:1px solid var(--line);border-radius:var(--r-sm);
  background:var(--surface);font:inherit;color:var(--ink);cursor:pointer;
}
.draftlist__item:hover{border-color:var(--navy);background:var(--surface-2)}
.draftlist__icon svg{width:20px;height:20px;color:var(--navy)}
.draftlist__body{flex:1;min-width:0;display:flex;flex-direction:column}
.draftlist__title{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.draftlist__sub{font-size:var(--fs-xs);color:var(--ink-3)}
.draftlist__go{display:inline-flex;align-items:center;gap:var(--s1);font-size:var(--fs-sm);font-weight:600;color:var(--navy)}
.draftlist__go svg{width:14px;height:14px}
/* The bin sits beside the card rather than inside it: a button cannot
   nest in a button, and the whole card stays one target for Continue. */
.draftlist__row{display:flex;align-items:center;gap:var(--s2)}
.draftlist__row .draftlist__item{flex:1;min-width:0}
.draftlist__del{flex:none;color:var(--ink-3)}
.draftlist__del:hover{background:var(--red-050);color:var(--red)}
.draftlist__del[disabled]{opacity:.5;pointer-events:none}
.wz__saved.is-failed{color:var(--red);opacity:1}
.wz__saved.is-failed svg{color:var(--red)}

/* D4 - an uploaded image shows itself. */
.photo--thumb{padding:0;position:relative;justify-content:flex-end}
.photo--thumb img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.photo--thumb span{position:relative;width:100%;padding:2px var(--s1);background:rgba(255,255,255,.85);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rep .photo--thumb{width:56px;height:56px;flex:none}

/* 5b - a picker is as wide as the other one-line boxes on the sheet. */
.wz .fgrid .combo{width:100%;max-width:340px}
.wz .fgrid .row .combo,.wz .rep .combo{max-width:none}

/* The photo viewer (DPE.lightbox): a picture over the page, like a photo on
   Facebook - dark, the picture as large as the screen allows, arrows either
   side, a strip of the form's other pictures underneath. */
.lbthumb{display:inline-block;line-height:0;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:#fff;cursor:zoom-in}
.lbthumb img{display:block;object-fit:cover}
.lbthumb:hover{border-color:var(--navy);box-shadow:var(--e1)}
/* Evidence card: the files attached to the form, pictures as squares. */
.evgrid{display:flex;flex-wrap:wrap;gap:var(--s2);align-items:flex-start}
.evgrid .lbthumb img{width:90px;height:90px}
/* A clip attached to a form, played where it sits. It is wider than a photo
   thumbnail because a video scrubber squeezed to 90px cannot be used. */
.evvid{
  display:block;width:220px;max-width:100%;border:1px solid var(--line);
  border-radius:8px;background:#000;
}
.evgrid .evvid{width:220px}
.photo--thumb{cursor:zoom-in}
.lb{
  position:fixed;inset:0;z-index:1100;background:#0e1014;color:#fff;
  display:grid;grid-template-rows:auto 1fr auto;
}
.lb[hidden]{display:none !important}
.lb__bar{display:flex;align-items:center;gap:var(--s3);padding:var(--s3) var(--s4);min-height:56px}
.lb__count{font-variant-numeric:tabular-nums;font-size:var(--fs-sm);color:rgba(255,255,255,.75);min-width:48px}
.lb__cap{flex:1;min-width:0;font-weight:600;font-size:var(--fs-md);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lb__btn{
  display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;
  border:0;background:rgba(255,255,255,.12);color:#fff;cursor:pointer;text-decoration:none;flex:none;
}
.lb__btn:hover{background:rgba(255,255,255,.24);color:#fff;text-decoration:none}
.lb__btn svg,.lb__nav svg{width:20px;height:20px}
.lb__stage{position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;
  padding:0 var(--s10);touch-action:pan-y}
.lb__img{max-width:100%;max-height:calc(100vh - 56px - 96px);object-fit:contain;cursor:zoom-in;
  user-select:none;box-shadow:0 12px 40px rgba(0,0,0,.45);background:#111}
.lb.is-zoomed .lb__stage{overflow:auto;display:block;padding:0;cursor:zoom-out}
.lb.is-zoomed .lb__img{max-width:none;max-height:none;cursor:zoom-out;margin:auto}
.lb__nav{
  position:absolute;top:50%;transform:translateY(-50%);width:48px;height:48px;border-radius:50%;
  border:0;background:rgba(255,255,255,.14);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;
}
.lb__nav:hover{background:rgba(255,255,255,.28)}
.lb__nav--prev{left:16px}
.lb__nav--next{right:16px}
.lb.is-single .lb__nav,.lb.is-zoomed .lb__nav{display:none}
.lb__strip{display:flex;gap:6px;justify-content:center;padding:var(--s2) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom));
  overflow-x:auto;min-height:12px}
.lb__thumb{flex:none;width:64px;height:48px;padding:0;border:2px solid transparent;border-radius:var(--r-xs);overflow:hidden;
  background:#222;cursor:pointer;opacity:.55}
.lb__thumb img{width:100%;height:100%;object-fit:cover;display:block}
.lb__thumb.is-on{border-color:#fff;opacity:1}
.lb__thumb:hover{opacity:.9}
.lb__spin{position:absolute;top:50%;left:50%;width:36px;height:36px;margin:-18px 0 0 -18px;border-radius:50%;
  border:3px solid rgba(255,255,255,.25);border-top-color:#fff;animation:lbspin .8s linear infinite;display:none}
.lb.is-loading .lb__spin{display:block}
@keyframes lbspin{to{transform:rotate(360deg)}}
@media (max-width:640px){
  .lb__stage{padding:0 var(--s2)}
  .lb__nav{width:40px;height:40px;background:rgba(0,0,0,.35)}
  .lb__nav--prev{left:6px}.lb__nav--next{right:6px}
  .lb__thumb{width:52px;height:40px}
}

/* The Forms list on a desktop: the table fills the screen (xtable fit), so the
   page's closing padding - room for the phone's bottom bar and the New button -
   would only be an empty band under it. */
@media (min-width:1024px){
  body[data-module="forms"] .main{padding-bottom:0}
  body[data-module="forms"] .container{padding-bottom:var(--s3)}
}

/* ---------- 16. Winning back the controls from the desk theme -------------

   This module renders inside the desk, and `desk.bundle.css` defines six of
   the same bare class names we do - btn, card, modal, avatar, row, col - plus
   the input elements. Both sides are a single class, so specificity ties and
   the desk's copy was landing last: every .btn and .input in here wore the
   desk's 1px border and its type size instead of ours, while .chip, .fcard
   and the rest - names the desk has never heard of - wore ours.

   That is the real reason the controls looked like they came from two
   different kits. It is not a value that was set wrong; it is a value that
   never applied. Restating them one level more specific, scoped to this
   module so nothing outside it is touched, is what makes the dress code
   actually take.

   Measured in the browser, not assumed: .btn computed to 1px/13px and .input
   to 1px/14px against the 1.5px/16px declared for them. */

body[data-module] .btn{
  border:var(--bw-ctl) solid var(--line);
  border-radius:var(--r-sm);
  font-size:var(--fs-md);
  font-family:var(--font-head);
  min-height:var(--tap);
}
body[data-module] .btn--primary{border-color:var(--red)}
body[data-module] .btn--lg{font-size:var(--fs-ctl);border-radius:var(--r)}
body[data-module] .btn--sm{min-height:34px;font-size:var(--fs-sm)}

body[data-module] .input,
body[data-module] .select,
body[data-module] .textarea{
  border:var(--bw-ctl) solid var(--line);
  border-radius:var(--r-sm);
  /* 16px exactly: below it, iOS zooms the page when the field takes focus. */
  font-size:var(--fs-ctl);
  min-height:var(--tap);
  font-family:var(--font-body);
  /* background-COLOR, not the shorthand. `background:` resets
     background-image with it, and this rule outranks `.select` - so the
     chevron the select draws to say it is a dropdown was being wiped here,
     leaving a box indistinguishable from a text field. */
  background-color:var(--surface);
}
body[data-module] .input:focus,
body[data-module] .select:focus,
body[data-module] .textarea:focus,
body[data-module] .combo__input:focus{
  outline:0;border-color:var(--red);box-shadow:0 0 0 3px var(--red-050);
}
