/* The staff app's frame (app.html): a Mac-style sidebar, the section area, the
 * notification bell, sign-in, the lock screen, banners, Today and Settings.
 * Rides on tp.css (body.tp). No hex colours, no px.
 * Type (#52): 1rem text, 0.875rem secondary, 0.9375rem buttons; click targets at least
 * 2.5rem (40px) on everything the shell draws. */

/* no pull-to-refresh: a pull at the top of the page shouldn't reload the app (#16) */
html { overscroll-behavior-y: none; }
body.app { min-height: 100vh; min-height: 100dvh; overscroll-behavior-y: none; }
.shell { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
/* long headings wrap instead of pushing the page sideways, even at 200% text size (#13) */
.app h1, .app h2, .app h3, .app .title { overflow-wrap: anywhere; }
.shell-col { min-width: 0; display: grid; grid-template-rows: auto 1fr; align-content: start; }

/* ---------- the shell's own controls: readable and easy to hit ---------- */
.sidebar .btn, .shell-page .btn, .bell-panel .btn, .banner .btn, .lock .btn, #dialog .btn { font-size: var(--fs-button); }
.sidebar .btn.sm, .shell-page .btn.sm, .bell-panel .btn.sm, .banner .btn.sm, .lock .btn.sm { min-height: 2.5rem; padding: 0 1rem; font-size: var(--fs-fine); }
.shell-page .btn, .lock .btn, #dialog .btn { min-height: 2.75rem; }
.shell-page .input, .lock .input { min-height: 2.75rem; font-size: var(--fs-body); }
.shell-page .seg button { min-height: 2.5rem; font-size: var(--fs-fine); }
.shell-page .fine, .sidebar .fine, .bell-panel .fine { font-size: var(--fs-fine); }

/* ---------- sidebar ---------- */
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4) var(--space-3); background: var(--page-bg); overflow-y: auto; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 0 0 0 var(--space-2); }
/* their mark plus the name, big enough to read (#57) */
.brand { display: flex; align-items: center; gap: 0.625rem; min-width: 0; text-decoration: none; color: inherit; border-radius: var(--radius-sm); }
.brand-mark { width: 2.75rem; height: 2.75rem; flex: none; }
.brand-t { display: grid; line-height: 1.1; min-width: 0; }
.brand-name { color: var(--forest); font-size: 1.1875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.brand-sub { color: var(--ink-2); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap; }
.side-nav { display: grid; gap: 0.125rem; }
.nav-item { display: flex; align-items: center; gap: 0.75rem; min-height: 2.75rem; padding: 0 0.75rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); text-decoration: none; font-size: var(--fs-body); font-weight: 500; text-align: left; width: 100%; }
.nav-item .ico { width: 1.375rem; height: 1.375rem; flex: none; color: var(--forest-text); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: var(--fill-hover); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--forest-text); box-shadow: var(--card-shadow); }
.nav-item span:first-of-type { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { min-width: 1.5rem; height: 1.5rem; padding: 0 0.4375rem; display: inline-grid; place-items: center; border-radius: var(--radius-pill); background: var(--peach); color: var(--peach-ink); font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; display: grid; gap: var(--space-2); }
.side-me { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3) var(--space-2) 0; box-shadow: inset 0 var(--border-w) 0 var(--line); }
.side-me .avatar-sm, .avatar-sm { width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center; background: var(--avatar); color: var(--avatar-ink, var(--on-primary)); font-size: 0.8125rem; font-weight: 600; }
.side-me-t { display: grid; line-height: 1.3; min-width: 0; }
.side-me-t .strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-me-acts { grid-column: 1 / -1; display: flex; gap: var(--space-1); margin-left: calc(-1 * var(--space-2)); }
.side-me-acts .btn { gap: 0.375rem; }
.side-me-acts .ico { width: 1.0625rem; height: 1.0625rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-foot .built { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2) 0; border: 0; color: var(--ink-3); font-size: 0.75rem; }
.side-foot .built img { height: 0.75rem; }

