/* ================================================================
   app-menu.css — additions for the shared navigation.
   Everything else (.sidebar, .nav-item, .badge, .card …) already
   lives in main.css; this file only adds what is new:
   the search trigger, the command palette and the sidebar footer.
   Load AFTER main.css.
   ================================================================ */

/* ---- search trigger in the sidebar ---- */
.nav-search-trigger{
  display:flex; align-items:center; gap:.75rem; width:calc(100% - 1.5rem);
  margin:.2rem .75rem .3rem; padding:.4rem .7rem;
  background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.10);
  border-radius:var(--r-md); color:var(--sidebar-text);
  font:inherit; font-size:.85rem; cursor:pointer; text-align:left;
  transition:background .15s ease, color .15s ease;
}
.nav-search-trigger:hover{ background:rgba(255,255,255,.12); color:var(--sidebar-text-hover); }
.nav-search-trigger svg{ width:18px; height:18px; flex:0 0 18px; }
.nav-kbd{
  margin-left:auto; font-size:.68rem; font-family:inherit; letter-spacing:.02em;
  padding:.12rem .38rem; border-radius:4px;
  background:rgba(255,255,255,.10); border:1px solid rgba(255,255,255,.14);
  color:var(--sidebar-text);
}
.sidebar.collapsed .nav-search-trigger{ justify-content:center; width:calc(100% - 1rem); margin-inline:.5rem; }
.sidebar.collapsed .nav-kbd{ display:none; }

/* ---- sidebar footer / signed-in user ---- */
.sidebar-footer{
  margin-top:auto; padding:.6rem .75rem .9rem;
  border-top:1px solid rgba(255,255,255,.08);
}
.sidebar-user{ display:flex; align-items:center; gap:.6rem; padding:.35rem .2rem; }
.sidebar-user-meta{ display:flex; flex-direction:column; min-width:0; flex:1; }
.sidebar-user-name{
  color:var(--sidebar-text-hover); font-size:.82rem; font-weight:600;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:150px;
}
.sidebar-user-role{ color:var(--sidebar-text); font-size:.7rem; }
.sidebar.collapsed .sidebar-user{ flex-direction:column; gap:.35rem; }
.sidebar.collapsed .sidebar-user-meta{ display:none; }

/* ---- theme toggle + sign out: one compact row beside the avatar,
   instead of two full-width rows stacked under it ---- */
.sidebar-footer-actions{ display:flex; align-items:center; gap:.15rem; flex-shrink:0; }
.footer-icon-btn{
  display:flex; align-items:center; justify-content:center;
  width:30px; height:30px; border-radius:var(--r-md); flex-shrink:0;
  border:0; background:none; color:var(--sidebar-text);
  cursor:pointer; text-decoration:none;
  transition:background .15s ease, color .15s ease;
}
.footer-icon-btn svg{ width:16px; height:16px; }
.footer-icon-btn:hover{ background:rgba(255,255,255,.1); color:var(--sidebar-text-hover); }

/* ---- topbar "signed in as" — moved out of the sidebar footer
   (2026-09-28) so it stays visible regardless of sidebar state.
   Injected by app-menu.js's mountTopbarUser() into .topbar-right,
   which is on a light surface (unlike the dark sidebar), so this
   uses the ordinary text tokens rather than --sidebar-text. ---- */
.topbar-user{
  display:flex; align-items:center; gap:.55rem;
  padding:.3rem .7rem .3rem .3rem; border-radius:var(--r-full);
  background:var(--color-bg); border:1px solid var(--color-border);
}
.topbar-user-meta{ display:flex; flex-direction:column; min-width:0; line-height:1.2; }
.topbar-user-name{
  color:var(--color-text); font-size:.82rem; font-weight:600;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:160px;
}
.topbar-user-role{ color:var(--color-text-muted); font-size:.7rem; }
@media (max-width: 640px){
  .topbar-user-meta{ display:none; }
  .topbar-user{ padding:.3rem; border-radius:50%; }
}

/* external (other system) links get a subtle marker */
.nav-item[data-ext]{ position:relative; }
.nav-item[data-ext] .nav-item-text::after{
  content:'↗'; margin-left:.35rem; opacity:.55; font-size:.85em;
}
.sidebar.collapsed .nav-item[data-ext] .nav-item-text::after{ content:none; }

