/* Shell: sidebar = icon rail (Search, Favorites, one icon per section) + a panel with that section's pages; Ctrl+K search; top bar with "Online now"; phone drawer. Loaded last. */
:root { --sidebar-w: 312px; --rail-w: 72px; --panel-w: 240px; }
.ico { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar { flex-direction: row; }
.sidebar :is(button, a, input):focus-visible { outline: 2px solid var(--c-ink); outline-offset: 1px; }

/* Rail */
.rail { width: var(--rail-w); flex-shrink: 0; display: flex; flex-direction: column; align-items: center; padding: 10px 0 8px; border-inline-end: 1px solid var(--c-line); background: var(--c-card); }
.rail .brand { margin-bottom: 8px; flex-shrink: 0; }
.rail .brand .mark { width: 34px; height: 34px; }
.rail-main { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 6px; overflow-y: auto; scrollbar-width: none; }
.rail-main::-webkit-scrollbar { display: none; }
.rail-btn { position: relative; width: 60px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0 5px; border: 0; border-radius: var(--r-md); background: none; color: var(--c-text); font: inherit; font-size: var(--fs-hint); line-height: 1.15; text-decoration: none; cursor: pointer; }
.rail-btn .ico { width: 20px; height: 20px; color: var(--c-ink); }
.rail-btn span { max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-btn:hover { background: var(--c-select); color: var(--c-ink); }
.rail-btn.on { background: var(--c-nav-on); color: var(--c-ink); font-weight: var(--fw-semibold); } /* the whole cell shows it is open, no side line (Sami 2026-11-08) */
.rail-btn.has-alert::after { content: ""; position: absolute; top: 6px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-danger); box-shadow: 0 0 0 2px var(--c-card); }
.rail-sep { width: 36px; height: 1px; margin: 6px 0; background: var(--c-line); flex-shrink: 0; }
.rail-foot { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 8px; }
.rail-foot .rail-btn { padding: 8px 0; }

/* Panel: pages of the section in view */
.nav-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--c-tile); }
.nav-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: var(--topbar-h); padding: 0 12px 0 16px; flex-shrink: 0; }
.nav-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--fw-semibold); font-size: var(--fs-body); color: var(--c-ink); }
.collapse-btn { background: none; border: 0; padding: 6px; border-radius: var(--r-sm); color: var(--c-muted); cursor: pointer; line-height: 0; }
.collapse-btn:hover { color: var(--c-ink); background: var(--c-select); }
.collapse-btn .ico { width: 20px; height: 20px; }

#nav { flex: 1; min-height: 0; overflow-y: auto; padding: 0 10px 12px; scrollbar-width: thin; }
.nav-title { margin: 10px 8px 6px; font-size: var(--fs-hint); font-weight: var(--fw-semibold); letter-spacing: .05em; text-transform: uppercase; color: var(--c-faint); }
nav a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav a .ico { color: var(--c-ink); }
nav a.active .ico { color: var(--c-ink); }
nav a.active { background: var(--c-nav-on); color: var(--c-ink); font-weight: var(--fw-semibold); }
.nav-row { display: flex; align-items: center; border-radius: var(--r-md); }
.nav-row:hover { background: var(--c-select); }
.nav-row a { flex: 1; min-width: 0; }
.nav-row a:hover { background: none; }
.nav-star { flex-shrink: 0; padding: 6px 8px; border: 0; background: none; color: var(--c-faint); line-height: 0; cursor: pointer; opacity: 0; }
.nav-star .ico { width: 16px; height: 16px; }
.nav-row:hover .nav-star, .nav-star:focus-visible, .nav-star.on { opacity: 1; }
.nav-star.on { color: var(--c-accent); }
.nav-star.on .ico { fill: currentColor; }
.nav-star:hover { color: var(--c-accent); }
@media (hover: none) { .nav-star { opacity: 1; } }

/* Context row under the top bar (Sami 2026-11-07; look 2026-11-08): Back / Forward on the start side, History on the end side, the same
   place on every screen. Only on screens that have one of them; stays in view while the page scrolls. Design system: flat, --r-md buttons,
   line borders, the "selected" colours for an open History, no shadows. */
