/* Step 6: the refreshed look, from Denys's South Region app (docs/SPEC.md, step 6 §2). Loaded last, so the shared
   pieces read the same on every page. The tokens are in css/app.css (:root).

   Shared components (the desk pages use them too):
   - Page header: .pghead > .pgt (h1.dtitle with .n, the grey count; p.pgsum, one line) + .pgact (the green
     button with an icon). A 2px ink rule under it. The older .dtop / .dtitle / .dbar / .dp-bar follow the same look.
   - Tabs: .utabs > button[role=tab][aria-selected] (+ .cnt): page-level underline tabs (ink 3px under the open one).
     The part panel's tabs (.ctabs / .ctabb) are underline tabs too.
   - Segmented control: .seg > button[aria-pressed], and the existing .segm / .seg2 / .qrow .qv: the selected one is
     black with white words; the group has 3px corners.
   - Lists and tables: .colhead (or table th): 13px upper case (12px in the reference; 13 is our smallest text), letter-spaced, ink-3, over a 2px ink rule; rows about
     64px with hairlines. .ghead: a group header row: a small drawing, an 18px bold title with a grey .gn count, a dot
     summary on the right (.gs > span > .dot), a chevron to fold.
   - Status: .pill (.good .bad .warn .plain) with a dot, and our .stag (Low diamond, Out triangle, On order box).
   - Search: .sbox (a 48px box, 2px ink border, the search icon), and the existing .field.big / .dfield.
   - Radii: var(--r) 4px for surfaces, var(--rc) 3px for controls and chips. */

/* ---------------------------------------------------------------- controls: 3px corners, the field edge */
.btn, .dbtn, .dgo, .go, .pin, .dsel, .field, .dfield, .scanbtn, .sq, .chip, .chip2, .abc, .unitbox, .wobox, .undo, .uchip, .unitin2,
.stepper > button, .stepper label, .stepper2, .reasons button, .ropt, .sphoto, .cpe-add, .mbtn, .retbtn.boxed, .fitunit, .lchip, .tag, .flag, .stag, .st,
.cbadge, .nbadge, .pimg img, .dpick, .rsteps li, .rln, .rnewtag, .jobparts { border-radius: var(--rc); }
.jobcard, .bigscan, .note, .dmodal, .toast, .menu, .scard .sc-relabel, .padjust, .picker2, .abox, .sign-in, .usug:focus-visible { border-radius: var(--r); }
.jobcard + .jobparts { border-top-left-radius: 0; border-top-right-radius: 0; }
.jobcard:has(+ .jobparts) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.dbtn, .btn, .pin, .dsel, .field, .scanbtn, .sq, .chip, .abc, .unitbox, .wobox, .undo, .stepper > button, .stepper label, .reasons button, .fitunit { border-color: var(--field); }
.dbtn:hover, .btn:hover, .dsel:hover { border-color: var(--ink-3); }
.dgo { font-weight: 700; gap: 8px; }
.dgo svg, .dbtn svg { flex: none; }
.dmodal { box-shadow: var(--shadow); border-color: var(--line); }
.toast { border-radius: var(--r); box-shadow: var(--shadow); }
.menu { border-color: var(--line); box-shadow: var(--shadow); border-radius: var(--r); }
:focus-visible { outline-color: var(--focus); }

