/* BM Group design system "Lamp & Ledger" (decision docs/decisions/0004-visual-identity.md, guide docs/design/README.md).
   Load order on every page: bootstrap.min.css (for now) -> ui.css -> bootstrap-bridge.css -> the app's own site.css.
   Rule: pages and app CSS use these tokens, never a hex value. Light values on :root; dark values twice (device setting,
   and the toggle's data-theme="dark"), so the toggle wins both ways. */

/* ---------- fonts (self-hosted, Google Fonts latin + latin-ext; the rupee sign is in latin-ext) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(../fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(../fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 500 800; font-display: swap; src: url(../fonts/jakarta-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 500 800; font-display: swap; src: url(../fonts/jakarta-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- tokens ---------- */
:root {
  --frame: #f3f1ef; --panel: #ffffff; --sunken: #f7f6f4; --raised: #ffffff; --hover: #f1eeeb; --pressed: #e9e5e1;
  --line: #e6e1dc; --line-strong: #d4cdc6;
  --ink: #1c1917; --ink-2: #57534e; --ink-3: #736c66; --ink-inv: #ffffff;
  --brand: #a3302e; --brand-hover: #8c2322; --brand-fg: #ffffff; --brand-text: #9b2c2a; --brand-soft: #fbeeec; --brand-ring: rgba(163,48,46,.28);
  --ember: #e8952f; --ember-soft: #fdf0dd;
  --ok: #17753f; --ok-soft: #e6f4ea; --ok-line: #b9dfc6;
  --warn: #8f5206; --warn-soft: #fdf3dc; --warn-line: #f1d79f;
  --bad: #c9301a; --bad-soft: #fcebe7; --bad-line: #f3c2b7;
  --info: #2b62b8; --info-soft: #e8effa; --info-line: #c3d5f3;
  --c1: #a3302e; --c2: #2f6f8f; --c3: #c98a1b; --c4: #5b7f3a; --c5: #7a5ea8; --c6: #8a8178;
  --shadow-1: 0 1px 2px rgba(28,25,23,.06);
  --shadow-2: 0 1px 2px rgba(28,25,23,.05), 0 6px 16px -4px rgba(28,25,23,.10);
  --shadow-3: 0 2px 6px rgba(28,25,23,.08), 0 24px 48px -12px rgba(28,25,23,.22);
  --highlight: inset 0 0 0 0 transparent;
  --scrim: rgba(28,25,23,.36);
  --logo: url(../img/logo.png); --emblem: url(../img/emblem.png);

  --font-display: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Inter", "Segoe UI", system-ui, sans-serif;
  --fs-11: .6875rem; --fs-12: .75rem; --fs-13: .8125rem; --fs-14: .875rem; --fs-16: 1rem; --fs-18: 1.125rem; --fs-22: 1.375rem; --fs-28: 1.75rem;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 999px;
  --d-1: 90ms; --d-2: 150ms; --d-3: 220ms; --d-4: 320ms; --d-5: 560ms;
  --e-out: cubic-bezier(.16,1,.3,1); --e-std: cubic-bezier(.2,0,0,1); --e-in: cubic-bezier(.4,0,1,1);
  --e-spring: linear(0, .25 6%, .63 14%, .9 22%, 1.04 30%, 1.08 37%, 1.06 45%, 1.01 58%, .995 70%, 1);
  --side-w: 244px; --rail-w: 60px; --top-h: 52px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --frame: #0f0e0d; --panel: #181615; --sunken: #141211; --raised: #211e1c; --hover: #24211f; --pressed: #2c2825;
    --line: #2b2725; --line-strong: #3a3532;
    --ink: #f2efec; --ink-2: #b4aea8; --ink-3: #928b85; --ink-inv: #181615;
    --brand: #c0443d; --brand-hover: #cf5048; --brand-fg: #ffffff; --brand-text: #ef8a80; --brand-soft: rgba(239,138,128,.12); --brand-ring: rgba(239,138,128,.34);
    --ember: #f2b45a; --ember-soft: rgba(242,180,90,.12);
    --ok: #5cc98a; --ok-soft: rgba(92,201,138,.12); --ok-line: rgba(92,201,138,.3);
    --warn: #f0b44c; --warn-soft: rgba(240,180,76,.12); --warn-line: rgba(240,180,76,.3);
    --bad: #ff7a66; --bad-soft: rgba(255,122,102,.12); --bad-line: rgba(255,122,102,.32);
    --info: #7fa8f0; --info-soft: rgba(127,168,240,.12); --info-line: rgba(127,168,240,.3);
    --c1: #e06a61; --c2: #5fa8c9; --c3: #e0ad4c; --c4: #8fb86a; --c5: #a68ad6; --c6: #a8a097;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4);
    --shadow-2: 0 1px 2px rgba(0,0,0,.4), 0 8px 20px -6px rgba(0,0,0,.5);
    --shadow-3: 0 2px 6px rgba(0,0,0,.5), 0 28px 56px -12px rgba(0,0,0,.7);
    --highlight: inset 0 1px 0 rgba(255,255,255,.04);
    --scrim: rgba(0,0,0,.55);
    --logo: url(../img/logo-dark.png); --emblem: url(../img/emblem-dark.png);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --frame: #0f0e0d; --panel: #181615; --sunken: #141211; --raised: #211e1c; --hover: #24211f; --pressed: #2c2825;
  --line: #2b2725; --line-strong: #3a3532;
  --ink: #f2efec; --ink-2: #b4aea8; --ink-3: #928b85; --ink-inv: #181615;
  --brand: #c0443d; --brand-hover: #cf5048; --brand-fg: #ffffff; --brand-text: #ef8a80; --brand-soft: rgba(239,138,128,.12); --brand-ring: rgba(239,138,128,.34);
  --ember: #f2b45a; --ember-soft: rgba(242,180,90,.12);
  --ok: #5cc98a; --ok-soft: rgba(92,201,138,.12); --ok-line: rgba(92,201,138,.3);
  --warn: #f0b44c; --warn-soft: rgba(240,180,76,.12); --warn-line: rgba(240,180,76,.3);
  --bad: #ff7a66; --bad-soft: rgba(255,122,102,.12); --bad-line: rgba(255,122,102,.32);
  --info: #7fa8f0; --info-soft: rgba(127,168,240,.12); --info-line: rgba(127,168,240,.3);
  --c1: #e06a61; --c2: #5fa8c9; --c3: #e0ad4c; --c4: #8fb86a; --c5: #a68ad6; --c6: #a8a097;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 1px 2px rgba(0,0,0,.4), 0 8px 20px -6px rgba(0,0,0,.5);
  --shadow-3: 0 2px 6px rgba(0,0,0,.5), 0 28px 56px -12px rgba(0,0,0,.7);
  --highlight: inset 0 1px 0 rgba(255,255,255,.04);
  --scrim: rgba(0,0,0,.55);
  --logo: url(../img/logo-dark.png); --emblem: url(../img/emblem-dark.png);
  color-scheme: dark;
}

