/* ============================================================================================
   HQ — layout and components. Colours, type and radii come from AdvDeli.Catalog.UI's theme.css
   (--c-*, --glass-*, --r-*), so HQ looks like the rest of AdvEnt and follows its dark theme.
   ============================================================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--c-s0); color: var(--c-text); font-family: var(--font); }
a { color: var(--c-nav); }
h1, h2 { letter-spacing: var(--track-tight); }

/* ---- shell --------------------------------------------------------------------------------- */

/* The shell: a full-height sidebar beside the page. Redesigned 2026-12-01 from the user's
   mock-up (hq-sidebar.html). The sidebar keeps its own dark palette in light and dark theme alike. */
.hq-shell {
    --sb-w: 264px; --sb-w-rail: 72px;
    --sb-bg: #0f1f1a; --sb-bg-2: #13281f; --sb-line: rgba(255, 255, 255, .07);
    --sb-text: #b9c9c1; --sb-dim: #7f948a; --sb-hi: #ffffff;
    --sb-accent: #22a06b; --sb-accent-soft: rgba(34, 160, 107, .18); --sb-glow: rgba(34, 160, 107, .45);
    min-height: 100vh; display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr);
    transition: grid-template-columns .25s ease;
}
.hq-main { grid-column: 2; }
.hq-mbar, .hq-navtoggle, .hq-scrim { display: none; }

/* ---- the sidebar ---------------------------------------------------------------------------- */

.hq-sb {
    grid-column: 1; grid-row: 1; position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; color: var(--sb-text); border-right: 1px solid #0a1612;
    background:
        radial-gradient(120% 55% at 0% 0%, rgba(34, 160, 107, .20), transparent 60%),
        linear-gradient(180deg, var(--sb-bg) 0%, var(--sb-bg-2) 100%);
}

.hq-ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round; }

/* Brand */
.hq-sb-brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 14px; text-decoration: none; min-width: 0; }
.hq-sb-logo { width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center; padding: 6px;
    background: linear-gradient(135deg, #2bc283, #168457);
    box-shadow: 0 6px 18px -6px var(--sb-glow), inset 0 1px 0 rgba(255, 255, 255, .25); }
.hq-sb-logo > * { width: 100%; height: 100%; }
.hq-sb-bt { min-width: 0; line-height: 1.2; white-space: nowrap; overflow: hidden; }
.hq-sb-bt b { display: block; color: var(--sb-hi); font-size: .95rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.hq-sb-bt span { font-size: .68rem; color: var(--sb-dim); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.hq-sb-pill { margin-left: auto; flex: none; font-size: .62rem; font-weight: 700; color: #f5b544;
    background: rgba(245, 181, 68, .12); border: 1px solid rgba(245, 181, 68, .3); padding: 2px 7px; border-radius: 999px; }

/* Search */
.hq-sb-search { position: relative; margin: 2px 14px 10px; }
.hq-sb-search input { width: 100%; padding: 9px 36px 9px 34px; border-radius: 10px; outline: none;
    background: rgba(0, 0, 0, .24); border: 1px solid var(--sb-line); color: var(--sb-hi); font: inherit; font-size: .84rem;
    transition: border-color .15s, box-shadow .15s; }
.hq-sb-search input::placeholder { color: var(--sb-dim); }
.hq-sb-search input:focus { border-color: var(--sb-accent); box-shadow: 0 0 0 3px var(--sb-accent-soft); }
.hq-sb-search .hq-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--sb-dim); }
.hq-sb-search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 600 .62rem var(--font);
    color: var(--sb-dim); border: 1px solid var(--sb-line); border-radius: 5px; padding: 2px 5px; background: rgba(255, 255, 255, .03); }

/* Navigation */
.hq-sb-nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .14) transparent; }
.hq-sb-nav::-webkit-scrollbar { width: 6px; }
.hq-sb-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 6px; }

.hq-sec { padding: 16px 10px 6px; font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--sb-dim); white-space: nowrap; }

/* A top-level link and a group heading look the same, so the column lines up. */
.hq-it, .hq-grp > summary {
    display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; cursor: pointer;
    color: var(--sb-text); text-decoration: none; font-size: .88rem; font-weight: 500; white-space: nowrap;
    transition: background .15s, color .15s; list-style: none; user-select: none; margin-top: 2px;
}
.hq-grp > summary::-webkit-details-marker { display: none; }
.hq-it:hover, .hq-grp > summary:hover { background: rgba(255, 255, 255, .06); color: var(--sb-hi); }
.hq-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hq-it.active { background: var(--sb-accent-soft); color: var(--sb-hi); font-weight: 600; }
.hq-it.active .hq-ico, .hq-grp:has(.hq-nl.active) > summary .hq-ico { color: var(--sb-accent); }
.hq-grp:has(.hq-nl.active) > summary { color: var(--sb-hi); }