/* ---------- bell ---------- */
.bell { position: relative; flex: none; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; color: var(--ink-2); }
.bell:hover { background: var(--fill); }
.bell .ico { width: 1.375rem; height: 1.375rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.bell-dot { position: absolute; top: -0.0625rem; right: -0.25rem; min-width: 1.375rem; height: 1.375rem; padding: 0 0.3125rem; border-radius: var(--radius-pill); background: var(--peach); color: var(--peach-ink); font-size: 0.75rem; font-weight: 700; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.bell-panel { position: fixed; z-index: 40; top: var(--space-4); left: 17.25rem; width: 28rem; max-height: calc(100vh - var(--space-6)); max-height: calc(100dvh - var(--space-6)); overflow: auto; padding: var(--space-4); display: grid; gap: var(--space-4); box-shadow: var(--sheet-shadow); }
.bell-list { display: grid; }
.bell-wait { display: grid; gap: var(--space-1); }
.wait-row { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) auto; align-items: center; gap: var(--space-2); min-height: 2.75rem; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: var(--fill-2); color: var(--ink); text-align: left; font-size: var(--fs-body); }
.wait-row:hover { background: var(--fill); }
.wait-row b { color: var(--bad); font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.wait-row .ico, .wait-chip .ico, .fu-row .ico, .today-alert .ico { width: 1rem; height: 1rem; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.note { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-2); box-shadow: inset 0 calc(-1 * var(--border-w)) 0 var(--line); font-size: var(--fs-body); }
.note:last-child { box-shadow: none; }
.note-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: transparent; }
.note.unread .note-dot { background: var(--forest); }
.note.unread .note-t { font-weight: 500; }
.card .note { padding-left: var(--space-4); padding-right: var(--space-4); }

/* ---------- main area ---------- */
.shell-main { min-width: 0; padding: var(--space-6) var(--space-6) var(--space-7); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); align-content: start; max-width: 104rem; }
.shell-main .tp-main { padding: 0; max-width: none; margin: 0; }
.shell-main .tp-left { top: var(--space-5); }
.sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); }
.sec-head .seg { justify-self: start; }
.shell-page.shell-main { max-width: 84rem; }
.h4 { margin: var(--space-2) 0 0; font-size: var(--fs-body); font-weight: 600; }

/* ---------- banners: offline, something broke, a new version ---------- */
.banners { display: grid; gap: var(--space-2); padding: var(--space-4) var(--space-6) 0; max-width: 104rem; }
.banners[hidden] { display: none; }
.banner { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--card-shadow); font-size: var(--fs-body); }
.banner > .ico { width: 1.5rem; height: 1.5rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.banner-t { flex: 1; min-width: 0; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.warn .banner-t { color: var(--ink); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.bad .banner-t { color: var(--ink); }
.banner.info { color: var(--forest-text); }
.banner.info .banner-t { color: var(--ink); }
.banner .x { flex: none; width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); font-size: 1.375rem; }
.banner .x:hover { background: var(--fill); }
.help-link { color: var(--forest-text); font-weight: 500; white-space: nowrap; }
.banner .help-link { flex: none; }

/* ---------- sign in and the lock screen ---------- */
.app .signin-box { max-width: 27rem; padding: var(--space-6) var(--space-6) var(--space-5); gap: var(--space-4); text-align: left; justify-items: stretch; }
.app .signin-box > div { display: grid; gap: var(--space-1); }
.app .signin-box .tp-logo { justify-self: center; height: 3.5rem; }
.app .signin-box > div { text-align: center; }
.signin-box .forgot { justify-self: center; }
.ok-note { margin: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--ok-bg); color: var(--ink); font-size: var(--fs-fine); }
.ok-note[hidden] { display: none; }
.demo-accts summary { cursor: pointer; color: var(--forest-text); font-size: var(--fs-fine); font-weight: 500; min-height: 2.5rem; display: flex; align-items: center; justify-content: center; }
.demo-accts[open] { display: grid; gap: var(--space-2); }
.demo-list { display: grid; border-radius: var(--radius-md); background: var(--fill-2); overflow: hidden; }
.demo-acct { display: grid; text-align: left; gap: 0.0625rem; min-height: 2.75rem; padding: var(--space-2) var(--space-3); border: 0; background: transparent; box-shadow: inset 0 calc(-1 * var(--border-w)) 0 var(--line); }
.demo-acct:hover { background: var(--fill); }

/* Locked: nothing behind it shows, not even under the frosted glass (#4) */
body.locked #app, body.locked #dialog, body.locked #toast, body.locked #print-root, body.locked #bell-holder { visibility: hidden; }
dialog.lock { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: calc(var(--space-5) + env(safe-area-inset-top, 0rem)) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom, 0rem)); overflow-y: auto; border: 0; border-radius: 0; box-shadow: none; background: var(--page-bg); color: var(--ink); }
dialog.lock[open] { display: grid; place-items: center; }
dialog.lock::backdrop { background: var(--page-bg); }
.lock-box { width: min(26rem, 100%); padding: var(--space-6); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--card-shadow); justify-items: stretch; text-align: center; }
.lock-box .field { text-align: left; }
.lock-logo { justify-self: center; height: 2.75rem; width: auto; }
.lock-box .avatar-lg { justify-self: center; display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 50%; background: var(--avatar); color: var(--avatar-ink, var(--on-primary)); font-size: 1.25rem; font-weight: 600; letter-spacing: 0.02em; }
.lock-who { display: grid; gap: var(--space-1); }
.lock-who .sub { font-size: var(--fs-body); }

