/* ==========================================================================
   iara staff kit: components for STATIC apps (no build step).
   Requires tokens.css. Classes are prefixed .k- so they never collide with
   an app's legacy CSS during migration. React apps use next/ instead; both
   render the same pixels from the same tokens.
   ========================================================================== */
/* The hidden attribute always wins over component display rules (.k-alert is flex, .k-empty grid...).
   Without this, apps that toggle [hidden] showed empty error boxes and closed popovers (2026-10-14). */
[hidden] { display: none !important; }

.k-body { margin: 0; background: var(--k-page); color: var(--k-ink); font-family: var(--k-font-sans); -webkit-font-smoothing: antialiased; }
.k-num, .k-body td, .k-body .num { font-variant-numeric: tabular-nums; }
.k-body h1, .k-body h2, .k-body h3 { text-wrap: balance; }
.k-body p { text-wrap: pretty; }
.k-muted { color: var(--k-muted); }

/* Type scale (tokens.css --k-text-*). Display serif only for page + section headings.
   Next twin: same class names as Tailwind utilities in next/theme.css, plus text-page/section/... sizes. */
.k-h-page    { margin: 0; font-family: var(--k-font-display); font-size: var(--k-text-page);    line-height: var(--k-text-page-lh);    font-weight: var(--k-text-page-w);    letter-spacing: -0.02em; color: var(--k-display); text-wrap: balance; }
.k-h-section { margin: 0; font-family: var(--k-font-display); font-size: var(--k-text-section); line-height: var(--k-text-section-lh); font-weight: var(--k-text-section-w); letter-spacing: -0.01em; color: var(--k-display); text-wrap: balance; }
.k-h-card    { margin: 0; font-family: var(--k-font-sans);    font-size: var(--k-text-card);    line-height: var(--k-text-card-lh);    font-weight: var(--k-text-card-w);    color: var(--k-ink); text-wrap: balance; }
.k-text-body  { font-family: var(--k-font-sans); font-size: var(--k-text-body);  line-height: var(--k-text-body-lh);  font-weight: var(--k-text-body-w); }
.k-text-small { font-family: var(--k-font-sans); font-size: var(--k-text-small); line-height: var(--k-text-small-lh); font-weight: var(--k-text-small-w); }
.k-text-meta  { font-family: var(--k-font-sans); font-size: var(--k-text-meta);  line-height: var(--k-text-meta-lh);  font-weight: var(--k-text-meta-w); color: var(--k-muted); font-variant-numeric: tabular-nums; }
.k-text-label { font-family: var(--k-font-sans); font-size: var(--k-text-label); line-height: var(--k-text-label-lh); font-weight: var(--k-text-label-w); color: var(--k-ink); }
:where(.k-body) :focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }

/* Lockup: mark big, word small */
.k-lockup { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--k-display); text-decoration: none; min-height: var(--k-tap); border-radius: var(--k-radius); }
.k-lockup img { width: var(--k-lockup-mark); height: auto; display: block; }
.k-lockup span { white-space: nowrap; font-family: "Fraunces", Georgia, serif; font-style: italic; font-size: var(--k-lockup-word); line-height: 1; color: var(--k-display); }

/* Header */
.k-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 16px; }
.k-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.k-nav a, .k-nav button { display: inline-flex; align-items: center; min-height: var(--k-tap); padding: 0 10px; border-radius: var(--k-radius); color: var(--k-muted); text-decoration: none; font: 500 14px/1 var(--k-font-sans); background: none; border: 0; cursor: pointer; }
.k-nav a:hover, .k-nav button:hover { color: var(--k-ink); background: var(--k-raised); }
.k-nav [aria-current="page"] { color: var(--k-ink); font-weight: 700; }

/* Buttons: ONE button (Jay, 2026-10-13). Never hand-roll a button: use .k-btn + a variant + optional size.
   Pixel-identical to next/ui/button.tsx: 40 default / 32 sm / 44 lg, 8px radius, 600 14px (lg 15px),
   2px ring outline offset 2, real-token hover and disabled. Below 1024px every size is at least 44px tall. */
.k-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box; min-height: 40px; padding: 0 16px; border-radius: var(--k-radius); border: 1px solid transparent; background: none; color: var(--k-ink); font: 600 14px/1 var(--k-font-sans); white-space: nowrap; cursor: pointer; text-decoration: none; user-select: none; transition: background-color var(--k-fast) var(--k-ease), color var(--k-fast) var(--k-ease), transform var(--k-fast) var(--k-ease); }
.k-btn svg { flex: none; width: 16px; height: 16px; pointer-events: none; }
.k-btn:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }
.k-btn:active:not(:disabled) { transform: translateY(1px); }
.k-btn:disabled, .k-btn[aria-disabled="true"] { cursor: not-allowed; pointer-events: none; background: var(--k-raised); color: var(--k-muted); border-color: transparent; }
.k-btn-primary { background: var(--k-primary); color: var(--k-primary-ink); }
.k-btn-primary:hover { background: var(--k-primary-hover); }
.k-btn-secondary { background: var(--k-raised); color: var(--k-ink); border-color: var(--k-border); }
.k-btn-secondary:hover { background: var(--k-raised-hover); }
.k-btn-outline { background: none; color: var(--k-ink); border-color: var(--k-border-input); }
.k-btn-outline:hover, .k-btn-outline[aria-expanded="true"] { background: var(--k-raised); }
.k-btn-ghost { background: none; color: var(--k-ink); }
.k-btn-ghost:hover, .k-btn-ghost[aria-expanded="true"] { background: var(--k-raised); }
.k-btn-danger { background: var(--k-raised); color: var(--k-critical); border-color: var(--k-critical); }
.k-btn-danger:hover { background: var(--k-raised-hover); }
.k-btn-link { background: none; color: var(--k-accent-text); padding: 0 4px; text-underline-offset: 4px; }
.k-btn-link:hover { text-decoration: underline; }
.k-btn-sm { min-height: 32px; padding: 0 12px; }
.k-btn-sm svg { width: 14px; height: 14px; }
.k-btn-lg { min-height: 44px; padding: 0 20px; font-size: 15px; }
.k-btn-icon { padding: 0; min-width: 40px; }
.k-btn-icon.k-btn-sm { min-width: 32px; }
.k-btn-icon.k-btn-lg { min-width: 44px; }
.k-btn-block { width: 100%; }
@media (pointer: coarse), (max-width: 1023px) { .k-btn { min-height: var(--k-tap); } .k-btn-icon { min-width: var(--k-tap); } }