/* ---------------------------------------------------------------- the page header */
.pghead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 2px solid var(--ink); }
.pgt { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dtitle, .pgt h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; margin: 0; white-space: nowrap; }
.dtitle .n, .pgt h1 .n { color: var(--ink-3); font-weight: 700; margin-left: 6px; }
.pgsum { margin: 0; font-size: 15px; color: var(--ink-2); line-height: 1.4; }
.pgsum:empty { display: none; }
.pgact { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pgact .dgo { height: 44px; padding: 0 18px; }
/* step 6: compact pages (below 1024px) start with the same page header, sized for phones: the title with its grey
   count (28px), the one-line summary, the 2px ink rule. The top bar then shows the brand and the actions only (its
   title hides once the page has a .pghead). .pghead.cph adds the 16px side gutter on a page with none of its own. */
@media (max-width: 1023.98px) {
  .pghead { padding: 16px 0 12px; gap: 10px 12px; align-items: flex-start; }
  .pgt { gap: 4px; }
  .dtitle, .pgt h1 { font-size: 28px; white-space: normal; }
  .pgsum { font-size: 15px; }
  .pghead.cph { margin: 0 16px; }
  body:has(#view .pghead) #hdr .hsep, body:has(#view .pghead) #hdr .hpage { display: none; }
}

/* ---------------------------------------------------------------- tabs: page-level underline tabs */
.utabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line2); }
.utabs > button, .utabs > a { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 10px 4px; margin-right: 18px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--ink-3); font-size: 15px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.utabs > [aria-selected="true"], .utabs > [aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.utabs .cnt { font-size: 13px; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.utabs > button:hover, .utabs > a:hover { color: var(--ink); }

/* ---------------------------------------------------------------- segmented control: the selected one black */
.seg { display: inline-flex; border: 1px solid var(--field); border-radius: var(--rc); overflow: hidden; }
.seg > button { min-height: 44px; border: 0; background: var(--paper); color: var(--ink-2); font-size: 14px; font-weight: 600; padding: 0 14px; white-space: nowrap; }
.seg > button + button { border-left: 1px solid var(--field); }
.seg > button[aria-pressed="true"], .seg > button[aria-selected="true"] { background: var(--ink); color: #FFFFFF; }
.segm, .seg2 { border-radius: var(--rc); }
.segm button, .seg2 button { border-color: var(--field); color: var(--ink-2); font-weight: 600; }
.segm button:first-child, .seg2 button:first-child { border-top-left-radius: var(--rc); border-bottom-left-radius: var(--rc); }
.segm button:last-child, .seg2 button:last-child { border-top-right-radius: var(--rc); border-bottom-right-radius: var(--rc); }
.segm button[aria-pressed="true"], .seg2 button[aria-pressed="true"] { background: var(--ink); color: #FFFFFF; border-color: var(--ink); font-weight: 700; }
/* the quick views (All / Low / Out / On order / Needs attention) */
.qv { border-color: var(--field); color: var(--ink-2); font-weight: 600; border-radius: 0; }
.qv b { color: var(--ink); }
.qrow > .qv:first-child { border-top-left-radius: var(--rc); border-bottom-left-radius: var(--rc); }
.qrow > .qv:last-child { border-top-right-radius: var(--rc); border-bottom-right-radius: var(--rc); }
.qv.on, .cparts .qv.on { background: var(--ink); border-color: var(--ink); color: #FFFFFF; font-weight: 700; }
.qv.on b, .cparts .qv.on b { color: #FFFFFF; }

/* ---------------------------------------------------------------- lists and tables */
.colhead, .dtable th, .ctable th, .htable th, .ptable th { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.dtable th { background: var(--paper); border-bottom: 2px solid var(--ink); height: 40px; }
.dtable th button:hover, .dtable th[aria-sort] { color: var(--ink); }
.dtable th button { text-transform: inherit; letter-spacing: inherit; font-weight: inherit; }
/* the Parts header block: white, the page header's rule on top; the table's heads carry the second rule */
.dbar { background: var(--paper); border-bottom: 0; }
.dbar .pghead { margin-bottom: 4px; }
.dtable td { border-bottom-color: var(--line2); }
.dtable tbody tr[data-id]:hover td { background: var(--surface-2); }
.dtable tbody tr.open td { background: var(--sel-bg); }
.dtable tr.grp th { background: var(--paper); text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 18px; font-weight: 800; padding: 16px 10px 10px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line2); }
.dtable tr.grp .gn { color: var(--ink-3); font-weight: 700; margin-left: 8px; }
.dtable tr.grp .gwhy { font-size: 14px; color: var(--ink-2); }
.ctable th, .htable th { border-bottom: 2px solid var(--ink); }
.ghead { width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 4px; border: 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line2); background: none; text-align: left; color: var(--ink); }
.ghead .gico { width: 64px; flex: none; color: var(--ink-2); }
.ghead .gt { font-size: 18px; font-weight: 800; }
.ghead .gn { font-size: 18px; font-weight: 700; color: var(--ink-3); }
.ghead .gs { margin-left: auto; display: flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; font-size: 13px; color: var(--ink-2); }
.ghead .gs > span { display: inline-flex; align-items: center; gap: 6px; }
.ghead .chev { flex: none; color: var(--ink-2); transition: transform 0.15s; }
.ghead[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; background: var(--ink-3); }
.dot.good { background: var(--good-dot); } .dot.bad { background: var(--bad-dot); } .dot.warn { background: var(--warn-dot); }

/* ---------------------------------------------------------------- status: a dot or our shape, the word, a tint */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--rc); font-size: 13px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { background: none; color: var(--ink-2); padding: 0 2px; font-weight: 600; }
.pill.good::before { background: var(--good-dot); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.plain::before { display: none; }
.stag, .st { font-weight: 700; }

/* ---------------------------------------------------------------- search boxes: 48px, a 2px ink border, the icon */
.sbox, .dfield, .field.big, .searchrow .field { height: 48px; border: 2px solid var(--ink); border-radius: var(--rc); background: var(--paper); }
.dfield:focus-within, .field.big:focus-within, .searchrow .field:focus-within, .sbox:focus-within { box-shadow: 0 0 0 1px var(--ink); border-color: var(--ink); }
.field.big input, .searchrow .field input { font-size: 18px; }
.findform .field { border: 2px solid var(--ink); border-radius: var(--rc); }      /* Find (home): the same search box, its own height */
.findform .field:focus-within { box-shadow: 0 0 0 1px var(--ink); }
.dfield input, .sbox input { font-size: 16px; }
.searchrow .scanbtn { height: 48px; }

/* ---------------------------------------------------------------- the desk side menu: counts in white boxes */
.navi .nbadge, .navi[aria-current="page"] .nbadge { margin-left: auto; min-width: 30px; height: 22px; padding: 1px 6px 0; border-radius: 2px; background: #FFFFFF; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 800; }
.navi[aria-current="page"] .nbadge { box-shadow: none; }

/* ---------------------------------------------------------------- phone: the top bar and the bottom tabs */
.hdr { border-bottom: 1px solid var(--line2); }
.hbrand { display: flex; flex-direction: column; justify-content: center; min-width: 0; min-height: 48px; text-decoration: none; color: var(--ink); line-height: 1.1; flex: none; }
.hbrand small { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.hbrand b { font-size: 17px; font-weight: 800; letter-spacing: 0.01em; white-space: nowrap; }
.hsep { width: 1px; height: 28px; background: var(--line); flex: none; }
.hdr .hpage { font-size: 18px; font-weight: 800; line-height: 1.15; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hsearch { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; flex: none; color: var(--ink); border-radius: var(--rc); }
.hsearch:active, .tagbtn:active { background: var(--g4); }
.tagbtn { border-radius: var(--rc); }
.nav { border-top: 1px solid var(--line2); }
.nav a { color: var(--ink-3); font-size: 13px; font-weight: 700; letter-spacing: 0.03em; }
.nav a[aria-current="page"], .nav.n4 a[aria-current="page"] { background: var(--paper); color: var(--ink); box-shadow: inset 0 3px 0 var(--green); }
.nav a[aria-current="page"] .sico { stroke-width: 2.4; }
.nav a:active { background: var(--surface-2); }
.cbadge { background: #FFFFFF; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); border-radius: 2px; }
.nav a[aria-current="page"] .cbadge { box-shadow: inset 0 0 0 1px var(--line); }

/* ---------------------------------------------------------------- phone sheets: a hairline under the bar, over the foot */
.msheet-bar { border-bottom: 1px solid var(--line2); }
.msheet-foot { border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- section heads on the phone pages: a 2px ink rule, no band */
.sechead, .dayh { background: none; border-top: 2px solid var(--ink); padding: 12px 0 8px; }
.sechead h2 { font-size: 18px; font-weight: 800; }
.sechead .lbl { color: var(--ink-3); }
.hdr.cbrand .hdr-left { gap: 12px; }
/* Find (home): the sync words in full; they may wrap onto two lines, right-aligned */
.hsync { display: flex; min-width: 0; max-width: 46vw; }
.hsync .sync2 { white-space: normal; text-align: right; line-height: 1.2; }
/* Find: the job (unit and work order) in a strip above the search box */
.jobstrip { display: flex; align-items: center; min-height: 56px; margin: 0 16px; border-bottom: 1px solid var(--line2); }
.jobstrip .jobbtn { flex: 1; min-width: 0; }
/* on the desk frame: a page that starts with its .pghead needs no title in the column's bar; a bar left with nothing
   to say (no back arrow, no sync state) goes */
.dph-col:has(.pghead) .dph-bar:not(:has(.back)) .hpage, .dph-col:has(.pghead) .dph-bar:not(:has(.back)) .hsep { display: none; }
.dph-col:has(.pghead) .dph-bar:not(:has(.back)):not(:has(.sync2)) { display: none; }
.dph-col .pghead { padding-top: 22px; }
.dph-col .pghead.cph { margin: 0 16px; }
/* on the desk the side menu is the brand: no second brand or search icon in the phone column */
.dphone .dph-bar .hbrand, .dphone .dph-bar .hsep, .dphone .dph-bar .hsearch { display: none; }