/* ---------- base ---------- */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--frame); color: var(--ink); font: 400 var(--fs-14)/1.5 var(--font-ui); font-feature-settings: "cv11"; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-family: var(--font-display); color: var(--ink); letter-spacing: -.01em; text-wrap: balance; }
::selection { background: var(--brand-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
[hidden] { display: none !important; }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--panel); color: var(--ink); padding: 6px 10px; border-radius: var(--r-sm); box-shadow: var(--shadow-2); }
.skip-link:focus { left: 8px; }
.kbd { font: 500 var(--fs-11)/1 var(--font-ui); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--line-strong); border-bottom-width: 2px; color: var(--ink-3); background: var(--panel); white-space: nowrap; }

/* ---------- shell: frame, sidebar, top bar, content panel ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns var(--d-4) var(--e-out); }
:root[data-rail] .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1px; padding: 10px 8px; overflow: hidden auto; scrollbar-width: none; view-transition-name: side; }
.side::-webkit-scrollbar { width: 0; }
.side-brand { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px; margin-bottom: 8px; text-decoration: none; color: var(--ink); border-radius: var(--r-md); }
.side-brand:hover { background: var(--hover); color: var(--ink); }
.side-emblem { width: 30px; height: 30px; flex: none; background: var(--emblem) center / contain no-repeat; }
.side-brand b { display: block; font: 700 var(--fs-14)/1.15 var(--font-display); white-space: nowrap; }
.side-brand small { display: block; font-size: var(--fs-11); color: var(--ink-3); white-space: nowrap; }
.nav-group { display: grid; }
.nav-head { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; margin-top: 6px; border: 0; background: none; width: 100%; text-align: left; font: 600 var(--fs-11)/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); cursor: pointer; border-radius: var(--r-sm); white-space: nowrap; }
.nav-head:hover { color: var(--ink); }
.nav-head .ic { width: 16px; height: 16px; }
.nav-head .chev { margin-left: auto; width: 14px; height: 14px; transition: transform var(--d-3) var(--e-out); }
.nav-head[aria-expanded="true"] .chev { transform: rotate(90deg); }
.nav-sub { display: grid; grid-template-rows: 1fr; transition: grid-template-rows var(--d-4) var(--e-out); }
.nav-sub.closed { grid-template-rows: 0fr; }
.nav-sub > div { overflow: hidden; display: grid; gap: 1px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 10px; border-radius: var(--r-sm); color: var(--ink-2); font-size: var(--fs-13); font-weight: 500; text-decoration: none; white-space: nowrap; transition: background-color var(--d-2) var(--e-std), color var(--d-2); }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item .ic { color: var(--ink-3); transition: color var(--d-2); }
.nav-item:hover .ic { color: var(--ink-2); }
.nav-item[aria-current="page"] { color: var(--ink); background: var(--panel); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); font-weight: 600; }
.nav-item[aria-current="page"] .ic { color: var(--brand-text); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav-item .lbl, .nav-head .lbl { overflow: hidden; text-overflow: ellipsis; }
.side-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); display: grid; gap: 1px; }
.side-foot button.nav-item { border: 0; background: none; width: 100%; cursor: pointer; text-align: left; font: inherit; font-size: var(--fs-13); font-weight: 500; }
/* rail (collapsed): icons only, names as tooltips */
:root[data-rail] .side .lbl, :root[data-rail] .side-brand span, :root[data-rail] .nav-head .chev { opacity: 0; pointer-events: none; }
:root[data-rail] .nav-head { justify-content: center; padding: 0; }
:root[data-rail] .nav-head .ic { display: none; }
:root[data-rail] .nav-head::after { content: ""; width: 18px; height: 1px; background: var(--line-strong); }
:root[data-rail] .nav-head > .lbl { position: absolute; }
:root[data-rail] .nav-sub.closed { grid-template-rows: 1fr; }
:root[data-rail] .nav-item { justify-content: center; padding: 0; }
:root[data-rail] .nav-item .lbl { position: absolute; }
.side .lbl, .side-brand span { transition: opacity var(--d-2); }
.tip { position: fixed; z-index: 90; padding: 5px 8px; border-radius: 6px; background: var(--ink); color: var(--ink-inv); font-size: var(--fs-12); font-weight: 500; white-space: nowrap; pointer-events: none; opacity: 0; transform: translateX(-4px); transition: opacity var(--d-2), transform var(--d-2) var(--e-out); }
.tip.show { opacity: 1; transform: none; }