.ctxbar { position: sticky; top: var(--topbar-h); z-index: 19; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 52px; padding: var(--sp-2) var(--sp-5); border-bottom: 1px solid transparent; background: color-mix(in srgb, var(--c-page) 92%, transparent); backdrop-filter: blur(8px); transition: border-color .2s, padding-inline-end .25s ease; }
.ctxbar:not(:has(a, button)) { display: none; }
.ctxbar.lifted { border-bottom-color: var(--c-line); }
.ctx-back, .ctx-hist { display: flex; align-items: center; min-width: 0; }
.ctx-pager { display: flex; align-items: center; margin-inline-start: auto; }
.ctx-pager + .ctx-hist { margin-inline-start: var(--sp-2); }

/* Back / Forward: one joined control, like a browser's */
.navpair { display: inline-flex; min-width: 0; max-width: 100%; border: 1px solid var(--c-line-strong); border-radius: var(--r-md); background: var(--c-card); }
.np-btn { position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; height: 32px; padding-inline: var(--sp-2) var(--sp-3); color: var(--c-ink); font-size: var(--fs-body); font-weight: var(--fw-medium); text-decoration: none; transition: background .15s; }
.np-fwd { flex-shrink: 0; padding-inline: var(--sp-3) var(--sp-2); }
.np-btn + .np-btn { border-inline-start: 1px solid var(--c-line); }
.np-btn:first-child { border-start-start-radius: calc(var(--r-md) - 1px); border-end-start-radius: calc(var(--r-md) - 1px); }
.np-btn:last-child { border-start-end-radius: calc(var(--r-md) - 1px); border-end-end-radius: calc(var(--r-md) - 1px); }
/* Where it goes: a small dark label under the button on hover / keyboard focus, after a short pause so passing the mouse doesn't flash it */
:is(.ctxbar, .tb-nav, .tb-end) [data-tip]::after { content: attr(data-tip); position: absolute; top: calc(100% + var(--sp-2)); inset-inline-start: 0; z-index: 30; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm); background: var(--c-btn); color: var(--c-card); font-size: var(--fs-hint); font-weight: var(--fw-medium); white-space: nowrap; box-shadow: var(--shadow-pop); opacity: 0; transform: translateY(-2px); pointer-events: none; transition: opacity .12s, transform .12s; }
:is(.ctxbar, .tb-nav, .tb-end) [data-tip]:hover::after, :is(.ctxbar, .tb-nav, .tb-end) [data-tip]:focus-visible::after { opacity: 1; transform: none; transition-delay: .3s; }
:is(.ctx-pager, .tb-end) [data-tip]::after { inset-inline-start: auto; inset-inline-end: 0; }

