/* Kasbo Inbox components (DESIGN-SYSTEM section 9). Owner: A. Mobile first, min-width queries only.
   Markup for each component comes from src/web/ui.ts; see docs/design/COMPONENTS.md. */

/* ---------- 9.1 app shell (WHATSAPP-FEEL-SPEC 4) ----------
   Phones: white top bar with the Kasbo Inbox wordmark, search and menu; 4 bottom tabs. Desktop (900+): 64px nav rail on the
   left, content next to it; page({ split }) adds the list pane + detail pane. Flat panes divided by 1px --pane-line. */
.app main { display: block; padding: var(--s-2) var(--gutter) calc(var(--tabs-h) + var(--safe-b) + var(--s-6)); max-width: calc(var(--content-max) + 2 * var(--gutter)); }
.app.detail main { padding-bottom: calc(var(--safe-b) + var(--s-8)); }
.app.has-actions main { padding-bottom: calc(76px + var(--safe-b) + var(--s-6)); }
.app.has-sub { --top-h: 76px; } /* top bar with the business name line (Chats); sticky offsets below it follow */
.topbar, .backbar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--s-2); min-height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) var(--s-2) 0 var(--gutter); background: var(--bg); border-bottom: 1px solid transparent; transition: border-color var(--dur-2) var(--ease-out); }
.topbar.is-stuck, .backbar.is-stuck { border-bottom-color: var(--pane-line); }
.backbar { padding-left: var(--gutter); }
.wordmark { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap-min); color: var(--brand) !important; text-decoration: none !important; }
.wordmark .logo { width: 28px; height: 28px; border-radius: var(--r-sm); flex: none; }
.topbar .wordmark .logo { view-transition-name: logo; }
.wordmark .wm { font: var(--t-brand); letter-spacing: -0.01em; white-space: nowrap; }
.top-sub { flex: 0 0 100%; margin: -6px 0 0 38px; padding-bottom: var(--s-2); font: 500 13px/18px var(--font-body); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backbar a.back { display: inline-flex; align-items: center; gap: 2px; min-height: var(--tap-min); margin-left: -10px; padding: 0 10px 0 4px; border-radius: var(--r-sm); font: var(--t-label); color: var(--ink); text-decoration: none; }
.backbar a.back:active { background: var(--surface-3); }
.backbar .spacer { flex: 1; }
.top-actions { display: flex; gap: 0; color: var(--ink-2); }
.top-actions .iconbtn.bare { color: var(--ink-2) !important; border-radius: 50%; }
.top-actions .iconbtn.bare:hover { background: var(--surface-2); }

/* selection bar (long-press multi-select): replaces the top bar while chats are selected. RD.selection.show(n) / hide() */
.selbar { position: fixed; z-index: 35; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: var(--s-1); min-height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) var(--s-2) 0; background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--pane-line); box-shadow: var(--e-menu); animation: fade-in var(--dur-2) var(--ease-out); }
.selbar .selbar-n { white-space: nowrap; font: var(--t-pane); font-variant-numeric: tabular-nums; }
.selbar .spacer { flex: 1; }
.selbar .iconbtn { color: var(--ink) !important; border-radius: 50%; }
.selbar .iconbtn:hover { background: var(--surface-2); }
/* 390: count + 6 round buttons only fit without the word "selected" (kept for screen readers) and with tighter gaps */
@media (max-width: 419px) { .selbar { gap: 0; padding-left: var(--s-1); padding-right: var(--s-1); } .selbar .selbar-w { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
body.selecting .topbar { visibility: hidden; }

/* bottom tabs: 4 items, icon in a pill when active */
.tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: grid; grid-template-columns: repeat(4, 1fr); background: var(--bg); border-top: 1px solid var(--pane-line); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; color: var(--ink-2); font: 600 12px/16px var(--font-body); text-decoration: none !important; -webkit-user-select: none; user-select: none; }
.tab .tab-ic { position: relative; display: grid; place-items: center; width: 56px; height: 32px; border-radius: var(--r-pill); transition: background-color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out); }
.tab:active .tab-ic { transform: scale(.92); }
.tab .tab-l { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tab[aria-current="page"] .tab-ic { background: var(--brand-tint); color: var(--brand-strong); }
.badge { position: absolute; top: -5px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--badge); color: var(--on-badge); font: 700 12px/18px var(--font-body); text-align: center; box-shadow: 0 0 0 2px var(--bg); font-variant-numeric: tabular-nums; animation: pop var(--dur-4) var(--ease-spring) both; }
.badge:empty { display: none; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* desktop nav rail */
.rail, .pane-head { display: none; }
@media (min-width: 900px) {
  .tabbar, .topbar, .backbar { display: none; }
  .selbar { left: var(--rail-w); right: auto; width: var(--list-w); min-height: 60px; padding-top: 0; }
  .app main, .app.detail main, .app.has-actions main { margin-left: var(--rail-w); padding: var(--s-6) var(--gutter) var(--s-12); }
  .app.has-actions main { padding-bottom: calc(96px + var(--s-6)); }
  .rail { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: var(--rail-w); display: flex; flex-direction: column; align-items: center; gap: var(--s-2); padding: var(--s-3) 0; background: var(--rail); border-right: 1px solid var(--pane-line); }
  .desk-back { display: inline-flex !important; }
}
.rail-brand { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: var(--s-2); border-radius: var(--r-md); }
.rail-brand img { width: 40px; height: 40px; border-radius: 10px; view-transition-name: logo; }
.rail-nav, .rail-foot { display: flex; flex-direction: column; align-items: center; gap: var(--s-1); }
.rail-foot { margin-top: auto; }
.rail-i { position: relative; display: grid; place-items: center; width: 48px; height: 48px; color: var(--ink-2) !important; text-decoration: none !important; }
.rail-ic { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; transition: background-color var(--dur-2) var(--ease-out); }
.rail-i:hover .rail-ic { background: var(--surface-3); }
.rail-i[aria-current="page"] { color: var(--brand-strong) !important; }
.rail-i[aria-current="page"] .rail-ic { background: var(--brand-tint); }
.rail-ic .badge { top: 0; right: -2px; box-shadow: 0 0 0 2px var(--rail); }
.rail-tip { position: absolute; z-index: 40; left: calc(100% + 4px); top: 50%; transform: translate(-4px, -50%); padding: 4px 10px; border-radius: var(--r-sm); background: var(--brand-ink); color: var(--on-ink); font: var(--t-chip); white-space: nowrap; box-shadow: var(--e-menu); opacity: 0; pointer-events: none; transition: opacity var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out); }
.rail-i:hover .rail-tip, .rail-i:focus-visible .rail-tip { opacity: 1; transform: translate(0, -50%); transition-delay: 300ms; }
.rail-me { display: grid; place-items: center; width: 48px; height: 48px; margin-top: var(--s-1); padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.rail-me:hover .av { box-shadow: 0 0 0 3px var(--surface-3); }

/* list-detail split (page({ split })): #listpane + #detail. Phones show one pane: detail when a chat is open, else the list. */
.split-view main.panes { padding: 0; max-width: none; }
.listpane { padding: 0 var(--gutter) calc(var(--tabs-h) + var(--safe-b) + var(--s-6)); }
.split-view.detail .listpane { padding-bottom: var(--s-8); }
.detailpane { min-width: 0; }
.split-view.has-sel .listpane, .split-view:not(.has-sel) .detailpane { display: none; }
.split-view.detail .detailpane { padding: 0 var(--gutter) calc(var(--safe-b) + var(--s-8)); }
.split-view.has-actions .detailpane { padding-bottom: calc(76px + var(--safe-b) + var(--s-6)); }
.pane-head { align-items: center; gap: var(--s-2); position: sticky; top: 0; z-index: 12; min-height: 60px; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--s-2) 0 var(--gutter); background: var(--bg); }
.detail-empty { display: grid; place-content: center; justify-items: center; gap: var(--s-2); min-height: 100%; padding: var(--s-8); text-align: center; color: var(--muted); }
.detail-empty img { width: 56px; height: 56px; border-radius: 14px; margin-bottom: var(--s-2); }
.detail-empty h2 { font: var(--t-pane); color: var(--ink); }
.detail-empty p { margin: 0; font: var(--t-small); }
.detailpane.pane-in > * { animation: fade-in 120ms var(--ease-out); }
@media (min-width: 900px) {
  body.split-view { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
  .split-view .banners { flex: none; }
  .split-view main.panes, .split-view.detail main.panes, .split-view.has-actions main.panes { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--list-w) minmax(480px, 1fr); margin-left: var(--rail-w); padding: 0; }
  .split-view .listpane, .split-view.has-sel .listpane { display: block; --gutter: 16px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--gutter) var(--s-8); background: var(--bg); border-right: 1px solid var(--pane-line); }
  .split-view .pane-head { display: flex; }
  .split-view .detailpane, .split-view:not(.has-sel) .detailpane, .split-view.detail .detailpane, .split-view.has-actions .detailpane { display: block; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0; background: var(--canvas); }
  .split-view.has-actions .detailpane { padding-bottom: 76px; }
  .split-view:not(.has-sel) .detailpane { background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1.5px); background-size: 20px 20px; }
  .split-view .desk-back { display: none !important; }
  .split-view .actionbar { left: calc(var(--rail-w) + var(--list-w)); }
  .app.split-view .toasts { left: calc(var(--rail-w) + var(--list-w) + var(--s-4)); }
}
@media (min-width: 1440px) {
  .split-view.drawer-open main.panes { padding-right: var(--drawer-w); }
  .split-view.drawer-open .actionbar { right: var(--drawer-w); }
}

