/* The app shell of the staff pages (app/shell.js): a floating side menu on a wide
   screen, a floating bottom bar on a phone, the person's name and avatar in the top
   bar. Also the shared pieces of the new look that are not tied to one page (avatars,
   big-number tiles, soft cards) and the motion: an entrance once per page, numbers and
   bars that grow once, a soft dialog; all of it off under prefers-reduced-motion.
   Loaded last on every staff page; reads tokens.css. */

/* ── The menu ─────────────────────────────── */
.side { background: var(--ds-surface); }
.side:empty { visibility: hidden; }
.side-logo { display: block; padding-inline: 6px; }
.side-logo img { display: block; block-size: 58px; inline-size: auto; }
.side-nav { position: relative; display: grid; gap: 2px; }
.side-k { color: var(--ds-muted); font-size: 12.5px; padding: 4px 12px; }
/* The second part of a long menu: a hairline and a quiet heading. */
.side-k-rest { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--ds-line); }
.side-list { display: grid; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ds-muted); font: inherit; font-size: 15px; text-align: start; text-decoration: none; cursor: pointer;
  transition: color var(--ds-t-fast), background-color var(--ds-t-fast);
}
.side-link:hover { color: var(--ds-ink); background: var(--ds-ground); }
.side-link[aria-current] { color: var(--ds-ink); font-weight: 600; }
.side-link:focus-visible { outline-offset: -2px; }
.side-rail {
  position: absolute; inset-inline-start: -14px; top: 0; inline-size: 5px; block-size: 30px; opacity: 0;
  border-start-end-radius: 6px; border-end-end-radius: 6px; background: var(--ds-navy);
  transition: transform .45s var(--ds-ease), opacity .2s;
}
.side-promo {
  border-radius: var(--ds-r-card); padding: 16px; color: var(--ds-on-navy); text-decoration: none;
  background: radial-gradient(120% 90% at 0% 0%, var(--ds-navy-2), var(--ds-navy)); display: grid; gap: 8px;
}
.side-promo:hover { color: var(--ds-on-navy); box-shadow: var(--ds-shadow-hover); }
.side-promo strong { font-family: var(--ds-font-h); font-size: 18px; font-weight: 400; line-height: 1.2; }
.side-promo small { color: #D5DCF0; font-size: 13px; }
.side-promo:focus-visible { outline-offset: 3px; }

/* The top bar under the shell: the page's place, then who is signed in. */
.has-shell .session .dot, .has-shell .session .who {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.who-name { color: var(--ds-ink); font-size: 14.5px; font-weight: 500; white-space: nowrap; }
/* The one button between the two profiles (the owners, Ofir, Lior): navy to open the
   manager profile, a quiet outline for the way back. The same place on every screen. */
.profile-switch {
  display: inline-flex; align-items: center; justify-content: center; flex: none; min-height: 44px; padding: 8px 16px;
  border-radius: 999px; border: 1.5px solid var(--ds-navy); background: var(--ds-navy); color: var(--ds-on-navy);
  font-size: 14.5px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color var(--ds-t-fast), color var(--ds-t-fast);
}
.profile-switch:hover { background: var(--ds-navy-2); color: var(--ds-on-navy); }
.profile-switch[data-to='mine'] { background: transparent; color: var(--ds-navy); }
.profile-switch[data-to='mine']:hover { background: var(--ds-ground); color: var(--ds-navy); }
.profile-switch:focus-visible { outline-offset: 3px; }
@media (max-width: 420px) { .profile-switch { padding-inline: 12px; font-size: 13.5px; } }
@media print { .profile-switch { display: none; } }
.topbar .btn-sm { border-color: var(--ds-line-strong); font-weight: 500; }

@media (min-width: 1024px) {
  body.has-shell { padding-inline-start: calc(var(--ds-gutter) + var(--ds-side-w) + var(--ds-gap)); }
  body.has-shell .topbar, body.has-shell > main { max-width: none; margin-inline: 0; }
  .side {
    position: fixed; z-index: 31; top: 12px; inset-inline-start: var(--ds-gutter); inline-size: var(--ds-side-w);
    max-block-size: calc(100vh - 24px); max-block-size: calc(100dvh - 24px); overflow-y: auto; overflow-x: hidden; scrollbar-width: thin;
    border-radius: var(--ds-r-panel); padding: 18px 14px 14px; display: grid; gap: 16px; align-content: start;
  }
  .side-sheet, .side-more { display: none !important; }
  /* The logo is in the menu: the bar names the area of the app instead. */
  .has-shell .topbar .brand-logo, .has-shell .topbar .brand-chip, .has-shell .topbar .brand-name, .has-shell .topbar .brand-sep { display: none; }
  .has-shell .topbar .brand-product { font-family: var(--ds-font-h); font-size: 19px; color: var(--ds-ink); }
  .has-shell .topbar { min-height: 60px; }
}

/* ── A phone (and anything narrower than the menu needs): the bottom bar ── */
@media (max-width: 1023.98px) {
  .side { display: none; }
  body.has-tabbar { --tabbar-room: 76px; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); }
  body.has-tabbar .side {
    display: block; position: fixed; z-index: 50; inset-inline: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    max-inline-size: 560px; margin-inline: auto; padding: 6px; border-radius: 22px; box-shadow: var(--ds-shadow-float);
  }
  /* While a field is being typed in, the floating bar steps aside: with the phone's keyboard open it
     sat on the field and hid what was typed (25.10.2026). */
  body.has-tabbar:has(:is(input:not([type="checkbox"], [type="radio"], [type="button"], [type="submit"], [type="range"]), textarea):focus) .side { display: none; }
  .side-logo, .side-promo, .side-k, .side-rail { display: none; }
  .side-list { grid-template-columns: repeat(var(--bar-n, 4), minmax(0, 1fr)); gap: 4px; }
  .side-link {
    justify-content: center; text-align: center; font-size: 13px; line-height: 1.2; padding: 6px 4px; min-height: 50px; border-radius: 16px;
    overflow-wrap: anywhere;
  }
  .side-link[aria-current], .side-more.is-on { background: var(--ds-navy); color: var(--ds-on-navy); }
  .side-link[aria-current]:hover, .side-more.is-on:hover { background: var(--ds-navy-2); color: var(--ds-on-navy); }
  .side-link[aria-current]:focus-visible, .side-more.is-on:focus-visible { outline-color: #fff; outline-offset: -4px; }
  .side-more[aria-expanded='true']:not(.is-on) { background: var(--ds-soft); color: var(--ds-ink); }
  .side-sheet {
    position: absolute; inset-inline: 0; bottom: calc(100% + 8px); display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
    padding: 8px; border-radius: 22px; background: var(--ds-surface); box-shadow: var(--ds-shadow-float);
    max-block-size: min(60vh, 420px); overflow-y: auto;
  }
  .side-sheet .side-link { background: var(--ds-ground); min-height: 48px; font-size: 14px; }
  .side-sheet .side-link[aria-current] { background: var(--ds-navy); }
  .has-shell .who-name { display: none; }
}
@media (min-width: 761px) and (max-width: 1023.98px) { .has-shell .who-name { display: inline; } }

/* ── Avatars ──────────────────────────────── */
.ds-av {
  inline-size: 38px; block-size: 38px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-weight: 600; font-size: 13px; line-height: 1; background: var(--av, var(--ds-soft)); color: #1B2340;
}
.ds-av-sm { inline-size: 28px; block-size: 28px; font-size: 11px; box-shadow: 0 0 0 2px var(--ds-surface); }
.ds-av-lg { inline-size: 62px; block-size: 62px; font-size: 19px; }
.ds-avs { display: inline-flex; }
.ds-avs .ds-av + .ds-av { margin-inline-start: -8px; }

/* ── Tiles and cards ──────────────────────── */
.ds-tile { background: var(--ds-ground); border-radius: var(--ds-r-card); padding: 16px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.ds-tile.is-hero { background: var(--ds-navy-grad); color: var(--ds-on-navy); }
.ds-card { background: var(--ds-ground); border-radius: var(--ds-r-card); padding: 16px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.ds-card h2 { margin: 0; font-size: 19px; }
.ds-num { font-family: var(--ds-font-h); font-variant-numeric: tabular-nums; }

/* ── Motion ───────────────────────────────── */
@keyframes ds-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes ds-pop { from { opacity: 0; transform: translateY(14px); } }
@keyframes ds-grow-x { from { transform: scaleX(0); } }
@keyframes ds-grow-y { from { transform: scaleY(0); } }
.ds-rise { animation: ds-rise var(--ds-t-rise) var(--ds-ease) both; animation-delay: calc(var(--i, 0) * var(--ds-stagger)); }
.ds-motion dialog[open] { animation: ds-pop .35s var(--ds-ease); }
.ds-motion dialog[open]::backdrop { animation: ds-fade .25s ease; }
@keyframes ds-fade { from { opacity: 0; } }
.ds-gliding [style*='--vt:'] { view-transition-name: var(--vt); }
::view-transition-group(*) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; }

/* A number that counts up once: the real text stays in the page, the moving figure is drawn over it. */
@property --ds-n { syntax: '<integer>'; inherits: false; initial-value: 0; }
@keyframes ds-count { from { --ds-n: 0; } to { --ds-n: var(--ds-to, 0); } }
.ds-counting { position: relative; color: transparent !important; }
.ds-counting::after {
  content: counter(ds-n) attr(data-suf); counter-reset: ds-n var(--ds-n);
  position: absolute; inset: 0; color: var(--ds-count-color, currentColor); text-align: inherit;
  animation: ds-count .7s cubic-bezier(.2, .7, .2, 1) var(--ds-count-delay, 0s) both;
}
/* Meters and bars grow once, while their container carries .ds-grow (growOnce in app/shell.js). */
.ds-grow .pbar-fill { transform-origin: 100% 50%; animation: ds-grow-x .9s var(--ds-ease) both; }
[dir='ltr'] .ds-grow .pbar-fill { transform-origin: 0 50%; }
.ds-grow .wk-seg { transform-origin: 50% 100%; animation: ds-grow-y .7s var(--ds-ease) both; }

@media (prefers-reduced-motion: reduce) {
  .ds-rise, dialog[open], dialog[open]::backdrop, .ds-grow .pbar-fill, .ds-grow .wk-seg { animation: none !important; }
  .ds-counting { color: inherit !important; }
  .ds-counting::after { content: none; }
  .side-rail, .side-link { transition: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

@media print {
  .side { display: none !important; }
  body, body.has-shell, body.has-tabbar { padding: 0 !important; background: #fff; }
  body > main { border-radius: 0; margin: 0; max-width: none; background: #fff; }
}

/* One pink action a screen. Where the same action repeats down a list, the first (the
   next thing to do) is the pink one and the rest are navy; a second section's own
   action is navy too. */
#msg-queue > li:not(:first-child) .btn-primary, .gt-share .btn-primary {
  background: var(--ds-navy); border-color: var(--ds-navy); color: var(--ds-on-navy); box-shadow: none;
}
#msg-queue > li:not(:first-child) .btn-primary:hover, .gt-share .btn-primary:hover { background: var(--ds-navy-2); border-color: var(--ds-navy-2); color: var(--ds-on-navy); }

/* ── The feel of an app on a phone (docs/ops.md, section 42) ─────────────── */
/* Every control answers the finger at once with its own pressed state (not the grey
   flash of the browser); no double-tap zoom, and a long press selects no text and
   opens no menu on a control. */
:root { -webkit-tap-highlight-color: transparent; }
:where(a, button, summary, select, label, input, textarea, [role='tab'], [role='button']) { touch-action: manipulation; }
:where(button, summary, [role='tab'], a.btn, .side-link, .profile-switch, .navlink) { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
:where(a, button, summary, [role='tab']):active:not(:disabled, [aria-disabled='true']) { opacity: .62; }
:where(.tab, .chip, .side-link, .profile-switch):active:not(:disabled) { transform: scale(.97); }
/* The end of a list inside a dialog or the "עוד" sheet does not drag the page behind it. */
dialog, .dlg-body, .side-sheet { overscroll-behavior: contain; }
/* A phone with a notch held sideways: the page keeps clear of it (viewport-fit=cover). */
html { padding-inline: env(safe-area-inset-right, 0px) env(safe-area-inset-left, 0px); }

/* A page opens whole. While it is built (<html data-boot>, mountSession in
   app/protocol-ui.js) its blocks are laid out but not shown, so a card that arrives
   late pushes nothing under the finger, and a quiet placeholder stands in the panel. */
html[data-boot] #app { opacity: 0; pointer-events: none; }
html[data-boot] #state:not(.no-access) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; }
html[data-boot] main:has(> #login-block[hidden]) { position: relative; min-height: min(80vh, 660px); }
html[data-boot] main:has(> #login-block[hidden])::before, html[data-boot] main:has(> #login-block[hidden])::after {
  content: ''; position: absolute; inset-inline-start: 22px; background: var(--ds-ground); color: var(--ds-ground);
  animation: ds-wait 1.4s ease-in-out infinite alternate;
}
html[data-boot] main:has(> #login-block[hidden])::before { top: 30px; inline-size: min(46%, 300px); block-size: 30px; border-radius: 10px; box-shadow: 0 48px 0 -6px currentColor; }
html[data-boot] main:has(> #login-block[hidden])::after {
  top: 132px; inset-inline-end: 22px; block-size: 96px; border-radius: var(--ds-r-card);
  box-shadow: 0 112px 0 currentColor, 0 224px 0 currentColor, 0 336px 0 currentColor;
}
@keyframes ds-wait { from { opacity: 1; } to { opacity: .55; } }
/* The bottom bar's place is taken from the first paint, so the bar does not blink
   between two screens (not on a page whose people have no bar: data-boot="plain"). */
@media (max-width: 1023.98px) {
  html[data-boot=''] body::after {
    content: ''; position: fixed; z-index: 49; inset-inline: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    max-inline-size: 560px; margin-inline: auto; block-size: 62px; border-radius: 22px; background: var(--ds-surface); box-shadow: var(--ds-shadow-float);
  }
}
@media (max-width: 760px) {
  html[data-boot] main:has(> #login-block[hidden])::before, html[data-boot] main:has(> #login-block[hidden])::after { inset-inline-start: 12px; }
  html[data-boot] main:has(> #login-block[hidden])::after { inset-inline-end: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-boot] main::before, html[data-boot] main::after { animation: none !important; }
}
@media print {
  html[data-boot] #app { visibility: visible; }
  html[data-boot] main::before, html[data-boot] main::after, html[data-boot] body::after { content: none !important; }
}

/* From screen to screen: the old page changes into the new one instead of a white flash
   (a browser without cross-document view transitions simply loads the page). The rule
   that turns this on is app/styles/nav.css, the first thing in the <head> of every
   staff page: in this file, the last one, it was read too late (docs/ops.md, section 60). */
/* The app's frame stays where it is from screen to screen (docs/ops.md, section 60):
   the menu and the top bar are in the first paint of the next page (app/shell-gate.js),
   and are named here, so the browser carries them across as they are (only the marked
   item changes) while what is between them changes. A step in to a client's page
   arrives from the side and "back" leaves the way it came (<html data-nav>, set by the
   gate; the page reads right to left, so "in" is from the left); a screen of the menu
   fades. Where the frame was not drawn early, and in a browser without these
   transitions, the page loads as before. */
.side { view-transition-name: app-menu; }
header.topbar { view-transition-name: app-top; }
::view-transition-group(app-menu), ::view-transition-group(app-top) { animation: none; }
::view-transition-old(app-menu), ::view-transition-new(app-menu), ::view-transition-old(app-top), ::view-transition-new(app-top) { animation-duration: .16s; }
@keyframes ds-page-in { from { opacity: 0; transform: translateX(calc(var(--ds-way, 0) * 26%)); } }
@keyframes ds-page-out { to { opacity: 0; transform: translateX(calc(var(--ds-way, 0) * -9%)); } }
html[data-nav='forward'] { --ds-way: -1; }
html[data-nav='back'] { --ds-way: 1; }
html[dir='ltr'][data-nav='forward'] { --ds-way: 1; }
html[dir='ltr'][data-nav='back'] { --ds-way: -1; }
html:is([data-nav='forward'], [data-nav='back'])::view-transition-new(root) { animation: ds-page-in .32s cubic-bezier(.2, .8, .2, 1) both; }
html:is([data-nav='forward'], [data-nav='back'])::view-transition-old(root) { animation: ds-page-out .2s ease-out both; }
@media print { .side, header.topbar { view-transition-name: none; } }

/* A page that opened with what it showed last time (the session's store, app/supa.js;
   docs/ops.md, section 60). Until the server has confirmed what is on the screen, its
   buttons and fields wait: a tap acts on what the server said, not on what was
   remembered. Links, tabs and what only opens or folds work at once. */
html[data-stale] #app :is(button:not([role='tab'], [aria-expanded]), input, select, textarea, label, [contenteditable]) { pointer-events: none; }
/* The room of a part of the page that is not there yet (holdParts in app/protocol-ui.js). */
.ds-hold { border-radius: var(--ds-r-card); background: var(--ds-ground); animation: ds-wait 1.4s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { .ds-hold { animation: none; } }
@media print { .ds-hold { display: none; } }
/* A page the browser kept from another account's visit: nothing of it is drawn while it loads again. */
html[data-left] body { visibility: hidden; }

/* ── The phone bugs of 9.10.2026 (docs/ops.md, section 54) ─────────────── */
/* The top safe area. An installed app draws under the phone's status bar
   (viewport-fit=cover): the page keeps clear of it at rest (the padding), and while it
   scrolls a layer in the page's colour stands under the clock, so no card is drawn
   there. Where the phone gives no inset the layer has no height. In the installed app
   on a touch screen it is never thinner than a hair line of the page's own colour, so
   a system that tints the bar from what touches the top edge finds the page colour. */
html { --safe-top: env(safe-area-inset-top, 0px); }
body { padding-top: calc(12px + var(--safe-top)); }
@media (max-width: 760px) { body { padding-top: calc(8px + var(--safe-top)); } }
body::before {
  content: ''; position: fixed; z-index: 54; inset-block-start: 0; inset-inline: 0; block-size: var(--safe-top);
  background: var(--ds-ground); pointer-events: none;
}
@media (display-mode: standalone) and (pointer: coarse) { body::before { block-size: max(var(--safe-top), 6px); } }
@media print { body::before { content: none; } body { padding-top: 0; } }

/* A row of views that does not fit scrolls sideways inside itself (the page never does):
   every tab one line, the same padding, and the row snaps to a tab. Where they all fit
   they share the row. The four tabs of "המשימות שלי" keep their own split (protocol.css). */
.tabs-scroll {
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: 5px;
  -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y;
}
.tabs-scroll > .tab { flex: 1 0 auto; white-space: nowrap; scroll-snap-align: start; padding: 8px 18px; font-size: 15px; line-height: 1.3; }
@media (max-width: 760px) {
  .tabs-scroll { justify-self: stretch; gap: 4px; padding: 5px; }
  .tabs-scroll > .tab { padding: 8px 16px; font-size: 14.5px; }
}

/* Leftovers of the visual pass of 9.10.2026 (shared chrome, look only). */
/* A toast with a long task name stays on the screen and wraps. */
.toast, .pr-toast { max-inline-size: calc(100vw - 24px); box-sizing: border-box; white-space: normal; overflow-wrap: anywhere; }
/* Dialog close buttons are a full finger wide on a phone, wherever the dialog comes from. */
@media (max-width: 760px) { dialog .close { min-inline-size: 44px; min-block-size: 44px; } }

/* "הערה מיוחדת" written to the signed-in person (9.11.2026; app/staff-notes-ui.js): at the top
   of every page, above its head. Pink, as what must not be missed; it has no close button
   (only the writers delete a note). Several notes stack in one box. */
.sn-banner {
  grid-column: 1 / -1; min-width: 0; box-sizing: border-box; display: grid; gap: 8px;
  margin: 0 0 var(--ds-gap, 16px); padding: 12px 16px 14px;
  border: 1px solid var(--ds-hot); border-inline-start-width: 6px; border-radius: var(--ds-r-card, 16px);
  background: var(--ds-hot-soft); color: var(--ds-ink);
}
.sn-banner-h { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--ds-hot-text); }
.sn-banner-h::before {
  content: '!'; flex: none; inline-size: 22px; block-size: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ds-hot); color: var(--ds-on-hot); font-size: 14px; line-height: 1;
}
.sn-note { min-width: 0; display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--ds-r-item, 12px); background: var(--ds-surface); }
.sn-body { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.sn-by { margin: 0; font-size: 13.5px; color: var(--ds-ink-2); }
@media (max-width: 760px) { .sn-banner { padding: 10px 12px 12px; } .sn-body { font-size: 16px; } }
@media print { .sn-banner { display: none; } }