/* ---------- today: two calm rows ---------- */
.today-head .title { margin-bottom: var(--space-1); }
.today-head > div { display: grid; gap: var(--space-1); }
.calm { margin: 0; }
.waiting { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.wait-chip { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; padding: 0 0.875rem 0 1rem; border: 0; border-radius: var(--radius-pill); background: var(--surface); box-shadow: var(--card-shadow); color: var(--ink); font-size: var(--fs-body); font-weight: 500; }
.wait-chip b { color: var(--bad); font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.wait-chip:hover { background: var(--fill-2); }
.today-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--space-4); align-items: stretch; }
.today-row.week-first { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.today-stack { display: grid; gap: var(--space-4); align-content: start; }
.today-row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space-4); align-items: stretch; }
.today-card { padding: var(--space-4) var(--space-5) var(--space-5); display: grid; gap: var(--space-3); align-content: start; grid-template-rows: auto; }
.today-card > .btn-row { margin-top: auto; align-self: end; }
.today-card .btn { justify-self: start; }
.today-card .h3 { display: flex; align-items: center; gap: var(--space-2); }
.today-card .h3 .ico { width: 1.25rem; height: 1.25rem; fill: none; stroke: var(--forest-text); stroke-width: 1.8; stroke-linecap: round; }
.today-n { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; color: var(--ink-2); font-variant-numeric: tabular-nums; line-height: 1; }
.today-n.hot { color: var(--bad); }
.today-card .fine { margin: 0; }
.fu-list, .to-list, .today-list { margin: 0; padding: 0; list-style: none; display: grid; }
.fu-list li + li, .to-list li + li { box-shadow: inset 0 var(--border-w) 0 var(--line); }
.fu-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-3); width: 100%; min-height: 3.25rem; padding: var(--space-2) var(--space-2); margin: 0 calc(-1 * var(--space-2)); width: calc(100% + 2 * var(--space-2)); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); text-align: left; font-size: var(--fs-body); }
.fu-row:hover { background: var(--fill-2); }
.fu-who { display: grid; min-width: 0; }
.fu-who > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.to-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 2.75rem; }
.today-alert { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); width: 100%; min-height: 2.75rem; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--ink); font-weight: 500; font-size: var(--fs-body); text-align: left; text-decoration: none; }
.today-alert:hover { background: var(--fill); }
.whats-new { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-5) var(--space-4); box-shadow: var(--card-shadow), inset 0.25rem 0 0 var(--forest); }
.whats-new .h3 { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-body); }
.whats-new .h3 .ico { width: 1.25rem; height: 1.25rem; fill: none; stroke: var(--forest-text); stroke-width: 1.8; stroke-linecap: round; }
.new-list { margin: 0; padding-left: 1.25rem; display: grid; gap: var(--space-1); color: var(--ink-2); font-size: var(--fs-fine); }
.whats-new .new-list { display: block; columns: 2 22rem; column-gap: var(--space-6); }
.whats-new .new-list li { break-inside: avoid; margin-bottom: var(--space-1); }