/* Badges (status, square-ish) and chips (filters, pill) */
.k-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--k-radius-sm); font: 600 12px/1.4 var(--k-font-sans); background: var(--k-raised); color: var(--k-ink); font-variant-numeric: tabular-nums; }
.k-badge-good { color: var(--k-good); } .k-badge-critical { color: var(--k-critical); } .k-badge-warning { color: var(--k-warning); } .k-badge-accent { color: var(--k-accent-text); }
.k-badge-info { color: var(--k-info); } .k-badge-ask { color: var(--k-ask); } .k-badge-muted { color: var(--k-muted); } .k-badge-display { color: var(--k-display); }
/* One badge per status (tokens.css --k-status-*; Next: STATUS_BADGE in next/status.ts). Never hand-roll a status pill. */
.k-badge-inquiry { color: var(--k-status-inquiry); }   .k-badge-offered { color: var(--k-status-offered); }
.k-badge-hold { color: var(--k-status-hold); }         .k-badge-ask-to-confirm { color: var(--k-status-ask); }
.k-badge-confirmed { color: var(--k-status-confirmed); } .k-badge-completed { color: var(--k-status-completed); }
.k-badge-lost { color: var(--k-status-lost); }         .k-badge-needs-answer { color: var(--k-status-needs-answer); }
.k-badge-private-dining { color: var(--k-status-private-dining); } .k-badge-vendor { color: var(--k-status-vendor); }
.k-badge-done { color: var(--k-status-done); }         .k-badge-skipped { color: var(--k-status-skipped); }
.k-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--k-radius-pill); border: 1px solid var(--k-border-input); background: none; color: var(--k-ink); font: 500 14px/1 var(--k-font-sans); cursor: pointer; font-variant-numeric: tabular-nums; }
.k-chip { transition: background-color var(--k-fast) var(--k-ease), color var(--k-fast) var(--k-ease), border-color var(--k-fast) var(--k-ease), transform var(--k-fast) var(--k-ease); }
.k-chip:active { transform: scale(0.97); }
.k-chip[aria-pressed="true"] { background: var(--k-ink); color: var(--k-page); border-color: var(--k-ink); }
/* Identical to next/controls Chip: 36px, 44px below 1024px or on touch; border --k-border-input (3.46+ control boundary); pressed = ink fill. Group them in role="group" + aria-label. */
@media (pointer: coarse), (max-width: 1023px) { .k-chip { min-height: var(--k-tap); } }

/* Tabs: one style everywhere, segmented */
.k-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--k-radius-lg); background: var(--k-surface); border: 1px solid var(--k-border); max-width: 100%; overflow-x: auto; }
.k-tab { min-height: 36px; padding: 0 14px; border: 0; border-radius: var(--k-radius); background: none; color: var(--k-muted); font: 600 14px/1 var(--k-font-sans); cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums; }
.k-tab:hover { color: var(--k-ink); }
.k-tab[aria-selected="true"] { background: var(--k-primary); color: var(--k-primary-ink); }
@media (pointer: coarse), (max-width: 1023px) { .k-tab { min-height: var(--k-tap); } }
.k-tab { transition: background-color var(--k-fast) var(--k-ease), color var(--k-fast) var(--k-ease); } /* not outline-color: the ring must not fade in */
/* Arrow keys: load /kit/tabs.js; it wires roving tabindex + Left/Right/Home/End on every [role=tablist] (WAI-ARIA tabs, automatic activation = click). */

/* Cards */
.k-card { background: var(--k-surface); border: 1px solid var(--k-border); border-radius: var(--k-radius-lg); padding: 16px; }
@media (min-width: 900px) { .k-card { padding: 20px; } }

/* Inputs (kit v2: same pixels as next/ui/input, select, textarea, field).
   <div class="k-field"><label class="k-label" for="ps">Party Size<span class="req" aria-hidden="true"> *</span></label>
     <p class="k-hint" id="ps-h">Include the host</p>
     <input class="k-input" id="ps" required aria-describedby="ps-h ps-e" aria-invalid="true">
     <p class="k-error" id="ps-e">Enter a party size</p></div>
   40px / 14px at >= 1024px with a fine pointer, 44px / 16px below or on touch (16px stops iOS zoom). */
.k-field { display: grid; gap: 6px; }
.k-label { font: 600 13px/1.3 var(--k-font-sans); color: var(--k-ink); }
.k-label .req { color: var(--k-critical); }
.k-hint { margin: 0; font: 400 13px/1.4 var(--k-font-sans); color: var(--k-muted); }
.k-error { margin: 0; display: flex; align-items: flex-start; gap: 6px; font: 500 13px/1.4 var(--k-font-sans); color: var(--k-critical); }
.k-error::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 14px; height: 14px; margin-top: 1px; border: 1.5px solid currentColor; border-radius: 50%; font: 700 10px/1 var(--k-font-sans); }
.k-input, .k-select, .k-textarea { width: 100%; box-sizing: border-box; min-height: var(--k-tap); padding: 10px 12px; border-radius: var(--k-radius); border: 1px solid var(--k-border-input); background: var(--k-surface); color: var(--k-ink); font: 16px/1.3 var(--k-font-sans); transition: border-color var(--k-fast) var(--k-ease); }
.k-input, .k-select { height: var(--k-tap); padding-top: 0; padding-bottom: 0; }
@media (min-width: 1024px) and (pointer: fine) { .k-input, .k-select { height: 40px; min-height: 40px; font-size: 14px; } .k-textarea { font-size: 14px; } }
.k-input::placeholder, .k-textarea::placeholder { color: var(--k-muted); }
.k-input:hover, .k-select:hover, .k-textarea:hover { border-color: var(--k-muted); }
.k-input:focus-visible, .k-select:focus-visible, .k-textarea:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }
.k-input[aria-invalid="true"], .k-select[aria-invalid="true"], .k-textarea[aria-invalid="true"] { border-color: var(--k-critical); }
.k-input:disabled, .k-select:disabled, .k-textarea:disabled { cursor: not-allowed; background: var(--k-raised); color: var(--k-muted); border-color: var(--k-border); }
.k-textarea { min-height: 88px; resize: vertical; field-sizing: content; }
.k-select { appearance: none; cursor: pointer; padding-right: 36px; background: var(--k-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23c9bfae' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px; }

/* Switch: on/off that applies at once. <button type="button" class="k-switch" role="switch" aria-checked="false" aria-labelledby="lbl"></button>
   Toggle aria-checked in your click handler. 44x24 track, 44x44 hit area. Off = surface + --k-border-input (3.46+), muted thumb;
   on = primary track, primary-ink thumb (5.07). Same as next/ui/switch. Row: <div class="k-check-row">[control]<label>…</label></div> */
.k-switch { position: relative; flex: none; display: inline-flex; align-items: center; width: 44px; height: 24px; padding: 0; box-sizing: border-box; border: 1px solid var(--k-border-input); border-radius: 999px; background: var(--k-surface); cursor: pointer; transition: background-color var(--k-fast) var(--k-ease), border-color var(--k-fast) var(--k-ease); }
.k-switch::before { content: ""; position: absolute; inset: -10px 0; }
.k-switch::after { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--k-muted); transform: translateX(2px); transition: transform var(--k-fast) var(--k-ease); }
.k-switch[aria-checked="true"] { background: var(--k-primary); border-color: var(--k-primary); }
.k-switch[aria-checked="true"]::after { background: var(--k-primary-ink); transform: translateX(22px); }
.k-switch:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }
.k-switch:disabled { cursor: not-allowed; background: var(--k-raised); border-color: var(--k-border); }
.k-switch:disabled::after { background: var(--k-border); }
/* Checkbox: native input, kit look. <input type="checkbox" class="k-check" id="x"> <label for="x">Card Saved</label> */
.k-check { appearance: none; position: relative; flex: none; width: 20px; height: 20px; margin: 0; border: 1px solid var(--k-border-input); border-radius: 5px; background: var(--k-surface); cursor: pointer; display: inline-grid; place-items: center; }
.k-check::before { content: ""; position: absolute; inset: -12px; }
.k-check:checked, .k-check:indeterminate { background: var(--k-primary); border-color: var(--k-primary); }
.k-check:checked::after { content: ""; width: 10px; height: 5px; border: solid var(--k-primary-ink); border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg); }
.k-check:indeterminate::after { content: ""; width: 10px; height: 2.5px; background: var(--k-primary-ink); border-radius: 2px; }
.k-check:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }
.k-check-row { display: flex; align-items: center; gap: 12px; min-height: var(--k-tap); }
.k-check-row label { font: 600 13px/1.3 var(--k-font-sans); color: var(--k-ink); cursor: pointer; }

