/* G27 (portal restyle): the BetterWays look, served as /beta/shell.css and loaded LAST on every portal page, after
   style.css, the page's own sheet and portal-app.css. Palette taken from the owner's BetterWays logo: royal blue ring and
   arrow, green tick. CSP style-src 'self': no inline styles anywhere; icons are inline SVG coloured from here. */
:root{
  --bw-blue:#1b5fae;--bw-blue-700:#164c8c;--bw-blue-900:#0e3060;--bw-blue-50:#edf3fc;--bw-blue-100:#d6e4f7;
  --bw-green:#2e9b47;--bw-green-700:#22773a;--bw-green-50:#e9f6ec;
  --bw-ink:#14213d;--bw-muted:#5a6a80;--bw-line:#e0e6ee;--bw-line-strong:#c8d2df;--bw-canvas:#f3f6fb;--bw-surface:#fff;
  --bw-amber:#a96400;--bw-amber-50:#fff4e1;--bw-red:#c0362c;--bw-red-50:#fdecea;
  --bw-bar-h:58px;--bw-drawer-w:300px;--bw-radius:16px;--bw-radius-sm:12px;
  --bw-shadow:0 1px 2px rgba(20,33,61,.06),0 4px 14px rgba(20,33,61,.05);
  /* The older sheets read these names. */
  --brand:var(--bw-blue);--brand-ink:var(--bw-blue-900);--brand-soft:var(--bw-blue-50);
  --ink:var(--bw-ink);--muted:var(--bw-muted);--line:var(--bw-line);--line-strong:var(--bw-line-strong);
  --canvas:var(--bw-canvas);--surface:var(--bw-surface);--warn:var(--bw-amber);--warn-soft:var(--bw-amber-50);
  --danger:var(--bw-red);--danger-soft:var(--bw-red-50);--radius:var(--bw-radius);
  font-family:"Segoe UI",Roboto,"Helvetica Neue",system-ui,-apple-system,sans-serif;color:var(--bw-ink);background:var(--bw-canvas);
  -webkit-text-size-adjust:100%;text-size-adjust:100%
}
html,body{max-width:100%}
body{background:var(--bw-canvas);color:var(--bw-ink)}

