/* BML OS shell — glue only (A1, rewritten by A1-fix). Loaded LAST, after os.css (generated by hub/tools/os-css-build.php): what the prototype
   built from <button>s but the hub builds from links and forms, plus the few things os.css lacks, in os.css's own tokens. No inline styles.
   Written inside the OS donut like os.css: @scope keeps it out of legacy bodies (<div class="legacy">) and the nested `:is(html.os:scope,#os-bump) { … }`
   gives each rule os.css's prefix (later file wins). The root element itself is `&.ui-v2 …`. The rules that must reach a legacy body sit outside. */

/* ---- legacy chrome: if an old page still emits its own sidebar/topbar it must not draw inside the OS frame ------------- */
html.os .hub-side,html.os .hub-topbar,html.os .hub-nav-backdrop{display:none!important}

/* ---- legacy confirm dialogs (ui.js `dialog.ui-confirm`, classed .legacy by os-shell.js) open CENTRED under the OS shell (A12-fix3) ------------------------
   hub.css's `*{margin:0}` cancels `dialog:modal{margin:auto}`. Outside the donut because the dialog IS a .legacy node; html.os only. */
html.os dialog.legacy[open]{margin:auto;inset:0;position:fixed}

/* ---- a legacy page body keeps the look it always had: os.css sets tokens, colour, size and font on the root, so re-assert the old shell's values on the wrapper (change with tokens.css / c3.css) ---- */
html.os .legacy{--ink:#211A1B;--muted:#5D5052;--line:#ECE0E0;--canvas:#FAF6F5;color:#211A1B;font-family:Inter,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;font-size:15px;line-height:1.55}
html.os.ui-v2 .legacy{--muted:#5C5152;--line:#E7E0E1;--canvas:#F7F5F5;font-size:15.5px;line-height:1.5}

@scope (html.os) to (.legacy) {
:is(html.os:scope,#os-bump) {

/* ---- links standing in for the prototype's buttons --------------------------------------------------------------- */
.brand,.nav-item,.avatar,.icon-button{text-decoration:none}
.nav-item{white-space:nowrap;min-width:44px;justify-content:center}
.nav-item:hover{color:var(--wine)}
.avatar{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
.global-search svg.icon{width:17px;height:17px;flex-shrink:0}
.global-search kbd{flex-shrink:0;font-family:Inter,Arial,sans-serif;color:#8a8183}   /* the reference's key hint is 12 px body type, not the New look's mono; #8A8183 = the search box's own colour (c3.css's `html.ui-v2 kbd` painted it #5C5152 on New-look pages) */
.global-search input{text-overflow:ellipsis;color:#2e2528}   /* S5: a long placeholder ends in an ellipsis, never cut mid-glyph; text colour = ink (c3.css gave New-look pages #2E2528 and plain pages the browser's black: now one value everywhere) */
.header-tools .icon-button svg.icon{width:20px;height:20px}

/* nav-item icons (S6): <span><svg class="icon"></svg></span> + label, 17 px line icons like the reference (os.css sizes `.nav-item svg`);
   the span is a flex item so the label keeps os.css's 8 px gap */
.nav-item>span{display:inline-flex;align-items:center;flex-shrink:0}

/* count bubbles some modules put inside a page label (<i class="hs-bubble">3</i>: Partners, Inspection, Equipment, Recruitment) */
.nav-item .hs-bubble{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;margin-left:6px;padding:0 6px;border-radius:99px;background:var(--pale);color:var(--wine);font-size:11px;font-weight:600;font-style:normal;line-height:1}

/* ---- a long module menu WRAPS onto further rows (A1 audit M4): the nav grows, nothing is hidden, nothing scrolls -------- */
.workspace-nav{height:auto}
.workspace-nav .nav-left{min-width:0;flex-wrap:wrap}
.nav-right{flex-shrink:0}
@media(min-width:1001px){
  .workspace-nav{gap:20px}
}
@media(min-width:561px){
  .workspace-nav .nav-left{row-gap:0}
}
/* the nav rows are full-height and clip, so the focus ring goes inside them */
.nav-item:focus-visible{outline-offset:-3px}

/* ---- main ---------------------------------------------------------------------------------------------------------- */
.page.wide{max-width:none}
.page{min-width:0}
/* os.css styles every <footer>; module views have their own footers (inspection, requisition) with their own classes */
:where(main.page) footer{border-top:0;display:block;justify-content:normal;align-items:normal;padding:0;font-size:inherit;color:inherit}
/* footer text: #8e8080 on white is 3.6:1 at 10 px (plan gap G8); --muted is 4.9:1 */
body.os-root>footer{color:var(--muted)}

/* ---- Courtney 31 Oct: fluid width (PR #16 FINANCE-AND-WIDTH): ChatGPT's four rules override os.css's 1440 px cap; left/right padding only ---- */
.page{max-width:none;width:100%;padding-left:2.5vw;padding-right:2.5vw}
.context-strip{max-width:none;padding-left:2.5vw;padding-right:2.5vw}
.topbar,.workspace-nav{padding-left:2.5vw;padding-right:2.5vw}
body.os-root>footer{padding-left:2.5vw;padding-right:2.5vw}
@media(min-width:1600px){   /* beats os.css's 1325 px bar inset */
  .topbar,.workspace-nav{padding-left:2.5vw;padding-right:2.5vw}
}

/* ---- "More ▾": a module with more than 6 pages shows its first five and the rest in a native <details> menu (A12-fix2; interim rule) ----
   Same family as the account menu below: a white pop-over on the shell's tokens. The summary IS a .nav-item, so it sits on the nav row like its neighbours. */
.nav-more{position:relative}
.nav-more-btn{list-style:none;cursor:pointer;user-select:none}
.nav-more-btn::-webkit-details-marker{display:none}
.nav-more-btn svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.nav-more[open] .nav-more-btn{color:var(--wine)}
.nav-more[open] .nav-more-btn svg{transform:rotate(180deg)}
.nav-more-pop{position:absolute;right:0;left:auto;top:calc(100% - 6px);z-index:60;min-width:230px;max-width:min(320px,calc(100vw - 32px));max-height:min(70vh,520px);overflow-y:auto;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow);padding:8px;display:flex;flex-direction:column;gap:2px}
/* A12-fix3 M1: anchored by its RIGHT edge (More is the last item), so it grows leftwards into the page and never off the right edge; os-shell.js adds
   .nav-more-start only when More sits so far left (a wrapped second row) that the right-anchored pop-over would leave the left edge */
.nav-more.nav-more-start .nav-more-pop{left:0;right:auto}
.nav-more-pop .nav-item{height:auto;min-height:44px;width:100%;padding:0 10px;border-radius:7px;justify-content:flex-start;white-space:normal;color:var(--ink)}
.nav-more-pop .nav-item:hover{background:var(--pale);color:var(--wine)}
.nav-more-pop .nav-item.active{color:var(--wine)}
.nav-more-pop .nav-item.active:after{display:none}

/* ---- Staff | Management toggle (the old .seg, in os tokens: same look as os.css's .segmented) -----------------------------
   S3: every target is 44 px tall (the track no longer pads around 28 px links; the links ARE the track). */
.seg{display:inline-flex;background:#f5f1f0;border:1px solid var(--line);padding:0;border-radius:8px;overflow:hidden}
.seg a{display:inline-flex;align-items:center;justify-content:center;min-height:44px;min-width:44px;font-size:11px;font-weight:400;padding:0 14px;border-radius:0;color:var(--muted);text-decoration:none;white-space:nowrap}   /* weight 400 = os.css's inactive .nav-item (c3.css's `.seg a` made the inactive segment 600) */
.seg a:hover{color:var(--wine)}
.seg a.on{background:#fff;color:var(--wine);font-weight:600;box-shadow:0 1px 3px #3c202211}

/* ---- account menu under the avatar (native <details>: works without JS) ---------------------------------------------- */
.profile-area{position:relative;display:flex;align-items:center;gap:2px}
.profile-menu{position:relative}
.profile-caret{list-style:none;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:8px;color:#6d6064;cursor:pointer}   /* S3: a 44 px target (was 24 x 36) */
.profile-caret::-webkit-details-marker{display:none}
.profile-caret:hover,.profile-menu[open] .profile-caret{background:var(--pale)}
.profile-caret svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.profile-pop{position:absolute;right:0;top:calc(100% + 8px);z-index:60;min-width:250px;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow);padding:8px;display:flex;flex-direction:column;gap:2px}
.profile-id{display:flex;flex-direction:column;padding:8px 10px 10px;border-bottom:1px solid var(--line);margin-bottom:4px}
.profile-id b{font-size:14px;font-weight:600;color:var(--ink)}
.profile-id span{font-size:12px;color:var(--muted);overflow-wrap:anywhere}
.profile-pop>a,.profile-pop>.menu-link{display:flex;align-items:center;min-height:44px;padding:0 10px;border-radius:7px;font-size:13px;color:var(--ink);text-decoration:none;width:100%;text-align:left}
.profile-pop>a:hover,.profile-pop>.menu-link:hover{background:var(--pale);color:var(--wine)}
.profile-pop form{padding:8px 10px 4px}
.profile-pop .button{width:100%;min-height:44px}

/* ---- sandbox banner: bml_env_banner() is fixed to the bottom edge by sandbox-env.css (which also pads <body> so the footer
   is never covered). It is emitted above the topbar in the markup and needs no spacing here. ------------------------------ */

/* ---- artwork ---------------------------------------------------------------------------------------------------------- */
img.rich-icon{width:80px;height:80px;object-fit:contain}

/* ---- focus: ChatGPT's ring (3px #C49058, offset 3px) on every interactive element, incl. summary and kbd-reachable links */
a:focus-visible,button:focus-visible,summary:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible{outline:3px solid #c49058;outline-offset:3px}
.nav-item:focus-visible{outline-offset:-3px}

@media(max-width:560px){
  .nav-right .seg{margin-right:auto}
  /* "More ▾" is one cell of the 4-column grid; its pop-over spans the nav instead of hanging off that cell */
  .workspace-nav{position:relative}
  .nav-more{position:static;min-width:0;align-self:stretch}
  .nav-more-btn{height:auto;min-height:52px}   /* A12-fix3 M1: a full cell like its neighbours (it was 14 px: `height:100%` of an auto-height cell) */
  .workspace-nav .nav-more-btn svg{display:inline-block;width:13px;height:13px;margin-left:3px}
  .nav-more-pop,.nav-more.nav-more-start .nav-more-pop{left:12px;right:12px;top:100%;min-width:0;max-width:none}
  .profile-pop{right:-6px}
  /* the 4-column grid of os.css (≤560): long labels wrap inside their cell instead of overflowing it */
  .workspace-nav .nav-item{white-space:normal;min-width:0}
}

/* ---- A-gate (31 Oct): the sign-in page (gate_os.php). .signin / .form-group / .form-control / .button come from os.css; this is only what it lacks ---- */
.signin-form .form-control{line-height:17.5px}   /* the reference's field is 39.5 px tall (13 px text); inheriting the 1.5 body line made it 41.5 */
.notice.error{color:var(--wine);background:#fbf1f1;border-color:#efd3d4}
.signin-form>p+.notice,.signin-form>.notice+.notice{margin:0 0 18px}
.gate-recovery{margin-top:18px;padding-top:14px;border-top:1px solid var(--line)}
.gate-recovery summary{font-size:12px;font-weight:500;cursor:pointer;color:var(--ink)}
.gate-recovery form{margin-top:12px}
.signin-form .gate-recovery p{font-size:10px;margin:8px 0 0}

/* ---- A-gate2 (2 Nov): the split panel fills the whole viewport: no bar, no footer, no card chrome (Courtney's screenshot) ---- */
body.gate-page main.page{padding:0}
body.gate-page .signin{max-width:none;min-height:100vh;min-height:100dvh;margin:0;border:0;border-radius:0}
/* A-gate2-fix: sandbox-env.css pads <body> for its banner (a canvas strip + scroll under the panel): the panel runs under it; stacked, the form takes the clearance. */
body.gate-page{padding-bottom:0}
@media(max-width:560px){.bml-sandbox-banner~main.page .signin-form{padding-bottom:92px}}


/* ---- Equipment OS E2 (2 Nov): the design builds these from <button>s; the hub builds them from links. Values are the prototype's own ---- */
.tabs a.tab{text-decoration:none}
.view-toggle a{padding:6px;display:flex;color:var(--muted);border-radius:4px;text-decoration:none}
.view-toggle a.selected{background:var(--pale);color:var(--wine)}
.view-toggle a svg{width:16px;height:16px}
.eq-quick-filters a{border-radius:30px;border:1px solid var(--line);background:white;padding:8px 15px;font-size:12px;min-height:38px;display:inline-flex;align-items:center;text-decoration:none;color:var(--ink)}
.eq-quick-filters a:hover{border-color:#c8989a}
.eq-quick-filters a.selected{background:var(--deep);color:white;border-color:var(--deep)}
a.eq-card{display:block;color:inherit;text-decoration:none}
.eq-page .button{text-decoration:none}
.eq-pagination [aria-disabled="true"]{opacity:.45;pointer-events:none}
.eq-apply{margin-top:10px}
@media(max-width:600px){.eq-quick-filters a{font-size:11px;padding:8px 10px;min-height:40px}}

/* ---- Equipment OS E3 (2 Nov): the record and its dialogs. A server-rendered <dialog open> is not modal and hub.css pinned it to the corner: centre and dim it; equip-os.js makes it a true modal ---- */
a.text-button.eq-back{display:inline-block;text-decoration:none}
#modal[open]{position:fixed;inset:0;margin:auto;max-height:calc(100dvh - 28px);overflow-y:auto}
#modal[open]:not(:modal){box-shadow:0 0 0 100vmax #2a14164f,0 25px 100px #24121533}
#eqPrinterSupplies h3{font-size:14px;margin:2px 0 12px}
.form-group .eq-note[role=alert]{color:#9f3035;margin:8px 0 0}

/* ---- Equipment OS E6 (2 Nov): the maintenance screen. Links where the design has <button>s. (E7, 3 Nov: v9's frequency / period / filter-notice / calendar-legend rules moved out: v13's own maintenance-log.css supplies them in the equipment sheet) ---- */
.ml-calendar-day,.ml-today,.ml-view-switch a,.ml-period-navigation a{text-decoration:none}
.ml-today{text-align:center}
.ml-view-switch a{font-size:12px;padding:10px 13px;border-radius:5px;min-height:44px;color:var(--muted);display:flex;align-items:center}
.ml-view-switch a.selected{background:var(--wine);color:#fff}
.ml-period-navigation a{font-size:25px;line-height:1;width:32px;height:36px;border-radius:6px;color:var(--wine);display:flex;align-items:center;justify-content:center}
.ml-period-navigation a:hover{background:var(--pale)}
.ml-session-buttons form{margin:0}
.eq-report-entry{margin:3px 0 19px}
.eq-report-entry h2{font-size:21px;font-weight:500;margin:0}
.eq-report-entry p{font-size:13px;line-height:1.7;color:var(--muted);margin:5px 0 0}

/* ---- NAV1 (nav.top_row_2026_11): rules scoped to .workspace-nav.nav1 / .nav1-module; round 2 lines the row up with an old body's own box. ---- */
.workspace-nav.nav1>.nav-left{gap:26px;justify-content:flex-start;min-width:0}
.workspace-nav.nav1>.nav-left>.nav-item{flex:0 0 auto;white-space:nowrap}
@media(max-width:560px){
  .workspace-nav.nav1>.nav-left{gap:24px}
}
.nav1-module{position:relative;display:flex;flex-wrap:wrap;align-items:center;column-gap:25px;row-gap:0;min-width:0;margin:0 0 20px;border-bottom:1px solid var(--line)}
.nav1-module>.nav-item,.nav1-module>.nav-more>.nav-more-btn{height:48px}
@media(max-width:1000px){
  .nav1-module{column-gap:20px}
}
@media(max-width:560px){
  .nav1-module{column-gap:18px}
  .nav1-module>.nav-item{white-space:normal;min-width:0;min-height:44px;height:auto;padding-top:6px;padding-bottom:6px}
  .nav1-module>.nav-item svg{display:none}
  .nav1-module>.nav-more{position:static}
}
.nav1-module:has(+ .legacy > .content){margin-left:max(30px,calc((100% - 1300px) / 2));margin-right:max(30px,calc((100% - 1300px) / 2))}
.nav1-module:has(+ .legacy > .cd){max-width:980px}
@media(max-width:700px){
  .nav1-module:has(+ .legacy > .content){margin-left:16px;margin-right:16px}
}
/* ---- end NAV1 ---- */
}
}