/* ---- command palette ---- */
.cmdp-backdrop{
  position:fixed; inset:0; z-index:1200; display:none;
  background:rgba(15,23,42,.55); backdrop-filter:blur(3px);
  padding:12vh 1rem 1rem;
}
.cmdp-backdrop.open{ display:block; }
.cmdp{
  max-width:620px; margin:0 auto; background:var(--color-surface);
  border-radius:var(--r-lg); box-shadow:0 24px 60px rgba(15,23,42,.35);
  overflow:hidden; animation:cmdp-in .13s ease-out;
}
@keyframes cmdp-in{ from{ transform:translateY(-8px); opacity:0 } to{ transform:none; opacity:1 } }
.cmdp-input-row{
  display:flex; align-items:center; gap:.7rem;
  padding:.85rem 1rem; border-bottom:1px solid var(--color-border);
}
.cmdp-input-row svg{ width:20px; height:20px; color:var(--color-text-muted); flex:0 0 20px; }
.cmdp-input-row .nav-kbd{
  background:var(--color-gray-100); border-color:var(--color-border); color:var(--color-text-muted);
}
#cmdp-input{
  flex:1; border:0; outline:0; font:inherit; font-size:1rem;
  color:var(--color-text); background:transparent;
}
.cmdp-results{ max-height:52vh; overflow-y:auto; padding:.4rem; }
.cmdp-item{
  display:flex; align-items:center; gap:.75rem; width:100%;
  padding:.6rem .7rem; border-radius:var(--r-md);
  text-decoration:none; color:var(--color-text);
}
.cmdp-item:hover,.cmdp-item.sel{ background:var(--color-primary-lighter); }
.cmdp-item.sel{ box-shadow:inset 2px 0 0 var(--color-primary); }
.cmdp-ico svg{ width:20px; height:20px; color:var(--color-primary); display:block; }
.cmdp-text{ display:flex; flex-direction:column; min-width:0; }
.cmdp-text strong{ font-size:.9rem; font-weight:600; }
.cmdp-text em{ font-style:normal; font-size:.78rem; color:var(--color-text-muted);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cmdp-sec{
  margin-left:auto; font-size:.7rem; color:var(--color-text-muted);
  background:var(--color-gray-100); padding:.15rem .45rem; border-radius:var(--r-full);
  white-space:nowrap;
}
.cmdp-empty{ padding:1.4rem; text-align:center; color:var(--color-text-muted); font-size:.88rem; }

@media (max-width:640px){
  .cmdp-backdrop{ padding-top:6vh; }
  .cmdp-sec{ display:none; }
}

/* ---- small shared helpers used by the new module pages ---- */
.page-head{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:1rem; flex-wrap:wrap; margin-bottom:var(--sp-5);
}
.page-head .page-sub{ color:var(--color-text-secondary); font-size:.9rem; margin-top:.15rem; }
.kpi-row{ display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:var(--sp-4); margin-bottom:var(--sp-5); }
.filter-bar{ display:flex; gap:.6rem; flex-wrap:wrap; align-items:center; margin-bottom:var(--sp-4); }
.filter-bar .form-input,.filter-bar .filter-select{ max-width:240px; }
.timeline{ list-style:none; margin:0; padding:0 0 0 1.15rem; border-left:2px solid var(--color-border); }
.timeline li{ position:relative; padding:0 0 1rem 1rem; }
.timeline li::before{
  content:''; position:absolute; left:-1.42rem; top:.3rem; width:.6rem; height:.6rem;
  border-radius:50%; background:var(--color-primary); box-shadow:0 0 0 3px var(--color-primary-light);
}
.timeline li.done::before{ background:var(--color-success); box-shadow:0 0 0 3px var(--color-success-light); }
.timeline li.pending::before{ background:var(--color-gray-300); box-shadow:0 0 0 3px var(--color-gray-100); }
.timeline-when{ font-size:.75rem; color:var(--color-text-muted); }

/* ---- form grid used by WF.renderForm() ---- */
.wf-form-grid{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--sp-4); }
.wf-form-grid .wf-full{ grid-column:1 / -1; }
.wf-form-grid .wf-half{ grid-column:span 1; }
@media (max-width:720px){
  .wf-form-grid{ grid-template-columns:1fr; }
  .wf-form-grid .wf-half{ grid-column:1 / -1; }
}
@media (max-width:768px){
  /* Same iOS auto-zoom fix as main.css's .form-control (which these
     already inherit) — the line-items table's own cell inputs have a
     smaller font-size that needs its own override. */
  .wf-line-table td .wf-cell{ font-size:16px; }
}
.wf-check{ display:flex; align-items:center; gap:.5rem; padding:.55rem 0; font-size:.9rem; }
.wf-check input{ width:1.05rem; height:1.05rem; accent-color:var(--color-primary); }
.form-hint{ display:block; margin-top:.25rem; font-size:.76rem; color:var(--color-text-muted); }
.wf-row{ display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }
.wf-muted{ color:var(--color-text-muted); }
.wf-mono{ font-family:Consolas,"Courier New",monospace; font-size:.85em; }
.wf-overdue{ color:var(--color-danger); font-weight:600; }
.wf-split{ display:grid; grid-template-columns:1.6fr 1fr; gap:var(--sp-5); align-items:start; }
@media (max-width:980px){ .wf-split{ grid-template-columns:1fr; } }