/* Record pager: "‹ 10 / 168 ›", one joined control like Back / Forward */
.recpager { display: inline-flex; align-items: center; border: 1px solid var(--c-line-strong); border-radius: var(--r-md); background: var(--c-card); }
.rp-btn { position: relative; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; background: none; color: var(--c-muted); cursor: pointer; transition: background .15s, color .15s; }
.rp-btn:first-child { border-start-start-radius: calc(var(--r-md) - 1px); border-end-start-radius: calc(var(--r-md) - 1px); }
.rp-btn:last-child { border-start-end-radius: calc(var(--r-md) - 1px); border-end-end-radius: calc(var(--r-md) - 1px); }
.rp-btn:hover:not(:disabled) { background: var(--c-select); color: var(--c-ink); }
.rp-btn:active:not(:disabled) { background: var(--c-select-line); }
.rp-btn:disabled { opacity: .35; cursor: default; }
.rp-btn:disabled::after { display: none; }
.rp-btn:focus-visible { outline: 2px solid var(--c-ink); outline-offset: -2px; }
.rp-pos { padding-inline: var(--sp-2); border-inline: 1px solid var(--c-line); line-height: 32px; font-size: var(--fs-body); color: var(--c-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-pos b { font-weight: var(--fw-semibold); color: var(--c-ink); }
.modal-head .recpager { align-self: center; margin-inline-start: auto; margin-inline-end: var(--sp-2); }
.md-dw-nav .recpager { margin-inline-end: var(--sp-2); }
.np-btn:hover { background: var(--c-select); }
.np-btn:active { background: var(--c-select-line); }
.np-btn:focus-visible { outline: 2px solid var(--c-ink); outline-offset: -2px; }
.np-ic { flex: none; display: grid; place-items: center; color: var(--c-muted); transition: transform .15s, color .15s; }
.np-btn:hover .np-ic { color: var(--c-ink); }
.np-back:hover .np-ic { transform: translateX(-2px); }
.np-fwd:hover .np-ic { transform: translateX(2px); }
.np-txt { white-space: nowrap; }
.mirror:dir(rtl) { transform: scaleX(-1); }

/* History: a secondary button; open = selected (never the main colour) */
.ctx-hist .hist-btn { height: 34px; padding-inline: var(--sp-2) var(--sp-3); gap: var(--sp-2); border: 1px solid var(--c-line-strong); border-radius: var(--r-md); background: var(--c-card); color: var(--c-ink); font-size: var(--fs-body); font-weight: var(--fw-medium); box-shadow: none; }
.ctx-hist .hist-btn .hist-ic { color: var(--c-muted); transition: transform .3s, color .15s; }
.ctx-hist .hist-btn:hover { background: var(--c-select); }
.ctx-hist .hist-btn:hover .hist-ic { transform: rotate(-30deg); color: var(--c-ink); }
.ctx-hist .hist-btn[aria-pressed="true"] { background: var(--c-select); border-color: var(--c-ink); }
.ctx-hist .hist-btn[aria-pressed="true"] .hist-ic { color: var(--c-ink); }
.ctx-hist .hist-btn:focus-visible { outline: none; border-color: var(--c-ink); box-shadow: var(--focus-ring); }
@media (prefers-reduced-motion: no-preference) {
  .np-btn, .recpager, .ctx-hist .hist-btn { animation: ctx-in .2s ease-out both; }
}
@keyframes ctx-in { from { opacity: 0; transform: translateY(-4px); } }

/* Favorites: tabs along the top bar */
.fav-zone { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.fav-zone[hidden] { display: none; }
.fav-label { display: flex; align-items: center; gap: 4px; padding-inline-start: 8px; font-size: var(--fs-hint); font-weight: var(--fw-semibold); letter-spacing: .06em; line-height: 1; text-transform: uppercase; color: var(--c-faint); }
.fav-label .ico { width: 10px; height: 10px; fill: currentColor; }
/* The strip slides sideways when the tabs don't fit (Sami 2026-11-12): swipe, mouse drag or wheel, or the edge arrows; fades show there is more */
.fav-rail { position: relative; min-width: 0; display: flex; }
.fav-tabs { flex: none; min-width: 0; max-width: 100%; display: flex; flex-direction: row; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; overscroll-behavior-x: contain; }
.fav-tabs.sliding { scroll-behavior: auto; cursor: grabbing; user-select: none; }
.fav-rail.has-l .fav-tabs { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 36px); mask-image: linear-gradient(90deg, transparent 0, #000 36px); }
.fav-rail.has-r .fav-tabs { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent 100%); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent 100%); }
.fav-rail.has-l.has-r .fav-tabs { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 36px, #000 calc(100% - 36px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 36px, #000 calc(100% - 36px), transparent 100%); }
.fav-arrow { position: absolute; top: 50%; z-index: 1; display: none; place-items: center; width: 26px; height: 26px; margin-top: -13px; padding: 0; border: 1px solid var(--c-line-strong); border-radius: 50%; background: var(--c-card); color: var(--c-text); box-shadow: var(--card-shadow); cursor: pointer; }
.fav-arrow:hover { color: var(--c-ink); background: var(--c-select); }
.fav-arrow .ico { width: 14px; height: 14px; }
.fav-arrow.l { left: -2px; } .fav-arrow.l .ico { transform: scaleX(-1); }
.fav-arrow.r { right: -2px; }
.fav-rail.has-l .fav-arrow.l, .fav-rail.has-r .fav-arrow.r { display: grid; }
@media (hover: none) { .fav-arrow { display: none !important; } } /* tablets and phones: the finger slides the strip */
.fav-tabs::-webkit-scrollbar { display: none; }
/* Every favorite in view (Sami 2026-11-14): no sliding outside edit mode; what doesn't fit sits behind the "N more" button. */
.fav-rail:not(.editing) .fav-tabs { overflow: hidden; -webkit-mask-image: none; mask-image: none; }
.fav-rail:not(.editing) .fav-arrow { display: none !important; }
.fav-tab.fav-off { display: none; }
.fav-more { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 34px; margin-inline-start: 4px; padding: 0 10px; border: 1px solid var(--c-line-strong); border-radius: var(--r-md); background: var(--c-card); color: var(--c-text); font: inherit; font-size: var(--fs-table); font-weight: var(--fw-semibold); white-space: nowrap; cursor: pointer; }
.fav-more[hidden] { display: none; }
.fav-more:hover { background: var(--c-select); color: var(--c-ink); }
.fav-more:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.fav-more .ico { width: 14px; height: 14px; transform: rotate(90deg); transition: transform .2s; }
.fav-more[aria-expanded="true"] .ico { transform: rotate(-90deg); }
.fav-more.active, .fav-more.active:hover { background: var(--c-btn); border-color: var(--c-btn); color: var(--c-card); }
.fav-pop { position: fixed; z-index: 60; min-width: 220px; max-height: 70vh; overflow-y: auto; display: grid; gap: 2px; padding: 6px; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--r-md); box-shadow: var(--shadow-pop); }
.fav-pop[hidden] { display: none; }
.fav-pop-i { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border-radius: var(--r-sm); color: var(--c-text); font-size: var(--fs-body); font-weight: var(--fw-medium); text-decoration: none; white-space: nowrap; }
.fav-pop-i:hover { background: var(--c-select); }
.fav-pop-i:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.fav-pop-i .ico { width: 16px; height: 16px; flex: none; opacity: .7; }
.fav-pop-i.active, .fav-pop-i.active:hover { background: var(--c-btn); color: var(--c-card); }
.fav-pop-i.active .ico { opacity: 1; }
.fav-tab { position: relative; flex-shrink: 0; display: flex; align-items: center; height: 36px; padding: 0 2px; border-radius: var(--r-md); color: var(--c-text); }
.fav-tab:hover { background: var(--c-select); }
.fav-tab a:hover { background: none; }
.fav-tab a { display: flex; align-items: center; height: 100%; padding: 0 4px; color: inherit; font-size: var(--fs-body); font-weight: var(--fw-medium); text-decoration: none; white-space: nowrap; }
.fav-tab.active, .fav-tab.active:hover { background: var(--c-btn); color: var(--c-card); }
.fav-tab.active a { font-weight: var(--fw-semibold); }
/* Each tab: its page's icon (the same as in the menu) + the word (Sami 2026-11-12) */
.fav-tab a { gap: 6px; }
.fav-tab a .ico { width: 16px; height: 16px; flex: none; opacity: .7; color: inherit; } /* the icon takes the word's colour: white on the blue picked tab, like "N more" (the sidebar's nav a .ico ink rule hit it, Sami 2026-11-16) */
.fav-tab.active a .ico { opacity: 1; }
.fav-tab :is(a, button):focus-visible { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.fav-tab .fx-grip, .fav-x { display: none; flex-shrink: 0; place-items: center; padding: 0; border: 0; background: none; color: inherit; }
.fav-tab .fx-grip { width: 16px; height: 28px; border-radius: var(--r-sm); cursor: grab; touch-action: none; }
.fav-tab .fx-grip svg { width: 7px; height: 12px; fill: currentColor; }
.fav-x { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; }
.fav-x .ico { width: 13px; height: 13px; }
.fav-x:hover { background: rgba(127, 127, 127, .25); }
.fav-tabs.editing :is(.fx-grip, .fav-x) { display: grid; }
.fav-tabs.editing .fav-tab { border: 1px dashed var(--c-line-strong); }
.fav-tabs.editing .fav-tab a { cursor: default; }
.fav-edit { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 8px; border: 1px solid var(--c-line-strong); border-radius: var(--r-md); background: var(--c-card); color: var(--c-muted); font: inherit; font-size: var(--fs-body); font-weight: var(--fw-semibold); cursor: pointer; }
.fav-edit:hover { background: var(--c-select); color: var(--c-ink); }
.fav-edit[hidden], #favDiscard[hidden], #favSave[hidden] { display: none; }
.fav-tabs.editing:empty::before { content: "No favorites left. Save to keep this, or Discard to undo."; padding: 0 8px; font-size: var(--fs-table); color: var(--c-muted); }
.fav-edit:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.fav-tab.dragging { background: var(--c-card); color: var(--c-ink); box-shadow: 0 10px 26px rgba(20, 20, 28, .2), 0 0 0 1.5px var(--c-accent); cursor: grabbing; z-index: 3; }

/* Ctrl+K: find a page */
.pal { position: fixed; inset: 0; z-index: 80; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 12px 0; background: rgba(16, 24, 40, .35); }
.pal[hidden] { display: none; }
.pal-box { width: min(520px, 100%); overflow: hidden; background: var(--c-card); border: 1px solid var(--c-line-strong); border-radius: var(--r-lg); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.pal-q { width: 100%; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--c-line); font: inherit; font-size: var(--fs-body); color: var(--c-ink); outline: none; }
.pal-list { max-height: 46vh; overflow-y: auto; padding: 6px; }
/* A band for each section so the groups stand apart: icon + name, full width, a line above and below */
.pal-h { position: sticky; top: -6px; z-index: 1; display: flex; align-items: center; gap: 8px; margin: 10px -6px 4px; padding: 7px 16px; background: var(--c-tile); border-top: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); font-size: var(--fs-hint); font-weight: var(--fw-semibold); letter-spacing: .06em; text-transform: uppercase; color: var(--c-ink); }
.pal-h:first-child { margin-top: -6px; border-top: 0; }
.pal-h .ico { width: 15px; height: 15px; color: var(--c-accent-text); }
.pal-h ~ .pal-i { padding-inline-start: 40px; } /* pages sit to the right of their section heading, so the headings stand apart (Sami 2026-11-13) */
.pal-i { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); color: var(--c-text); text-decoration: none; }
.pal-i .ico { color: var(--c-muted); }
.pal-i:hover, .pal-i.on { background: var(--c-select); color: var(--c-ink); }
.pal-i mark { background: none; color: var(--c-ink); font-weight: var(--fw-semibold); } /* the typed words, like the Menu search */
.pal-sep { margin: 0 6px; font-style: normal; color: var(--c-muted); } /* › between the parts of a path (findPlaces.js) */
.pal-none { padding: 18px; color: var(--c-muted); }
.pal-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--c-line); font-size: var(--fs-hint); color: var(--c-muted); }