/* Progress: <div class="k-progress"><div class="k-progress-head"><span id="pl">Menu Learned</span><span aria-hidden="true">7 of 12</span></div>
     <div class="k-progress-track" role="progressbar" aria-labelledby="pl" aria-valuemin="0" aria-valuemax="12" aria-valuenow="7" aria-valuetext="7 of 12">
       <div class="k-progress-bar" style="--k-p:.583"></div></div></div>
   Covers vs cap (a reading, not a task) uses role="meter". Fill = primary (3.45+), grows by transform. */
.k-progress { display: grid; gap: 6px; }
.k-progress-head { display: flex; justify-content: space-between; gap: 12px; font: 600 13px/1.3 var(--k-font-sans); color: var(--k-ink); }
.k-progress-head > :last-child { font-weight: 500; color: var(--k-muted); font-variant-numeric: tabular-nums; }
.k-progress-track { height: 8px; border-radius: 999px; background: var(--k-raised); overflow: hidden; }
.k-progress-bar { height: 100%; border-radius: 999px; background: var(--k-primary); transform-origin: left; transform: scaleX(var(--k-p, 0)); transition: transform var(--k-base) var(--k-ease); }
@media (prefers-reduced-motion: reduce) { .k-switch, .k-switch::after, .k-progress-bar, .k-input, .k-select, .k-textarea { transition: none; } }

/* Toasts (toast.js, window.iaraToast): bottom centre, stacked newest at the bottom, aria-live. One action max. */
.k-toaster { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%); z-index: 2600; display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
.k-toast { pointer-events: auto; display: flex; align-items: center; gap: 16px; box-sizing: border-box; max-width: 100%; min-height: 48px; padding: 8px 8px 8px 16px; border-radius: var(--k-radius-lg); background: var(--k-raised); color: var(--k-ink); border: 1px solid var(--k-border); box-shadow: 0 8px 24px rgb(0 0 0 / .35); font: 500 14px/1.35 var(--k-font-sans); animation: k-toast-in var(--k-base) var(--k-ease); }
.k-toast[data-kind="error"] { border-color: var(--k-critical); }
.k-toast-msg { flex: 1; min-width: 0; padding: 6px 0; overflow-wrap: anywhere; }
.k-toast-icon { flex: none; width: 16px; height: 16px; }
.k-toast[data-kind="success"] .k-toast-icon { color: var(--k-good); } .k-toast[data-kind="error"] .k-toast-icon { color: var(--k-critical); }
.k-toast button { flex: none; min-height: 36px; padding: 0 10px; border: 0; border-radius: var(--k-radius); background: none; color: var(--k-sun); font: 700 14px/1 var(--k-font-sans); cursor: pointer; }
.k-toast button:hover { background: var(--k-raised-hover); }
.k-toast button:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }
@media (pointer: coarse), (max-width: 1023px) { .k-toast button { min-height: var(--k-tap); } }
@keyframes k-toast-in { from { transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .k-toast { animation: none; } }

/* States */
/* Empty states sit on the left edge like everything else (Jay, 2026-10-14: "everything justified to the left"). */
/* Empty state: say which empty, teach, offer an action (secondary action optional):
   <div class="k-empty"><svg aria-hidden="true">…</svg><h3>No messages match "tony"</h3><p>Try a name, phone number or handle.</p>
     <div class="k-empty-actions"><button class="k-btn k-btn-outline">Clear Search</button></div></div> */
.k-empty { max-width: 560px; margin: 32px 0; text-align: left; display: grid; justify-items: start; gap: 8px; }
.k-empty h2, .k-empty h3 { margin: 0; font: 600 16px/1.3 var(--k-font-sans); color: var(--k-ink); }
.k-empty p { margin: 0 0 8px; color: var(--k-muted); font-size: 14px; }
.k-empty-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* One error box per failed load, with Try Again:
   <div class="k-alert" role="alert"><p>Couldn't load analytics. Try again in a minute.</p><button class="k-btn k-btn-outline k-btn-sm">Try Again</button></div> */
.k-alert { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--k-radius-lg); border: 1px solid var(--k-critical); background: var(--k-surface); color: var(--k-critical); font: 400 14px/1.4 var(--k-font-sans); }
.k-alert > p { margin: 0; flex: 1 1 240px; }
/* Heads-up banner (not an error): same box, warning edge, ink text, a link and a Dismiss button.
   <div class="k-alert k-alert-warning" role="status"><p><svg…/> 3 low Resy ratings to check. <a href="…">Open Guest Reviews</a></p><button class="k-btn k-btn-ghost k-btn-sm">Dismiss</button></div> */
.k-alert-warning { border-color: var(--k-warning); color: var(--k-ink); }
.k-alert-warning a { color: var(--k-accent-text); font-weight: 600; text-underline-offset: 3px; }
.k-skeleton { border-radius: var(--k-radius); background: var(--k-raised); animation: k-pulse 1.5s ease-in-out infinite; }
@keyframes k-pulse { 50% { background: var(--k-raised-hover); } }
/* Kitchen loading line (next/loading.tsx, loading.js): one aria-hidden line under a skeleton.
   Height is reserved before the text lands at 200ms. Only the icon moves, transform only. */