.shell-main { min-width: 0; padding: 8px 8px 8px 0; display: flex; flex-direction: column; }
.panel-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1), var(--highlight); position: relative; view-transition-name: panel; }
.topbar { position: sticky; top: 8px; z-index: 20; display: flex; align-items: center; gap: 8px; height: var(--top-h); padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-radius: var(--r-lg) var(--r-lg) 0 0; view-transition-name: topbar; }
.shell-main::before { content: ""; position: sticky; top: 0; height: 8px; margin-bottom: -8px; background: var(--frame); z-index: 21; display: block; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--ink-3); min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { width: 12px; height: 12px; color: var(--line-strong); }
.crumbs [aria-current] { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.top-search { margin-left: auto; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 10px; min-width: 240px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--sunken); color: var(--ink-3); font: 400 var(--fs-13) var(--font-ui); cursor: pointer; transition: border-color var(--d-2), background-color var(--d-2); }
.top-search:hover { border-color: var(--line-strong); background: var(--hover); color: var(--ink-2); }
.top-search .kbd { margin-left: auto; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); border: 0; background: none; color: var(--ink-2); cursor: pointer; transition: background-color var(--d-2), color var(--d-2), transform var(--d-1); flex: none; text-decoration: none; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .ic { width: 18px; height: 18px; }
.menu-btn { display: none; }
.who { position: relative; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--brand-text) 25%, transparent); background: var(--brand-soft); color: var(--brand-text); font: 700 var(--fs-11) var(--font-display); cursor: pointer; padding: 0; }
.popover { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 240px; padding: 6px; border-radius: var(--r-lg); background: var(--raised); border: 1px solid var(--line-strong); box-shadow: var(--shadow-3), var(--highlight); transform-origin: top right; animation: pop var(--d-3) var(--e-out); }
.popover[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
.popover .pop-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.popover .pop-head b { display: block; font-weight: 600; }
.popover .pop-head span { font-size: var(--fs-12); color: var(--ink-3); }
.popover a, .popover .pop-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-size: var(--fs-13); }
.popover a:hover { background: var(--hover); color: var(--ink); }
.popover .ic { color: var(--ink-3); }
.seg { display: inline-flex; margin-left: auto; padding: 2px; border-radius: var(--r-sm); background: var(--hover); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 3px 8px; border-radius: 4px; font: 500 var(--fs-12) var(--font-ui); color: var(--ink-3); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-1); }