/* this week, one line (Gennaro: assistants and hygienists just need a strip of their week) */
.week-card { container-type: inline-size; }
.week-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.5rem; }
.wk-short { display: none; }
/* too narrow for "South Windsor": the Schedule's short labels (Riv, Ouel, SW) */
@container (max-width: 30rem) { .wk-long { display: none; } .wk-short { display: inline; } }
.wk { display: grid; gap: 0.1875rem; align-content: start; min-height: 5.25rem; padding: 0.625rem 0.5rem 0.75rem; border-radius: var(--radius-sm); background: var(--fill-2); border-top: 0.1875rem solid var(--line-strong); min-width: 0; color: var(--ink); text-decoration: none; }
a.wk:hover { filter: brightness(0.97); }
.wk[class*=" c"] { background: var(--cb); border-top-color: var(--cc); }
.wk.c1 { --cc: var(--c1); --cb: var(--c1-bg); }
.wk.c2 { --cc: var(--c2); --cb: var(--c2-bg); }
.wk.c3 { --cc: var(--c3); --cb: var(--c3-bg); }
.wk.off { background: var(--c4-bg); border-top-color: var(--c4); }
.wk.today { box-shadow: 0 0 0 0.125rem var(--forest) inset; }
.wk-skel { opacity: 0.6; }
.wk-d { font-size: var(--fs-fine); font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
.wk-d b { color: var(--ink); font-weight: 600; letter-spacing: 0; }
.wk-o { font-size: var(--fs-body); font-weight: 500; line-height: 1.25; }
.wk-t { font-size: var(--fs-fine); color: var(--ink-2); line-height: 1.3; }
/* one column on tablets and phones; .week-first too (it used to win on specificity, #11) */
@media (max-width: 75em) { .today-row, .today-row.week-first { grid-template-columns: minmax(0, 1fr); } }

/* ---------- settings ---------- */
.steps-list { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.25rem; color: var(--ink-2); font-size: var(--fs-fine); }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2); }
.copy-row .input { font-size: var(--fs-fine); font-family: ui-monospace, Menlo, monospace; }
.file-btn { justify-self: start; cursor: pointer; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: var(--space-4); align-items: start; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2) var(--space-4); }
.set-list { display: grid; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 3rem; padding: var(--space-3) var(--space-5); box-shadow: inset 0 calc(-1 * var(--border-w)) 0 var(--line); cursor: pointer; }
.toggle-row.inline { padding-left: 0; padding-right: 0; }
.toggle-row:last-child { box-shadow: none; }
.toggle-row > span { display: grid; gap: 0.125rem; }
.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 3rem; height: 1.75rem; margin: 0; border-radius: var(--radius-pill); background: var(--fill-hover); cursor: pointer; box-shadow: inset 0 0 0 var(--border-w) var(--line-strong); }
.switch::after { content: ""; position: absolute; top: 0.125rem; left: 0.125rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--surface); box-shadow: var(--seg-shadow); }
.switch:checked { background: var(--ok); box-shadow: none; }
.switch:checked::after { left: 1.375rem; }
.switch:disabled { opacity: 0.5; cursor: default; }
@media (prefers-reduced-motion: no-preference) { .switch, .switch::after { transition: all 0.2s ease; } }
.app tr.off td { opacity: 0.6; }
.app td .input.sm { width: auto; min-width: 13.5rem; min-height: 2.5rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.warn-t { color: var(--warn); }
.app .tag { display: inline-block; padding: 0.1875rem 0.625rem; border-radius: var(--radius-pill); background: var(--fill); color: var(--ink-2); font-size: var(--fs-fine); font-weight: 600; white-space: nowrap; }
.app .tag.ok { background: var(--ok-bg); color: var(--ok-ink, var(--ok)); }
.app .tag.warn { background: var(--warn-bg); color: var(--warn-ink, var(--warn)); }
.pw-once { margin: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--fill-2); font-family: ui-monospace, Menlo, monospace; font-size: 1.375rem; letter-spacing: 0.04em; text-align: center; user-select: all; }
.help-card p { margin: 0; }

/* ---------- toast with Undo ---------- */
.app .toast { display: flex; align-items: center; gap: var(--space-3); font-size: var(--fs-body); }
.app .toast[hidden] { display: none; }
/* above whatever sits at the bottom (#15): the treatment plan's total bar (--bottom-ui, set by
 * js/tp.js while it shows), the phone's tab bar (--tabbar-h) and the iPhone's home bar */