.k-cook { display: flex; align-items: center; gap: 8px; min-height: 20px; margin: 4px 0 0; grid-column: 1 / -1; color: var(--k-muted); font: 500 13px/20px var(--k-font-sans); }
.k-cook-icon { flex: none; color: var(--k-accent-text); transform-origin: 50% 90%; animation: k-wobble 1.6s ease-in-out infinite; }
@keyframes k-wobble { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
/* CSS mode (route loading.tsx, never hydrated): whole line appears at 200ms, then one of 13 stacked
   lines is visible per 1.6s slot. 7.69% = 1/13 of the 20.8s cycle. */
.k-cook-css { animation: k-cook-show 0s linear 200ms both; }
@keyframes k-cook-show { from { visibility: hidden; } to { visibility: visible; } }
.k-cook-cycle { display: grid; }
.k-cook-cycle > span { grid-area: 1 / 1; visibility: hidden; animation: k-cook-slot 20.8s linear infinite; animation-delay: calc(var(--i) * 1.6s + 200ms); }
@keyframes k-cook-slot { 0%, 7.68% { visibility: visible; } 7.69%, 100% { visibility: hidden; } }
/* Bold full-page loader (PageLoading, [data-k-bigload]): centered badge + display-serif line + sweep bar.
   Shows at 200ms (visibility, never opacity). Icon and line pop in together (transform only). */
.k-bigload { display: grid; justify-items: center; align-content: center; gap: 16px; min-height: min(60vh, 560px); padding: 32px 16px; box-sizing: border-box; text-align: center; animation: k-cook-show 0s linear 200ms both; }
.k-bigload-badge { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: var(--k-surface); color: var(--k-primary); }
.k-bigload-badge > * { grid-area: 1 / 1; }
.k-bigload-line { display: grid; justify-items: center; min-height: 1.25em; margin: 0; font: 400 23px/1.25 var(--k-font-display); color: var(--k-ink); text-wrap: balance; }
.k-bigload-line > * { grid-area: 1 / 1; }
.k-bigload-pop { animation: k-pop 220ms var(--k-ease, ease-out) both; }
@keyframes k-pop { from { transform: scale(.9); } to { transform: scale(1); } }
.k-bigload-slot { visibility: hidden; animation: k-bigslot 20.8s linear infinite; animation-delay: calc(var(--i) * 1.6s + 200ms); }
@keyframes k-bigslot { 0% { visibility: visible; transform: scale(.9); } 1.06% { transform: scale(1); } 7.68% { visibility: visible; } 7.69%, 100% { visibility: hidden; } }
.k-bigload-bar { position: relative; width: 120px; height: 4px; border-radius: 999px; background: var(--k-raised); overflow: hidden; }
.k-bigload-bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; border-radius: inherit; background: var(--k-primary); animation: k-sweep 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
@keyframes k-sweep { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .k-skeleton, .k-skel-card, [class*="k-skel"], .k-cook-icon { animation: none; } .k-cook-cycle > span { animation: none; } .k-cook-cycle > span:first-child { visibility: visible; } .k-bigload-pop, .k-bigload-slot { animation: none; } .k-bigload-slot:first-child { visibility: visible; } .k-bigload-bar::before { animation: none; transform: translateX(75%); } .k-btn, .k-chip, .k-tab { transition: none; } .k-btn:active, .k-chip:active { transform: none; } }

/* Sign-in gate */
.k-gate { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.k-gate-card { width: 100%; max-width: 380px; box-sizing: border-box; display: grid; gap: 16px; justify-items: center; text-align: center; }
.k-gate-card p { margin: 0; color: var(--k-muted); }
.k-gate-card .k-btn { width: 100%; }

/* Screen-reader-only text */
.k-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Skeleton layouts: wrap in role="status" aria-busy="true" with a .k-sr-only label.
   Shape them like the content that replaces them. */
.k-skel { display: grid; gap: 12px; }
.k-skel-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .k-skel-kpis { grid-template-columns: 1fr 1fr; } }
.k-skel-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.k-skel-tile { height: 88px; border-radius: var(--k-radius-lg); }
.k-skel-row  { height: 56px; }
.k-skel-card { height: 160px; border-radius: var(--k-radius-lg); }
.k-skel-line { height: 14px; border-radius: var(--k-radius-sm); }
.k-skel-title { height: 22px; width: 40%; border-radius: var(--k-radius-sm); }

/* Command palette (palette.js) */
.k-palette-trigger { display: inline-flex; align-items: center; gap: 8px; min-height: var(--k-tap); padding: 0 8px 0 12px; border-radius: var(--k-radius); border: 1px solid var(--k-border-input); background: var(--k-surface); color: var(--k-ink); font: 500 14px/1 var(--k-font-sans); cursor: pointer; white-space: nowrap; transition: background-color var(--k-fast) var(--k-ease); }
.k-palette-trigger:hover { background: var(--k-raised); }
.k-palette-trigger:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }
.k-palette-trigger svg { color: var(--k-muted); flex: none; }
.k-palette-trigger kbd, .k-palette-esc { font: 500 12px/1 var(--k-font-sans); color: var(--k-muted); background: var(--k-raised); border: 1px solid var(--k-border); border-radius: var(--k-radius-sm); padding: 4px 6px; }
@media (pointer: coarse) { .k-palette-trigger kbd { display: none; } .k-palette-trigger { padding-right: 12px; } }

.k-palette { position: fixed; inset: 0; z-index: 2000; display: flex; justify-content: center; align-items: flex-start; padding: max(12vh, 16px) 16px 16px; box-sizing: border-box; font-family: var(--k-font-sans); }
.k-palette[hidden] { display: none; }
.k-palette-scrim { position: absolute; inset: 0; background: rgb(0 0 0 / .55); }
.k-palette-dialog { position: relative; width: 100%; max-width: 560px; max-height: min(70vh, 520px); display: flex; flex-direction: column; background: var(--k-raised); color: var(--k-ink); border: 1px solid var(--k-border); border-radius: var(--k-radius-lg); box-shadow: 0 16px 48px rgb(0 0 0 / .45); overflow: hidden; animation: k-palette-in var(--k-base) var(--k-ease); }
@keyframes k-palette-in { from { transform: translateY(-8px) scale(0.98); } }
.k-palette-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--k-border); }
.k-palette-input { flex: 1; min-width: 0; min-height: var(--k-tap); border: 0; background: none; color: var(--k-ink); font: 16px/1.3 var(--k-font-sans); padding: 0 4px; }
.k-palette-input::placeholder { color: var(--k-muted); }
.k-palette-input:focus { outline: none; }
.k-palette-dialog:focus-within .k-palette-head { box-shadow: inset 0 -2px 0 var(--k-ring); }
.k-palette-esc { cursor: pointer; min-height: 32px; padding: 0 8px; }
@media (pointer: coarse) { .k-palette-esc { min-height: var(--k-tap); min-width: var(--k-tap); } }
.k-palette-esc:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }
.k-palette-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain; }
.k-palette-group { padding: 10px 10px 4px; font: 600 12px/1.3 var(--k-font-sans); color: var(--k-muted); }
.k-palette-list [role="option"] { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--k-tap); padding: 0 10px; border-radius: var(--k-radius); cursor: pointer; font: 500 15px/1.3 var(--k-font-sans); }
.k-palette-list [role="option"][aria-selected="true"] { background: var(--k-raised-hover); }
.k-palette-hint { font-size: 12px; color: var(--k-muted); }
.k-palette-list .k-palette-person { padding-top: 6px; padding-bottom: 6px; }
.k-palette-person .k-palette-label { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-palette-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 12px/1.4 var(--k-font-sans); color: var(--k-muted); }
.k-palette-vip { color: var(--k-primary); }
.k-palette-note { padding: 10px; font-size: 13px; color: var(--k-muted); }
.k-palette-empty { padding: 20px 10px; text-align: center; color: var(--k-muted); font-size: 14px; }
.k-palette-open, .k-palette-open body { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .k-palette-dialog { animation: none; } .k-palette-trigger { transition: none; } }

/* App bar v3 (Jay, 2026-10-13): the ONE manager navigation, identical in every manager app
   (static via nav.js, Next via next/staff-bar.tsx, same class names). Lineup is separate
   (data-mode="solo": no tabs, no search) and opens in a new tab from here.
     [iara mark → Home] [Rolling Title] | Home  Inbox▾  Private Dining  Lineup↗   [Search ⌘K] [avatar]
   Contents are capped at --k-content-max and centered. Below 1100px the tabs drop to a
   second row that scrolls sideways. Height = --k-appbar-h (changes with the layout). */
:root { --k-content-max: 1200px; }
[data-k-appbar] { position: sticky; top: 0; z-index: 900; }
.k-appbar { position: sticky; top: 0; z-index: 900; background: var(--k-page); border-bottom: 1px solid var(--k-border); font-family: var(--k-font-sans); padding-top: env(safe-area-inset-top); }
.k-appbar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; max-width: var(--k-content-max); margin: 0 auto; padding: 8px 16px; box-sizing: border-box; min-height: 60px; }
.k-appbar-mark { display: inline-flex; align-items: center; min-height: var(--k-tap); padding: 0 4px; border-radius: var(--k-radius); flex: none; }
.k-appbar-mark img { width: var(--k-lockup-mark); height: auto; display: block; }
.k-appbar-mark:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }
.k-appbar-title { display: inline-flex; align-items: center; min-height: var(--k-tap); padding: 0 12px 0 8px; color: var(--k-display); flex: none; }  /* 12px to the divider, mirrored by the 12px after it */
.k-appbar-spacer { flex: 1; min-width: 4px; }
.k-roll { position: relative; display: inline-block; overflow: hidden; height: 1.3em; line-height: 1.3em; vertical-align: middle; white-space: nowrap; font-family: "Fraunces", Georgia, serif; font-style: italic; font-size: var(--k-lockup-word); }
.k-roll > span { display: block; }
.k-roll > .k-roll-out { position: absolute; left: 0; top: 0; }