/* top-bar menu sheet (#menu-sheet) */
.menu-me { display: flex; align-items: center; gap: var(--s-3); min-height: 72px; margin: 0 calc(-1 * var(--s-4)); padding: var(--s-2) var(--s-4); color: var(--ink) !important; text-decoration: none !important; border-bottom: 1px solid var(--pane-line); }
.menu-me:hover { background: var(--surface-2); }
.menu-me > .ic { color: var(--faint); }
.menu-list { margin: var(--s-2) calc(-1 * var(--s-4)) 0; }
.menu-list.menu-page { padding-bottom: var(--s-2); border-bottom: 1px solid var(--pane-line); }
.menu-list button.row { width: 100%; border: 0; background: transparent; text-align: left; font: inherit; cursor: pointer; }
.menu-list .row[aria-current="true"] .row-title { color: var(--brand-strong); }
.menu-list .row[aria-current="true"] .row-trail .ic { color: var(--brand-strong); }

.desk-back { display: none; align-items: center; gap: 4px; margin: 0 0 var(--s-2) -6px; min-height: var(--tap-min); padding: 0 8px 0 2px; border-radius: var(--r-sm); font: var(--t-label); color: var(--muted) !important; text-decoration: none !important; }
.desk-back:hover { background: var(--surface-2); }

/* page title block */
.page-head { margin: var(--s-2) 0 var(--s-4); }
.page-head h1 { overflow-wrap: anywhere; }
.page-head .hint { margin: var(--s-1) 0 0; }
.page-head .head-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
@media (min-width: 900px) {
  .page-head { display: flex; align-items: flex-end; gap: var(--s-4); margin: 0 0 var(--s-6); }
  .page-head > div:first-child { flex: 1; min-width: 0; }
  .page-head .head-actions { margin: 0; }
}

/* banners (one per page) */
.banners { padding: 0 var(--gutter); max-width: calc(var(--content-max) + 2 * var(--gutter)); }
.banner { display: flex; align-items: flex-start; gap: var(--s-3); margin: var(--s-2) 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); font: var(--t-small); background: var(--brand-wash); color: var(--ink); }
.banner > .ic { width: 20px; height: 20px; margin-top: 0; }
.banner .banner-t { flex: 1; min-width: 0; }
.banner a, .banner button.link { color: inherit !important; font-weight: 800; text-decoration: underline; white-space: nowrap; }
.banner button.link { border: 0; background: none; font: inherit; font-weight: 800; cursor: pointer; }
.banner.bad { background: var(--st-us-bg); color: var(--st-us-fg); }
.banner.warn { background: var(--st-due-bg); color: var(--st-due-fg); }
.banner.info { background: var(--brand-wash); color: var(--brand-strong); box-shadow: inset 0 0 0 1px var(--brand-ring); }
.banner.ok { background: var(--st-ok-bg); color: var(--st-ok-fg); }
@media (min-width: 900px) { .banners { margin-left: var(--rail-w); padding-top: var(--s-4); } .banners .banner { margin: 0; } }