/* ---- attachments: the picker on a form, the list on a record ---- */
.wf-attach{ border-top:1px solid var(--color-border); margin-top:var(--sp-5); padding-top:var(--sp-4); }
.wf-attach h3{ font-size:.95rem; margin:0 0 .15rem; }
.wf-drop{
  display:flex; align-items:center; justify-content:center; gap:.6rem;
  margin-top:.75rem; padding:1.1rem; text-align:center; cursor:pointer;
  border:1.5px dashed var(--color-border); border-radius:var(--r-md);
  background:var(--color-bg); color:var(--color-text-secondary); font-size:.86rem;
  transition:border-color .15s, background .15s;
}
.wf-drop:hover, .wf-drop.is-over{ border-color:var(--color-primary); background:var(--color-primary-light); }
.wf-drop strong{ color:var(--color-primary); font-weight:600; }
.wf-filelist{ list-style:none; margin:.75rem 0 0; padding:0; display:grid; gap:.4rem; }
.wf-file{
  display:flex; align-items:center; gap:.6rem; padding:.5rem .65rem;
  border:1px solid var(--color-border); border-radius:var(--r-md);
  background:var(--color-surface); font-size:.85rem;
}
.wf-file > svg{ flex:none; color:var(--color-text-muted); }
.wf-file-body{ display:flex; flex-direction:column; min-width:0; flex:1; }
.wf-file-body > :first-child{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wf-file-body small{ font-size:.73rem; }
.wf-file-remove{
  flex:none; border:0; background:none; cursor:pointer; padding:.15rem .35rem;
  color:var(--color-text-muted); font-size:1.1rem; line-height:1; border-radius:var(--r-sm);
}
.wf-file-remove:hover{ color:var(--color-danger); background:var(--color-bg); }
.wf-file.is-busy{ opacity:.6; }

/* ---- "table" field: a repeating line-items grid on a form ---- */
/* overflow-x, not hidden, on the wrapper: a line-items table's columns
   don't all fit on a phone — this scrolls the table horizontally
   within its own border instead of clipping columns or blowing out
   the page width. */
.wf-table-wrap{ margin-top:.35rem; overflow-x:auto; -webkit-overflow-scrolling:touch; border-radius:var(--r-md); }
.wf-line-table{ border:1px solid var(--color-border); border-radius:var(--r-md); border-collapse:collapse; min-width:480px; }
.wf-line-table th, .wf-line-table td{ padding:.4rem .5rem; border-bottom:1px solid var(--color-border); }
.wf-line-table thead th{
  background:var(--color-bg); font-size:.72rem; font-weight:700; text-transform:uppercase;
  letter-spacing:.04em; color:var(--color-text-muted); text-align:left;
}
.wf-line-table tbody tr:last-child td{ border-bottom:0; }
.wf-line-table td .wf-cell{ margin:0; padding:.4rem .5rem; font-size:.85rem; min-width:0; }
.wf-line-table .wf-row-remove-cell{ width:2rem; text-align:center; }
.wf-row-remove{
  border:0; background:none; cursor:pointer; padding:.15rem .35rem;
  color:var(--color-text-muted); font-size:1.1rem; line-height:1; border-radius:var(--r-sm);
}
.wf-row-remove:hover{ color:var(--color-danger); background:var(--color-bg); }
.wf-table-sum-label{ text-align:right; font-weight:600; }
.wf-table-sum{ font-weight:700; white-space:nowrap; }

/* ---- preview tiles: what the attachment actually is ----
   A row of small boxes under a record - the image itself, the first
   page of a PDF, a labelled card for anything else. Sized so half a
   dozen fit inside a modal without it turning into a gallery. */
.wf-previews{
  display:grid; gap:.7rem; margin-top:.75rem;
  grid-template-columns:repeat(auto-fill,minmax(148px,1fr));
}
.wf-preview{
  margin:0; overflow:hidden; background:var(--color-surface);
  border:1px solid var(--color-border); border-radius:var(--r-md);
}
.wf-preview-box{
  position:relative; height:104px; overflow:hidden;
  display:flex; align-items:center; justify-content:center;
  background:var(--color-bg);
}
.wf-preview-box img{ width:100%; height:100%; object-fit:cover; display:block; }
/* the embedded PDF is a picture here, not a reader - the overlay link
   below opens it properly, so the plugin must not eat the click */
.wf-preview-box embed{ width:100%; height:100%; display:block; border:0; pointer-events:none; }
.wf-preview-none{
  display:flex; flex-direction:column; align-items:center; gap:.3rem;
  padding:.5rem; text-align:center; font-size:.72rem; color:var(--color-text-muted);
}
.wf-preview-open{ position:absolute; inset:0; display:block; }
.wf-preview-open:hover{ background:rgba(0,0,0,.07); }
.wf-preview figcaption{ padding:.45rem .55rem; display:flex; flex-direction:column; gap:.1rem; }
.wf-preview-name{
  font-size:.78rem; font-weight:600;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.wf-preview figcaption small{ font-size:.7rem; }

/* ---- thumbnail strip for a table cell ---- */
.wf-thumbs{ display:inline-flex; align-items:center; gap:.25rem; }
.wf-thumb{
  width:26px; height:26px; display:block; object-fit:cover;
  border:1px solid var(--color-border); border-radius:var(--r-sm);
  background:var(--color-bg);
}
.wf-thumb-doc{ display:inline-flex; align-items:center; justify-content:center; color:var(--color-text-muted); }
.wf-thumb-doc svg{ width:14px; height:14px; }
.wf-thumb-more{ font-size:.72rem; color:var(--color-text-muted); }

/* ================================================================
   Stat / KPI cards — everything centred.
   Overrides main.css's icon-left layout. Lives here rather than in
   main.css because main.css is shared with the Access Control system.
   ================================================================ */
.stat-card{
  flex-direction:column; align-items:center; justify-content:center;
  text-align:center; gap:var(--sp-3);
}
button.stat-card{ width:100%; font:inherit; color:inherit; cursor:pointer; }
.stat-card .stat-icon{ margin:0 auto; }
.stat-card .stat-content{ width:100%; text-align:center; }
.stat-card .stat-label,
.stat-card .stat-value,
.stat-card .stat-trend,
.stat-card .stat-meta{ text-align:center; margin-left:auto; margin-right:auto; }
.stat-card .stat-trend{ justify-content:center; }
.stat-card .stat-meta{ font-size:var(--fs-xs); color:var(--color-text-muted); margin-top:var(--sp-1); }
.stat-card .drill-hint{ text-align:center; width:100%; }

/* visible log out button in the top bar */
.topbar-signout{display:inline-flex;align-items:center;gap:.4rem;border:1px solid var(--color-border);background:var(--color-surface);color:var(--color-text);border-radius:999px;padding:.4rem .85rem;font:inherit;font-size:.82rem;font-weight:700;cursor:pointer;white-space:nowrap}
.topbar-signout:hover{background:var(--color-danger-light);color:var(--color-danger);border-color:var(--color-danger)}
@media(max-width:640px){.topbar-signout span{display:none}.topbar-signout{padding:.45rem}}

.topbar-viewas{display:inline-flex;align-items:center;gap:.4rem;font-size:.78rem;font-weight:700;color:var(--color-text-secondary);white-space:nowrap}
.topbar-viewas select{border:1px solid var(--color-border);border-radius:999px;background:var(--color-surface);color:var(--color-text);padding:.3rem .6rem;font:inherit;font-size:.8rem}
@media(max-width:640px){.topbar-viewas span{display:none}}

/* No sliding while a page first builds its menu (see app-menu.js mount) */
html.menu-settling .sidebar, html.menu-settling .sidebar *, html.menu-settling .main-content { transition: none !important; }

/* Tables, the same everywhere: faint lines between the columns, and text that wraps only between words (never in the middle of one).
   Short whole-number columns are centred by table-scroll.js, which also pins the sideways scroll bar to the bottom of the screen.
   A table can opt out with class="no-grid". */
:is(main, .page-body, .modal, .ui) table:not(.no-grid) :is(th, td) { border-right: 1px solid rgba(100,116,139,.18); word-break: normal; overflow-wrap: normal; hyphens: manual; }
:is(main, .page-body, .modal, .ui) table:not(.no-grid) :is(th, td):last-child { border-right: 0; }

/* The floating "More above / More below" pills are switched off everywhere (also hides them if an old copy of the script is cached) */
#sh-wrap { display: none !important; }

/* The description line under each page heading is hidden on every page (delete this rule to bring them back).
   The company/date line on the hub pages (#page-date) is not a description and stays. */
.page-sub, .page-subtitle:not(#page-date), .ui-head h1 + p, #hp-hi + p { display: none !important; }

/* The Back button is not shown in the top ribbon any more (Home and the system tabs stay). The thin line that separates the two rows
   of the ribbon used to hang off the Back button, so it now hangs off the Home button. */
.sys-strip > .topbar-home { position: relative; }
.sys-strip > .topbar-home::before { content: ''; position: absolute; left: -.75rem; right: -100vw; top: -.4rem; border-top: 1px solid var(--color-border); pointer-events: none; }
/* (2026-10-27) Back is shown again: row 2 = Back + Home buttons, row 3 = the system tabs. */

/* ---- System colours ----
   Every page takes the colour of the system you are working in (the same colours as the cards on the "Choose a system" page).
   app-menu.js puts the system on <html data-system="...">. Where nothing is set the colour is the dark navy.
   To give another system its colour, add one more line like the HR one. */
:root { --theme: #121212; --theme-2: #2a2a2a; --theme-tint: #f3f3f3; --theme-edge: #c1272e; }
html[data-system="hr"] { --theme: #2679b8; --theme-2: #1d628f; --theme-tint: #e3f0fa; --theme-edge: #a9d4f5; }
html[data-system="hs"] { --theme: #5d7f17; --theme-2: #4a6612; --theme-tint: #eaf0dc; --theme-edge: #b9d27a; }

/* Number cards take the system colour instead of navy (pages set the navy themselves, so this wins with !important) */
html:is([data-system="hr"], [data-sec]) :is(.kpis .kpi, #kpis .stat-card, #att-stats .stat-card, #rec-kpis .stat-card, #kpis .rc-kpi, #kpis .ui-kpi, .ui-kpi, .dh-kpi, .st-kpi,
  .jd-stat, .al-stat, .hr-stat, .sd-stat, .summary-row .sum-card, .hero-bar .hero-card, .pr-k, #my-balances .lv-bal, .pl-hero, a.kpi) {
  background: var(--theme) !important; border-color: var(--theme) !important; }
html:is([data-system="hr"], [data-sec]) :is(button.stat-card, #kpis button.stat-card, .st-kpi, #kpis .rc-kpi, button.ui-kpi, .dh-kpi, .jd-stat, .al-stat, .hr-stat, .sd-stat, a.kpi, .kpis button.kpi, .kpis .kpi[data-f], .kpis .kpi[data-kpi]):hover,
html:is([data-system="hr"], [data-sec]) :is(button.stat-card, .st-kpi, #kpis .rc-kpi, button.ui-kpi, .dh-kpi, .jd-stat, .al-stat, .hr-stat, .sd-stat, a.kpi, .kpis button.kpi, .kpis .kpi[data-f], .kpis .kpi[data-kpi]):focus-visible {
  background: var(--theme-2) !important; border-color: var(--theme-edge) !important; }

/* Buttons are dark blue with white text, so they are easy to tell apart from fields and drop-downs (which are white).
   Deliberate exceptions keep their own look: the pale-blue "Apply for leave" (.btn-apply), red Delete/Reject (.at-del, btn-danger),
   the pale green / pale red Approve and Reject bar on the Overtime page, and the borderless week arrows. */
.btn:is(.btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-success):not(.btn-apply):not(.at-del):not(.btn-delete) {
  background: var(--theme, #121212) !important; color: #fff !important; border: 1px solid var(--theme, #121212) !important; box-shadow: none; filter: none; text-decoration: none; }
.btn:is(.btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-success):not(.btn-apply):not(.at-del):not(.btn-delete):hover:not(:disabled) {
  background: var(--theme-2, #2a2a2a) !important; border-color: var(--theme-edge, #c1272e) !important; color: #fff !important; text-decoration: none; }
.btn:is(.btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-success):not(.btn-apply):not(.at-del):not(.btn-delete):disabled { opacity: .5; cursor: not-allowed; }
.btn:is(.btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-success):not(.btn-apply):not(.at-del):not(.btn-delete):focus-visible { outline: 2px solid var(--theme-edge, #c1272e); outline-offset: 2px; }
/* Delete / Remove buttons stay red in every system: white with a red border and red text (table-scroll.js tags them by what the button says) */
.btn.btn-delete { background: #fff !important; color: #b91c1c !important; border: 1px solid #b91c1c !important; box-shadow: none; filter: none; text-decoration: none; }
.btn.btn-delete:hover:not(:disabled) { background: #fef2f2 !important; border-color: #991b1b !important; color: #991b1b !important; text-decoration: none; }
.btn.btn-delete:disabled { opacity: .5; cursor: not-allowed; }
/* on a dark strip (the bulk-action bar) a navy button would disappear, so it gets a light edge */
.rc-bulk .btn:is(.btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-success) { border-color: rgba(255,255,255,.55) !important; }

/* Previous / next arrows that sit either side of a date or month box (one look everywhere, as on the Shifts page):
   borderless, as tall as the box, tucked in close to it. Use class="nav-arrow prev" and class="nav-arrow next". */
.nav-arrow { box-sizing: border-box; height: 42px; min-height: 42px; width: 30px; padding: 0; margin: 0; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: #121212; font: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; border-radius: 8px; box-shadow: none; }
.nav-arrow:hover:not(:disabled), .nav-arrow:focus-visible { background: #f1f5f9; }
.nav-arrow.prev { margin-right: -.4rem; }
.nav-arrow.next { margin-left: -.4rem; }
.nav-arrow.prev + .form-control { height: 42px; min-height: 42px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; }

/* The top ribbon stays put while the page scrolls underneath it */
.sys-strip { position:sticky; top:var(--strip-top, 0px); z-index:210; box-shadow:0 1px 0 var(--color-border), 0 4px 12px rgba(15,23,42,.06); }
/* the page's own bar (also sticky, z-index 200) used to slide over the ribbon: it now parks just underneath it */
.sys-strip ~ .topbar { top:calc(var(--strip-h, 0px) + var(--strip-top, 0px)); }

/* Signed-in person: an avatar at the far right of the top strip; click it for the account menu */
.user-menu { position:relative; flex:none; order:1; margin-top:.35rem; margin-bottom:.35rem; z-index:2000; }
.user-menu .topbar-user { cursor:pointer; padding:.2rem; gap:0; border-radius:50%; transition:box-shadow .15s ease, border-color .15s ease; }
.user-menu .topbar-user[hidden] { display:none; }
.user-menu .topbar-user:hover, .user-menu .topbar-user[aria-expanded="true"] { border-color:var(--color-primary); box-shadow:0 0 0 3px color-mix(in srgb, var(--color-primary) 18%, transparent); }
.user-menu .topbar-user:focus-visible { outline:2px solid var(--color-primary); outline-offset:2px; }
.user-menu .topbar-user-meta { display:none; }
.user-pop { position:absolute; right:0; top:calc(100% + 8px); min-width:230px; padding:.4rem; border-radius:12px;
  background:var(--color-surface); border:1px solid var(--color-border); box-shadow:0 14px 36px rgba(15,23,42,.22); }
.user-pop[hidden] { display:none; }
.user-pop-head { display:flex; flex-direction:column; gap:.1rem; padding:.55rem .65rem .65rem; margin-bottom:.3rem; border-bottom:1px solid var(--color-border); line-height:1.25; }
.user-pop-head b { font-size:.9rem; color:var(--color-text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:260px; }
.user-pop-head span { font-size:.75rem; color:var(--color-text-muted); }
.user-pop-item { display:flex; align-items:center; gap:.6rem; width:100%; padding:.55rem .65rem; border:0; border-radius:8px; background:none;
  color:var(--color-text); font:inherit; font-size:.86rem; font-weight:600; text-align:left; text-decoration:none; cursor:pointer; }
.user-pop-item svg { width:16px; height:16px; flex:none; opacity:.75; }
.user-pop-item:hover, .user-pop-item:focus-visible { background:var(--color-bg); text-decoration:none; outline:none; }
.user-pop-item.danger { color:var(--color-danger); }
.user-pop-item.danger:hover, .user-pop-item.danger:focus-visible { background:var(--color-danger-light); }
@media print { .user-menu { display:none; } }

/* App name with a mini logo at the top of the expanded menu */
.sidebar-brand { display:flex; align-items:center; gap:.65rem; flex-shrink:0; padding:.8rem 1rem; text-decoration:none;
  color:#fff; border-bottom:1px solid rgba(255,255,255,.1); }
.sidebar-brand:hover { background:rgba(255,255,255,.06); text-decoration:none; }
.sidebar-brand img { width:32px; height:32px; flex:none; object-fit:contain; background:#fff; border-radius:8px; padding:3px; }
.sidebar-brand span { font-size:.95rem; font-weight:700; line-height:1.2; letter-spacing:.01em; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media print { .sidebar-brand { display:none; } }

/* Collapsed means gone, not a thin icon rail: the menu slides fully out of the way, the page uses the whole width,
   and the hamburger in the top strip brings it back. (Phones already hide the menu off-screen by themselves.) */
@media (min-width: 769px) {
  .sidebar.collapsed { width: 0 !important; min-width: 0; border: 0; box-shadow: none; visibility: hidden; pointer-events: none;
    transition: width var(--t-slow), visibility 0s linear var(--t-slow); }
  .main-content.collapsed { margin-left: 0 !important; }
}

/* Topbar back button */
.topbar-back {
  display:inline-flex; align-items:center; gap:.4rem; flex-shrink:0;
  height:36px; padding:0 .85rem 0 .65rem; border-radius:999px; cursor:pointer;
  font:inherit; font-size:.82rem; font-weight:700; letter-spacing:.01em;
  color:var(--color-primary); background:color-mix(in srgb, var(--color-primary) 10%, transparent);
  border:1px solid color-mix(in srgb, var(--color-primary) 28%, transparent);
  transition:background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.topbar-back svg { transition:transform .18s ease; }
.topbar-back:hover { background:var(--color-primary); color:#fff; box-shadow:0 4px 12px color-mix(in srgb, var(--color-primary) 35%, transparent); }
.topbar-back:hover svg { transform:translateX(-3px); }
.topbar-back:active { transform:scale(.96); }
.topbar-back:focus-visible { outline:2px solid var(--color-primary); outline-offset:2px; }
.topbar-back[hidden] { display:none; }
@media (max-width:640px) { .topbar-back span { display:none; } .topbar-back { padding:0 .6rem; } }
@media print { .topbar-back { display:none; } }

/* Topbar home button: solid, so it reads as "take me to the start" next to the outlined Back */
.topbar-home {
  display:inline-flex; align-items:center; gap:.4rem; flex-shrink:0; text-decoration:none;
  height:36px; padding:0 .95rem 0 .75rem; border-radius:999px; cursor:pointer;
  font:inherit; font-size:.82rem; font-weight:700; letter-spacing:.01em;
  color:#fff; background:var(--color-primary); border:1px solid var(--color-primary);
  box-shadow:0 1px 3px color-mix(in srgb, var(--color-primary) 30%, transparent);
  transition:filter .15s ease, transform .15s ease, box-shadow .15s ease;
}
.topbar-home:hover { filter:brightness(1.12); box-shadow:0 4px 12px color-mix(in srgb, var(--color-primary) 35%, transparent); }
.topbar-home:active { transform:scale(.96); }
.topbar-home:focus-visible { outline:2px solid var(--color-primary); outline-offset:2px; }
.sys-strip .topbar-home { flex:none; }
@media (max-width:640px) { .topbar-home span { display:none; } .topbar-home { padding:0 .6rem; } }
@media print { .topbar-home { display:none; } }

/* System switcher (HR / Health & Safety / Payroll / My Space) */
.sys-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 4px 12px 10px; padding: 4px; border-radius: 12px; background: rgba(127,127,127,.14); color: var(--sidebar-text); }
.sys-btn { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border: 0; border-radius: 9px; background: transparent; color: inherit; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; opacity: .75; text-align: left; line-height: 1.15; }
.sys-btn svg { width: 15px; height: 15px; flex: none; }
.sys-btn:hover { opacity: 1; background: rgba(127,127,127,.16); }
.sys-btn.on { opacity: 1; background: var(--primary, #2563eb); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.sidebar.collapsed .sys-switch { grid-template-columns: 1fr; margin: 4px 6px 8px; }
.sidebar.collapsed .sys-btn span { display: none; }
.sidebar.collapsed .sys-btn { justify-content: center; }


/* ---- system bar above the top bar: HR / Health & Safety / Payroll / Fleet / My Space + search ---- */
.sys-strip{ display:flex; align-items:center; gap:.75rem; padding:.45rem 1rem; background:var(--color-surface); border-bottom:1px solid var(--color-border); }
.sys-tabs{ display:flex; gap:.3rem; flex:1; min-width:0; overflow-x:auto; scrollbar-width:none; }
.sys-tabs::-webkit-scrollbar{ display:none; }
.sys-tab{ display:inline-flex; align-items:center; gap:.45rem; padding:.45rem .9rem; border:1px solid transparent; border-radius:999px; background:transparent; color:var(--color-text-secondary, var(--color-text)); font:inherit; font-size:.85rem; font-weight:700; cursor:pointer; white-space:nowrap; transition:background .15s, color .15s; }
.sys-tab svg{ width:17px; height:17px; flex:none; }
.sys-tab:hover{ background:var(--color-primary-light, rgba(127,127,127,.14)); }
.sys-tab.on{ background:var(--theme, var(--color-primary, #121212)); color:#fff; box-shadow:0 2px 6px rgba(0,0,0,.2); }
.sys-search{ display:inline-flex; align-items:center; gap:.5rem; flex:none; padding:.4rem .75rem; border:1px solid var(--color-border); border-radius:999px; background:var(--color-surface); color:var(--color-text-muted, var(--color-text)); font:inherit; font-size:.82rem; cursor:pointer; }
.sys-search:hover{ border-color:var(--color-primary, #121212); color:var(--color-text); }
.sys-search svg{ width:16px; height:16px; }
.sys-search kbd{ font:inherit; font-size:.68rem; padding:.05rem .35rem; border-radius:4px; border:1px solid var(--color-border); }
@media(max-width:760px){ .sys-tab span{ display:none; } .sys-tab{ padding:.5rem .7rem; } .sys-search span, .sys-search kbd{ display:none; } .sys-tab.on span{ display:inline; } }
@media print{ .sys-strip{ display:none; } }

/* ---- side menu: tighter, one open section ---- */
.sidebar-nav .nav-section-label{ padding-top:.55rem; padding-bottom:.55rem; }
.sidebar-nav .nav-item{ padding-top:.42rem; padding-bottom:.42rem; }

/* ---- compact top: company header is one slim row, the system bar is slim ---- */
.sidebar .sidebar-header{ min-height:0; padding:.45rem .75rem; }
.sidebar .sidebar-header .logo-icon{ width:30px; height:30px; }
.sidebar .sidebar-header .logo-icon img{ width:26px !important; height:26px !important; }
.sidebar .sidebar-header .logo-text{ font-size:.85rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; overflow-wrap:normal; }
.sys-strip{ padding:.25rem .75rem; }
.sys-tab{ padding:.3rem .75rem; }
.sys-search{ padding:.28rem .65rem; }

/* ---- side menu in the Fleet style: every group open, small headings, coloured icons ---- */
.sidebar-nav .nav-section.flat{ margin-bottom:.15rem; }
.sidebar-nav .nav-section.flat .nav-section-label{ display:block; margin:0; cursor:default; padding:.85rem 1.1rem .25rem; font-size:.66rem; letter-spacing:.09em; font-weight:700; color:var(--sidebar-text); opacity:.75; }
.sidebar-nav .nav-section.flat .nav-section-items{ max-height:none; overflow:visible; }
.nav-item .nav-emoji{ width:20px; flex:0 0 20px; text-align:center; font-size:1rem; line-height:1; }
/* menu icons are plain white line icons, no colour */
.sidebar-nav .nav-item svg{ color:#fff; stroke:#fff; opacity:.92; }
.sidebar-nav .nav-item:hover svg, .sidebar-nav .nav-item.active svg{ opacity:1; }
.sidebar-nav .nav-item{ gap:.65rem; margin:1px .5rem; padding:.5rem .7rem; border-radius:8px; font-weight:500; }
.sidebar-nav .nav-item.active{ box-shadow:inset 3px 0 0 var(--accent, #c1272e); font-weight:600; }
.sidebar.collapsed .nav-section.flat .nav-section-label{ display:none; }

/* ---- company, system tabs, search and "powered by" live in the bar across the top ---- */
.sys-strip{ gap:.6rem; padding:.3rem .75rem; }
.sys-burger{ flex:none; display:grid; place-items:center; width:34px; height:34px; border:1px solid var(--color-border); border-radius:8px; background:var(--color-surface); color:var(--color-text); cursor:pointer; }
.sys-burger:hover{ border-color:var(--color-primary, #121212); }
.sys-brand{ flex:none; display:flex; align-items:center; gap:.5rem; max-width:260px; text-decoration:none; color:var(--color-text); font-weight:800; font-size:.9rem; }
.sys-brand img{ width:30px; height:30px; object-fit:contain; border-radius:6px; background:#fff; padding:2px; box-sizing:border-box; border:1px solid var(--color-border); }
.sys-brand span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sys-tabs{ margin-left:.5rem; }
.sys-by{ flex:none; display:flex; align-items:center; gap:.4rem; text-decoration:none; color:var(--color-text-muted, var(--color-text)); font-size:.68rem; line-height:1.1; }
.sys-by img{ height:22px; width:auto; background:#121212; border-radius:5px; padding:3px 5px; box-sizing:content-box; }
.sys-by b{ display:block; font-size:.78rem; color:var(--color-text); }
.sys-by span{ white-space:nowrap; }
@media(max-width:1100px){ .sys-by span{ display:none; } }
@media(max-width:900px){ .sys-brand span{ display:none; } .sys-burger{ display:none; } }

/* ---- page introductions run the full width, left to right, not in a narrow block ---- */
.page-header > div:first-child, .page-head > div:first-child{ flex:1 1 min(100%, 40rem); min-width:0; }
.page-subtitle{ max-width:none; font-size:.95rem; line-height:1.55; overflow-wrap:normal; }
.page-title{ overflow-wrap:normal; }

/* ---- one top row: back, view-as, user, clock and log out live in the strip ---- */
.topbar.lifted{ display:none; }
@media(max-width:900px){ .topbar.lifted{ display:flex; } .sys-strip .topbar-right{ display:none; } }
.sys-strip .topbar-right{ flex:none; display:flex; align-items:center; gap:.5rem; margin-left:auto; }
.sys-strip .sys-tabs{ flex:0 1 auto; min-width:0; overflow-x:auto; scrollbar-width:none; }
.sys-strip .sys-search{ flex:none; margin-left:0; }
/* a proper search box: wide, with its label and the Ctrl K hint (the clock is gone from the bar) */
.sys-strip .sys-search{ flex:0 1 380px; min-width:150px; justify-content:flex-start; padding:.5rem 1rem; font-size:.9rem; }
.sys-strip .sys-search svg{ width:18px; height:18px; flex:none; }
.sys-strip .sys-search span{ flex:1; text-align:left; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sys-strip .sys-search kbd{ flex:none; }
.sys-strip .topbar-clock{ display:none !important; }
@media(max-width:900px){ .sys-strip .sys-search{ flex:none; padding:.5rem .7rem; } .sys-strip .sys-search span, .sys-strip .sys-search kbd{ display:none; } }
.sys-strip .sys-by span{ display:none; }
.sys-strip .topbar-back{ flex:none; }
.sys-strip .topbar-user-role{ display:none; }
@media(max-width:1500px){ .sys-strip .topbar-user-meta{ display:none; } }

/* Two-row header (2026-10-21): row 1 = menu, company, search, who is signed in, log out, powered by;
   row 2 = Back, Home and the system tabs. One row ran out of room on busy pages and cut the tabs off. */
.sys-strip{ flex-wrap:wrap; row-gap:0; padding:0 .75rem; align-items:center; }
.sys-strip > .sys-burger, .sys-strip > .sys-brand, .sys-strip > .sys-search, .sys-strip > .topbar-right, .sys-strip > .sys-by{ order:1; margin-top:.35rem; margin-bottom:.35rem; }
.sys-strip::before{ content:''; order:2; flex:0 0 100%; height:0; }
.sys-strip > .topbar-back, .sys-strip > .topbar-home, .sys-strip > .sys-tabs{ order:3; margin-top:.4rem; margin-bottom:.4rem; }
.sys-strip > .topbar-back{ margin-top:.4rem; }
.sys-strip > .sys-brand{ margin-right:auto; }
.sys-strip > .sys-search{ margin-left:0; }
.sys-strip > .topbar-right{ margin-left:0; }
.sys-strip > .sys-tabs{ order:5; flex:1 1 100%; margin:0 0 .4rem; padding:.4rem 0 0; border-top:1px solid var(--color-border); }
.sys-strip > .sys-tabs:empty{ display:none; }
.sys-strip > .topbar-back, .sys-strip > .topbar-home{ border-radius:10px; height:34px; }
.sys-strip > .topbar-home{ margin-left:.4rem; }
/* Log out: far right of row 2 (the Back / Home row) */
.sys-strip > .topbar-signout{ order:3; margin:.4rem 0 .4rem auto; border-radius:10px; height:34px; padding:0 .9rem; flex:none; }
/* a hairline above the second row */
.sys-strip > .topbar-back{ position:relative; }
.sys-strip > .topbar-back::before{ content:''; position:absolute; left:-.75rem; right:-100vw; top:-.4rem; border-top:1px solid var(--color-border); pointer-events:none; }
.sys-strip{ overflow-x:clip; }

/* ---- Section colours on the home / hub pages (2026-10-28) ----
   The big job buttons (.hp-q) set their own rainbow colours inline, and the cards below them hard-code navy.
   Under a section colour (html[data-sec]) they all take the section's theme instead. */
html[data-sec] .hp-q { --a: var(--theme) !important; --b: var(--theme-2) !important; }
html[data-sec] .hd-bar h2 { color: var(--theme) !important; }
/* the number cards (.hr-stat) are filled with the section colour, so their number, label and icon are white on every page and every card */
html[data-sec] .hr-stat .hr-stat-val { color: #fff !important; }
html[data-sec] .hr-stat .hr-stat-lbl { color: rgba(255,255,255,.85) !important; }
html[data-sec] .hr-stat .hr-stat-icon, html[data-sec] .hr-stat .hr-stat-icon:is(.navy, .gold, .green, .red, .purple) { background: rgba(255,255,255,.14) !important; color: #fff !important; }

/* text on a section-coloured banner is solid white, not faded, so it stays readable on every colour */
html[data-sec] .pl-hero :is(h2, p, span, small, b) { color: #fff !important; opacity: 1 !important; }

/* Section dashboards: the cards stay white. Only the icon tile on each card takes the section colour (the top cards, the number cards
   and the "most used jobs" buttons are the ones filled with colour). Urgent items keep a red count badge. */
html[data-sec] :is(.hd-card, .qa a):is(:hover, :focus-visible) { border-color: var(--theme) !important; box-shadow: 0 4px 14px color-mix(in srgb, var(--theme) 25%, transparent) !important; }
html[data-sec] :is(.hd-ico, .qa a:not(.urgent) .ico) { background: linear-gradient(135deg, var(--theme), var(--theme-2)) !important; color: #fff !important; box-shadow: 0 2px 6px color-mix(in srgb, var(--theme) 35%, transparent); }
html[data-sec] .qa a:not(.urgent) { color: var(--theme); }
html[data-sec] .qa a:not(.urgent) .n { background: var(--theme) !important; color: #fff !important; }

/* Tags (.pill) on cards wrap onto a second line instead of running past the edge and being cut off.
   In table cells they stay on one line, so dates and short statuses are never split. */
html .pill { white-space: normal; max-width: 100%; overflow-wrap: anywhere; line-height: 1.35; text-align: left; }
html .pill:not(:where(td *)) { border-radius: 14px; }
html td .pill, html th .pill { white-space: nowrap; overflow-wrap: normal; }