/* App tabs */
/* Spacing (Jay, 2026-10-13: "not right"): one 4px gap between every pill (same as .k-tabs), 12px inside each pill,
   and the divider sits with 12px on both sides (title slot padding | divider | first pill). */
.k-apptabs { display: flex; align-items: center; gap: 4px; min-width: 0; padding-left: 12px; border-left: 1px solid var(--k-border); }
.k-apptab { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px; border-radius: var(--k-radius); color: var(--k-muted); font: 600 14px/1 var(--k-font-sans); text-decoration: none; white-space: nowrap; transition: background-color var(--k-fast) var(--k-ease), color var(--k-fast) var(--k-ease); }
.k-apptab:hover { color: var(--k-ink); background: var(--k-raised); }
.k-apptab:active { transform: scale(0.98); }
.k-apptab:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }
.k-apptab[aria-current="page"] { color: var(--k-primary-ink); background: var(--k-primary); }
.k-apptab svg { flex: none; }
/* A tab that opens a menu (Inbox ▾: Messages, Reviews, Contacts, Analytics, Settings). Same pill as a link tab. */
button.k-apptab { margin: 0; border: 0; background: none; cursor: pointer; }
.k-apptab[aria-expanded="true"]:not([aria-current]) { color: var(--k-ink); background: var(--k-raised); }
.k-apptab[aria-haspopup] svg { transition: transform var(--k-fast) var(--k-ease); }
.k-apptab[aria-expanded="true"] svg { transform: rotate(180deg); }
@media (pointer: coarse), (max-width: 1023px) { .k-apptab { min-height: var(--k-tap); } }
/* Phones (Jay, 2026-10-19: Lineup was cut off at 360): under 480px the row shows Home, Inbox, Private Dining
   and a "More" menu holding the rest (Watch List, Lineup). Desktop/tablet never render the More button. */
/* Open-count badge on a tab, the phone More trigger and a More item (Jay, 2026-10-21: Guest Reviews open low-review count).
   Kit badge style (radius-sm, solid ground, warning text 7.27+ on raised, 8.00 on surface) sized to sit in a 36px pill.
   Markup: <span class="k-tab-count"><span aria-hidden="true">3</span><span class="k-sr-only">, 3 open</span></span> */
.k-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; margin-left: 4px; padding: 0 5px; box-sizing: border-box; border-radius: var(--k-radius-sm); background: var(--k-raised); color: var(--k-warning); font: 600 12px/1 var(--k-font-sans); font-variant-numeric: tabular-nums; }
.k-apptab:hover .k-tab-count, .k-apptab[aria-expanded="true"] .k-tab-count, .k-menu-item .k-tab-count, [data-slot="menu-content"] .k-tab-count { background: var(--k-surface); }
.k-apptab[aria-current="page"] .k-tab-count { background: var(--k-primary-ink); color: var(--k-warning); }   /* 9+ on the orange pill */
.k-apptab-more { display: none; }
@media (max-width: 479px) {
  .k-apptab-more { display: inline-flex; }
  .k-apptab[data-k-overflow] { display: none; }
  .k-apptab { padding: 0 10px; }   /* 4 pills fit 360 with room to spare (PD measured 1px over at 12px) */
}

.k-appbar .k-palette-trigger { border-color: transparent; background: none; }
.k-appbar .k-palette-trigger:hover, .k-appbar .k-palette-trigger[aria-expanded="true"] { background: var(--k-raised); }
/* Search is an icon in the bar at every width (Jay, 2026-11-09: nav cramped; the full row needed 1,247px of a 1,200px bar,
   so the account button wrapped). Cmd/Ctrl K still opens it; the label lives in aria-label and the tooltip. */
.k-appbar .k-palette-trigger span, .k-appbar .k-palette-trigger kbd { display: none; }
.k-appbar .k-palette-trigger { padding: 0; width: var(--k-tap); justify-content: center; }

/* Narrow: tabs become a full-width second row that scrolls sideways */
@media (max-width: 1099px) {
  :root { --k-appbar-h: 107px; }
  .k-appbar-inner { padding: 8px 12px 6px; }
  .k-apptabs { order: 10; flex-basis: 100%; padding: 4px 0 0; margin-left: -8px; border-left: 0; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
  .k-apptabs::-webkit-scrollbar { display: none; }
  :root[data-k-nav="solo"] { --k-appbar-h: 61px; }
}
@media (max-width: 479px) {
  .k-appbar-inner { padding-left: 8px; padding-right: 8px; }
  .k-appbar .k-palette-trigger span, .k-appbar .k-palette-trigger kbd { display: none; }
  .k-appbar .k-palette-trigger { padding: 0; width: var(--k-tap); justify-content: center; }
}
.k-appbar-btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--k-tap); min-width: var(--k-tap); padding: 0; border-radius: var(--k-radius); border: 0; background: none; color: var(--k-ink); cursor: pointer; }
.k-appbar-btn:hover, .k-appbar-btn[aria-expanded="true"] { background: var(--k-raised); }
.k-appbar-btn:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }
.k-avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 999px; background: var(--k-primary); color: var(--k-primary-ink); font: 700 13px/1 var(--k-font-sans); text-transform: uppercase; }

.k-menu { position: relative; min-width: 0; }
.k-menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 950; min-width: 240px; max-width: calc(100vw - 24px); margin: 0; padding: 6px; list-style: none; box-sizing: border-box; background: var(--k-raised); border: 1px solid var(--k-border); border-radius: var(--k-radius-lg); box-shadow: 0 12px 32px rgb(0 0 0 / .45); animation: k-menu-in var(--k-fast) var(--k-ease); }
.k-menu-list[hidden] { display: none; }
/* Tab menus sit outside the sideways-scrolling tab row (so they are never clipped); nav.js / staff-bar.tsx set top/left. */
.k-menu-list.k-menu-fixed { position: fixed; right: auto; top: 0; left: 0; min-width: 200px; }
@keyframes k-menu-in { from { transform: translateY(-4px); } }
.k-menu-label { padding: 8px 10px 4px; font: 600 12px/1.3 var(--k-font-sans); color: var(--k-muted); overflow-wrap: anywhere; }
.k-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--k-tap); padding: 0 10px; box-sizing: border-box; border: 0; border-radius: var(--k-radius); background: none; color: var(--k-ink); font: 500 15px/1.2 var(--k-font-sans); text-align: left; text-decoration: none; cursor: pointer; }
.k-menu-item:hover, .k-menu-item:focus-visible { background: var(--k-raised-hover); outline: none; }
.k-menu-item svg { color: var(--k-muted); flex: none; }
.k-menu-item[aria-current="page"] { font-weight: 700; }
.k-menu-item[aria-current="page"]::after { content: "Current"; margin-left: auto; font: 600 12px/1 var(--k-font-sans); color: var(--k-accent-text); }
.k-menu-sep { height: 1px; margin: 6px 4px; background: var(--k-border); }
@media (prefers-reduced-motion: reduce) { .k-menu-list { animation: none; } .k-apptab, .k-apptab svg { transition: none; } }