/* sticky action bar (detail pages) */
.actionbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; gap: var(--s-2); padding: 10px var(--gutter) calc(10px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--e-2); }
.actionbar > * { flex: 1; }
.actionbar > .iconbtn { flex: none; }
@media (min-width: 900px) { .actionbar { left: var(--rail-w); padding: var(--s-3) var(--gutter); } .actionbar > * { flex: 0 0 auto; } }

/* ---------- 9.2 buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-5); border: 0; border-radius: var(--r-md); background: var(--brand); color: var(--on-brand) !important; font: var(--t-label); text-align: center; text-decoration: none !important; cursor: pointer; -webkit-user-select: none; user-select: none; position: relative; transition: transform var(--dur-1) var(--ease-out), filter var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out); }
.btn .ic { width: 22px; height: 22px; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn.big { min-height: 60px; width: 100%; border-radius: var(--r-md); font-size: 18px; }
.btn.block { width: 100%; }
.btn.sm { min-height: var(--tap-min); padding: 0 var(--s-4); font-size: 15px; }
.btn.ghost { background: var(--brand-wash); color: var(--brand-strong) !important; box-shadow: inset 0 0 0 1.5px var(--brand-ring); }
.btn.line { background: var(--surface); color: var(--ink) !important; box-shadow: inset 0 0 0 2px var(--line-2); }
.btn.quiet { background: transparent; color: var(--link) !important; min-height: var(--tap-min); padding: 0 var(--s-3); }
.btn.danger { background: var(--surface); color: var(--st-us-fg) !important; box-shadow: inset 0 0 0 2px var(--st-us-bg); }
.btn.amber { background: var(--amber); color: var(--on-amber) !important; }
/* the action on an ink band that is not the Today hero (landing end band): white, so amber stays the Today/savebar signature */
.btn.onink { background: var(--on-ink); color: var(--on-amber) !important; }
.btn.ghost:hover, .btn.line:hover, .btn.quiet:hover, .btn.danger:hover { filter: none; background: var(--brand-wash); }
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2.5px solid var(--on-brand); border-right-color: transparent; animation: spin 700ms linear infinite; }
.btn.ghost.is-busy::after, .btn.line.is-busy::after, .btn.quiet.is-busy::after, .btn.danger.is-busy::after { border-color: var(--brand); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.iconbtn { display: inline-grid; place-items: center; flex: none; width: var(--tap-min); height: var(--tap-min); padding: 0; border: 0; border-radius: var(--r-sm); background: var(--surface); color: var(--ink) !important; box-shadow: inset 0 0 0 1.5px var(--line-2); text-decoration: none !important; cursor: pointer; transition: transform var(--dur-1) var(--ease-out), background-color var(--dur-2); }
.iconbtn:active { transform: scale(.94); }
.iconbtn.bare { background: transparent; box-shadow: none; }
.btnrow { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.btnstack { display: grid; gap: var(--s-2); }

/* ---------- 9.3 status chip, 9.4 tag and AI label ---------- */
.chip-st { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font: var(--t-meta); white-space: nowrap; background: var(--st-quiet-bg); color: var(--st-quiet-fg); vertical-align: middle; }
.chip-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--st-quiet); flex: none; }
.chip-st.nodot::before { display: none; }
.chip-st .ic { width: 14px; height: 14px; }
.chip-st.st-us { background: var(--st-us-bg); color: var(--st-us-fg); } .chip-st.st-us::before { background: var(--st-us); }
.chip-st.st-due { background: var(--st-due-bg); color: var(--st-due-fg); } .chip-st.st-due::before { background: var(--st-due); }
.chip-st.st-them { background: var(--st-them-bg); color: var(--st-them-fg); } .chip-st.st-them::before { background: var(--st-them); }
.chip-st.st-cold { background: var(--st-cold-bg); color: var(--st-cold-fg); }
.chip-st.st-quiet, .chip-st.st-closed { background: var(--st-quiet-bg); color: var(--st-quiet-fg); }
.chip-st.st-ok { background: var(--st-ok-bg); color: var(--st-ok-fg); } .chip-st.st-ok::before { background: var(--st-ok); }
.tag { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 8px; border-radius: var(--r-xs); background: var(--surface-2); color: var(--ink-2); font: var(--t-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.ai { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-xs); background: var(--ai-bg); color: var(--ai-fg); font: 700 12px/16px var(--font-body); letter-spacing: .02em; vertical-align: middle; white-space: nowrap; }
.ai .ic { width: 14px; height: 14px; }

/* ---------- 9.5 filter chips and segmented control ---------- */
.chips { display: flex; gap: var(--s-2); overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter); scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter); -webkit-mask-image: linear-gradient(to right, black calc(100% - 56px), transparent calc(100% - 4px)); mask-image: linear-gradient(to right, black calc(100% - 56px), transparent calc(100% - 4px)); }
/* once scrolled to the end (sheet.js / app.js toggle .at-end) the last chip is not faded */
.chips.at-end { -webkit-mask-image: none; mask-image: none; }
.chips::-webkit-scrollbar { display: none; }
/* 32px visible (messenger size), 44px hit area from the ::before outset */
.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; flex: none; height: var(--chip-h); margin: 6px 0; padding: 0 var(--s-3); border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2) !important; box-shadow: none; font: var(--t-chip); white-space: nowrap; text-decoration: none !important; scroll-snap-align: start; transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2), box-shadow var(--dur-2); }
.chip::before { content: ""; position: absolute; inset: -6px 0; }
.chip:hover { background: var(--surface-3); }
.chip .n { font: var(--t-time); font-weight: 600; opacity: .85; font-variant-numeric: tabular-nums; }
.chip .cdot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--lb-fg); }
.chip:active { transform: scale(.97); }
.chip[aria-current="true"], .chip.on { background: var(--brand-tint); color: var(--brand-strong) !important; box-shadow: inset 0 0 0 1px var(--brand-ring); }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--surface-2); max-width: 100%; }
.seg > a, .seg > label { display: inline-flex; align-items: center; justify-content: center; flex: 1; min-height: var(--tap-min); padding: 0 var(--s-4); border-radius: var(--r-sm); color: var(--ink-2) !important; font: var(--t-label); text-decoration: none !important; cursor: pointer; white-space: nowrap; transition: background-color var(--dur-2), box-shadow var(--dur-2); }
.seg > a[aria-current="true"], .seg > a[aria-current="page"], .seg > label:has(input:checked) { background: var(--surface); color: var(--brand-strong) !important; box-shadow: var(--e-raise); }
.seg > label input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- 9.6 lists ---------- */
.group-head { display: flex; align-items: center; gap: var(--s-2); min-height: var(--tap-min); margin: var(--s-6) 0 var(--s-2); }
.group-head h2 { flex: 1; min-width: 0; font: var(--t-section); color: var(--ink-2); }
.group-head .btn.quiet { margin-right: calc(-1 * var(--s-3)); }
.group { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--e-1); overflow: hidden; }
.group > li { position: relative; }
.group > li + li::before { content: ""; position: absolute; z-index: 1; top: 0; left: 72px; right: 0; border-top: 1px solid var(--line); }
.group > li + li:has(> .row > .tile)::before, .group > li + li:has(> form > .row > .tile)::before { left: 52px; } /* rows with a 24px glyph */
/* flat list: full-bleed rows on the page background, no card, dividers inset after the avatar (spec 5.1) */
.group.flat { margin: 0 calc(-1 * var(--gutter)); background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.group.flat > li + li::before { left: var(--row-inset); border-top-color: var(--pane-line); }
.group.flat > li:has(> .chatrow:hover, > .chatrow[aria-current="true"], > .chatrow.is-sel)::before, .group.flat > li:has(> .chatrow:hover, > .chatrow[aria-current="true"], > .chatrow.is-sel) + li::before { border-top-color: transparent; }
.group.flat .row { padding-left: var(--gutter); padding-right: var(--gutter); }
/* desktop pages without the split (Today columns, Leads): rows line up with the column edge instead of bleeding into the gap */
@media (min-width: 900px) {
  .app:not(.split-view) .group.flat { --gutter: 8px; margin: 0 -8px; }
  .app:not(.split-view) .group.flat > li + li::before { left: calc(8px + var(--av-md) + var(--s-3)); right: 8px; }
  .app:not(.split-view) .group.flat .chatrow { border-radius: var(--r-sm); }
}
.group.flat > li + li:has(> .row > .tile)::before, .group.flat > li + li:has(> a > .row > .tile)::before { left: calc(var(--gutter) + 36px); }
.group > li.lazy { content-visibility: auto; contain-intrinsic-size: auto 76px; }
.group .empty { padding: var(--s-6) var(--s-4); }
.row { display: flex; align-items: center; gap: var(--s-3); min-height: 60px; padding: 10px var(--s-4); color: var(--ink) !important; text-decoration: none !important; transition: background-color var(--dur-2) var(--ease-out); }
a.row:hover { background: var(--brand-wash); }
a.row:active { background: var(--surface-3); transition-duration: var(--dur-1); }
/* row icon: a plain glyph in the text colour, no tinted square per row (anti-AI 28; Stripe settings rows) */
.row .tile { display: grid; place-items: center; width: 24px; height: 24px; flex: none; color: var(--ink-2); }
.row .tile .ic { width: 22px; height: 22px; }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; font: var(--t-label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { display: block; font: var(--t-small); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-trail { display: flex; align-items: center; gap: var(--s-1); flex: none; font: var(--t-meta); color: var(--muted); }
.row-trail .ic { width: 20px; height: 20px; color: var(--faint); }

.av { position: relative; display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--av-1); color: var(--av-1-fg); font: 700 16px/1 var(--font-body); letter-spacing: .01em; -webkit-user-select: none; user-select: none; }
.av.sm { width: var(--av-sm); height: var(--av-sm); font-size: 15px; }
.av.md { width: var(--av-md); height: var(--av-md); font-size: 17px; }
.av.lg { width: 56px; height: 56px; font-size: 20px; }
/* selected (multi-select): blue disc with a check drawn in CSS, initials hidden; scales in with the spring */
span.av.sel, .chatrow.is-sel .av { background: var(--brand); color: transparent; }
span.av.sel::after, .chatrow.is-sel .av::after { content: ""; position: absolute; left: 50%; top: 46%; width: 30%; height: 15%; border: solid var(--on-brand); border-width: 0 0 3px 3px; transform: translate(-50%, -50%) rotate(-45deg); animation: pop var(--dur-2) var(--ease-spring) both; }
.av.a2 { background: var(--av-2); color: var(--av-2-fg); } .av.a3 { background: var(--av-3); color: var(--av-3-fg); }
.av.a4 { background: var(--av-4); color: var(--av-4-fg); } .av.a5 { background: var(--av-5); color: var(--av-5-fg); }
.av.a6 { background: var(--av-6); color: var(--av-6-fg); }
.av .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--st-us); box-shadow: 0 0 0 2px var(--surface); }
.av .dot.due { background: var(--st-due); }