.page { flex: 1; padding: 20px 28px 40px; min-width: 0; }
.page:focus { outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 20px; }
.page-head h1 { font-size: var(--fs-22); font-weight: 700; line-height: 1.2; margin: 0; }
.page-head .lead { margin: 4px 0 0; color: var(--ink-3); font-size: var(--fs-13); max-width: 760px; }
.page-head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.old-link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--ink-3); text-decoration: none; padding: 4px 8px; border-radius: var(--r-sm); }
.old-link:hover { background: var(--hover); color: var(--ink); }
.page > *:not(.page-head) { animation: rise var(--d-4) var(--e-out) both; }
.page > *:nth-child(3) { animation-delay: 30ms; } .page > *:nth-child(4) { animation-delay: 60ms; } .page > *:nth-child(5) { animation-delay: 90ms; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* phones and small tablets: the menu becomes a sheet */
@media (max-width: 900px) {
  .shell, :root[data-rail] .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 60; width: 280px; background: var(--frame); box-shadow: var(--shadow-3); transform: translateX(-104%); transition: transform var(--d-4) var(--e-out); visibility: hidden; }
  :root[data-rail] .side .lbl, :root[data-rail] .side-brand span, :root[data-rail] .nav-head .chev { opacity: 1; pointer-events: auto; }
  :root[data-rail] .nav-head { justify-content: flex-start; padding: 0 10px; } :root[data-rail] .nav-head .ic { display: block; } :root[data-rail] .nav-head::after { display: none; }
  :root[data-rail] .nav-item { justify-content: flex-start; padding: 0 10px; } :root[data-rail] .nav-item .lbl, :root[data-rail] .nav-head > .lbl { position: static; }
  body.nav-open .side { transform: none; visibility: visible; }
  .sheet-scrim { position: fixed; inset: 0; z-index: 55; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity var(--d-4); }
  body.nav-open .sheet-scrim { opacity: 1; pointer-events: auto; }
  .shell-main { padding: 0; }
  .shell-main::before { display: none; }
  .panel-main { border: 0; border-radius: 0; box-shadow: none; }
  .topbar { top: 0; border-radius: 0; padding: 0 8px; }
  .menu-btn { display: inline-grid; }
  .top-search { min-width: 0; width: 32px; padding: 0; justify-content: center; border-color: transparent; background: none; }
  .top-search .t, .top-search .kbd, .collapse-btn { display: none; }
  .page { padding: 16px 16px 32px; }
  .page-head .actions { margin-left: 0; }
  .crumbs > :nth-last-child(n+4) { display: none; }
}
@media (min-width: 901px) { .sheet-scrim { display: none; } }