/* ---- Sub-tabs: an app family's own pages, first row in the page frame ----
   Inbox's tabs (Inbox, Reviews, Contacts, Analytics, Settings). Static: <nav class="k-subtabs" aria-label="Inbox">
   <div class="k-subtabs-row"><a class="k-subtab" href aria-current="page">. Next: InboxTabs in Inbox's app-header.tsx
   (Tailwind, same measurements). Current = quiet fill + primary underline, never orange fill (the app tab is the marker). */
.k-subtabs { margin-bottom: 20px; }
.k-subtabs-row { display: inline-flex; max-width: 100%; gap: 4px; padding: 4px; overflow-x: auto; box-sizing: border-box; border: 1px solid var(--k-border); border-radius: var(--k-radius-lg); background: var(--k-surface); }
.k-subtab { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: var(--k-radius); color: var(--k-muted); font: 600 14px/20px var(--k-font-sans); text-decoration: none; white-space: nowrap; transition: color var(--k-fast) var(--k-ease); }
.k-subtab:hover { color: var(--k-ink); }
.k-subtab:active { transform: scale(0.98); }
.k-subtab:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }
.k-subtab[aria-current="page"] { background: var(--k-raised); color: var(--k-ink); box-shadow: inset 0 -2px 0 var(--k-primary); }
@media (max-width: 1023px) { .k-subtab { min-height: var(--k-tap); } }
@media (max-width: 767px) { .k-subtabs { margin-bottom: 16px; } }
@media (prefers-reduced-motion: reduce) { .k-subtab { transition: none; } .k-subtab:active { transform: none; } }

/* App subtitle: one plain line under the bar saying what the app does (text lives in nav.js / staff-bar.tsx). */
.k-app-sub { margin: 0 0 16px; padding: 0; color: var(--k-muted); font: 400 15px/1.4 var(--k-font-sans); text-wrap: pretty; }
.k-app-sub-row { max-width: var(--k-content-max); margin: 16px auto 4px; padding: 0 16px; box-sizing: border-box; } /* legacy, prefer .k-page */

/* Page frame (Jay, 2026-10-13): every manager app's content sits in .k-page, which lines up with
   the app bar: same max width as .k-appbar-inner, and its content edge is the iara mark's left edge
   (bar side padding + the mark's 4px inset) at every breakpoint. The subtitle is always its first
   child, so it sits the same distance under the bar in every app.
   Static: <main class="k-page"><p data-k-subtitle></p> ...</main>.  Next: <PageShell home="/inbox">. */
:root { --k-page-x: 20px; }
@media (max-width: 1099px) { :root { --k-page-x: 16px; } }
@media (max-width: 479px) { :root { --k-page-x: 12px; } }
.k-page { display: block; width: 100%; max-width: var(--k-content-max); margin: 0 auto; padding: 24px var(--k-page-x) 64px; box-sizing: border-box; min-width: 0; }
.k-page > .k-app-sub:first-child, .k-page > [data-k-subtitle]:first-child { margin: 0 0 16px; padding: 0; max-width: none; text-align: left; }
.k-page-bleed { margin-left: calc(-1 * var(--k-page-x)); margin-right: calc(-1 * var(--k-page-x)); padding-left: var(--k-page-x); padding-right: var(--k-page-x); } /* rows that span the frame */
@media (max-width: 767px) { .k-page { padding-top: 16px; } }

/* Tooltip (tip.js): supplementary text on hover, focus and tap. WCAG 1.4.13. */
.k-tip { position: fixed; z-index: 3000; max-width: min(260px, calc(100vw - 16px)); box-sizing: border-box; padding: 8px 10px; border-radius: var(--k-radius-lg); background: var(--k-raised); color: var(--k-ink); border: 1px solid var(--k-border); box-shadow: 0 8px 24px rgb(0 0 0 / .4); font: 400 13px/1.4 var(--k-font-sans); white-space: pre-line; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; text-align: left; animation: k-tip-in var(--k-fast) var(--k-ease); }
.k-tip[hidden] { display: none; }
.k-tip[data-side="bottom"] { animation-name: k-tip-in-b; }
@keyframes k-tip-in { from { transform: translateY(3px); } }
@keyframes k-tip-in-b { from { transform: translateY(-3px); } }
[data-k-tip], [data-k-tip-for] { cursor: help; }
:where([data-k-tip], [data-k-tip-for]):focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }

/* Confirmation dialog (confirm.js): destructive or costly actions only. */
.k-confirm { position: fixed; inset: 0; z-index: 2500; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; font-family: var(--k-font-sans); }
.k-confirm-scrim { position: absolute; inset: 0; background: rgb(0 0 0 / .55); }
.k-confirm-dialog { position: relative; width: 100%; max-width: 420px; box-sizing: border-box; padding: 20px; background: var(--k-raised); color: var(--k-ink); border: 1px solid var(--k-border); border-radius: var(--k-radius-lg); box-shadow: 0 16px 48px rgb(0 0 0 / .45); animation: k-palette-in var(--k-base) var(--k-ease); }
.k-confirm-title { margin: 0 0 8px; font: 600 18px/1.3 var(--k-font-sans); color: var(--k-ink); text-wrap: balance; overflow-wrap: anywhere; }
.k-confirm-body { margin: 0; color: var(--k-muted); font: 400 15px/1.45 var(--k-font-sans); text-wrap: pretty; }
.k-confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.k-confirm-actions .k-btn-danger:hover { background: var(--k-raised-hover); }
@media (max-width: 479px) { .k-confirm-actions { flex-direction: column-reverse; } .k-confirm-actions .k-btn { width: 100%; } }
.k-confirm-open, .k-confirm-open body { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .k-tip, .k-confirm-dialog { animation: none; } }

/* Desktop app-switch motion (Jay, 2026-10-13). Staff apps share one origin, so a cross-document
   View Transition keeps the bar perfectly still while the page swaps underneath, and only the
   title rolls (old up and out, new up and in). Desktop only; phones/tablets get no motion.
   The title slot has a fixed width so the tabs never slide when the name changes.
   Page content does NOT fade (no opacity animation on primary content): it swaps instantly. */
@media (min-width: 1100px) and (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .k-appbar { view-transition-name: k-appbar; }
  .k-roll { view-transition-name: k-title; }
  ::view-transition-old(root), ::view-transition-new(root),
  ::view-transition-old(k-appbar), ::view-transition-new(k-appbar) { animation: none; }
  ::view-transition-group(k-title) { animation-duration: 600ms; overflow: hidden; }
  ::view-transition-old(k-title) { animation: k-title-out 600ms cubic-bezier(0.65, 0, 0.35, 1) both; }
  ::view-transition-new(k-title) { animation: k-title-in 600ms cubic-bezier(0.65, 0, 0.35, 1) both; }
}
@keyframes k-title-out { to { transform: translateY(-110%); } }
@keyframes k-title-in { from { transform: translateY(110%); } }
/* Slot = the longest name ("Private Dining", 106px at 18px Fraunces italic) + room for the italic overhang,
   so the divider hugs it and never moves. Sized off the title font, not the bar's 16px em. */
@media (min-width: 1100px) { .k-appbar-title { width: calc(var(--k-lockup-word) * 7.8); box-sizing: content-box; } }  /* 7.8: fit "Negative Reviews" (2026-10-20); "Guest Reviews" (2026-10-22) is shorter */
/* The account slot always takes the avatar's width, so Search sits in the same spot in every app,
   with or without a signed-in account (the bar must not shift between apps). */
.k-acct-slot { display: inline-flex; align-items: center; justify-content: center; min-width: var(--k-tap); }