.chatrow { display: grid; grid-template-columns: var(--av-md) minmax(0, 1fr); column-gap: var(--s-3); align-content: center; min-height: var(--row-h); padding: var(--s-3) var(--gutter); color: var(--ink) !important; text-decoration: none !important; background: var(--bg); transition: background-color var(--dur-2) var(--ease-out); -webkit-touch-callout: none; }
.chatrow:hover { background: var(--surface-2); }
.chatrow:active { background: var(--surface-3); transition-duration: var(--dur-1); }
.chatrow[aria-current="true"] { background: var(--brand-tint); }
.chatrow.is-sel { background: var(--brand-tint); }
.chatrow .av { grid-row: 1 / span 3; align-self: start; }
.cr-top { display: flex; align-items: baseline; gap: var(--s-2); min-width: 0; }
.cr-top .name { flex: 1; min-width: 0; font: var(--t-row); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-top .time { flex: none; font: var(--t-time); color: var(--muted); font-variant-numeric: tabular-nums; }
.chatrow.is-us .name, .chatrow.is-due .name, .chatrow.unread .name { font-weight: 700; }
.chatrow.is-us .cr-top .time { color: var(--st-us-fg); font-weight: 700; }
.chatrow.is-due .cr-top .time { color: var(--st-due-fg); font-weight: 700; }
.cr-mid { display: flex; align-items: center; gap: var(--s-2); min-width: 0; margin-top: 2px; }
.cr-prev { flex: 1; min-width: 0; display: block; font: var(--t-preview); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatrow.is-us .cr-prev, .chatrow.is-due .cr-prev, .chatrow.unread .cr-prev { color: var(--ink-2); }
.cr-prev .ticks { margin-right: 3px; vertical-align: -2px; }
.cr-cold { flex: none; display: inline-grid; place-items: center; color: var(--st-cold-fg); }
.cr-cold .ic { width: 16px; height: 16px; }
.cr-unread { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.cr-foot { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 6px; }
.cr-foot:empty { display: none; }
.cr-foot .who { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 3px; font: var(--t-time); font-weight: 600; color: var(--muted); }
.cr-foot .who .ic { width: 14px; height: 14px; }
.cr-foot .chip-st { padding: 1px 8px; flex: none; }
.cr-foot .lbl-chip { flex: 0 0 auto; max-width: 60%; } /* the label keeps its name; the vehicle tag shrinks first */
.cr-foot .tag { flex: 0 1 auto; min-width: 0; }
.cr-foot .tag:not(:has(.ic)), .bc-foot .tag:not(:has(.ic)) { display: block; } /* text-overflow needs a block box */

/* wait badge (unread-count slot), stage label, ticks */
.wbadge { flex: none; display: inline-block; min-width: 22px; height: 20px; padding: 0 7px; border-radius: var(--r-pill); background: var(--wait-badge); color: var(--on-wait-badge); font: var(--t-badge); line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.wbadge.due { background: var(--due-badge); }
.lbl-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; height: 22px; padding: 0 8px 0 6px; border-radius: var(--r-sm); background: var(--lb-bg); color: var(--lb-fg); font: var(--t-time); font-weight: 600; white-space: nowrap; vertical-align: middle; }
.lbl-chip .ic { width: 14px; height: 14px; flex: none; fill: currentColor; stroke-width: 1.5; }
.lbl-chip .lbl-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lb-1 { --lb-bg: var(--lb-1); --lb-fg: var(--lb-1-fg); } .lb-2 { --lb-bg: var(--lb-2); --lb-fg: var(--lb-2-fg); }
.lb-3 { --lb-bg: var(--lb-3); --lb-fg: var(--lb-3-fg); } .lb-4 { --lb-bg: var(--lb-4); --lb-fg: var(--lb-4-fg); }
.lb-5 { --lb-bg: var(--lb-5); --lb-fg: var(--lb-5-fg); } .lb-6 { --lb-bg: var(--lb-6); --lb-fg: var(--lb-6-fg); }
.lb-ok { --lb-bg: var(--lb-ok); --lb-fg: var(--lb-ok-fg); } .lb-grey { --lb-bg: var(--lb-grey); --lb-fg: var(--lb-grey-fg); }
.ticks { display: inline-flex; flex: none; color: var(--bubble-meta); }
.ticks .ic { width: 16px; height: 16px; }
.ticks.read { color: var(--tick-read); }
.ticks.failed { color: var(--st-us-fg); }
.datehead { position: sticky; top: calc(var(--top-h) + var(--safe-t)); z-index: 5; margin: var(--s-4) 0 var(--s-2); padding: var(--s-1) 0; background: var(--bg); font: var(--t-section); color: var(--ink-2); }
@media (min-width: 900px) { .datehead { top: 0; } }

/* swipe actions (swipe.js) */
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--s-6); font: var(--t-label); color: var(--on-ink); pointer-events: none; }
.swipe-bg .sw { display: inline-flex; align-items: center; gap: var(--s-2); opacity: 0; transition: transform var(--dur-2) var(--ease-spring), opacity var(--dur-2); }
.swipe-bg.l { background: var(--brand); } .swipe-bg.r { background: var(--swipe-done); justify-content: flex-end; }
.swipe-bg.l .sw.l, .swipe-bg.r .sw.r { opacity: 1; }
.swipe-bg.armed .sw { transform: scale(1.15); }
li.swiping > .chatrow { position: relative; z-index: 2; touch-action: pan-y; }
li.gone { animation: row-out var(--dur-3) var(--ease-inout) forwards; }
@keyframes row-out { to { opacity: 0; transform: translateX(var(--out, -100%)); } }

/* ---------- 9.7 cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--e-1); padding: var(--pad); }
.card + .card, .card + .group-head, .group + .card { margin-top: var(--s-3); }
.card-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3); }
.card-head h2 { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-2); }
.card-head .btn.quiet { margin: -8px -12px -8px 0; }
.card.flush { padding: 0; overflow: hidden; }

.hero { position: relative; overflow: hidden; isolation: isolate; border-radius: var(--r-xl); padding: var(--s-5); background: linear-gradient(135deg, var(--hero-a), var(--hero-b) 60%, var(--hero-c)); color: var(--on-ink); box-shadow: var(--e-1); }
.hero::after { content: ""; position: absolute; z-index: -1; right: -60px; top: -70px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgb(255 255 255 / .16), transparent 70%); }
.hero .over { color: var(--on-ink-2); }
.hero .n { display: block; margin: var(--s-2) 0 var(--s-1); font: var(--t-huge); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero p { margin: 0; font: var(--t-small); color: var(--on-ink-2); }
.hero p b { color: var(--on-ink); }
.hero .btn { margin-top: var(--s-4); width: 100%; }
.hero.calm { background: var(--st-ok-bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.hero.calm::after { display: none; }
.hero.calm .over { color: var(--st-ok-fg); }
.hero.calm p { color: var(--ink-2); }
.hero .tick { display: grid; place-items: center; width: 56px; height: 56px; margin: var(--s-2) 0 var(--s-3); border-radius: 50%; background: var(--st-ok); color: var(--on-ink); animation: pop 400ms var(--ease-spring) both; }
.hero .tick .ic { width: 30px; height: 30px; }
.hero .h { display: block; margin-bottom: var(--s-1); font: var(--t-h1); }
@media (min-width: 900px) { .hero .btn { width: auto; min-width: 240px; } }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); margin-top: var(--s-3); }
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 14px var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--e-1); color: var(--ink) !important; text-decoration: none !important; transition: border-color var(--dur-2), transform var(--dur-1) var(--ease-out); }
a.kpi:hover { border-color: var(--brand-ring); }
a.kpi:active { transform: scale(.98); }
.kpi .over { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi .n { font: var(--t-big); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .sub { font: var(--t-meta); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi.us .n { color: var(--st-us-fg); } .kpi.due .n { color: var(--st-due-fg); } .kpi.cold .n { color: var(--st-cold-fg); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); } }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3) var(--s-4); margin: 0; }
.facts > div { min-width: 0; }
.facts dt { font: var(--t-meta); color: var(--muted); }
.facts dd { margin: 2px 0 0; font: 600 16px/22px var(--font-body); overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }

/* meter rows (who handled what) */
.meters { list-style: none; margin: 0; padding: 0; }
.meters li { display: grid; grid-template-columns: 36px minmax(0, 7rem) 1fr auto; align-items: center; gap: var(--s-3); min-height: 56px; padding: 6px var(--s-4); }
.meters li + li { border-top: 1px solid var(--line); }
.meters .who { font: var(--t-label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meters .meter-sub { display: block; font: var(--t-meta); color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.meters b { font: 800 17px/22px var(--font-display); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
progress.meter, progress.bar { -webkit-appearance: none; appearance: none; width: 100%; height: 7px; border: 0; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; color: var(--brand); }
progress.bar { height: 8px; }
progress.meter::-webkit-progress-bar, progress.bar::-webkit-progress-bar { background: var(--surface-2); border-radius: var(--r-pill); }
progress.meter::-webkit-progress-value, progress.bar::-webkit-progress-value { background: var(--brand); border-radius: var(--r-pill); transition: width var(--dur-3) var(--ease-out); }
progress.meter::-moz-progress-bar, progress.bar::-moz-progress-bar { background: var(--brand); border-radius: var(--r-pill); }
.progress { display: flex; align-items: center; gap: var(--s-3); font: var(--t-meta); color: var(--muted); }

/* ---------- 9.8 forms ---------- */
.field { margin: 0 0 var(--s-4); }
.lbl { display: block; margin-bottom: 6px; font: var(--t-label); color: var(--ink-2); }
.help { margin: 6px 0 0; font: var(--t-small); color: var(--muted); }
.err-text { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font: var(--t-small); color: var(--st-us-fg); }
.input, :where(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="range"], [type="file"], [type="submit"], [type="button"]), select, textarea) {
  display: block; width: 100%; min-height: var(--tap); padding: 12px 14px; border: 2px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 400 16px/22px var(--font-body); transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out); -webkit-appearance: none; appearance: none;
}
:where(textarea) { min-height: 96px; resize: vertical; }
select.input, :where(select) { padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.input:focus, :where(input, select, textarea):focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgb(91 53 232 / .18); outline: none; }
:where(input, select, textarea)::placeholder { color: var(--faint); }
:where(input, select, textarea):disabled { opacity: .6; cursor: not-allowed; }
.field.err .input, .field.err :where(input, select, textarea) { border-color: var(--st-us); }
:where(input[type="checkbox"]:not(.switch), input[type="radio"]) { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--brand); vertical-align: middle; }
.pw { position: relative; }
.pw .input, .pw input { padding-right: 56px; }
.pw .iconbtn { position: absolute; right: 4px; top: 4px; box-shadow: none; background: transparent; }
.switch { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 52px; height: 32px; margin: 0; border-radius: var(--r-pill); background: var(--line-2); cursor: pointer; transition: background-color var(--dur-2) var(--ease-out); }
.switch::before { content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--on-ink); box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform var(--dur-2) var(--ease-out); }
.switch:checked { background: var(--brand); }
.switch:checked::before { transform: translateX(20px); }
.switch:disabled { opacity: .5; cursor: not-allowed; }
.toggle-row { display: flex; align-items: center; gap: var(--s-3); min-height: 60px; padding: var(--s-2) var(--s-4); cursor: pointer; }
.toggle-row .tr-main { flex: 1; min-width: 0; }
.toggle-row .tr-main b { display: block; font: var(--t-label); }
.toggle-row .tr-main small { display: block; font: var(--t-small); color: var(--muted); }
.rcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: var(--s-2); }
.rcard { position: relative; display: block; cursor: pointer; }
.rcard input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.rcard .rc-body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 92px; padding: var(--s-3) var(--s-2); border-radius: var(--r-md); background: var(--surface); box-shadow: inset 0 0 0 2px var(--line-2); font: var(--t-label); text-align: center; color: var(--ink); transition: box-shadow var(--dur-2), background-color var(--dur-2); }
.rcard .rc-body .ic { width: 28px; height: 28px; color: var(--brand-strong); }
.rcard input:checked + .rc-body { background: var(--brand-wash); box-shadow: inset 0 0 0 2px var(--brand); color: var(--brand-strong); }
.rcard input:focus-visible + .rc-body { outline: 3px solid var(--focus); outline-offset: 2px; }
.savebar { position: sticky; z-index: 25; bottom: calc(var(--tabs-h) + var(--safe-b) + 8px); display: none; align-items: center; gap: var(--s-3); margin-top: var(--s-4); padding: 10px 10px 10px var(--s-4); border-radius: var(--r-md); background: var(--brand-ink); color: var(--on-ink); box-shadow: var(--e-3); font: var(--t-label); }
.savebar span { flex: 1; }
form.is-dirty .savebar { display: flex; animation: toast-in var(--dur-3) var(--ease-out); }
@media (min-width: 900px) { .savebar { bottom: var(--s-4); } }