/* ---------- portal shell (students, later applicants): phone first, no sidebar ---------- */
body.portal { font-size: 15px; background: var(--frame); }
.portal-top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--frame) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.portal-top__in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); }
.portal-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); margin-right: auto; }
.portal-brand b { display: block; font: 700 var(--fs-14)/1.15 var(--font-display); }
.portal-brand small { display: block; font-size: var(--fs-11); color: var(--ink-3); }
.portal-tabs { display: flex; gap: 2px; }
.portal-tabs a { position: relative; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: var(--fs-14); transition: background-color var(--d-2), color var(--d-2); }
.portal-tabs a:hover { background: var(--hover); color: var(--ink); }
.portal-tabs a[aria-current="page"] { color: var(--ink); background: var(--panel); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.portal-tabs a[aria-current="page"] .ic { color: var(--brand-text); }
.portal-brand b, .portal-brand small { white-space: nowrap; }
/* six or more tabs on a laptop / tablet: compact tabs; between 701 and 1100px only the current tab keeps its label
   (the others show the icon; the label stays for screen readers and as the tooltip) */
.portal-tabs:has(> a:nth-child(6)) a { padding: 0 10px; font-size: var(--fs-13); }
@media (min-width: 701px) and (max-width: 1100px) {
  .portal-tabs:has(> a:nth-child(6)) a:not([aria-current="page"]) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.portal-main { max-width: 1040px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); }
.portal-main > * { animation: rise var(--d-4) var(--e-out) both; }
.portal-main h1 { font-size: var(--fs-22); font-weight: 700; margin: 0 0 4px; }
.portal-main .lead { color: var(--ink-3); margin: 0 0 16px; font-size: var(--fs-14); }
@media (max-width: 700px) {
  .portal-top { backdrop-filter: none; background: var(--frame); }
  .portal-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; gap: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .portal-tabs { padding-left: 2px; padding-right: 2px; }
  /* up to 7 tabs share a 320px phone: no side padding, labels clipped rather than pushing the last tab off-screen */
  .portal-tabs a { flex: 1 1 0; min-width: 0; padding: 0 2px; flex-direction: column; gap: 2px; height: 50px; justify-content: center; font-size: var(--fs-11); border-radius: var(--r-md); }
  .portal-tabs a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .portal-tabs:has(> a:nth-child(7)) a { padding: 0; font-size: calc(var(--fs-11) - 1px); letter-spacing: -0.03em; }
  .portal-tabs a .ic { width: 20px; height: 20px; }
  .portal-tabs a[aria-current="page"] { background: var(--brand-soft); box-shadow: none; color: var(--brand-text); }
  .portal-main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); padding-top: 16px; }
  .portal .toasts { bottom: 84px; }
}

/* ---------- components ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-full); font: 500 var(--fs-12)/1 var(--font-ui); white-space: nowrap; background: var(--hover); color: var(--ink-2); vertical-align: middle; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--info-soft); color: var(--info); }
.pill.brand { background: var(--brand-soft); color: var(--brand-text); }
.pill.plain::before { display: none; }

/* a block of related content (replaces ad-hoc bordered sections) */
.section, .office-grid section, .carry-side, .bus-form, .desk-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-1), var(--highlight); min-width: 0; }
.section > h2, .section > h3, .office-grid section > h3 { font: 600 var(--fs-14)/1.3 var(--font-display); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.section-note { font: 400 var(--fs-12) var(--font-ui); color: var(--ink-3); }

/* key / value lists */
.kv { display: grid; grid-template-columns: minmax(9em, max-content) 1fr; gap: 6px 16px; margin: 0; font-size: var(--fs-13); }
.kv dt { font-weight: 400; color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-variant-numeric: tabular-nums; }
.kv dd:empty::after { content: "\2014"; color: var(--line-strong); }

/* stat tiles (real figures only) */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 0 0 16px; }
.stat { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); min-width: 0; }
.stat span { font-size: var(--fs-12); color: var(--ink-3); }
.stat b { font: 700 var(--fs-22)/1.15 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat small { font-size: var(--fs-12); color: var(--ink-3); }
.stat.ok b { color: var(--ok); } .stat.bad b { color: var(--bad); } .stat.warn b { color: var(--warn); }

/* full-page messages (signed out, not allowed, error) */
.status-page { max-width: 460px; margin: 8vh auto; display: grid; justify-items: center; text-align: center; gap: 10px; }
.status-page h1 { font-size: var(--fs-22); font-weight: 700; margin: 6px 0 0; }
.status-page p { margin: 0; color: var(--ink-2); }
.status-page .empty-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--sunken); border: 1px solid var(--line); color: var(--ink-3); }
.status-page .empty-ic .ic { width: 24px; height: 24px; }
.status-emblem { width: 56px; height: 56px; }

/* empty states */
.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 32px 16px; color: var(--ink-3); }
.empty .ic { width: 22px; height: 22px; }
.empty .empty-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--sunken); border: 1px solid var(--line); margin-bottom: 4px; }
.empty b { color: var(--ink); font-weight: 600; }
.empty p { margin: 0; max-width: 340px; font-size: var(--fs-13); }