.app .toast { bottom: calc(var(--bottom-ui, 0rem) + var(--tabbar-h, 0rem) + env(safe-area-inset-bottom, 0rem) + var(--space-5)); }
.app:has(#tp-bar) .toast { bottom: calc(max(var(--bottom-ui, 0rem), 4.5rem) + var(--tabbar-h, 0rem) + env(safe-area-inset-bottom, 0rem) + var(--space-5)); }
.toast-undo { min-height: 2.25rem; padding: 0 0.875rem; border: 0; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.18); color: var(--on-primary); font-weight: 600; font-size: var(--fs-fine); }


/* ---------- while the app is in the background: only the logo (#2) ---------- */
.cover { position: fixed; inset: 0; z-index: 2147483000; display: grid; place-items: center; background: var(--page-bg); }
.cover[hidden] { display: none; }
.cover img { width: min(16rem, 60vw); height: auto; }
body.covered #app, body.covered #dialog, body.covered #toast, body.covered #bell-holder, body.covered #menu-holder, body.covered #print-root { visibility: hidden; }

/* ---------- first paint, before the scripts have arrived (#46) ---------- */
.signin.boot .boot-box { justify-items: center; text-align: center; }
.signin.boot .sub { margin: 0; color: var(--ink-2); }
.signin-banners { width: min(27rem, 100%); padding: 0; margin: 0 auto var(--space-3); }
.sec-wait .sub { margin: 0; color: var(--ink-2); }

/* ---------- skip to content (#50) ---------- */
.skip-link { position: absolute; z-index: 100; left: var(--space-3); top: -5rem; display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 var(--space-4); border-radius: var(--radius-sm); background: var(--surface); color: var(--forest-text); font-weight: 600; box-shadow: var(--sheet-shadow); text-decoration: none; }
.skip-link:focus { top: calc(var(--space-3) + env(safe-area-inset-top, 0rem)); }
.shell-main:focus { outline: none; }