/* ---------- 9.9 sheets and dialogs ---------- */
dialog.sheet { position: fixed; inset: auto 0 0 0; z-index: 70; width: 100%; max-width: 100%; max-height: 92dvh; margin: 0; padding: var(--s-2) var(--s-4) calc(var(--s-4) + var(--safe-b)); border: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--surface); color: var(--ink); box-shadow: var(--e-3); overflow: hidden; flex-direction: column; overscroll-behavior: contain; }
dialog.sheet[open] { display: flex; animation: sheet-in var(--dur-3) var(--ease-out); }
dialog.sheet.closing { animation: sheet-out 200ms var(--ease-in) forwards; }
dialog.sheet::backdrop { background: var(--scrim); animation: fade-in var(--dur-3) var(--ease-out); }
dialog.sheet.closing::backdrop { animation: fade-out 200ms var(--ease-in) forwards; }
.sheet-handle { flex: none; width: 36px; height: 5px; margin: 0 auto var(--s-2); border-radius: var(--r-pill); background: var(--line-2); touch-action: none; }
.sheet-head { flex: none; display: flex; align-items: center; gap: var(--s-2); min-height: 52px; touch-action: none; }
.sheet-head h2 { flex: 1; min-width: 0; font: var(--t-h3); }
.sheet-head .sub { display: block; font: var(--t-small); color: var(--muted); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s-1) 0 var(--s-4); overscroll-behavior: contain; }
.sheet-foot { flex: none; display: flex; gap: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.sheet-foot > * { flex: 1; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-pop { from { opacity: 0; transform: scale(.96); } }
@keyframes sheet-pop-out { to { opacity: 0; transform: scale(.96); } }
@keyframes side-in { from { transform: translateX(100%); } }
@keyframes side-out { to { transform: translateX(100%); } }
@media (min-width: 900px) {
  dialog.sheet { inset: 0; margin: auto; max-width: 520px; max-height: 86dvh; height: fit-content; padding: var(--s-2) var(--s-6) var(--s-6); border-radius: var(--r-lg); }
  dialog.sheet[open] { animation: sheet-pop var(--dur-3) var(--ease-out); }
  dialog.sheet.closing { animation: sheet-pop-out 180ms var(--ease-in) forwards; }
  dialog.sheet .sheet-handle { visibility: hidden; height: 0; margin: 0; }
  dialog.sheet.side { inset: 0 0 0 auto; width: 440px; height: 100dvh; max-height: 100dvh; border-radius: var(--r-lg) 0 0 var(--r-lg); padding-top: var(--s-4); }
  dialog.sheet.side[open] { animation: side-in var(--dur-3) var(--ease-out); }
  dialog.sheet.side.closing { animation: side-out 200ms var(--ease-in) forwards; }
}
/* Chat info drawer (sheet({ drawer: true })): full screen on phones; desktop: non-modal right panel, overlay at 900-1439,
   third column at 1440+ (layout reserves the space through body.drawer-open). Open state remembered by sheet.js. */
dialog.sheet.drawer { inset: 0; max-height: 100dvh; height: 100dvh; border-radius: 0; padding-top: calc(var(--s-2) + var(--safe-t)); }
dialog.sheet.drawer .sheet-handle { visibility: hidden; height: 0; margin: 0; }
dialog.sheet.drawer[open] { animation: side-in var(--dur-3) var(--ease-out); }
dialog.sheet.drawer.closing { animation: side-out 200ms var(--ease-in) forwards; }
@media (min-width: 900px) {
  dialog.sheet.drawer { inset: 0 0 0 auto; z-index: 32; width: var(--drawer-w); height: 100dvh; max-height: 100dvh; margin: 0; padding: var(--s-2) var(--s-5) var(--s-5); border-radius: 0; border-left: 1px solid var(--pane-line); box-shadow: var(--e-menu); }
  dialog.sheet.drawer[open] { animation: side-in var(--dur-3) var(--ease-out); }
}
@media (min-width: 1440px) { dialog.sheet.drawer { box-shadow: none; } }
dialog.sheet.drawer.instant[open] { animation: none; } /* restored after a page load or swap: no slide */
details.sheet-fallback { margin: var(--s-2) 0; }
details.sheet-fallback > summary { display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tap-min); padding: 0 var(--s-4); border-radius: var(--r-md); background: var(--surface); box-shadow: inset 0 0 0 2px var(--line-2); font: var(--t-label); cursor: pointer; list-style: none; }
details.sheet-fallback > summary::-webkit-details-marker { display: none; }
details.sheet-fallback[open] > summary { margin-bottom: var(--s-3); }
.confirm { text-align: center; padding: var(--s-2) 0; }
.confirm .empty-ic { margin-bottom: var(--s-3); }
.confirm h2 { font: var(--t-h2); margin-bottom: var(--s-2); }
.confirm p { color: var(--ink-2); }
.confirm .btnstack { margin-top: var(--s-5); }
.empty-ic.danger { color: var(--st-us-fg); }

/* ---------- 9.10 toast ---------- */
.toasts { position: fixed; z-index: 80; left: var(--s-4); right: var(--s-4); bottom: calc(var(--tabs-h) + var(--safe-b) + 12px); display: flex; justify-content: center; pointer-events: none; }
body:not(.app) .toasts, .app.detail .toasts { bottom: calc(var(--safe-b) + 16px); }
.app.has-actions .toasts { bottom: calc(76px + var(--safe-b) + 12px); }
@media (min-width: 900px) { .app .toasts, .app.detail .toasts { left: calc(var(--rail-w) + var(--s-4)); bottom: var(--s-6); } .app.has-actions .toasts { bottom: 96px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s-3); width: 100%; max-width: 420px; min-height: 52px; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--brand-ink); color: var(--on-ink); box-shadow: var(--e-3); font: var(--t-label); animation: toast-in var(--dur-3) var(--ease-out) both; }
.toast .toast-t { flex: 1; min-width: 0; }
.toast .act { flex: none; min-height: var(--tap-min); margin: -10px -8px -10px 0; padding: 0 var(--s-3); border: 0; border-radius: 10px; background: transparent; color: var(--on-ink-link); font: 800 16px/20px var(--font-body); cursor: pointer; }
.toast .act:hover { background: rgb(255 255 255 / .08); }
.toast.err { background: var(--err-toast); }
.toast.out { animation: toast-out 180ms var(--ease-in) forwards; }
.toast.flash { animation: toast-in var(--dur-3) var(--ease-out) both, toast-out 180ms var(--ease-in) 4s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(16px); } }
.newpill { position: fixed; z-index: 40; left: 50%; top: calc(var(--top-h) + var(--safe-t) + 12px); transform: translateX(-50%); display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tap-min); padding: 0 var(--s-4); border: 0; border-radius: var(--r-pill); background: var(--brand-ink); color: var(--on-ink); box-shadow: var(--e-3); font: var(--t-label); cursor: pointer; animation: toast-in var(--dur-3) var(--ease-out); }
@media (min-width: 900px) { .newpill { left: calc(50% + var(--rail-w) / 2); top: var(--s-4); } }
/* "New version · tap to reload" (live.js): at the bottom, so it never covers the "New message" pill */
.newpill.ver { top: auto; bottom: calc(var(--safe-b) + var(--nav-h) + 16px); }
@media (min-width: 900px) { .newpill.ver { top: auto; bottom: var(--s-6); } }