/* Top bar: "Online now" (top right): green dot, stacked faces, count; tap for the full list */
.shellbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: var(--topbar-h); padding: 0 24px; background: var(--c-card); border-bottom: 1px solid var(--c-line); flex-shrink: 0; }
.presence-slot { flex-shrink: 0; margin-inline-start: auto; }
.presence { position: relative; }
.presence summary { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: var(--r-pill); cursor: pointer; list-style: none; font-size: var(--fs-table); font-weight: var(--fw-medium); color: var(--c-text); }
.presence summary::-webkit-details-marker { display: none; }
.presence summary:hover, .presence[open] summary { background: var(--c-select); }
.presence summary:focus-visible { outline: 2px solid var(--c-ink); outline-offset: 1px; }
.presence .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-success); box-shadow: 0 0 0 3px var(--c-success-line); }
.presence .faces { display: flex; }
.presence .faces .avatar { width: 30px; height: 30px; font-size: var(--fs-hint); border: 2px solid var(--c-card); }
.presence .faces .avatar + .avatar { margin-inline-start: -5px; }
.presence .faces .avatar.more { background: var(--c-neutral-soft); color: var(--c-muted); }
.presence-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: 260px; max-height: 60vh; overflow-y: auto; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--r-lg); box-shadow: 0 12px 32px rgba(20,20,28,.12); padding: 8px; }
.presence-head { font-size: var(--fs-hint); font-weight: var(--fw-semibold); color: var(--c-faint); padding: 4px 8px 8px; }
.presence-pop ul { list-style: none; margin: 0; padding: 0; }
.presence-pop li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.presence-pop li div { min-width: 0; }
.presence-pop b, .presence-pop small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presence-pop b { font-size: var(--fs-body); font-weight: var(--fw-semibold); color: var(--c-ink); }
.presence-pop small { font-size: var(--fs-hint); color: var(--c-muted); }