/* ---------- the account menu and More ---------- */
.acct-btn { flex: none; width: 2.75rem; height: 2.75rem; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.acct-btn:hover { background: var(--fill); }
.acct-btn .avatar-sm { width: 2.125rem; height: 2.125rem; }
.menu-panel { position: fixed; z-index: 45; display: grid; gap: 0.125rem; width: min(18rem, calc(100vw - 1rem)); padding: var(--space-2); box-shadow: var(--sheet-shadow); }
.menu-who { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3) var(--space-3); box-shadow: inset 0 calc(-1 * var(--border-w)) 0 var(--line); margin-bottom: var(--space-1); }
.menu-who > span:last-child { display: grid; min-width: 0; line-height: 1.3; }
.menu-who .strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* its rows are .menu-item, in components.css */
.set-built { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-2) 0 0; color: var(--ink-3); font-size: 0.75rem; }
.set-built img { height: 0.75rem; }
.shell[data-layout="full"] .set-built { display: none; }
/* Today: plan work on this device that hasn't reached the server, or was removed (#4) */
.today-unsent-wrap { display: grid; gap: var(--space-2); }
.today-unsent { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--warn-bg); color: var(--ink); font-size: var(--fs-fine); line-height: 1.45; }
.today-unsent .ico { width: 1.375rem; height: 1.375rem; flex: none; fill: none; stroke: var(--warn); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.today-unsent.bad { background: var(--bad-bg); }
.today-unsent.bad .ico { stroke: var(--bad); }
.today-unsent span { flex: 1 1 14rem; min-width: 0; }
.today-unsent .btn { flex: none; margin-left: auto; }
@media (max-width: 40em) { .today-unsent { flex-wrap: wrap; } }
.install-hint { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-5) var(--space-4); box-shadow: var(--card-shadow), inset 0.25rem 0 0 var(--forest); }
.install-hint .h3 { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-body); }
.install-hint .h3 .ico, .steps-list .ico { width: 1.125rem; height: 1.125rem; fill: none; stroke: var(--forest-text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.1875rem; }
.install-hint .fine { margin: 0; }

/* ---------- tablets, 40–60em: an icon rail instead of the sidebar ---------- */
.shell[data-layout="rail"] { grid-template-columns: 4.75rem minmax(0, 1fr); }
.shell[data-layout="rail"] .sidebar { align-items: center; padding: calc(var(--space-3) + env(safe-area-inset-top, 0rem)) var(--space-2) calc(var(--space-3) + env(safe-area-inset-bottom, 0rem)); gap: var(--space-3); }
.shell[data-layout="rail"] .side-top { flex-direction: column; padding: 0; gap: var(--space-2); }
.shell[data-layout="rail"] .brand-t { display: none; }
.shell[data-layout="rail"] .side-nav { width: 100%; }
.shell[data-layout="rail"] .nav-item { position: relative; justify-content: center; padding: 0; min-height: 3rem; }
.shell[data-layout="rail"] .nav-item span:first-of-type { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.shell[data-layout="rail"] .nav-badge { position: absolute; top: 0.125rem; right: 0.125rem; min-width: 1.25rem; height: 1.25rem; padding: 0 0.3125rem; font-size: 0.75rem; }
.shell[data-layout="rail"] .side-foot { width: 100%; justify-items: center; }
.shell[data-layout="rail"] .side-me { padding: var(--space-2) 0 0; grid-template-columns: auto; }
.shell[data-layout="rail"] ~ #bell-holder .bell-panel { left: 5.5rem; }
.shell[data-layout="rail"] ~ #menu-holder .acct-menu { left: 5.5rem; bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0rem)); }
.shell[data-layout="rail"] .shell-main { padding: var(--space-5) var(--space-5) var(--space-7); }
.shell[data-layout="rail"] .banners { padding: var(--space-4) var(--space-5) 0; }

/* ---------- phones, under 40em: a top bar and a tab bar (#8, #9, #13) ---------- */
.has-tabbar { --tabbar-h: 3.5rem; }
.shell[data-layout="phone"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
.shell[data-layout="phone"] .sidebar { z-index: 30; height: auto; flex-direction: row; align-items: center; gap: 0; padding: calc(0.375rem + env(safe-area-inset-top, 0rem)) max(var(--space-3), env(safe-area-inset-right, 0rem)) 0.375rem max(var(--space-3), env(safe-area-inset-left, 0rem)); overflow: visible; box-shadow: inset 0 calc(-1 * var(--border-w)) 0 var(--line); }
.shell[data-layout="phone"] .side-top { flex: 1; min-width: 0; padding: 0; }
.shell[data-layout="phone"] .brand { gap: var(--space-2); min-height: 2.75rem; }
.shell[data-layout="phone"] .brand-mark { width: 2.125rem; height: 2.125rem; }
.shell[data-layout="phone"] .brand-name { font-size: 1rem; }
.shell[data-layout="phone"] .brand-sub { font-size: 0.625rem; letter-spacing: 0.12em; }
.mbar-acts { display: flex; align-items: center; gap: var(--space-1); flex: none; }
.shell[data-layout="phone"] .shell-main { padding: var(--space-4) max(var(--space-4), env(safe-area-inset-right, 0rem)) calc(var(--tabbar-h, 0rem) + env(safe-area-inset-bottom, 0rem) + var(--space-6)) max(var(--space-4), env(safe-area-inset-left, 0rem)); gap: var(--space-4); }
.shell[data-layout="phone"] .banners { padding: var(--space-3) var(--space-4) 0; }
.shell[data-layout="phone"] ~ #bell-holder .bell-panel { top: calc(3.75rem + env(safe-area-inset-top, 0rem)); left: var(--space-2); right: var(--space-2); width: auto; max-height: calc(100vh - 4.5rem - var(--tabbar-h, 0rem) - env(safe-area-inset-bottom, 0rem) - env(safe-area-inset-top, 0rem)); max-height: calc(100dvh - 4.5rem - var(--tabbar-h, 0rem) - env(safe-area-inset-bottom, 0rem) - env(safe-area-inset-top, 0rem)); }
.shell[data-layout="phone"] ~ #menu-holder .acct-menu { top: calc(3.75rem + env(safe-area-inset-top, 0rem)); right: var(--space-2); }
.shell[data-layout="phone"] ~ #menu-holder .more-menu { right: var(--space-2); bottom: calc(var(--tabbar-h, 0rem) + env(safe-area-inset-bottom, 0rem) + var(--space-2)); }
.shell[data-layout="phone"] .page-head .title, .shell[data-layout="phone"] .sec-head .title { font-size: 1.625rem; }
.shell[data-layout="phone"] .today-card { padding: var(--space-4); }
.shell[data-layout="phone"] .whats-new .new-list { columns: 1; }
.shell[data-layout="phone"] .set-grid { grid-template-columns: minmax(0, 1fr); }
.shell[data-layout="phone"] .kv { grid-template-columns: minmax(0, 1fr); gap: 0 var(--space-3); }
.shell[data-layout="phone"] .kv > .fine { margin-top: var(--space-2); }
.shell[data-layout="phone"] .toggle-row { padding: var(--space-3) var(--space-4); }
.shell[data-layout="phone"] .copy-row { grid-template-columns: minmax(0, 1fr); }

.mtabs { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: stretch; height: calc(var(--tabbar-h, 3.5rem) + env(safe-area-inset-bottom, 0rem)); padding: 0 env(safe-area-inset-right, 0rem) env(safe-area-inset-bottom, 0rem) env(safe-area-inset-left, 0rem); background: var(--material); -webkit-backdrop-filter: saturate(180%) blur(1.25rem); backdrop-filter: saturate(180%) blur(1.25rem); box-shadow: inset 0 var(--border-w) 0 var(--line); }
.mtab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.125rem; min-width: 0; min-height: 2.75rem; padding: 0.25rem 0.125rem; border: 0; background: transparent; color: var(--ink-2); font-size: 0.75rem; font-weight: 500; line-height: 1.1; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.mtab .ico { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mtab .ico circle { fill: currentColor; }
.mtabs [data-sh="more"] .ico circle { stroke: none; }
.mtab-l { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtab[aria-current="page"] { color: var(--forest-text); }
.mtab[aria-current="page"] .ico { stroke-width: 2.1; }
.mtab-badge { position: absolute; top: 0.25rem; left: calc(50% + 0.375rem); min-width: 1.125rem; height: 1.125rem; padding: 0 0.25rem; display: grid; place-items: center; border-radius: var(--radius-pill); background: var(--bad); color: var(--on-primary); font-size: 0.6875rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.mtab:focus-visible { outline: 0.125rem solid var(--focus); outline-offset: -0.25rem; border-radius: var(--radius-sm); }

/* ---------- touch screens: bigger targets on what the shell draws (#50) ---------- */
@media (pointer: coarse) {
  .sidebar .btn.sm, .shell-page .btn.sm, .bell-panel .btn.sm, .banner .btn.sm, .lock .btn.sm, .shell-page .btn, .shell-page .seg button, .bell-panel .btn, .banner .btn { min-height: 2.75rem; }
  .banner .x { width: 2.75rem; height: 2.75rem; }
  .toast-undo { min-height: 2.75rem; }
  .demo-accts summary { min-height: 2.75rem; }
  .app td .input.sm { min-height: 2.75rem; }
  .note .btn.sm { min-width: 2.75rem; }
}

/* People on a phone: each person is a small card (name, role and office side by side, then the buttons) */
.shell:not([data-layout="full"]) .people-table, .shell:not([data-layout="full"]) .people-table tbody { display: block; width: 100%; }
.shell:not([data-layout="full"]) .people-table thead { display: none; }
.shell:not([data-layout="full"]) .people-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2); padding: var(--space-3) var(--space-4); box-shadow: inset 0 calc(-1 * var(--border-w)) 0 var(--line); }
.shell:not([data-layout="full"]) .people-table td { display: block; min-width: 0; padding: 0; border: 0; background: none; }
.shell:not([data-layout="full"]) .people-table td:first-child, .shell:not([data-layout="full"]) .people-table td:nth-child(4), .shell:not([data-layout="full"]) .people-table td:last-child { grid-column: 1 / -1; }
.shell:not([data-layout="full"]) .people-table td:first-child .fine { display: block; margin: 0; overflow-wrap: anywhere; }
.shell:not([data-layout="full"]) .people-table td .input.sm { width: 100%; min-width: 0; }

/* the on-screen keyboard is up (js/shell.js): no tab bar, so the field gets the room */
.has-tabbar.kb-up { --tabbar-h: 0rem; }
.kb-up .mtabs { display: none; }
/* chat fills the screen down to the tab bar */
.shell[data-layout="phone"] .shell-main.sec-chat { padding-bottom: calc(var(--tabbar-h, 0rem) + env(safe-area-inset-bottom, 0rem) + var(--space-2)); }