/* ---------- 9.11 empty, loading, error ---------- */
.empty { text-align: center; padding: var(--s-8) var(--s-4); }
.empty-ic { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto var(--s-2); border-radius: 50%; color: var(--muted); }
.empty-ic .ic { width: 32px; height: 32px; }
.empty h3, .empty .empty-t { margin-bottom: var(--s-1); }
.empty h1.empty-t { font: var(--t-h3); }
.empty p { max-width: 34ch; margin: 0 auto; font: var(--t-small); color: var(--muted); }
.empty .btn { margin-top: var(--s-4); }
p.empty { padding: var(--s-4); font: var(--t-small); color: var(--muted); max-width: none; }
.sk { display: block; border-radius: var(--r-xs); background: var(--surface-2) linear-gradient(90deg, transparent, var(--surface-3), transparent) no-repeat; background-size: 50% 100%; animation: shine 1.4s linear infinite; }
.sk.line { height: 14px; margin: 6px 0; }
.sk.line.short { width: 40%; }
.sk.block { height: 96px; border-radius: var(--r-lg); }
.sk.circle { width: 44px; height: 44px; border-radius: 50%; }
.sk-row { display: grid; grid-template-columns: 44px 1fr; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); }
@keyframes shine { from { background-position: -100% 0; } to { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; background-image: none; } }
.errorbox { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--st-us-bg); color: var(--st-us-fg); font: var(--t-small); }
.errorbox span { flex: 1; }
.errorbox .btn.quiet { color: inherit !important; font-weight: 800; }