/* ---- Spotlight (house SpotlightCard, vanilla) -----------------------------
   <section class="k-card k-spotlight">...</section> + /kit/spotlight.js.
   A soft orange glow follows the pointer. Decorative only: it paints BEHIND
   the content (isolation + z-index:-1, so above the card fill, below text),
   never takes pointer events, and is off on touch, coarse pointers and
   reduced motion. Primary at 12% peak alpha; text contrast stays AA on it. */
.k-spotlight { position: relative; isolation: isolate; }
.k-spotlight::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--x, 50%) var(--y, 50%), color-mix(in srgb, var(--k-primary) 12%, transparent), transparent 70%);
  transition: opacity 240ms var(--k-ease); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .k-spotlight[data-lit]::after { opacity: 1; }
}

/* ---- Dialog + sheet (dialog.js, native <dialog>) -----------------------
   <dialog class="k-dialog" id="edit" aria-labelledby="edit-t"><h2 class="k-dialog-title" id="edit-t">Edit Party</h2>
     <p class="k-dialog-body">…</p><div class="k-dialog-actions"><button class="k-btn k-btn-secondary" data-k-dialog-close>Cancel</button>…</div></dialog>
   <button data-k-dialog-open="edit">Edit Party</button>. Sheet: class="k-sheet" (right on >= 768px, bottom on phones).
   Same pixels as next/ui/dialog + sheet. Motion: transform only, off under reduced motion. */
dialog.k-dialog, dialog.k-sheet { box-sizing: border-box; margin: auto; padding: 20px; border: 1px solid var(--k-border); background: var(--k-raised); color: var(--k-ink); box-shadow: 0 16px 48px rgb(0 0 0 / .45); font-family: var(--k-font-sans); overscroll-behavior: contain; }
dialog.k-dialog { width: calc(100% - 32px); max-width: 480px; max-height: calc(100dvh - 32px); border-radius: var(--k-radius-lg); }
dialog.k-dialog.k-dialog-sm { max-width: 420px; } dialog.k-dialog.k-dialog-lg { max-width: 640px; }
dialog.k-dialog::backdrop, dialog.k-sheet::backdrop { background: rgb(0 0 0 / .55); }
dialog.k-dialog[open] { animation: k-dialog-in var(--k-base) var(--k-ease); }
@keyframes k-dialog-in { from { transform: translateY(8px) scale(0.98); } }
.k-dialog-title { margin: 0 0 8px; padding-right: 40px; font: 600 18px/1.3 var(--k-font-sans); color: var(--k-ink); text-wrap: balance; overflow-wrap: anywhere; }
.k-dialog-body { margin: 0; color: var(--k-muted); font: 400 15px/1.45 var(--k-font-sans); text-wrap: pretty; }
.k-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.k-dialog-x { position: absolute; top: 12px; right: 12px; }
@media (max-width: 479px) { .k-dialog-actions { flex-direction: column-reverse; } .k-dialog-actions .k-btn { width: 100%; } }
dialog.k-sheet { position: fixed; inset: auto 0 0 0; width: 100%; max-width: 100%; max-height: 90dvh; margin: 0; padding: 0 0 env(safe-area-inset-bottom); border-radius: var(--k-radius-lg) var(--k-radius-lg) 0 0; border-width: 1px 0 0; display: none; flex-direction: column; }
dialog.k-sheet[open] { display: flex; animation: k-sheet-up 250ms var(--k-ease); }
@keyframes k-sheet-up { from { transform: translateY(100%); } }
@media (min-width: 768px) {
  dialog.k-sheet { inset: 0 0 0 auto; height: 100dvh; max-height: none; max-width: 480px; border-radius: 0; border-width: 0 0 0 1px; padding-bottom: 0; }
  dialog.k-sheet[open] { animation-name: k-sheet-in; }
}
@keyframes k-sheet-in { from { transform: translateX(100%); } }
.k-sheet-head { flex: none; padding: 16px 56px 16px 20px; border-bottom: 1px solid var(--k-border); }
.k-sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px; }
.k-sheet-foot { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--k-border); }
.k-dialog-open, .k-dialog-open body { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { dialog.k-dialog[open], dialog.k-sheet[open] { animation: none; } }

/* Tooltip placement by CSS anchor positioning where supported (tip.js sets data-anchored). */
.k-tip[data-anchored] { position: fixed; position-anchor: --k-tip; inset: auto; margin: 0; position-area: top; margin-bottom: 8px; position-try-fallbacks: flip-block; position-try-order: most-height; justify-self: anchor-center; }

/* Right-edge fade on rows that scroll sideways (Jay, 2026-10-17): shows only while more sits off to the right,
   gone at the end and on rows that fit. Scroll-driven; browsers without it get the plain row. Add .k-scroll-row
   to any other sideways row (chips, filters). */
@property --k-fade { syntax: "<length>"; inherits: false; initial-value: 0px; }
@keyframes k-fade-edge { from { --k-fade: 32px; } to { --k-fade: 0px; } }
@supports (animation-timeline: scroll()) {
  .k-tabs, .k-scroll-row, .k-apptabs {
    animation: k-fade-edge linear both; animation-timeline: scroll(self inline);
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - var(--k-fade)), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - var(--k-fade)), transparent);
  }
}

/* Phone QA (Jay, 2026-11-11: "so fucked and sloppy on mobile"). Section tabs used to scroll sideways and cut the
   next tab mid-word ("Invent", "Or") with nothing saying more were there. Under 640px they wrap so every tab shows. */
@media (max-width: 640px) {
  .k-tabs, .k-subtabs-row { display: flex; flex-wrap: wrap; width: 100%; overflow: visible; -webkit-mask-image: none; mask-image: none; animation: none; }
  .k-tabs > *, .k-subtabs-row > * { flex: 1 1 auto; justify-content: center; }
}
/* 320px phones: Home, Inbox, Private Dining and More fit without the row sliding. */
@media (max-width: 359px) {
  .k-apptab { padding: 0 7px; font-size: 13px; }
  .k-apptabs { margin-left: -4px; }
}
/* 320px: long titles ("Guest Reviews") pushed the account button onto a second line. */
@media (max-width: 359px) {
  .k-appbar-title { padding: 0 6px 0 4px; }
  .k-appbar-title .k-roll { font-size: calc(var(--k-lockup-word) * 0.86); }
}
@media (max-width: 359px) { .k-appbar-mark img { width: calc(var(--k-lockup-mark) * 0.85); } .k-appbar-inner { gap: 0 2px; } }

/* ==========================================================================
   Page anatomy (Jay, 2026-11-12: "it feels like Frankenstein"). Every page, in this order, nothing else:
     1. .k-pagehead   the app subtitle (one-line purpose) left; freshness + at most 1 primary + 1 icon action right.
                      No H1 that repeats the app bar name or the selected tab ("Finance", "Overview"): the bar
                      already says it. Exception: a title that is data (Home's "Thursday, Nov 12").
     2. Row A         the family .k-subtabs (Inbox · Reviews · …) or the page's own .k-tabs. One level only.
     3. Row B         .k-toolbar: in-page view tabs (.k-tabs, orange) / filter chips / range left, search right.
                      Family nav = quiet underline (.k-subtab); views inside a page = orange fill (.k-tab).
     Max 2 control rows under the header. A third level becomes a <select> or a chip group in Row B.
     Sections:  .k-section-head (title, count, ⓘ help, right-side meta or link). No paragraph under a title:
                explanation goes in the ⓘ tooltip; visible text is only what someone acts on.
     Numbers:   .k-stats > .k-stat (label, value, delta, one detail line). Same size, same ink, every page.
   Static markup:
     <header class="k-pagehead"><p class="k-app-sub" data-k-subtitle></p>
       <div class="k-pagehead-actions"><span class="k-meta">Updated 3m ago</span><button class="k-btn k-btn-primary">New Party</button>
       <button class="k-btn k-btn-outline k-btn-icon" aria-label="Refresh" data-k-tip="Refresh">↻</button></div></header>
     <div class="k-toolbar"><div class="k-toolbar-start">chips/tabs</div><div class="k-toolbar-end">search</div></div>
     <div class="k-section-head"><h2 class="k-h-section">Needs a Look <span class="k-count">5</span></h2>
       <button class="k-help" aria-label="About Needs a Look" data-k-tip="…">i</button><span class="k-section-meta">…</span></div>
     <div class="k-stats"><div class="k-stat"><div class="k-stat-label">Covers <button class="k-help" …>i</button></div>
       <div class="k-stat-value">127<span class="k-stat-unit">/ 150</span></div><div class="k-stat-delta is-up">+12 vs last Thu</div>
       <div class="k-stat-detail">23 under cap</div></div></div>
   ========================================================================== */