/* tables: dense, sticky header, tabular numbers */
.report-table-wrap, .table-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--line); border-radius: var(--r-md); margin-top: 12px; background: var(--panel); }
.report-table, .data-table { border-collapse: separate; border-spacing: 0; font-size: var(--fs-13); width: auto; margin: 0; }
.report-table-wrap > .report-table, .table-wrap > .data-table, .table-responsive > .report-table { min-width: 100%; }
.report-table th, .report-table td, .data-table th, .data-table td { border: 0; border-bottom: 1px solid var(--line); padding: 6px 10px; vertical-align: middle; background: transparent; color: var(--ink); white-space: nowrap; }
.report-table thead th, .data-table thead th { position: sticky; top: 0; z-index: 1; background: var(--sunken); color: var(--ink-3); font-weight: 500; font-size: var(--fs-12); height: 34px; text-align: left; box-shadow: inset 0 -1px 0 var(--line); border-bottom: 0; }
.report-table tbody tr:last-child td, .data-table tbody tr:last-child td { border-bottom: 0; }
.report-table tbody tr, .data-table tbody tr { transition: background-color var(--d-1); }
.report-table tbody tr:hover, .data-table tbody tr:hover { background: var(--hover); }
.report-table tbody tr:nth-child(even) { background: transparent; }
.report-table tbody tr:nth-child(even):hover { background: var(--hover); }
.report-table tfoot td, .report-table tfoot th, .data-table tfoot td { background: var(--sunken); font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: 0; position: sticky; bottom: 0; }
.report-table td.num, .report-table th.num, .report-table .text-end { text-align: right; font-variant-numeric: tabular-nums; }
.report-table td a, .data-table td a { color: var(--brand-text); font-weight: 500; text-decoration: none; }
.report-table td a:hover, .data-table td a:hover { text-decoration: underline; }
.report-table button.sort { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; border-radius: 3px; }
.report-table button.sort:hover { color: var(--ink); }
.report-table button.sort:focus-visible { outline: 2px solid var(--brand-text); }
.report-table th[aria-sort] { color: var(--ink); }
.report-table th[aria-sort="ascending"] button::after { content: "\2191"; content: "\2191" / ""; font-size: 11px; color: var(--brand-text); }
.report-table th[aria-sort="descending"] button::after { content: "\2193"; content: "\2193" / ""; font-size: 11px; color: var(--brand-text); }
/* row states keep the old pages' meanings (red cancelled, yellow online-not-confirmed, green no remarks, blue short):
   a tint plus a coloured edge, so the words stay readable */
.report-table tbody tr.row-cancelled, tr.row-cancelled { background: var(--bad-soft); }
.report-table tbody tr.row-cancelled > :first-child { box-shadow: inset 3px 0 0 var(--bad); }
.report-table tbody tr.row-online, tr.row-online { background: var(--warn-soft); }
.report-table tbody tr.row-online > :first-child { box-shadow: inset 3px 0 0 var(--warn); }
.report-table tbody tr.row-noremarks, tr.row-noremarks { background: var(--ok-soft); }
.report-table tbody tr.row-noremarks > :first-child { box-shadow: inset 3px 0 0 var(--ok); }
.report-table tbody tr.short { background: var(--info-soft); font-weight: 600; }
.report-table tbody tr.short > :first-child { box-shadow: inset 3px 0 0 var(--info); }
.report-table tbody tr.row-cancelled:hover, .report-table tbody tr.row-online:hover, .report-table tbody tr.row-noremarks:hover, .report-table tbody tr.short:hover { filter: brightness(.98); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: var(--fs-12); color: var(--ink-3); }
.legend span, .legend i { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before, .legend i::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--sw, var(--hover)); box-shadow: inset 3px 0 0 var(--sw-edge, transparent); }
.legend .row-cancelled { --sw: var(--bad-soft); --sw-edge: var(--bad); background: none !important; }
.legend .row-online { --sw: var(--warn-soft); --sw-edge: var(--warn); background: none !important; }
.legend .row-noremarks { --sw: var(--ok-soft); --sw-edge: var(--ok); background: none !important; }
.legend .short { --sw: var(--info-soft); --sw-edge: var(--info); background: none !important; }

/* filter bars above lists and reports */
.filterbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--sunken); margin-bottom: 12px; }
.filterbar > div { min-width: 9em; }