/* Phone-only top bar and scrim */
.mobbar, .scrim { display: none; }

/* Laptop page list (Sami 2026-11-13, DECISIONS #234): unless pinned, only the rail takes room; the page list opens over the screen
   while the mouse is on a section icon or on the list, and closes when it leaves. The pin (head of the list) keeps it open, per account. */
@media (min-width: 861px) {
  body.nav-float { --sidebar-w: var(--rail-w); }
  body.nav-float .sidebar { overflow: visible; }
  body.nav-float .nav-panel { position: absolute; inset-block: 0; inset-inline-start: var(--rail-w); width: var(--panel-w); border-inline-end: 1px solid var(--c-line); box-shadow: var(--shadow-pop); visibility: hidden; opacity: 0; transform: translateX(-6px); transition: opacity .14s ease, transform .14s ease, visibility 0s .14s; }
  body.nav-float.nav-peek .nav-panel { visibility: visible; opacity: 1; transform: none; transition: opacity .14s ease, transform .14s ease; }
}
.pin-btn[aria-pressed="true"] { color: var(--c-accent-text); background: var(--c-accent-soft); }
.pin-btn[aria-pressed="true"] .ico { fill: currentColor; }

/* Phone: the rail and the panel slide in together behind a top bar */
@media (max-width: 860px) {
  .mobbar { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px; background: var(--c-card); border-bottom: 1px solid var(--c-line); position: sticky; top: 0; z-index: 25; }
  .mobbar .menu-btn { display: inline-flex; padding: 7px; line-height: 0; }
  .mobbar .brand .mark { width: 26px; height: 26px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(340px, 92vw); height: 100%; transform: translateX(-102%); transition: transform .2s ease; z-index: 50; box-shadow: none; }
  body.menu-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(20,20,28,.25); }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(20,20,28,.4); z-index: 40; }
  .collapse-btn { display: none; }
  .shellbar { display: none; }
  .shellbar.has-tabs { display: flex; top: 52px; padding: 0 12px; }
  .shellbar .presence-slot { display: none; }
  .ctxbar { top: 52px; min-height: 48px; padding: var(--sp-2) var(--sp-3); }
  .shellbar.has-tabs ~ .ctxbar { top: calc(52px + var(--topbar-h)); }
  .mobbar .presence-slot { margin-inline-start: auto; }
  .mobbar .presence .count { display: none; }
  .presence-pop { right: -4px; }
  body { overflow-x: hidden; }
  .content { width: 100%; }
}