/* ---------- 9.15 stepper ---------- */
.stepper { list-style: none; margin: 0; padding: 0; }
.stepper li { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: var(--s-3); padding-bottom: var(--s-5); }
.stepper li:last-child { padding-bottom: 0; }
.stepper li::before { content: ""; position: absolute; left: 16px; top: 38px; bottom: 4px; width: 2px; background: var(--line); }
.stepper li:last-child::before { display: none; }
.step-n { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-ink); color: var(--on-ink); font: var(--t-label); }
.stepper li.done .step-n { background: var(--st-ok-bg); color: var(--st-ok-fg); }
.stepper li.current .step-n { background: var(--brand); color: var(--on-brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.step-b b { display: block; font: var(--t-label); padding-top: 7px; }
.step-b p { margin: 2px 0 0; font: var(--t-small); color: var(--muted); }

/* caveat disclosure */
details.caveat { margin-top: var(--s-6); border-radius: var(--r-md); }
details.caveat > summary { display: flex; align-items: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-1); font: var(--t-label); color: var(--ink-2); cursor: pointer; list-style: none; }
details.caveat > summary::-webkit-details-marker { display: none; }
details.caveat > summary .ic { transition: transform var(--dur-2) var(--ease-out); }
details.caveat[open] > summary .ic.chev { transform: rotate(90deg); }
details.caveat > p { margin: 0 0 var(--s-2); padding: 0 var(--s-1) 0 36px; font: var(--t-small); color: var(--muted); max-width: 68ch; }

/* public shell (landing, auth, legal) */
.pub { min-height: 100dvh; display: flex; flex-direction: column; }
.pubbar { display: flex; align-items: center; gap: var(--s-3); max-width: calc(var(--content-max) + 2 * var(--gutter)); width: 100%; margin: 0 auto; min-height: calc(64px + var(--safe-t)); padding: var(--safe-t) var(--gutter) 0; }
.pubbar .brand { display: inline-flex; align-items: center; min-height: 44px; gap: 10px; font: 800 20px/24px var(--font-display); letter-spacing: -0.01em; color: var(--ink) !important; text-decoration: none !important; }
.pubbar .brand > span, .land .brand > span { color: var(--brand); } /* suite word in blue, product word in ink (.wm-prod), as in the app */
.pubbar .brand img { width: 32px; height: 32px; border-radius: 9px; view-transition-name: logo; }
.pubbar .spacer { flex: 1; }
.pub main { flex: 1; width: 100%; max-width: calc(var(--content-max) + 2 * var(--gutter)); margin: 0 auto; padding: var(--s-2) var(--gutter) var(--s-10); }
.pub.narrow main { max-width: calc(460px + 2 * var(--gutter)); }
.foot { padding: var(--s-6) var(--gutter) calc(var(--s-6) + var(--safe-b)); text-align: center; font: var(--t-meta); color: var(--muted); line-height: 22px; }
.foot p { margin: 0; text-wrap: balance; }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; margin-top: var(--s-1); }
.foot a { display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap-min); min-height: var(--tap-min); padding: 0 var(--s-2); color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.banner > a, .banner > button.link { display: inline-flex; align-items: center; min-height: var(--tap-min); margin: -12px -8px -12px 0; padding: 0 8px; flex: none; }
/* business type select: the "Tell us what you do" text only shows when Other is picked (always shown without :has support) */
.bt-other { margin-top: var(--s-3); }
@supports selector(:has(*)) {
  .bt-other { display: none; }
  .bt:has(option[value="other"]:checked) .bt-other { display: block; }
}

/* Kasbo suite wordmark: "Kasbo" in brand blue, the product word in ink at a lighter weight (layout.ts brandName). */
.wm-prod { color: var(--ink); font-weight: 600; }