.k-pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin: 0 0 20px; }
.k-pagehead > :first-child { min-width: 0; }
.k-pagehead .k-app-sub { margin: 0; }
.k-pagehead-sub { margin: 6px 0 0; font-size: var(--k-text-small); line-height: var(--k-text-small-lh); color: var(--k-muted); max-width: 64ch; text-wrap: pretty; }
.k-pagehead-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.k-meta { font-size: var(--k-text-meta); line-height: var(--k-text-meta-lh); font-weight: var(--k-text-meta-w); color: var(--k-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.k-meta.is-stale { color: var(--k-critical); }

.k-pagehead + .k-tabs, .k-pagehead + .k-subtabs { margin-bottom: 12px; }
.k-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 20px; }
.k-toolbar-start, .k-toolbar-end { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.k-toolbar-end { margin-left: auto; }
.k-toolbar .k-chip { white-space: nowrap; }
.k-toolbar .k-input[type="search"] { width: 240px; max-width: 100%; }
@media (max-width: 640px) {
  /* Phones: wrap, never scroll sideways: a chip cut in half ("Texts 3") hid the rest (Inbox QA 11/13). */
  .k-toolbar-start { width: 100%; }
  .k-toolbar-start > [role="group"] { display: flex; flex-wrap: wrap; gap: 6px; }
  .k-toolbar-end, .k-toolbar .k-input[type="search"] { width: 100%; margin-left: 0; }
}

.k-section-head { display: flex; align-items: center; gap: 8px; margin: 32px 0 12px; min-height: 28px; }
.k-section-head:first-child { margin-top: 0; }
.k-section-head .k-h-section { display: inline-flex; align-items: baseline; gap: 8px; }
.k-section-meta { margin-left: auto; font-size: var(--k-text-small); color: var(--k-muted); display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.k-count { font-family: var(--k-font-sans); font-size: var(--k-text-meta); font-weight: 600; line-height: 1; color: var(--k-muted); background: var(--k-raised); border-radius: 999px; padding: 4px 8px; font-variant-numeric: tabular-nums; }
.k-help { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--k-border-input); border-radius: 999px; background: none; color: var(--k-muted);
  font: 600 11px/1 var(--k-font-sans); font-style: italic; cursor: help; flex: none; position: relative; }
.k-help::after { content: ""; position: absolute; inset: -12px; }   /* 44px touch target */
.k-help:hover, .k-help:focus-visible { color: var(--k-ink); border-color: var(--k-ink); }
.k-help:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }

.k-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 12px; margin: 0 0 24px; }
.k-stat { background: var(--k-surface); border: 1px solid var(--k-border); border-radius: var(--k-radius-lg); padding: 16px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.k-stat-label { display: flex; align-items: center; gap: 6px; font-size: var(--k-text-label); line-height: var(--k-text-label-lh); font-weight: var(--k-text-label-w); color: var(--k-muted); }
.k-stat-value { font-family: var(--k-font-sans); font-size: 28px; line-height: 1.1; font-weight: 600; letter-spacing: -0.01em; color: var(--k-ink); font-variant-numeric: tabular-nums; }
.k-stat-unit { margin-left: 4px; font-size: var(--k-text-small); font-weight: 500; color: var(--k-muted); }
.k-stat-delta { font-size: var(--k-text-meta); font-weight: 600; color: var(--k-muted); font-variant-numeric: tabular-nums; }
.k-stat-delta.is-good { color: var(--k-good); } .k-stat-delta.is-bad { color: var(--k-critical); }
.k-stat-detail { font-size: var(--k-text-small); line-height: var(--k-text-small-lh); color: var(--k-muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.k-stat.is-alert { border-color: var(--k-critical); }
@media (max-width: 480px) { .k-stat { padding: 12px; } .k-stat-value { font-size: 24px; } }
button.k-stat[aria-pressed="true"] { border-color: var(--k-primary); box-shadow: inset 0 0 0 1px var(--k-primary); background: var(--k-raised); }
a.k-stat, button.k-stat { text-align: left; color: inherit; text-decoration: none; cursor: pointer; font: inherit; width: 100%; }
button.k-stat:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) { button.k-stat:active { transform: none; } }
a.k-stat:hover, button.k-stat:hover { background: var(--k-raised); }
a.k-stat:focus-visible, button.k-stat:focus-visible { outline: 2px solid var(--k-ring); outline-offset: 2px; }
/* Compact stats for narrow columns (sidebars): same anatomy, smaller number, fixed column count via data-cols. */
.k-stats.is-compact { gap: 8px; }
.k-stats.is-compact[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.k-stats.is-compact[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.k-stats.is-compact .k-stat { padding: 12px; }
.k-stats.is-compact .k-stat-value { font-size: 20px; }
/* Section head on phones: meta drops under the title instead of squeezing beside it. */
.k-section-head { flex-wrap: wrap; row-gap: 4px; }
@media (max-width: 640px) { .k-section-meta { flex-basis: 100%; margin-left: 0; flex-wrap: wrap; } }
/* Exactly 4 tiles: 2 x 2 until all 4 fit, never 3 + 1 (Feedback QA 11/13). */
.k-stats:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .k-stats:has(> :nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Exactly 3 tiles: one row from 560px, one column below; never 2 + 1. */
.k-stats:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 559px) { .k-stats:not(.is-compact):has(> :nth-child(3):last-child) { grid-template-columns: 1fr; } }

/* Chip rows on phones (Jay 2026-11-16: "buttons are squished"): any row of 3+ chips stays on ONE line and scrolls
   sideways instead of wrapping into a stack, with a soft fade on the right edge that hints there's more. */
@media (max-width: 640px) {
  :has(> :is(.k-chip,[data-chip]) + :is(.k-chip,[data-chip]) + :is(.k-chip,[data-chip])) {
    flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent);
    padding-right: 24px;
  }
  :has(> :is(.k-chip,[data-chip]) + :is(.k-chip,[data-chip]) + :is(.k-chip,[data-chip]))::-webkit-scrollbar { display: none; }
  :has(> :is(.k-chip,[data-chip]) + :is(.k-chip,[data-chip]) + :is(.k-chip,[data-chip])) > * { flex: none; }
}

/* Tab rows (role=tablist) on phones scroll sideways too, instead of stacking into a box (Jay 2026-11-16). */
@media (max-width: 640px) {
  .k-tabs[role=tablist] { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .k-tabs[role=tablist]::-webkit-scrollbar { display: none; }
  .k-tabs[role=tablist] > * { flex: none; }
}
