/* Portal shell (the admin audience): what differs from the shared chrome (../../shared/chrome.css, the frame, the top bar, the rail and sidebar rows):
   the sidebar as a drawer on phones (no tab bar for twenty modules), the breadcrumb, the ⌘K search entry, the waiting counts, the wave dividers and
   the dense row sizes (tokens §3.3). Spec: 02-foundations/portal-shell.md. Tokens only. */
.pb-skip { position: absolute; inset-inline-start: 16px; top: -64px; z-index: 50; display: inline-flex; align-items: center; min-height: 44px; box-sizing: border-box; padding: 8px 12px; border-radius: 12px; background: var(--primary); color: var(--on-primary); font-weight: 600; }
.pb-skip:focus-visible { top: 12px; outline: 2px solid var(--on-primary); outline-offset: 2px; }

/* ---------- top bar: the menu button (phones), the breadcrumb, the search entry, the avatar ---------- */
.pb-topbar { gap: 4px; padding-inline: 8px 12px; height: auto; min-height: 64px; }
.pb-menu, .pb-back { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; color: var(--text-primary); flex-shrink: 0; }
.pb-menu .ico, .pb-back .ico { font-size: 24px; }
.pb-menu:hover, .pb-back:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.pb-back[hidden] { display: none; }   /* a pushed page's Back (shell.js): below 1024 dp, in the menu button's place on a phone; the breadcrumb's links are the parent from 1024 dp (2026-10-19) */
.has-back .pb-menu { display: none; }
@media (min-width: 1024px) { .has-back .pb-menu { display: inline-flex; } }   /* on the web the menu button stays: it hides and shows the sidebar (Hide the menu / Show the menu, 2026-10-20, the owner); a pushed page keeps it too, since Back lives in the breadcrumb there */
.pb-crumb { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; font-size: calc(14px * var(--font-scale)); color: var(--text-secondary); white-space: nowrap; overflow: hidden; }
.pb-crumb a { position: relative; padding: 6px 8px; border-radius: 12px; min-height: 44px; display: none; align-items: center; }   /* 44 dp below 1024 (the harness found 36 on tablets, 2026-10-13); 36 dense on Expanded */
.pb-crumb a::after { content: ""; position: absolute; inset: min(0px, calc((100% - 44px) / 2)); }   /* a short link ("AI", 29 dp wide) keeps a 44 dp hit area: the size-aware recipe of components.css, render sweep 2026-10-19 */
.pb-crumb a:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); color: var(--text-primary); }
.pb-crumb .ico { display: none; font-size: 14px; opacity: .6; }
.pb-crumb > span:not(.ico) { display: none; padding: 6px 8px; }   /* a crumb that is a label, not a link (shell.js) */
.pb-crumb b { color: var(--text-primary); font-size: calc(18px * var(--font-scale)); font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; padding-inline: 8px; }
@media (max-width: 599px) { .pb-crumb b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; font-size: calc(17px * var(--font-scale)); padding-inline: 4px; letter-spacing: -0.02em; } }   /* a word never breaks inside ("Organisation|s"): two whole-word lines, then the ellipsis */   /* a phone's page name wraps to a second line instead of "Automatio…" (render sweep 2026-10-19) */
.pb-cmdk { display: none; align-items: center; gap: 10px; min-height: 40px; padding-block: 4px; padding-inline: 14px 10px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--edge); color: var(--text-secondary); font-size: calc(14px * var(--font-scale)); min-width: 0; }
.pb-cmdk .ico { font-size: 20px; color: var(--text-primary); }
.pb-cmdk span:not(.ico) { flex: 1; min-width: 0; overflow-wrap: anywhere; }   /* the label wraps to a second line in a longer language (Tamil at 1280 was cut with an ellipsis); the bar grows with it (.pb-topbar min-height) */
.pb-cmdk kbd { font: inherit; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 8px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--edge); color: var(--text-secondary); }
.pb-cmdk:hover { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.pb-topbar .me-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; flex-shrink: 0; }
/* PB's icon (2026-10-20, the fourth plain icon): PB's mark at 24 dp inside the same 44 dp plain button; a soft circle while the panel is open, as the other icons' panels */
.pb-topbar .tb-pb .pb-avatar { width: 30px; height: 30px; display: block; }   /* PB's mascot is drawn larger than a 24 dp line icon (2026-10-20, the owner: "looks small compared to other icons"): the art is a full-colour figure with a pedestal, so 30 dp reads as the same weight as the 24 dp glyphs beside it */
.tbtn[data-pb-ask] .pb-avatar { width: 28px; height: 28px; display: block; }   /* every Explain-this icon */
.pb-topbar .tb-pb[aria-pressed="true"] { background: color-mix(in srgb, var(--primary) 12%, transparent); }
@media (max-width: 599px) { .pb-topbar .tb-pb { display: none; } }   /* a phone's bar holds the menu or Back, the page name and three icons with the avatar: a fourth cut a one-word name ("Knowl…"); on a phone PB opens from the search palette's Ask PB row and the Explain-this icons (2026-10-20, proposed) */
@media (min-width: 1024px) { .pb-shell:has(.aip.open) .pb-cmdk { display: none; } .pb-shell:has(.aip.open) .pb-sx-btn { display: inline-flex; } }   /* with the panel open the main column is 360 dp narrower: the search box becomes its icon (the phone's), the breadcrumb keeps its name; ⌘K still opens the palette */
/* the ⌘K palette (a sheet over the page): the groups a search finds and the last row, Ask PB with what was typed */
.cmdk-r { display: flex; flex-direction: column; margin-top: 8px; max-height: 56vh; overflow-y: auto; scrollbar-width: thin; }
.cmdk-g { display: flex; align-items: center; gap: 6px; padding: 10px 4px 4px; font-size: calc(12px * var(--font-scale)); font-weight: 700; letter-spacing: .02em; color: var(--text-secondary); }
.cmdk-g .mi { font-size: 16px; }
.cmdk-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px; border-radius: 12px; color: var(--text-primary); }
.cmdk-row b { font-size: calc(14px * var(--font-scale)); font-weight: 600; }
.cmdk-row span { flex: 1; min-width: 0; font-size: calc(12px * var(--font-scale)); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-row > .mi:last-child { color: var(--text-secondary); transition: transform 150ms ease; }
.cmdk-row:hover b { color: var(--primary-text); } .cmdk-row:hover > .mi:last-child { transform: translateX(2px); }
.cmdk-none { margin: 8px 4px; font-size: calc(13px * var(--font-scale)); color: var(--text-secondary); line-height: 1.5; }
.cmdk-ask { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; margin-top: 8px; padding: 8px 12px; border-radius: 16px; text-align: start; color: var(--text-primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); box-shadow: inset 0 0 0 1px var(--edge); }
.cmdk-ask > .mi:first-child { font-size: 22px; color: var(--primary-text); flex-shrink: 0; }
.cmdk-ask .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cmdk-ask .tx b { font-size: calc(14px * var(--font-scale)); font-weight: 600; overflow-wrap: anywhere; }
.cmdk-ask .tx span { font-size: calc(12px * var(--font-scale)); color: var(--text-secondary); }
.cmdk-ask:disabled { opacity: .6; }
.cmdk-ask:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- the modules list: dense rows (tokens §3.3), the counts, the wave dividers; a drawer below 600 dp ---------- */
.pb-nav { --nav-row: 48px; --nav-row-pad: 12px; --nav-row-gap: 12px; --nav-font: 15px; --nav-logo: 40px; --nav-ico: 22px; gap: 2px; overflow-y: auto; scrollbar-width: thin; }   /* twenty rows: the list scrolls on its own, the brand stays at the top of it */
.pb-nav .word { line-height: 1.1; }
.pb-nav .word small { display: block; font-size: calc(11px * var(--font-scale)); font-weight: 600; color: var(--text-secondary); letter-spacing: 0; }
.pb-count { min-width: 22px; height: 22px; padding-inline: 7px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary-text); box-sizing: border-box; font-variant-numeric: tabular-nums; }
.pb-nav a[aria-current="page"] .pb-count { background: var(--primary); color: var(--on-primary); }
.pb-sep { height: 1px; margin: 8px 12px; background: var(--border); }
@media (max-width: 599px) {   /* the drawer: the sidebar rows over a scrim, opened by the menu button; closed: off screen and hidden, so its links are not Tab stops */
  .pb-nav { display: flex; position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 41; transform: translateX(-100%); visibility: hidden; transition: transform 300ms cubic-bezier(.16, 1, .3, 1), visibility 0s 300ms; }
  [dir="rtl"] .pb-nav { transform: translateX(100%); }
  .drawer-open .pb-nav { transform: none; visibility: visible; transition-delay: 0s; box-shadow: var(--elev-4); }
  .pb-scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity 150ms ease; }
  .drawer-open .pb-scrim { opacity: 1; pointer-events: auto; }
}
@media (min-width: 600px) {
  .pb-scrim { display: none; }
  .pb-topbar { gap: 8px; }
  .pb-crumb a, .pb-crumb .ico, .pb-crumb > span:not(.ico) { display: inline-flex; }
}
@media (min-width: 600px) and (max-width: 1023px) { .pb-menu { display: none; } }   /* the rail has no menu button; the web keeps it as Hide / Show the menu (2026-10-20) */
@media (min-width: 600px) and (max-width: 1023px) {   /* on the rail the count is a badge on the icon */
  .pb-nav a { min-height: 56px; box-sizing: border-box; }
  .pb-nav .pb-count, .pb-nav a[aria-current="page"] .pb-count { position: absolute; top: 4px; inset-inline-start: calc(50% + 4px); min-width: 16px; height: 16px; padding-inline: 4px; font-size: 10px; line-height: 12px; letter-spacing: -0.02em; background: var(--error); color: var(--on-error); border: 2px solid var(--bg); box-sizing: border-box; }   /* a small badge on the icon's corner, the size of the top bar's (2026-10-19: it was 22 dp tall and 32 wide, covering the icon) */
  .pb-sep { width: 40px; margin: 6px 0; }
}
@media (min-width: 1024px) {   /* the same three rules on the web rail (Hide the menu, 2026-10-20): the count is a badge on the icon, the rows 56 dp, the short dividers */
  .pb-shell.nav-collapsed .pb-nav a { min-height: 56px; box-sizing: border-box; }
  .pb-shell.nav-collapsed .pb-count, .pb-shell.nav-collapsed .pb-nav a[aria-current="page"] .pb-count { position: absolute; top: 4px; inset-inline-start: calc(50% + 4px); min-width: 16px; height: 16px; padding-inline: 4px; font-size: 10px; line-height: 12px; letter-spacing: -0.02em; background: var(--error); color: var(--on-error); border: 2px solid var(--bg); box-sizing: border-box; }   /* a small badge on the icon's corner, the size of the top bar's (2026-10-19: it was 22 dp tall and 32 wide, covering the icon) */
  .pb-shell.nav-collapsed .pb-sep { width: 40px; margin: 6px 0; }
@media (min-width: 1024px) {
  .pb-nav { --nav-row: 40px; gap: 1px; }   /* 40 dp rows in the Compact density (2026-10-20, the owner: twenty modules should need as little scrolling as the window allows; 44 in Comfortable, tokens §3.3) */
  :root[data-density="comfortable"] .pb-nav { --nav-row: 44px; gap: 2px; }
  .pb-sep { margin: 6px 12px; }
  .pb-topbar { min-height: 72px; }   /* chrome.css gives the Expanded bar 72 dp; it was a fixed height, now a minimum so a wrapped search label grows it */
  .pb-crumb { flex: 0 1 auto; }
  .pb-crumb a { min-height: 36px; }
  .pb-cmdk { display: inline-flex; width: 360px; flex-shrink: 1; }
  @media (max-width: 1279px) { .pb-cmdk { width: 220px; } .pb-cmdk span:not(.ico) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }   /* 1024 to 1279: a shorter box on one line, so the page's name beside it is not cut ("Gene…") and the bar does not grow */
  .pb-sx-btn { display: none; }
}
.pb-menu:focus-visible, .pb-back:focus-visible, .pb-cmdk:focus-visible, .pb-crumb a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (min-width: 1024px) { .pb-back { display: none; } }
@media (prefers-reduced-motion: reduce) { .pb-nav, .pb-scrim, .pb-topbar { transition: none; } }