/* scan / search box (desk pages, barcode scanners) */
.scan { display: grid; gap: 6px; margin: 0 0 16px; max-width: 640px; }
.scan-row { display: flex; gap: 8px; }
.scan-row .form-control { height: 44px; font-size: var(--fs-16); padding-left: 40px; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23928b85' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 12px 50% / 18px no-repeat; }
.scan-row .btn { height: 44px; padding: 0 18px; }

/* record header: who this page is about, its state and what you can do to it */
.record { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 20px; }
.record-photo { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; background: linear-gradient(135deg, var(--brand-soft), var(--ember-soft)); display: grid; place-items: center; font: 700 var(--fs-18) var(--font-display); color: var(--brand-text); border: 1px solid var(--line); flex: none; }
.record-main { min-width: 0; display: grid; gap: 4px; }
.record-main h1 { font-size: var(--fs-22); font-weight: 700; margin: 0; line-height: 1.2; }
.record-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: var(--fs-13); color: var(--ink-3); }
.record-meta b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.record-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.subnav { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 20px; overflow-x: auto; scrollbar-width: none; }
.subnav a { position: relative; padding: 8px 12px 10px; font-size: var(--fs-13); font-weight: 500; color: var(--ink-3); text-decoration: none; white-space: nowrap; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); }
.subnav a[aria-current="page"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); view-transition-name: subnav-ind; }

/* home launchpad */
.hello { margin-bottom: 24px; }
.hello h1 { font-size: var(--fs-28); font-weight: 800; letter-spacing: -.025em; margin: 0; }
.hello p { margin: 6px 0 0; color: var(--ink-3); }
.pad { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pad-group { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; background: var(--panel); box-shadow: var(--shadow-1), var(--highlight); display: grid; gap: 4px; align-content: start; }
.pad-group h2 { display: flex; align-items: center; gap: 10px; font: 600 var(--fs-14) var(--font-display); margin: 0 0 6px; }
.pad-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); }
.pad-group a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 -4px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink); font-size: var(--fs-13); transition: background-color var(--d-2), transform var(--d-2) var(--e-out); }
.pad-group a .ic { color: var(--ink-3); }
.pad-group a .go { margin-left: auto; opacity: 0; transform: translateX(-4px); transition: opacity var(--d-2), transform var(--d-2) var(--e-out); color: var(--ink-3); }
.pad-group a:hover { background: var(--hover); }
.pad-group a:hover .go { opacity: 1; transform: none; }
.pad-group a small { display: block; color: var(--ink-3); font-size: var(--fs-12); }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; max-width: 420px; padding: 10px 12px 10px 10px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line-strong); box-shadow: var(--shadow-3); font-size: var(--fs-13); color: var(--ink); animation: toastin var(--d-4) var(--e-out) both; }
.toast.out { animation: toastout var(--d-3) var(--e-in) both; }
.toast .t-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ok-soft); color: var(--ok); }
.toast.warn .t-ic { background: var(--warn-soft); color: var(--warn); }
.toast .t-ic .ic { width: 13px; height: 13px; stroke-width: 3; }
@keyframes toastin { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes toastout { to { opacity: 0; transform: translateX(16px); } }

/* dialogs (confirm) */
dialog.ui-dialog { border: 1px solid var(--line-strong); border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--raised); color: var(--ink); box-shadow: var(--shadow-3), var(--highlight); }
dialog.ui-dialog::backdrop { background: var(--scrim); }
dialog.ui-dialog[open] { animation: dlg var(--d-4) var(--e-out); }
dialog.ui-dialog[open]::backdrop { animation: fade var(--d-4) var(--e-std); }
@keyframes dlg { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }
.dlg-body { padding: 20px 20px 16px; display: flex; gap: 14px; }
.dlg-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--warn-soft); color: var(--warn); flex: none; }
.dlg-ic.bad { background: var(--bad-soft); color: var(--bad); }
.dlg-body h2 { font-size: var(--fs-16); margin: 0 0 4px; }
.dlg-body p { margin: 0; color: var(--ink-2); font-size: var(--fs-13); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--sunken); border-radius: 0 0 14px 14px; }