/* Back, the record pager and History on the screen's own title row (Look A, Sami 2026-11-09, DECISIONS #149, public/js/ctxRow.js):
   ‹ before the title, pager + a clock at the end, icons only (the name shows on hover). The row stays at the top while the page scrolls. */
.has-ctx { align-items: center; gap: var(--sp-3); }
.topbar.has-ctx { justify-content: flex-start; }
:is(.topbar, .lp-top).has-ctx > .tb-nav + div { flex: 1; min-width: 0; }
.tb-nav, .tb-end { display: flex; align-items: center; gap: var(--sp-2); flex: none; }
.tb-nav:not(:has(a, button)), .tb-end:not(:has(a, button)) { display: none; }
.tb-nav .np-txt, .tb-end .hb-txt { display: none; }
.tb-nav .np-btn, .tb-nav .np-fwd { width: 32px; padding: 0; justify-content: center; }
.tb-end .hist-btn { width: 34px; padding: 0; justify-content: center; }
.tb-end .ctx-pager { margin-inline-start: 0; }
.tb-end .ctx-pager:empty, .tb-end .ctx-hist:empty { display: none; }
/* No fade-in here: a redrawn title row gets the same buttons moved back in, and a replayed animation would blink (no flashing rule) */
.tb-nav .np-btn, .tb-end .recpager, .tb-end .hist-btn { animation: none; }
/* The page colour behind the row reaches the screen edges through a layer behind it (not a clip, which hid the hover labels under the buttons) */
.tb-sticky { position: sticky; top: var(--topbar-h); z-index: 18; padding-block: var(--sp-2); }
/* The title row brings its own 8px above it, so the screen adds only 8px more: 16px from the top bar to the title (was 32px, Sami 2026-11-12). */
main#view:has(.tb-sticky) { padding-top: var(--sp-2); }
/* (a shadow, not a wide box: a shadow never makes the page scroll sideways; the clip is on this layer only) */
.tb-sticky::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--c-page); box-shadow: 0 0 0 100vmax var(--c-page); clip-path: inset(0 -100vmax -1px); pointer-events: none; }
body.tb-lifted .tb-sticky::before { box-shadow: 0 0 0 100vmax var(--c-page), 0 1px 0 100vmax var(--c-line); }
:is(.tb-nav, .tb-end) [data-tip] { position: relative; }
@media (max-width: 860px) {
  .tb-sticky { top: 52px; }
  .shellbar.has-tabs ~ main .tb-sticky { top: calc(52px + var(--topbar-h)); }
}
/* Phone: ‹ name … pager History on the first line, the screen's buttons under it; the row does not follow the scroll (too tall for a phone) */
@media (max-width: 560px) {
  .tb-sticky { position: static; padding-block: 0; }
  .tb-sticky::before { content: none; }
  .has-ctx { flex-wrap: wrap; row-gap: var(--sp-2); }
  .has-ctx > .tb-end { order: 2; }
  .has-ctx > .topbar-actions, .has-ctx > .lp-acts { order: 3; flex-basis: 100%; }
}