/* ---------- Icons ---------- */
.bw-ic{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
.bw-tile-ic{display:inline-grid;place-items:center;width:36px;height:36px;border-radius:11px;flex:none}
.bw-tile-ic .bw-ic{width:20px;height:20px}
.bw-tone-blue{--tone:#1b5fae;--tone-50:#e8f0fb}
.bw-tone-green{--tone:#22863d;--tone-50:#e6f5ea}
.bw-tone-amber{--tone:#b86a00;--tone-50:#fff1db}
.bw-tone-teal{--tone:#0b7f86;--tone-50:#e0f4f4}
.bw-tone-violet{--tone:#6a45c9;--tone-50:#efe9fb}
.bw-tone-indigo{--tone:#33489e;--tone-50:#e9ecf8}
.bw-tone-slate{--tone:#4b5b70;--tone-50:#eceff3}
.bw-tone-rose{--tone:#c0362c;--tone-50:#fdecea}
.bw-tile-ic{color:var(--tone);background:var(--tone-50)}

/* ---------- Top app bar ---------- */
body.bw-shell{display:block;min-height:100vh;padding-top:var(--bw-bar-h)}
body.bw-shell>header{display:none}
.bw-appbar{position:fixed;top:0;left:0;right:0;height:var(--bw-bar-h);z-index:30;display:flex;align-items:center;gap:6px;
  padding:0 10px 0 4px;background:var(--bw-blue);color:#fff;box-shadow:0 2px 10px rgba(14,48,96,.28);border-bottom:3px solid var(--bw-green)}
.bw-iconbtn{display:inline-grid;place-items:center;width:48px;height:48px;min-height:0;padding:0;margin:0;border:0;border-radius:50%;
  background:transparent;color:inherit;cursor:pointer;flex:none}
.bw-iconbtn:hover{background:rgba(255,255,255,.14)}
.bw-iconbtn .bw-ic{width:24px;height:24px}
.bw-appbar-title{flex:1;min-width:0;display:flex;flex-direction:column}
.bw-appbar-page{font-size:1.12rem;font-weight:700;letter-spacing:.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bw-mark{width:36px;height:36px;border-radius:50%;background:#fff;flex:none;box-shadow:0 0 0 2px rgba(255,255,255,.35)}
.bw-avatar{display:inline-grid;place-items:center;width:36px;height:36px;min-height:0;padding:0;margin:0 4px 0 0;border-radius:50%;
  background:var(--bw-green);color:#fff;border:2px solid rgba(255,255,255,.85);font-weight:750;font-size:.95rem;cursor:pointer;flex:none}
.bw-avatar:hover{background:var(--bw-green-700)}
.bw-progress{position:fixed;top:var(--bw-bar-h);left:0;right:0;height:3px;z-index:31;overflow:hidden;pointer-events:none;opacity:0;transition:opacity .2s}
.bw-progress::before{content:"";position:absolute;top:0;bottom:0;width:40%;background:#9fd3ab;animation:bw-slide 1.1s ease-in-out infinite}
body.bw-busy .bw-progress{opacity:1}
@keyframes bw-slide{from{left:-40%}to{left:100%}}

/* ---------- Drawer ---------- */
.bw-drawer{position:fixed;top:0;bottom:0;left:0;width:min(86vw,var(--bw-drawer-w));z-index:40;background:var(--bw-surface);
  display:flex;flex-direction:column;overflow-y:auto;overscroll-behavior:contain;transform:translateX(-104%);transition:transform .22s ease;
  box-shadow:4px 0 24px rgba(14,48,96,.22)}
body.bw-drawer-open .bw-drawer{transform:none}
.bw-scrim{position:fixed;inset:0;z-index:35;background:rgba(14,30,60,.45);opacity:0;pointer-events:none;transition:opacity .2s}
body.bw-drawer-open .bw-scrim{opacity:1;pointer-events:auto}
.bw-drawer-head{background:linear-gradient(160deg,var(--bw-blue) 0%,var(--bw-blue-700) 100%);color:#fff;padding:12px 12px 14px;border-bottom:3px solid var(--bw-green)}
.bw-brand{display:flex;align-items:center;gap:10px}
.bw-brand img{width:40px;height:40px;border-radius:50%;background:#fff}
.bw-brand-text{flex:1;display:flex;flex-direction:column;line-height:1.2}
.bw-brand-text strong{font-size:1.08rem}
.bw-brand-text span{font-size:.78rem;opacity:.85;letter-spacing:.04em;text-transform:uppercase}
.bw-who{display:flex;align-items:center;gap:12px;width:100%;margin:14px 0 0;padding:10px 10px;min-height:0;border:1px solid rgba(255,255,255,.28);
  border-radius:var(--bw-radius-sm);background:rgba(255,255,255,.1);color:#fff;text-align:left;font-weight:400;cursor:pointer}
.bw-who:hover{background:rgba(255,255,255,.18)}
.bw-who-avatar{display:inline-grid;place-items:center;width:40px;height:40px;border-radius:50%;background:var(--bw-green);color:#fff;font-weight:750;font-size:1.05rem;flex:none}
.bw-who-text{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.3}
.bw-who-role{font-size:.98rem}
.bw-who-id,.bw-who-store{font-size:.82rem;opacity:.9;overflow-wrap:anywhere}
.bw-who .bw-chev{transition:transform .2s}
.bw-who[aria-expanded=true] .bw-chev{transform:rotate(180deg)}
.bw-session-slot:empty{display:none}
.bw-shell .bw-session-slot .bw-session{margin:10px 0 0;padding:8px 10px;background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.22);
  color:#fff;font-size:.82rem;font-weight:600;border-radius:10px}
/* The drawer's own Sign out (account list) does what this button does; the button stays for the page logic. Same for each
   page's own sign-out button: the menu's Sign out clicks it (shell.js), so it is hidden from view. */
.bw-shell .bw-in-menu{display:none!important}
.bw-shell .bw-session-slot #bwSignOut{display:none}
.bw-account{list-style:none;margin:0;padding:8px 8px 10px;border-bottom:1px solid var(--bw-line);background:#f8fafd}
.bw-account li{margin:0}
.bw-guest .bw-account{order:3;border-bottom:0;border-top:1px solid var(--bw-line);background:transparent}
.bw-nav{display:block;flex:1;padding:8px 8px 12px;margin:0}
.bw-tree,.bw-sub{list-style:none;margin:0;padding:0}
.bw-tree li{margin:0}
.bw-tree-note{color:var(--bw-muted);font-size:.9rem;padding:8px 12px}
.bw-link{position:relative;display:flex;align-items:center;gap:12px;width:100%;min-height:50px;margin:2px 0;padding:7px 12px;border:0;border-radius:12px;
  background:transparent;color:var(--bw-ink);font:inherit;font-weight:600;font-size:.97rem;text-align:left;text-decoration:none;cursor:pointer;justify-content:flex-start}
.bw-link:hover{background:var(--bw-blue-50);color:var(--bw-ink)}
.bw-link .bw-label{flex:1;min-width:0}
.bw-link .bw-chev{color:var(--bw-muted);transition:transform .2s}
.bw-group-toggle[aria-expanded=true] .bw-chev{transform:rotate(180deg)}
.bw-group-toggle.has-active{color:var(--bw-blue-900)}
.bw-sub{margin:0 0 6px 30px;padding-left:12px;border-left:2px solid var(--bw-line)}
.bw-sublink{min-height:46px;font-weight:550;font-size:.94rem;padding:6px 10px;gap:10px}
.bw-sub-ic{width:19px;height:19px;color:var(--tone)}
.bw-link.is-active{background:var(--bw-blue-50);color:var(--bw-blue-900);font-weight:700}
.bw-link.is-active::before{content:"";position:absolute;left:-6px;top:8px;bottom:8px;width:4px;border-radius:4px;background:var(--bw-green)}
.bw-sub .bw-link.is-active::before{left:-16px}
.bw-account-item{min-height:48px}
.bw-drawer-foot{padding:10px 18px 16px;color:var(--bw-muted);font-size:.78rem;border-top:1px solid var(--bw-line)}
.bw-guest .bw-drawer-foot{order:4}

/* Permanent drawer on wide screens. */
@media (min-width:1024px){
  body.bw-shell{padding-left:var(--bw-drawer-w)}
  .bw-drawer{top:var(--bw-bar-h);transform:none;width:var(--bw-drawer-w);z-index:20;box-shadow:none;border-right:1px solid var(--bw-line)}
  .bw-drawer-head .bw-brand{display:none}
  .bw-drawer-head .bw-who{margin-top:0}
  .bw-drawer-head:has(.bw-who[hidden]):has(.bw-session-slot:empty){display:none}
  .bw-menu-btn,.bw-scrim{display:none}
  .bw-appbar{padding-left:16px}
}

/* ---------- Snackbar, sheet, update notice ---------- */
.bw-snack{position:fixed;left:50%;top:calc(var(--bw-bar-h) + 12px);transform:translateX(-50%);z-index:60;display:flex;align-items:center;gap:10px;
  max-width:min(92vw,520px);padding:12px 18px;border-radius:14px;background:var(--bw-ink);color:#fff;font-weight:600;box-shadow:0 10px 30px rgba(14,30,60,.3)}
.bw-snack .bw-ic{color:#7ee09a}
.bw-snack span{overflow-wrap:anywhere}
.bw-sheet{position:fixed;inset:0;z-index:70;background:rgba(14,30,60,.5);display:flex;align-items:flex-end;justify-content:center;padding:16px}
.bw-sheet-card{width:100%;max-width:520px;background:var(--bw-surface);border-radius:20px;padding:22px;box-shadow:0 20px 50px rgba(14,30,60,.35)}
.bw-sheet-card h2{margin:0 0 8px}
.bw-sheet-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px}
.bw-sheet-actions button{flex:1;margin:0;min-width:140px}
.bw-guide{display:flex;gap:8px;align-items:flex-start;color:var(--bw-ink)}
@media (min-width:700px){.bw-sheet{align-items:center}}
.bw-update{position:fixed;left:50%;bottom:18px;transform:translateX(-50%);z-index:65;margin:0;border-radius:999px!important;
  background:var(--bw-ink)!important;border-color:var(--bw-ink)!important;color:#fff!important;padding:12px 22px!important;box-shadow:0 10px 30px rgba(14,30,60,.35)}

/* ---------- Page ---------- */
main{width:100%;max-width:1120px;margin:0 auto;padding:22px 16px 48px;min-width:0}
@media (min-width:700px){main{padding:30px 28px 56px}}
main>a:first-child{color:var(--bw-blue)}
.bw-shell main>a:first-child,.bw-shell main>a[href="/beta/"]{display:none}
.bw-drawer:focus{outline:none}
h1{font-size:clamp(1.45rem,4.6vw,2rem);line-height:1.2;margin:4px 0 6px;letter-spacing:-.01em;font-weight:750;color:var(--bw-ink)}
h2{font-size:1.1rem;font-weight:700;color:var(--bw-ink);margin:0 0 10px;line-height:1.3}
h3{font-size:1rem;font-weight:700;color:var(--bw-ink)}
.lead{font-size:1rem;color:var(--bw-muted);max-width:760px;margin:4px 0 14px}
main>p,section>p{color:var(--bw-muted)}
/* Words wrap only between words; a single word longer than its line may break (break-word does not shrink table columns
   below their longest word, so table cells never split a word: the table scrolls sideways instead). */
p,li,label,legend,.pill{overflow-wrap:break-word}
td,th{overflow-wrap:normal;word-break:normal;hyphens:manual}
a{color:var(--bw-blue)}

/* Cards */
section,.card{background:var(--bw-surface);border:1px solid var(--bw-line);border-radius:var(--bw-radius);padding:18px;margin:14px 0;box-shadow:var(--bw-shadow);min-width:0}
@media (min-width:700px){section,.card{padding:22px 24px}}
section section{border:0;box-shadow:none;padding:0;margin:16px 0 0;background:transparent}
section>h2{display:flex;align-items:center;gap:10px;padding-bottom:10px;margin-bottom:12px;border-bottom:1px solid var(--bw-line)}
section>h2::before{content:"";width:4px;height:18px;border-radius:3px;background:var(--bw-green);flex:none}
#workspace,#signedIn,#catalogWorkspace{min-width:0}
#workspace{display:block}
@media (min-width:1200px){
  #workspace{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 18px;align-items:start}
  #workspace>nav,#workspace>p,#workspace>div,#workspace>.wide,#workspace>.bw-full{grid-column:1/-1}
}

/* Toolbars (the pages' own nav rows) */
main nav{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:4px 0 10px}
main nav .button,main nav button{width:auto;margin:0;min-height:42px;padding:8px 14px;font-size:.93rem;background:var(--bw-surface);color:var(--bw-blue-900);border:1px solid var(--bw-line-strong)}
main nav .button:hover,main nav button:hover{background:var(--bw-blue-50)}
main nav .pill{margin-left:auto}

/* Forms */
label{display:block;margin:12px 0;font-weight:600;font-size:.93rem;color:var(--bw-ink)}
input,textarea,select{width:100%;max-width:100%;font:inherit;font-size:1rem;color:var(--bw-ink);border:1px solid var(--bw-line-strong);border-radius:var(--bw-radius-sm);
  padding:11px 13px;margin-top:6px;background:var(--bw-surface);min-height:48px}
input:focus,textarea:focus,select:focus{border-color:var(--bw-blue);box-shadow:0 0 0 3px rgba(27,95,174,.18);outline:none}
input[type=checkbox],input[type=radio]{width:20px;height:20px;min-height:0;margin:2px 0 0;accent-color:var(--bw-blue);flex:none}
label.check,label:has(>input[type=checkbox]){display:flex;gap:12px;align-items:flex-start;font-weight:500;padding:12px 14px;border:1px solid var(--bw-line);
  border-radius:var(--bw-radius-sm);background:#f8fafd}
fieldset{border:1px solid var(--bw-line);border-radius:var(--bw-radius-sm);padding:12px 14px;margin:14px 0;min-width:0}
textarea{font-family:ui-monospace,"Cascadia Mono",Consolas,monospace;font-size:.88rem}

/* Buttons */
button,.button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:10px 20px;margin:6px 8px 6px 0;
  border:1px solid var(--bw-blue);border-radius:var(--bw-radius-sm);background:var(--bw-blue);color:#fff;font:inherit;font-weight:650;font-size:.97rem;
  text-decoration:none;cursor:pointer;transition:background .15s,box-shadow .15s;max-width:100%}
button:hover,.button:hover{background:var(--bw-blue-700);color:#fff}
button:disabled{opacity:.5;cursor:default}
button.secondary,#logout,#catalogSignOut,#refresh,#copyConfig,#renew,#staffCancel,#cancelEdit,#hideCode{background:var(--bw-surface);color:var(--bw-blue-900);border-color:var(--bw-line-strong)}
button.secondary:hover,#logout:hover,#catalogSignOut:hover,#refresh:hover,#copyConfig:hover,#renew:hover,#staffCancel:hover,#cancelEdit:hover,#hideCode:hover{background:var(--bw-blue-50);color:var(--bw-blue-900)}
.bw-danger{background:var(--bw-surface)!important;color:var(--bw-red)!important;border-color:#e8b4af!important}
.bw-danger:hover{background:var(--bw-red-50)!important}
button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:3px solid #f0b429;outline-offset:2px}
form>button,#staff,#voidPolicy,#activate,#opening{min-width:0}
@media (max-width:560px){
  form>button[type=submit],form>button:not([type]),.bw-signin-el button{width:100%;margin-right:0}
  main nav button,main nav .button{flex:1 1 auto}
  section button{max-width:100%}
}

/* Status: chips, messages, outputs */
.pill{display:inline-flex;align-items:center;gap:6px;font-size:.8rem;font-weight:650;background:var(--bw-blue-50);color:var(--bw-blue-900);border-radius:999px;padding:4px 12px;line-height:1.4}
.pill.ok{background:var(--bw-green-50);color:var(--bw-green-700)}
.pill.warn{background:var(--bw-amber-50);color:#7a4700}
.pill.bad{background:var(--bw-red-50);color:var(--bw-red)}
[role=status]:not(:empty){display:block;padding:12px 14px 12px 16px;background:var(--bw-blue-50);color:var(--bw-blue-900);border-radius:var(--bw-radius-sm);
  border:1px solid var(--bw-blue-100);border-left:4px solid var(--bw-blue);margin:12px 0;font-weight:550;max-width:none}
[role=status]:empty{display:none}
[role=status].bw-msg-error{background:var(--bw-red-50);color:#8c1d15;border-color:#f3c3be;border-left-color:var(--bw-red)}
[role=status].bw-msg-error::before{content:"Sign-in failed: ";font-weight:750}
.bw-shell .bw-snack[role=status]{background:var(--bw-ink);color:#fff;border:0;margin:0;padding:12px 18px;display:flex}
.bw-shell .bw-snack[hidden]{display:none}
output{display:block;white-space:pre-wrap;overflow-wrap:anywhere;background:var(--bw-green-50);color:#174d26;border:1px solid #c6e6cf;padding:14px;border-radius:var(--bw-radius-sm);margin:12px 0;font-size:.88rem}
output:empty{display:none}
.notice{border-left:4px solid var(--bw-amber);background:var(--bw-amber-50);border-radius:10px;color:#6b4100}
.error{color:var(--bw-red)}
.muted{color:var(--bw-muted)}
.codebox{background:var(--bw-amber-50);border:1px solid #f0d9a8;border-radius:var(--bw-radius-sm)}
.codebox .code{overflow-wrap:anywhere;font-size:clamp(1.2rem,6vw,1.8rem)}

/* Lists, tiles, tables */
ul.rows>li{border-bottom:1px solid var(--bw-line);padding:12px 2px}
ul.rows>li>strong{min-width:0}
ul.rows>li.muted:only-child,.bw-empty{display:block;text-align:center;color:var(--bw-muted);padding:22px 14px;border:1px dashed var(--bw-line-strong);border-radius:var(--bw-radius-sm);background:#fafcfe}
.tile{border-radius:var(--bw-radius-sm);border:1px solid var(--bw-line);box-shadow:var(--bw-shadow)}
.totals{gap:10px}
.totals>p,.totals>div{background:var(--bw-blue-50);border-radius:12px;padding:8px 12px;margin:0;color:var(--bw-blue-900)}
table{width:100%;border-collapse:collapse;margin:10px 0;font-size:.93rem;background:var(--bw-surface)}
th,td{text-align:left;padding:10px 12px;border-bottom:1px solid var(--bw-line);vertical-align:top}
thead th,tr>th:only-of-type{background:#f5f8fc}
th{color:var(--bw-muted);font-weight:650;font-size:.8rem;text-transform:uppercase;letter-spacing:.03em}
tbody tr:hover td{background:#fafcff}
@media (max-width:760px){
  main table{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;border:1px solid var(--bw-line);border-radius:var(--bw-radius-sm)}
  th,td{padding:9px 10px;min-width:5.5rem}
}
@media (min-width:761px){main table{display:table}}

footer{color:var(--bw-muted);font-size:.8rem;text-align:center;margin-top:36px;padding-top:14px;border-top:1px solid var(--bw-line)}

/* ---------- Sign-in screen ---------- */
.bw-hero,.bw-resuming-card{display:none}
body.bw-out .bw-hero{display:flex;align-items:center;gap:14px;margin:6px 0 16px}
.bw-hero img{width:56px;height:56px;border-radius:50%;background:#fff;box-shadow:0 0 0 3px var(--bw-blue-100)}
.bw-hero div{display:flex;flex-direction:column;line-height:1.25}
.bw-hero strong{font-size:1.25rem;color:var(--bw-blue-900)}
.bw-hero span{color:var(--bw-muted);font-size:.92rem}
body.bw-out main{max-width:560px}
body.bw-out main>h1{font-size:1.35rem}
body.bw-in .bw-signin-el{display:none!important}
body.bw-resuming .bw-signin-el,body.bw-resuming .bw-hero{display:none!important}
body.bw-resuming .bw-resuming-card{display:flex;align-items:center;gap:12px;padding:18px;margin:16px 0;border-radius:var(--bw-radius);background:var(--bw-surface);
  border:1px solid var(--bw-line);box-shadow:var(--bw-shadow);font-weight:600}
.bw-spinner{width:22px;height:22px;border-radius:50%;border:3px solid var(--bw-blue-100);border-top-color:var(--bw-blue);animation:bw-spin .8s linear infinite;flex:none}
@keyframes bw-spin{to{transform:rotate(360deg)}}
body.bw-out #signedOut,body.bw-out .bw-tabbed{display:block}
.bw-signin-el .signin,.bw-signin-el.signin,#loginPanel{max-width:none}
.bw-signin-el section,.bw-signin-el.signin,section.bw-signin-el{border-top:4px solid var(--bw-blue)}
.bw-tabs{display:flex;gap:4px;padding:4px;margin:0 0 12px;background:#e6edf7;border-radius:14px}
.bw-tab{flex:1;margin:0;min-height:44px;padding:8px 10px;border:0;border-radius:11px;background:transparent;color:var(--bw-blue-900);font-weight:650;font-size:.95rem}
.bw-tab:hover{background:rgba(255,255,255,.6);color:var(--bw-blue-900)}
.bw-tab[aria-selected=true]{background:var(--bw-surface);color:var(--bw-blue);box-shadow:0 1px 4px rgba(14,48,96,.15)}
.bw-tabbed>section{margin-top:0}
.bw-tabbed>section.bw-tab-off{display:none}
.bw-alt{margin:14px 0 0;font-size:.93rem}
.bw-install .bw-warning,.bw-sheet .bw-warning{font-weight:650;color:var(--bw-ink);background:var(--bw-amber-50);border-left:4px solid var(--bw-amber);padding:10px 14px;border-radius:10px}

/* ---------- Owner home and employee page ---------- */
.bw-welcome{display:flex;flex-wrap:wrap;align-items:center;gap:14px;background:linear-gradient(135deg,#fff 0%,var(--bw-blue-50) 100%)}
.bw-welcome>h2{flex-basis:100%}
.bw-tiles{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:14px 0}
@media (min-width:640px){.bw-tiles{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (min-width:1200px){.bw-tiles{grid-template-columns:repeat(4,minmax(0,1fr))}}
.bw-tiles:empty{display:none}
.bw-tile{display:flex;align-items:center;gap:10px;min-height:64px;padding:12px;background:var(--bw-surface);border:1px solid var(--bw-line);border-radius:var(--bw-radius-sm);
  box-shadow:var(--bw-shadow);color:var(--bw-ink);font-weight:650;font-size:.93rem;text-decoration:none;line-height:1.25}
.bw-tile:hover{border-color:var(--bw-blue-100);background:var(--bw-blue-50)}
#storeLabel:not(:empty),#catalogStore:not(:empty),#store:not(:empty){display:inline-flex;align-items:center;font-weight:650;color:var(--bw-blue-900);background:var(--bw-blue-50);
  border:1px solid var(--bw-blue-100);border-radius:999px;padding:6px 14px;margin:4px 8px 4px 0}
#stage:not(:empty){color:var(--bw-muted);margin:4px 0}

/* ---------- Offline page (no shell script) and printing ---------- */
body.bw-offline>header{display:flex;align-items:center;gap:10px;background:var(--bw-blue);border-bottom:3px solid var(--bw-green);padding:12px 16px}
body.bw-offline>header a{color:#fff}
body.bw-offline>header span{display:none}
@media print{.bw-appbar,.bw-drawer,.bw-scrim,.bw-snack,.bw-progress,.bw-sheet{display:none!important}body.bw-shell{padding:0!important}}

/* G38.1 tidy layout (owner 2026-11-28: "empty spaces between some tiles"; "a tidier layout also for the Home tab and check all the
   other tables"). Layout only: no text, route, script or behaviour change. */
/* 1. Wide screens: the page sections stack one per row (as on phones and tablets) instead of a 2-column grid that paired short and tall
      sections and left holes; tables get the full width. */
@media (min-width:1200px){
  #workspace{display:block}
  /* Home only: the cards below the shortcut tiles flow into two balanced columns (newspaper style), so no card leaves a hole. */
  body[data-bw-page="home"] #workspace{columns:2;column-gap:18px}
  body[data-bw-page="home"] #workspace>*{column-span:all}
  body[data-bw-page="home"] #workspace>section:not(#setup):not(#salesTrend){column-span:none;break-inside:avoid;margin:0 0 18px;display:block;width:100%}
  body[data-bw-page="home"] #workspace>section[hidden]{display:none}
}
/* 2. Home shortcut tiles: 3 per row from tablet width up (not 4), and a short last row is stretched to fill it, so there is no hole. */
@media (min-width:1200px){.bw-tiles{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:639px){.bw-tiles>.bw-tile:last-child:nth-child(2n+1){grid-column:1/-1}}
@media (min-width:640px){
  .bw-tiles>.bw-tile:last-child:nth-child(3n+1){grid-column:1/-1}
  .bw-tiles>.bw-tile:last-child:nth-child(3n+2){grid-column:span 2}
}
/* 3. Figure tiles (Expiring soon, Warehouse, Counts...): as many equal columns as the figures need, no empty slot. */
main .tiles{grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr))}
@media (max-width:640px){main .tiles>:last-child:nth-child(odd){grid-column:1/-1}}
/* 4. G38.1: the result message after a button press is scrolled into view (below the top bar) and briefly highlighted. */
main [role=status],main [role=alert]{scroll-margin-top:84px;scroll-margin-bottom:24px}
main [role=status]:focus,main [role=alert]:focus{outline:2px solid var(--bw-blue);outline-offset:2px}
@keyframes bw-msg-flash{from{box-shadow:0 0 0 4px var(--bw-blue-100,#cfe0f5)}to{box-shadow:0 0 0 0 transparent}}
main .bw-msg-flash{animation:bw-msg-flash 1.2s ease-out}
@media (prefers-reduced-motion:reduce){main .bw-msg-flash{animation:none}}