/* command palette (Ctrl K) */
.cmdk-wrap { position: fixed; inset: 0; z-index: 70; display: grid; justify-items: center; align-content: start; padding: 12vh 12px 0; }
.cmdk-wrap[hidden] { display: none !important; }
.cmdk-scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade var(--d-3) var(--e-std); }
.cmdk { position: relative; width: min(600px, 100%); background: var(--raised); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-3), var(--highlight); overflow: hidden; animation: pop var(--d-3) var(--e-out); }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 52px; border-bottom: 1px solid var(--line); }
.cmdk-in .ic { width: 18px; height: 18px; color: var(--ink-3); }
.cmdk-in input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 400 var(--fs-16) var(--font-ui); color: var(--ink); }
.cmdk-in input::placeholder { color: var(--ink-3); }
.cmdk-list { max-height: min(400px, 56vh); overflow: auto; padding: 6px; }
.cmdk-group { font: 600 var(--fs-11) var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 4px 10px; border-radius: 8px; font-size: var(--fs-14); color: var(--ink); cursor: pointer; text-decoration: none; }
.cmdk-item .ic { color: var(--ink-3); }
.cmdk-item small { margin-left: auto; color: var(--ink-3); font-size: var(--fs-12); white-space: nowrap; }
.cmdk-item[aria-selected="true"] { background: var(--hover); }
.cmdk-item[aria-selected="true"] .ic { color: var(--brand-text); }
.cmdk-item mark { background: none; color: var(--brand-text); font-weight: 600; padding: 0; }
.cmdk-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: var(--fs-12); color: var(--ink-3); background: var(--sunken); }
.cmdk-note { padding: 22px; text-align: center; color: var(--ink-3); font-size: var(--fs-13); }

/* ---------- loading ---------- */
/* thin progress line at the top of the content panel, from the first moment of a navigation */
.progress-line { position: fixed; left: 0; top: 0; height: 2px; width: 100%; z-index: 95; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--brand), var(--ember)); box-shadow: 0 0 8px var(--ember); opacity: 0; pointer-events: none; }
/* the logo loader: for waits over a second the BM Group logo fills with colour from the bottom up.
   The grey copy is the empty logo; the coloured copy is clipped from the top by --fill (0..1). */
.loader { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; align-content: center; gap: 18px; background: color-mix(in srgb, var(--panel) 82%, transparent); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity var(--d-4) var(--e-std); }
.loader.show { opacity: 1; pointer-events: auto; }
.loader-logo { --fill: 0; position: relative; width: 200px; aspect-ratio: 283 / 149; }
.loader-logo i { position: absolute; inset: 0; background: var(--logo) center / contain no-repeat; }
.loader-logo .empty-logo { filter: grayscale(1); opacity: .22; }
.loader-logo .full-logo { clip-path: inset(calc((1 - var(--fill)) * 100%) 0 0 0); transition: clip-path 260ms linear; }
.loader-logo::after { content: ""; position: absolute; left: -6%; right: -6%; height: 2px; bottom: calc(var(--fill) * 100%); background: linear-gradient(90deg, transparent, var(--ember), transparent); opacity: calc(1 - var(--fill)); filter: blur(.5px); transition: bottom 260ms linear; }
.loader p { margin: 0; font-size: var(--fs-13); color: var(--ink-2); text-align: center; }
.loader small { display: block; color: var(--ink-3); font-size: var(--fs-12); margin-top: 2px; font-variant-numeric: tabular-nums; }
.skel { display: block; background: linear-gradient(90deg, var(--hover) 0%, var(--pressed) 40%, var(--hover) 80%); background-size: 300% 100%; animation: shimmer 1.4s var(--e-std) infinite; border-radius: 4px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* ---------- page transitions (same-origin navigations in Chrome/Edge; others navigate as before) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-old(panel) { animation: vt-out 120ms var(--e-in) both; }
::view-transition-new(panel) { animation: vt-in var(--d-4) var(--e-out) both; }
::view-transition-group(side), ::view-transition-group(topbar) { animation-duration: 0s; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- print: the page only ---------- */
@media print {
  .side, .topbar, .toasts, .loader, .progress-line, .old-link, .page-head .actions, .record-actions, .subnav, .sheet-scrim { display: none !important; }
  .shell { display: block; } .shell-main { padding: 0; } .panel-main { border: 0; box-shadow: none; }
  .page { padding: 0; } .page > * { animation: none !important; }
  .report-table-wrap, .table-wrap { max-height: none; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  @view-transition { navigation: none; }
}