.hq-chev { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; opacity: .55;
    transition: transform .2s ease; }
.hq-grp[open] > summary .hq-chev { transform: rotate(90deg); }

/* The links under a group, on a guide line. */
.hq-sub { margin: 2px 0 6px 19px; padding-left: 12px; border-left: 1px solid var(--sb-line);
    display: flex; flex-direction: column; gap: 1px; }
.hq-grp[open] > .hq-sub { animation: hq-sub-in .18s ease; }
@keyframes hq-sub-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.hq-nl { position: relative; display: block; padding: 7px 10px; border-radius: 8px; color: var(--sb-text);
    text-decoration: none; font-size: .84rem; transition: background .15s, color .15s; }
.hq-nl:hover { color: var(--sb-hi); background: rgba(255, 255, 255, .05); }
.hq-nl.active { color: #fff; background: var(--sb-accent-soft); font-weight: 600; }
.hq-nl.active::before { content: ""; position: absolute; left: -13px; top: 7px; bottom: 7px; width: 2px; border-radius: 2px;
    background: var(--sb-accent); box-shadow: 0 0 10px var(--sb-glow); }

/* Search results (hq-nav.js) */
.hq-sb mark { background: rgba(126, 226, 177, .25); color: #fff; border-radius: 3px; padding: 0 1px; }
.hq-hide { display: none !important; }
.hq-noresult { display: none; padding: 14px 10px; font-size: .82rem; color: var(--sb-dim); }
.hq-noresult.show { display: block; }

/* Foot: who is signed in, Sign out, fold */
.hq-sb-foot { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--sb-line); }
.hq-av { position: relative; width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(135deg, #f5b544, #e07b39); color: #fff; font-weight: 700; font-size: .78rem; }
.hq-av::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%;
    background: #2bc283; border: 2px solid var(--sb-bg-2); }
.hq-who { flex: 1; min-width: 0; line-height: 1.2; white-space: nowrap; overflow: hidden; }
.hq-who b { display: block; color: var(--sb-hi); font-size: .82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.hq-who span { font-size: .7rem; color: var(--sb-dim); }
.hq-ibtn { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--sb-line); background: rgba(255, 255, 255, .03); color: var(--sb-text); transition: all .15s; }
.hq-ibtn:hover { color: #fff; border-color: rgba(255, 255, 255, .22); }
.hq-ibtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- folded to an icon rail (hq-nav.js puts hq-rail on <html>, remembered per browser) ------- */

.hq-rail .hq-shell { grid-template-columns: var(--sb-w-rail) minmax(0, 1fr); }
.hq-rail .hq-sb-bt, .hq-rail .hq-sb-pill, .hq-rail .hq-sb-search, .hq-rail .hq-lbl, .hq-rail .hq-chev,
.hq-rail .hq-sec, .hq-rail .hq-who, .hq-rail .hq-sub, .hq-rail .hq-noresult { display: none !important; }
.hq-rail .hq-sb-brand { justify-content: center; padding: 20px 0 14px; }
.hq-rail .hq-it, .hq-rail .hq-grp > summary { justify-content: center; padding: 11px 0; }
.hq-rail .hq-grp:has(.hq-nl.active) > summary { background: var(--sb-accent-soft); }
.hq-rail .hq-sb-foot { flex-direction: column; }
.hq-rail .hq-fold svg { transform: rotate(180deg); }

/* The flyout a folded group shows on hover (built by hq-nav.js). */
.hq-flyout { position: fixed; z-index: 60; min-width: 210px; padding: 8px; border-radius: 12px;
    background: #162d24; border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .55);
    opacity: 0; pointer-events: none; transform: translateX(-6px); transition: opacity .15s, transform .15s; }
.hq-flyout.show { opacity: 1; pointer-events: auto; transform: none; }
.hq-flyout h6 { margin: 0; padding: 6px 10px 8px; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: #7f948a; }
.hq-flyout a { display: block; padding: 7px 10px; border-radius: 7px; color: #b9c9c1; text-decoration: none; font-size: .84rem; }
.hq-flyout a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.hq-flyout a.active { background: rgba(34, 160, 107, .18); color: #fff; font-weight: 600; }

/* ---- narrow screens: a slim bar, and the sidebar over the page -------------------------------- */

.hq-burger { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; cursor: pointer; color: var(--c-text); }
.hq-burger:hover { background: var(--c-s4); }
.hq-burger svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hq-mbrand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--c-text); text-decoration: none; }
.hq-mark { display: inline-flex; width: 28px; height: 28px; }

@media (max-width: 800px) {
    .hq-shell, .hq-rail .hq-shell { grid-template-columns: minmax(0, 1fr); }
    .hq-main { grid-column: 1; }
    .hq-mbar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; position: sticky; top: 0; z-index: 20;
        background: var(--c-s1); border-bottom: 1px solid var(--c-line); }
    .hq-sb { display: none; }
    .hq-navtoggle:checked ~ .hq-sb { display: flex; position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; z-index: 40;
        width: min(290px, 86vw); box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
    .hq-navtoggle:checked ~ .hq-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: var(--scrim); }
    /* The rail is a desktop choice: a phone always gets the full panel. */
    .hq-rail .hq-sb-bt, .hq-rail .hq-sb-search, .hq-rail .hq-lbl, .hq-rail .hq-chev, .hq-rail .hq-sec,
    .hq-rail .hq-who, .hq-rail .hq-sub { display: revert !important; }
    .hq-fold { display: none; }
}

.hq-main { padding: 22px 26px 40px; min-width: 0; }

.hq-err-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 10px 18px;
    background: var(--c-stop); color: #fff; z-index: 100; }
.hq-err-ui a { color: #fff; font-weight: 700; }

/* ---- page head, cards, grids --------------------------------------------------------------- */

.pg-head { margin-bottom: 14px; }
.pg-back { display: inline-block; margin-bottom: 6px; font-size: .85rem; font-weight: 600;
    color: var(--c-text-dim); text-decoration: none; }
.pg-back:hover { color: var(--c-text); text-decoration: underline; }
.pg-head h1 { margin: 0; font-size: 1.6rem; font-weight: 800; }
.pg-sub { color: var(--c-text-dim); font-size: .88rem; margin-top: 4px; }
.back { font-size: .85rem; text-decoration: none; color: var(--c-text-dim); }

.card { background: var(--c-s2); border: 1px solid var(--c-line); border-radius: var(--r-md); padding: 16px 18px;
    margin-bottom: 16px; min-width: 0; }
.card-h { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-h h2 { margin: 0; font-size: 1rem; font-weight: 750; }
.card-link { margin-left: auto; font-size: .85rem; text-decoration: none; }
.card-note { margin-top: 8px; font-size: .8rem; color: var(--c-text-faint); }
.dim { color: var(--c-text-dim); font-weight: 400; }

.grid2 { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1200px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.hq-status { padding: 28px; text-align: center; color: var(--c-text-dim); background: var(--c-s2);
    border: 1px dashed var(--c-line-strong); border-radius: var(--r-md); margin-bottom: 16px; }
.hq-status.err { color: var(--c-stop-text); border-color: var(--c-stop); background: rgba(229, 72, 77, .06); }
.hq-empty { padding: 40px; text-align: center; color: var(--c-text-dim); }

/* ---- KPIs ---------------------------------------------------------------------------------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--c-s2); border: 1px solid var(--c-line); border-radius: var(--r-md); padding: 14px 16px; }
.kpi-lbl { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: var(--track-label);
    color: var(--c-text-faint); }
.kpi-val { font-size: 1.45rem; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums;
    letter-spacing: var(--track-display); overflow-wrap: anywhere; }
.kpi-chg { margin-top: 6px; font-size: .82rem; font-weight: 700; color: var(--c-text-dim); }
.kpi-chg.up { color: var(--c-go-text); }
.kpi-chg.down { color: var(--c-stop-text); }
.kpi-prev { font-weight: 400; color: var(--c-text-faint); }

/* ---- tables -------------------------------------------------------------------------------- */

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: var(--track-label);
    color: var(--c-text-faint); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--c-line-strong);
    white-space: nowrap; background: var(--c-s2); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--c-line); white-space: nowrap; }
.tbl .n { text-align: right; }
.tbl tfoot td { font-weight: 750; border-top: 2px solid var(--c-line-strong); border-bottom: none; }
.tbl tr.clk { cursor: pointer; }
.tbl tr.clk:hover td { background: var(--c-s4); }
.tbl.compact td { padding: 6px 8px; }
.tbl td.up { color: var(--c-go-text); font-weight: 700; }
.tbl td.down { color: var(--c-stop-text); font-weight: 700; }
.tbl .tot { background: var(--c-s1); }
.tbl .zero { color: var(--c-text-faint); }
.tbl .sticky { position: sticky; left: 0; background: var(--c-s2); z-index: 1; }
.mx td.low { background: rgba(245, 165, 36, .18); }
.mx td.neg { background: rgba(229, 72, 77, .16); color: var(--c-stop-text); font-weight: 700; }
.mx td.nc { color: var(--c-text-faint); }

.share { display: inline-block; width: 60px; height: 6px; background: var(--c-s4); border-radius: 3px; vertical-align: middle;
    margin-right: 6px; overflow: hidden; }
.share > span { display: block; height: 100%; background: var(--rc-mark, #1F6FB2); }

.legend { font-size: .78rem; color: var(--c-text-dim); display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 8px; }
.sw.low { background: rgba(245, 165, 36, .5); }
.sw.neg { background: rgba(229, 72, 77, .5); }
.sw.nc { background: var(--c-s4); }

/* ---- filter bar ---------------------------------------------------------------------------- */

.fb { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 12px 14px; margin-bottom: 14px;
    background: var(--c-s2); border: 1px solid var(--c-line); border-radius: var(--r-md); }
.fb.sub { padding: 10px 14px; }
.fb-grp { display: flex; flex-direction: column; gap: 4px; position: relative; }
.fb-lbl { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: var(--track-label);
    color: var(--c-text-faint); }
.fb-in { min-height: 36px; padding: 6px 10px; border: 1px solid var(--c-line-strong); border-radius: var(--r-sm);
    background: var(--c-s3); color: var(--c-text); font: inherit; font-size: .88rem; min-width: 150px; }
.fb-sum { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 190px;
    cursor: pointer; text-align: left; }
.fb-caret { color: var(--c-text-faint); font-size: .7rem; }

/* The sheet that makes "click anywhere else" close the panel. Transparent and unpainted — its
   only job is to catch the click — and under the panel in z-order so the panel keeps its own. */
.fb-backdrop { position: fixed; inset: 0; z-index: 29; }

.fb-pop { position: absolute; top: 100%; left: 0; z-index: 30; margin-top: 4px; width: 320px; max-height: 360px; overflow-y: auto;
    background: var(--c-s2); border: 1px solid var(--c-line-strong); border-radius: var(--r-sm); padding: 8px;
    box-shadow: var(--shadow-modal); }
.fb-pop-acts { display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 4px 6px 8px; border-bottom: 1px solid var(--c-line); margin-bottom: 4px; }
.fb-pop-n { font-size: .72rem; color: var(--c-text-faint); }
.fb-pop-empty { margin: 4px 6px 8px; font-size: .82rem; color: var(--c-text-faint); line-height: 1.45; }
.fb-pop-foot { display: flex; justify-content: flex-end; padding: 8px 6px 2px; margin-top: 4px;
    border-top: 1px solid var(--c-line); }
.fb-btn.sm { min-height: 30px; padding: 0 14px; font-size: .82rem; }
.fb-opt { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; cursor: pointer; font-size: .86rem; }
.fb-opt:hover { background: var(--c-s4); }
.fb-cur { margin-left: auto; font-size: .72rem; color: var(--c-text-faint); }
.fb-link { background: none; border: none; color: var(--c-nav); cursor: pointer; font: inherit; font-size: .85rem; padding: 0; }
.fb-btn { min-height: 36px; padding: 0 16px; border-radius: var(--r-sm); border: none; cursor: pointer; font: inherit;
    font-weight: 700; background: var(--c-accent); color: var(--c-accent-ink); }
.fb-btn:hover { background: var(--c-accent-press); }
.fb-check { display: flex; align-items: center; gap: 8px; font-size: .88rem; min-height: 36px; }
.fb-note { margin: -6px 0 14px; font-size: .82rem; color: var(--c-warn); }

/* ---- segmented control --------------------------------------------------------------------- */

.seg { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--c-s2);
    border: 1px solid var(--c-line); border-radius: var(--r-pill); }
.seg-b { border: none; background: transparent; padding: 7px 14px; border-radius: var(--r-pill); cursor: pointer;
    font: inherit; font-size: .86rem; color: var(--c-text-dim); }
.seg-b.on { background: var(--c-accent-wash); color: var(--c-accent-text); font-weight: 700; }

/* ---- heat map ------------------------------------------------------------------------------ */

.hm { margin: 0; }
.hm-grid { display: grid; gap: 3px; margin-top: 6px; }
.hm-h { font-size: .68rem; color: var(--c-text-faint); text-align: center; }
.hm-d { font-size: .75rem; color: var(--c-text-dim); display: flex; align-items: center; }
.hm-c { height: 22px; border-radius: 4px; background: color-mix(in srgb, var(--rc-mark, #1F6FB2) calc(var(--a) * 100%), var(--c-s4)); }

/* ---- consolidated reports ------------------------------------------------------------------ */

.rep-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rep-card { display: block; padding: 16px; background: var(--c-s2); border: 1px solid var(--c-line); border-radius: var(--r-md);
    text-decoration: none; color: var(--c-text); }
.rep-card:hover { border-color: var(--c-nav); }
.rep-t { font-weight: 750; }
.rep-d { margin-top: 6px; font-size: .84rem; color: var(--c-text-dim); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.kv-i { padding: 10px 12px; background: var(--c-s1); border-radius: var(--r-sm); }
.kv-k { font-size: .72rem; text-transform: uppercase; letter-spacing: var(--track-label); color: var(--c-text-faint); font-weight: 700; }
.kv-v { margin-top: 4px; font-weight: 750; font-variant-numeric: tabular-nums; }

/* ---- sign-in ------------------------------------------------------------------------------- */

.lg { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--c-s0); }
.lg-card { width: min(400px, 100%); background: var(--c-s2); border: 1px solid var(--c-line); border-radius: var(--r-lg);
    padding: 28px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-modal); }
.lg-card.center { text-align: center; }
.lg-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 6px; }
.lg-logo { width: 52px; height: 52px; }
.lg-title { font-size: 1.5rem; font-weight: 800; letter-spacing: var(--track-display); }
.lg-sub { font-size: .85rem; color: var(--c-text-dim); }
.lg-err { padding: 10px 12px; border-radius: var(--r-sm); background: rgba(229, 72, 77, .1); color: var(--c-stop-text); font-size: .88rem; line-height: 1.45; overflow-wrap: anywhere; }
.lg-fld { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; font-weight: 650; color: var(--c-text-dim); }
.lg-in { min-height: 42px; padding: 8px 12px; border: 1px solid var(--c-line-strong); border-radius: var(--r-sm);
    background: var(--c-s3); color: var(--c-text); font: inherit; font-size: .95rem; }
.lg-check { display: flex; align-items: center; gap: 8px; font-size: .86rem; }
.lg-btn { min-height: 44px; border: none; border-radius: var(--r-sm); cursor: pointer; font: inherit; font-weight: 750;
    background: var(--c-accent); color: var(--c-accent-ink); text-decoration: none; display: inline-flex;
    align-items: center; justify-content: center; padding: 0 18px; }
.lg-btn.ghost { background: transparent; border: 1px solid var(--c-line-strong); color: var(--c-text); }
.lg-btn.danger { background: var(--c-stop); color: #fff; }
.lg-acts { display: flex; gap: 10px; justify-content: center; }
.lg-note { font-size: .8rem; color: var(--c-text-faint); margin: 0; }

/* ---- print: the browser's Print → Save as PDF gives a clean report ------------------------- */

@media print {
    .hq-mbar, .hq-sb, .fb, .seg, .card-link, .fb-note { display: none !important; }
    .hq-shell { display: block; }
    .hq-main { grid-column: auto; }
    .hq-main { padding: 0; }
    .card { break-inside: avoid; border: none; padding: 0 0 12px; }
    .tbl-wrap { overflow: visible; }
    .tbl .sticky { position: static; }
}

/* ============================================================================================
   THE CATALOGUE IN HQ (v9.4) — the frame round a shared Catalog.UI screen.

   DELIBERATELY ALMOST NOTHING. The Item Manager, Item Entry and the Menu Designer bring their own
   complete designs from AdvDeli.Catalog.UI and are not restyled here: they are the same screens
   the Back Office and the tills show, and HQ having its own opinion about them is how two
   applications drift into looking like two products. What is HQ's is the strip above them saying
   which shop is being edited, and the refusal card when a permission is missing.
   ============================================================================================ */

.hq-cat { min-height: 100vh; display: flex; flex-direction: column; background: var(--c-s0); }
.hq-catbody { flex: 1; min-height: 0; min-width: 0; }

/* ---- which store's catalogue is open ------------------------------------------------------- */

.hq-catbar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 8px 16px; background: var(--c-s1); border-bottom: 1px solid var(--c-line);
    /* Sticky, because the catalogue runs to many screens on a phone and "which shop am I editing"
       must not be a fact you have to scroll back up to re-check. */
    position: sticky; top: 0; z-index: 30;
}
.hq-catbar-back {
    display: inline-flex; align-items: center; gap: 4px; text-decoration: none;
    color: var(--c-text-dim); font-size: .85rem; font-weight: 650;
    border: 1px solid var(--c-line-strong); border-radius: var(--r-pill); padding: 4px 11px 4px 7px;
}
.hq-catbar-back:hover { background: var(--c-s4); color: var(--c-text); }
.hq-catbar-back svg { width: 15px; height: 15px; }
.hq-catbar-sep { color: var(--c-text-faint); }
.hq-catbar-ttl { font-weight: 750; font-size: .95rem; }
.hq-catbar-spacer { flex: 1; min-width: 8px; }
.hq-catbar-lbl { font-size: .78rem; text-transform: uppercase; letter-spacing: var(--track-label);
    color: var(--c-text-faint); font-weight: 700; }
.hq-catbar-store {
    font: inherit; font-size: .88rem; font-weight: 600; color: var(--c-text);
    background: var(--c-s3); border: 1px solid var(--c-line-strong); border-radius: var(--r-sm);
    padding: 6px 10px; max-width: 320px;
}
/* On the item editor the store is stated rather than offered — see CatalogStoreBar. It must not
   read as a control that has been disabled, so it gets no border and no field background. */
.hq-catbar-store.fixed { background: none; border: none; padding: 6px 2px; }
.hq-catbar-store.fixed em { font-style: normal; color: var(--c-text-dim); font-weight: 400; }

@media (max-width: 640px) {
    .hq-catbar-ttl, .hq-catbar-sep { display: none; }
    .hq-catbar-spacer { flex: 0; min-width: 0; }
    .hq-catbar-store { max-width: 60vw; }
}

/* ---- the shared full-screen views start BELOW the bar (2026-12-02) ----------------------------
   The Item Manager, Item Entry and Menu Designer pin themselves to the whole window
   (position: fixed; inset: 0), which is right on the till and in the Back Office. Here the store
   bar above sat on top of them and hid their header: the title and the Add / Import buttons of
   the Item Manager could not be seen. So the bar gets a fixed height and the views start under
   it. Selectors carry three classes so they outrank the views' own scoped rules. */
.hq-cat:not(.embed) > .hq-catbar { height: 50px; box-sizing: border-box; flex-wrap: nowrap; overflow: hidden; }
.hq-cat:not(.embed) .hq-catbody .im,
.hq-cat:not(.embed) .hq-catbody .ie,
.hq-cat:not(.embed) .hq-catbody .md { top: 50px; }
@media (max-width: 640px) {
    .hq-cat:not(.embed) .hq-catbar-lbl { display: none; }
}

/* ---- a permission is missing, or there is no shop to work on -------------------------------- */

.hq-catgate {
    max-width: 640px; margin: 14vh auto; padding: 28px 30px; text-align: center;
    background: var(--c-s2); border: 1px solid var(--c-line); border-radius: var(--r-md);
}
.hq-catgate.wait { color: var(--c-text-dim); border-style: dashed; padding: 40px; margin-top: 20vh; }
.hq-catgate h1 { margin: 0 0 12px; font-size: 1.3rem; font-weight: 800; }
.hq-catgate p { margin: 0 0 10px; color: var(--c-text-dim); line-height: 1.55; font-size: .92rem; }
.hq-catgate b { color: var(--c-text); }
.hq-catgate code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em;
    background: var(--c-s4); border-radius: var(--r-xs, 4px); padding: 1px 5px;
}
.hq-catgate-sub { font-size: .85rem !important; color: var(--c-text-faint) !important; }
.hq-catgate-go {
    display: inline-block; margin-top: 10px; text-decoration: none; font-weight: 650; font-size: .88rem;
    color: var(--c-text); border: 1px solid var(--c-line-strong); border-radius: var(--r-pill); padding: 8px 18px;
}
.hq-catgate-go:hover { background: var(--c-s4); }

/* ============================================================================================
   STOCK TRANSFERS (v9.5)

   The first screen in HQ that WRITES, which is why buttons, badges and a side sheet appear here
   for the first time. Everything before this was a report: it needed a table, a filter bar and
   nothing you could press.
   ============================================================================================ */

/* ---- buttons and the things that look like them -------------------------------------------- */

.btn {
    font: inherit; font-size: .86rem; font-weight: 650; cursor: pointer;
    color: var(--c-text); background: var(--c-s3);
    border: 1px solid var(--c-line-strong); border-radius: var(--r-sm); padding: 8px 15px;
}
.btn:hover:not(:disabled) { background: var(--c-s4); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 11px; font-size: .8rem; }
/* GO IS FOR THE IRREVERSIBLE ONE, which on this screen is Receive: it books stock at both ends
   and raises a bill, and nothing undoes it. STOP is for cancelling, which undoes nothing because
   nothing had moved. The two colours are the wrong way round from most screens for exactly that
   reason - here the dangerous button is the one that completes the job. */
.btn.go { background: var(--c-go); border-color: var(--c-go); color: #fff; }
.btn.go:hover:not(:disabled) { background: var(--c-go-press); }
.btn.stop { color: var(--c-stop-text); border-color: var(--c-stop); }
.btn.stop:hover:not(:disabled) { background: rgba(229, 72, 77, .08); }

.lnk {
    border: none; background: none; padding: 0; font: inherit; font-weight: 650; cursor: pointer;
    color: var(--c-nav); text-decoration: none;
}
.lnk:hover { text-decoration: underline; }
.lnk.stop { color: var(--c-stop-text); font-weight: 400; font-size: .82rem; }

.badge {
    display: inline-block; font-size: .7rem; font-weight: 750; text-transform: uppercase;
    letter-spacing: var(--track-label); padding: 2px 8px; border-radius: var(--r-pill);
    background: var(--c-s4); color: var(--c-text-dim);
}
.badge.ok   { background: rgba(43, 169, 107, .14); color: var(--c-go-text); }
.badge.warn { background: var(--c-accent-wash);    color: var(--c-accent-text); }
.badge.stop { background: rgba(229, 72, 77, .10);  color: var(--c-stop-text); }

.tbl .r { text-align: right; }
.tbl tr.on td { background: var(--c-accent-wash); }
.tbl tfoot th { border-top: 2px solid var(--c-line-strong); font-size: .8rem; text-transform: none;
    letter-spacing: normal; }

.hq-status.ok { color: var(--c-go-text); border-color: var(--c-go); background: rgba(43, 169, 107, .06);
    text-align: left; }
.hq-status.err { text-align: left; }

/* ---- a request, with its lines -------------------------------------------------------------- */

.tr-req { border: 1px solid var(--c-line); border-radius: var(--r-sm); margin-bottom: 12px; overflow: hidden; }
.tr-req-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 12px; background: var(--c-s1); border-bottom: 1px solid var(--c-line); font-size: .88rem; }

/* ---- the side sheet: one transfer, or a new one --------------------------------------------- */

.tr-sheet-bd { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: var(--scrim-blur); z-index: 40; }
.tr-sheet {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw);
    display: flex; flex-direction: column; z-index: 41;
    background: var(--c-s2); border-left: 1px solid var(--c-line-strong);
}
.tr-sheet.wide { width: min(980px, 100vw); }
.tr-sheet-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 14px 18px; border-bottom: 1px solid var(--c-line); background: var(--c-s1); }
.tr-sheet-no { font-size: 1.1rem; font-weight: 800; letter-spacing: var(--track-tight); }
.tr-sheet-b { flex: 1; overflow-y: auto; padding: 16px 18px 28px; }
/* The sheet's form error sticks to the top of the scrolling body (2026-12-01): Save is at the
   END of the same body, and a refusal at its head was off the top of the screen. Solid backing
   (the tint alone is see-through) and the body's padding cancelled, like the back office's
   RefDialog error. */
.tr-sheet-b > .hq-status.err:first-child {
    position: sticky; top: -16px; z-index: 3;
    margin: -16px -18px 14px; padding: 14px 18px;
    border-width: 0 0 1px; border-radius: 0;
    background-color: var(--c-s1);
    background-image: linear-gradient(rgba(229, 72, 77, .12), rgba(229, 72, 77, .12));
    font-weight: 600;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .12);
}

.tr-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 16px; font-size: .88rem; }
.tr-meta dt { color: var(--c-text-faint); font-weight: 650; }
.tr-meta dd { margin: 0; }

.tr-acts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ---- the new-transfer form ------------------------------------------------------------------ */

.tr-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.tr-fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tr-fld.wide { grid-column: 1 / -1; }
.tr-fld > label { font-size: .74rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: var(--track-label); color: var(--c-text-faint); }

.tr-q { font: inherit; font-size: .86rem; font-variant-numeric: tabular-nums; text-align: right;
    width: 92px; padding: 5px 7px; background: var(--c-s3);
    border: 1px solid var(--c-line-strong); border-radius: var(--r-sm); color: var(--c-text); }

.tr-hint { font-size: .78rem; color: var(--c-text-faint); font-weight: 400; }
.tr-hint.warn { color: var(--c-accent-text); }

/* WHERE A COST CAME FROM, on every line. Small, because it is reassurance most of the time -
   and coloured when it is "never bought", because then it is the opposite. */
.tr-src { display: block; font-size: .7rem; font-weight: 400; color: var(--c-text-faint); cursor: help; }
.tr-src.warn { color: var(--c-accent-text); font-weight: 650; }

/* ---- asking twice --------------------------------------------------------------------------- */

.tr-confirm {
    position: fixed; z-index: 42; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: min(520px, calc(100vw - 32px)); padding: 24px 26px;
    background: var(--c-s2); border: 1px solid var(--c-line-strong); border-radius: var(--r-md);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}
.tr-confirm h2 { margin: 0 0 10px; font-size: 1.15rem; font-weight: 800; }
.tr-confirm p { margin: 0 0 14px; color: var(--c-text-dim); font-size: .9rem; line-height: 1.55; }

/* ---- v9.52: receiving short, send-and-receive-now, supply setup ----------------------------- */

/* The receive dialog carries a table, so it is wider than a yes/no question and may scroll. */
.tr-confirm.wide { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow-y: auto; }
.tr-q.changed { border-color: var(--c-accent-text); background: var(--c-accent-wash); }

.tr-chk { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 10px 12px;
    border: 1px solid var(--c-line-strong); border-radius: var(--r-sm); background: var(--c-s3); cursor: pointer; }
.tr-chk input { margin-top: 3px; }
.tr-chk .tr-hint { display: block; margin-top: 2px; }

.badge.main { background: var(--c-nav-wash); color: var(--c-nav); }
.badge.wh   { background: rgba(160, 120, 60, .16); color: #8a6430; }

.sp-kinds { display: flex; gap: 8px; flex-wrap: wrap; }
.sp-kind { flex: 1 1 200px; display: block; position: relative; padding: 10px 12px 10px 34px; cursor: pointer;
    border: 1px solid var(--c-line-strong); border-radius: var(--r-sm); background: var(--c-s3); }
.sp-kind.on { border-color: var(--c-nav); background: var(--c-nav-wash); }
.sp-kind input { position: absolute; left: 11px; top: 12px; margin: 0; }
.sp-kind b { display: block; font-size: .9rem; }
.sp-kind span { font-size: .78rem; color: var(--c-text-faint); }
.sp-note { margin-top: 10px; padding: 10px 12px; font-size: .84rem; line-height: 1.5; border-radius: var(--r-sm);
    border: 1px solid var(--c-accent-text); background: var(--c-accent-wash); color: var(--c-accent-text); }

@media (max-width: 700px) {
    .tr-sheet, .tr-sheet.wide { width: 100vw; }
    .tr-req-h { font-size: .82rem; }
}

/* ---- central purchasing: a line's shares (v9.6) ---------------------------------------------- */

/* A GRID OF EVERY LOCATION, NOT AN "ADD A LOCATION" LIST. A central order is split across the
   estate, so the question on every line is "how much for each of these" - and a form that makes
   you add each destination one at a time asks it badly, and makes an omission invisible. Every
   location is on screen with a box; a blank box is zero. */
.po-shares { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 12px; }
.po-share { display: flex; align-items: center; gap: 6px; }
.po-share-c { font-size: .76rem; font-weight: 750; letter-spacing: var(--track-label);
    color: var(--c-text-dim); min-width: 44px; }

.po-total { padding: 8px 12px; font-size: .84rem; border-top: 1px solid var(--c-line);
    background: var(--c-s1); color: var(--c-text-dim); }
.po-total.warn { color: var(--c-accent-text); }
.po-total.ok { color: var(--c-text); }

/* ---- transfers: the place inside a store (v9.54) ---------------------------------------------- */
.tr-place { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.tr-place .fb-in { flex: 1; min-width: 0; max-width: 260px; }