/* ---- Tablet and phone menu (Sami 2026-11-13, DECISIONS #218) ----
   On a touch device (a tablet, any width) or a narrow screen there is no sidebar and no phone bar: one top bar holds the Menu icon,
   the Favorites tabs and who is online. The Menu icon opens, over the screen, the section icons + the picked section's pages
   (the sidebar's own look), with a search over every section. A laptop keeps the sidebar.
   The sales team (Salesperson, Sales supervisor, Team leader) gets this top bar on every device, with no Favorites tabs, and the Menu icon
   opens one plain list of their pages (Sami 2026-11-17, DECISIONS #358). All of it hangs on body.nb-shell, set before the first paint by
   index.html and kept by navShell.js (touch or narrow screen, or a sales role); :where() keeps the old weights so nothing else moves. */
.nb-menu, .nb-scrim, .nb-panel { display: none; }
body.nb-shell, body.nb-shell.nav-float { --sidebar-w: 0px; }
:where(.nb-shell) .sidebar, :where(.nb-shell) .mobbar { display: none !important; }
:where(.nb-shell) .shellbar, :where(.nb-shell) .shellbar.has-tabs { display: flex; top: 0; padding: 0 12px; gap: 10px; }
:where(.nb-shell) .shellbar .presence-slot { display: block; }
:where(.nb-shell) .ctxbar, :where(.nb-shell) .shellbar.has-tabs ~ .ctxbar { top: var(--topbar-h); }
:where(.nb-shell) .tb-sticky, :where(.nb-shell) .shellbar.has-tabs ~ main .tb-sticky { top: var(--topbar-h); }
:where(.nb-shell) .nb-menu { /* hover: .nb-menu:hover on the next lines */ flex: none; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--c-line-strong); border-radius: var(--r-md); background: var(--c-card); color: var(--c-ink); cursor: pointer; }
.nb-menu .ico { width: 22px; height: 22px; }
.nb-menu:hover, .nb-open .nb-menu { background: var(--c-select); }
:where(.nb-shell) .nb-scrim { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(20, 20, 28, .4); opacity: 0; pointer-events: none; transition: opacity .2s; }
.nb-open .nb-scrim { opacity: 1; pointer-events: auto; }
:where(.nb-shell) .nb-panel { display: flex; flex-direction: column; position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 71; width: min(400px, 92vw); background: var(--c-card); box-shadow: 0 0 40px rgba(20, 20, 28, .25); transform: translateX(-102%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
.nb-open .nb-panel { transform: none; visibility: visible; transition: transform .2s ease; }
.nb-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--c-line); }
.nb-logo { width: 30px; height: 26px; flex: none; }
.nb-logo svg { display: block; width: 100%; height: 100%; }
.nb-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-ink); }
.nb-x { margin-inline-start: auto; flex: none; width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 1px solid var(--c-line-strong); border-radius: var(--r-md); background: var(--c-card); color: var(--c-text); cursor: pointer; }
.nb-x:hover { background: var(--c-select-line); color: var(--c-ink); border-color: var(--c-line-strong); } /* hover (said-once #4, 2026-11-14) */
.nb-x .ico { width: 18px; height: 18px; }
.nb-find { position: relative; display: block; padding: 10px 12px; border-bottom: 1px solid var(--c-line); }
.nb-find-ico { position: absolute; inset-inline-start: 24px; top: 50%; margin-top: -9px; line-height: 0; color: var(--c-faint); pointer-events: none; }
.nb-find-ico .ico { width: 18px; height: 18px; }
.nb-find input { width: 100%; height: 44px; padding-inline: 40px 12px; }
.nb-body { flex: 1; min-height: 0; display: flex; }
.nb-rail { flex: none; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border-inline-end: 1px solid var(--c-line); overflow-y: auto; scrollbar-width: none; }
.nb-panel.simple { width: min(320px, 92vw); } /* the sales team: one plain list (DECISIONS #358) */
.nb-panel.simple .nb-find, .nb-panel.simple .nb-rail { display: none; }
.nb-panel.simple .nb-pages { padding-top: 8px; }
.nb-rail .rail-btn { min-height: 56px; justify-content: center; }
.nb-panel.searching .nb-rail .rail-btn.on { background: none; font-weight: inherit; }
.nb-pages { flex: 1; min-width: 0; overflow-y: auto; padding: 0 10px 12px; background: var(--c-tile); }
.nb-pages .nav-row a { min-height: 48px; }
.nb-pages .nav-star { padding: 15px 12px; opacity: 1; }
.nb-pages mark { background: none; color: var(--c-ink); font-weight: var(--fw-semibold); }
.nb-panel.searching .nb-pages nav { padding-inline-start: var(--sp-5); } /* search results: pages sit right of their section heading */
.nb-none { margin: 0; padding: 24px 8px; color: var(--c-muted); }
.nb-foot { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--c-line); }
.nb-who { flex: 1; min-width: 0; line-height: 1.3; }
.nb-who b, .nb-who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-who b { font-weight: var(--fw-semibold); color: var(--c-ink); }
.nb-who small { color: var(--c-muted); font-size: var(--fs-hint); }
.nb-out { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border: 1px solid var(--c-line-strong); border-radius: var(--r-md); background: var(--c-card); color: var(--c-text); text-decoration: none; }
.nb-out .ico { width: 16px; height: 16px; }
@media (max-width: 560px) { .shellbar .presence .count { display: none; } }
@media (prefers-reduced-motion: reduce) { .nb-panel, .nb-scrim { transition: none; } }

/* Login as (DECISIONS #229): red bar on top of every screen while an Owner works as someone else; the top bars sit under it. */
.login-as-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 40px; padding: 0 24px; background: var(--c-danger); color: #fff; font-size: var(--fs-table); }
.login-as-bar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-as-bar b { font-weight: 600; }
.login-as-bar .btn { flex-shrink: 0; }
/* Login as someone else (Sami 2026-11-17): a second button beside Back to my account, and the pick list it opens. */
.login-as-btns { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.login-as-bar .btn .ico { width: 16px; height: 16px; margin-inline-end: 6px; vertical-align: -3px; }
.login-as-bar .la-short { display: none; }
.la-list { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.la-person { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 12px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-card); color: var(--c-ink); text-align: start; cursor: pointer; }
.la-person:hover { background: var(--c-select); }
.la-person:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.la-person.on { cursor: default; border-color: var(--c-accent); }
.la-person[disabled]:not(.on) { opacity: .6; cursor: progress; }
.la-who { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; text-align: start; }
.la-who > * { max-width: 100%; }
.la-who b, .la-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.la-who b { font-weight: var(--fw-semibold); }
.la-who small { color: var(--c-faint); font-size: var(--fs-hint); }
body.login-as .shellbar, body.login-as .mobbar { top: 40px; }
@media (max-width: 767px) { .login-as-bar { padding: 0 12px; } .login-as-bar .la-long { display: none; } .login-as-bar .la-short { display: inline; } }
