/* The look is design.md (gainforest-admin's system): one page, near-black type, greys for everything secondary,
   depth as fill, never borders, rings or outlined cards. Colour means state. The one exception is the chat, which looks
   like iMessage: your bubbles and the send button are iMessage blue, darkened to clear 4.5:1 for white text.
   `npm run check:design` fails on borders, rings and raw colours outside :root. */

@font-face { font-family: 'Geist'; src: url('/vendor/geist.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/vendor/geist-mono.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --ink: #ffffff;
  --raised: #f4f4f4;         /* elev-1 flattened onto ink, for opaque needs (sticky cells) */
  --raised-hover: #ececec;
  --raised-picked: #e8eef8;
  --panel: #ffffff;          /* elev-2: popovers, sheets, dialogs, toasts */
  --paper: #f6f6f3;          /* the signature pad: always light, the ink is dark */
  --on-state: #ffffff;       /* text on a filled state colour (badges, swipe actions) */
  --fg: #0a0a0b;
  --soft: #3c3c42;
  --muted: #66666f;
  --faint: #8a8a93;
  --line-strong: #cfcfcb;
  --check: #8a5a00;
  --gets: #18794e;
  --owes: #c2362b;
  --info: #1f62c9;
  --blue: #0a6fe0;           /* iMessage, darkened: 4.6:1 under white text */
  --bubble: #e9e9eb;         /* iMessage's grey bubble */
  --elev-1: rgb(10 10 11 / 0.045);
  --elev-1-hover: rgb(10 10 11 / 0.07);
  --hover: rgb(10 10 11 / 0.05);
  --well: rgb(10 10 11 / 0.03);
  --shadow-overlay: 0 12px 32px -8px rgb(10 10 11 / 0.14), 0 4px 12px -4px rgb(10 10 11 / 0.08);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 20px; --r-xl: 24px; --r-2xl: 28px; --r-3xl: 32px; --r-4xl: 40px;
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
  --side: 248px;
  --tabs: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --glass: rgb(255 255 255 / 0.86);
  --track: rgb(10 10 11 / 0.14);
  --line-faint: rgb(10 10 11 / 0.06);
  --scrim: rgb(10 10 11 / 0.2);
  --well-mine: rgb(255 255 255 / 0.16);
  --well-other: rgb(10 10 11 / 0.06);
  --highlight: rgb(255 204 0 / 0.28);
  --tint-done: rgb(24 121 78 / 0.1); --tint-info: rgb(31 98 201 / 0.1); --tint-waiting: rgb(138 90 0 / 0.1); --tint-bad: rgb(194 54 43 / 0.1); --tint-blue: rgb(10 111 224 / 0.1);
  --primary-hover: #2a2a2e;
  --on-dark: #ffffff;        /* text on the photo viewer and other fixed dark layers */
  --bubble-mine-fg: #ffffff;
  color-scheme: light;
}
/* Dark, following the phone. Owners check this late at night. */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #0b0b0c; --raised: #161618; --raised-hover: #1e1e21; --raised-picked: #172033; --panel: #1c1c1f; --on-state: #0b0b0c; --fg: #f2f2f0; --soft: #c9c9cf; --muted: #9a9aa3; --faint: #74747d; --line-strong: #3a3a40;
    --check: #e0a63a; --gets: #3ccf8e; --owes: #ff6b5e; --info: #6aa8ff; --blue: #1f7cf2; --bubble: #262629;
    --elev-1: rgb(255 255 255 / 0.07); --elev-1-hover: rgb(255 255 255 / 0.11); --hover: rgb(255 255 255 / 0.07); --well: rgb(255 255 255 / 0.04);
    --shadow-overlay: 0 12px 32px -8px rgb(0 0 0 / 0.6), 0 4px 12px -4px rgb(0 0 0 / 0.5);
    --glass: rgb(28 28 31 / 0.84); --track: rgb(255 255 255 / 0.18); --line-faint: rgb(255 255 255 / 0.08); --scrim: rgb(0 0 0 / 0.55);
    --well-other: rgb(255 255 255 / 0.07);
    --highlight: rgb(255 204 0 / 0.22);
    --tint-done: rgb(60 207 142 / 0.14); --tint-info: rgb(106 168 255 / 0.15); --tint-waiting: rgb(224 166 58 / 0.16); --tint-bad: rgb(255 107 94 / 0.15); --tint-blue: rgb(31 124 242 / 0.2);
    --primary-hover: #d8d8d4;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html {
  background: var(--ink); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; accent-color: var(--fg); -webkit-tap-highlight-color: transparent;
  scrollbar-color: var(--line-strong) transparent; -webkit-text-size-adjust: 100%;
}
body { margin: 0; min-height: 100dvh; }
::selection { background: var(--fg); color: var(--ink); }
input, textarea, button, select { font: inherit; color: inherit; }
input, textarea { caret-color: var(--fg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; border-radius: 6px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 3px solid var(--ink); } /* design-ok: insets the thumb */
::-webkit-scrollbar-track { background: transparent; }
input::placeholder, textarea::placeholder { color: var(--muted); }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 13px; color: var(--soft); }
.muted { color: var(--muted); }
.meta { font-size: 13px; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex-shrink: 0; }

/* ------------------------------------------------------------ motion: arrive by un-blurring */

/* Things arrive as opacity, a small move and a blur coming clear, and leave the same way, a little faster (.leaving).
   Centred overlays use the `translate` property for centring, so these transforms never fight it. */
@keyframes rise { from { opacity: 0; transform: translateY(8px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes leave { to { opacity: 0; transform: translateY(-6px) scale(0.98); filter: blur(6px); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(24px); filter: blur(6px); } }
@keyframes fade-out { to { opacity: 0; } }
.leaving { animation: leave 0.18s var(--ease) both !important; pointer-events: none; }
.overlay.leaving { animation: fade-out 0.2s ease-out both !important; }
.sheet.leaving { animation: sheet-out 0.22s var(--ease) both !important; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes typing { 0%, 60%, 100% { transform: none; opacity: 0.4; } 30% { transform: translateY(-3px); opacity: 1; } }
.rise { animation: rise 0.4s var(--ease) both; }

/* ------------------------------------------------------------ controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border: 0;
  border-radius: 999px; background: var(--elev-1); color: var(--fg); font-weight: 500; font-size: 15px; cursor: pointer;
  white-space: nowrap; transition: background-color 0.15s, transform 0.15s var(--ease), opacity 0.15s; text-decoration: none;
}
.btn:hover:not(:disabled) { background: var(--elev-1-hover); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--fg); color: var(--ink); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.danger-fill { background: var(--owes); color: var(--on-state); }
.btn.danger-fill:hover:not(:disabled) { filter: brightness(1.08); }
.btn.quiet { background: transparent; color: var(--muted); }
.btn.quiet:hover:not(:disabled) { background: var(--hover); color: var(--fg); }
.btn.danger, .btn.quiet.danger:hover:not(:disabled) { color: var(--owes); }
.btn.icon-only { width: 40px; padding: 0; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 14px; }
.btn.lg { height: 44px; padding: 0 20px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); cursor: pointer; transition: background-color 0.15s, color 0.15s, transform 0.15s var(--ease); flex-shrink: 0;
}
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }

.field {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 999px; background: var(--elev-1);
  border: 0; outline: none; width: 100%; font-size: 15px;
}
.field:focus-within, .field:focus { background: var(--elev-1-hover); outline: 2px solid var(--fg); outline-offset: 0; }
.field input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; height: 100%; }
textarea.field { height: auto; min-height: 88px; padding: 12px 16px; border-radius: var(--r-md); resize: vertical; }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 19px, calc(100% - 15px) 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
label.labelled { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
label.labelled > span { padding-left: 16px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--elev-1);
  font-size: 13px; color: var(--soft); white-space: nowrap; border: 0;
}
button.pill { cursor: pointer; }
button.pill:hover { background: var(--elev-1-hover); }
.dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; flex-shrink: 0; }
.tone-done { color: var(--gets); }
.tone-moving, .tone-info { color: var(--info); }
.tone-waiting { color: var(--check); }
.tone-bad { color: var(--owes); }
.tone-quiet { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.chip.tone-done { background: var(--tint-done); }
.chip.tone-moving, .chip.tone-info { background: var(--tint-info); }
.chip.tone-waiting { background: var(--tint-waiting); }
.chip.tone-bad { background: var(--tint-bad); }
.chip.tone-quiet { background: var(--elev-1); }
.chip.is-live .dot { animation: pulse 1.4s ease-in-out infinite; }

.segmented { display: inline-flex; gap: 4px; padding: 0; }
.segmented button {
  position: relative; height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 14px; transition: color 0.15s, background-color 0.25s var(--ease);
}
.segmented button:hover:not(:disabled) { color: var(--fg); }
.segmented button:disabled { cursor: default; }
.segmented button[aria-pressed='true'] { background: var(--elev-1); color: var(--fg); font-weight: 500; }

.switch { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--track); border: 0; cursor: pointer; flex-shrink: 0; transition: background-color 0.2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 999px; background: var(--paper); transition: transform 0.25s var(--ease); }
.switch[aria-checked='true'] { background: var(--gets); }
.switch[aria-checked='true']::after { transform: translateX(18px); }
.switch:disabled { opacity: 0.45; cursor: default; }

/* ------------------------------------------------------------ avatars */

.avatar { display: inline-block; flex-shrink: 0; border-radius: 999px; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.avatar.bot { border-radius: 30%; }


/* ------------------------------------------------------------ overlays */

.overlay { position: fixed; inset: 0; z-index: 40; background: var(--scrim); animation: fade 0.25s ease-out both; }
.sheet {
  position: fixed; z-index: 50; top: 12px; right: 12px; bottom: 12px; width: min(600px, calc(100vw - 24px)); display: flex; flex-direction: column;
  background: var(--panel); box-shadow: var(--shadow-overlay); border-radius: var(--r-3xl); overflow: hidden; animation: sheet-in 0.4s var(--ease) both; outline: none;
}
.sheet.narrow { width: min(460px, calc(100vw - 24px)); }
.sheet > header { display: flex; align-items: flex-start; gap: 12px; padding: 24px 24px 12px; }
.sheet > header h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.sheet > header p { margin-top: 4px; font-size: 14px; color: var(--muted); }
.sheet > header .grow { flex: 1; min-width: 0; }
.sheet > .body { flex: 1; overflow-y: auto; padding: 4px 24px 24px; mask-image: linear-gradient(to bottom, transparent 0, black 12px); -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 12px); }
.sheet > footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 24px 24px; }
.sheet form { display: grid; gap: 14px; }
.form-error { color: var(--owes); font-size: 14px; }

.popover {
  position: fixed; z-index: 60; min-width: 220px; max-height: min(420px, 70vh); overflow-y: auto; padding: 4px; border-radius: var(--r-xl);
  background: var(--panel); box-shadow: var(--shadow-overlay); animation: pop 0.2s var(--ease) both; transform-origin: var(--origin, top left);
}
.popover button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: var(--r-lg);
  background: transparent; color: var(--soft); cursor: pointer; text-align: left; font-size: 14px;
}
.popover button:hover, .popover button:focus-visible { background: var(--hover); color: var(--fg); outline: none; }
.popover button[aria-checked='true'] { color: var(--fg); font-weight: 500; }
.popover button.tone-bad, .popover button.tone-bad:hover { color: var(--owes); }
.popover button .grow { flex: 1; }
.popover hr { border: 0; height: 4px; margin: 0; }

.toast {
  position: fixed; z-index: 70; left: 50%; bottom: calc(24px + var(--safe-b) + var(--composer-h, 0px)); translate: -50% 0; min-height: 40px; display: flex; align-items: center;
  padding: 0 5px 0 18px; border-radius: 999px; background: var(--panel); gap: 6px;
  box-shadow: var(--shadow-overlay); font-size: 14px; animation: rise 0.3s var(--ease) both; white-space: nowrap;
  max-width: calc(100vw - 24px);
}
.toast > span { overflow: hidden; text-overflow: ellipsis; padding-right: 13px; }
.toast-action { border: 0; background: var(--elev-1); color: var(--fg); font-weight: 600; height: 30px; padding: 0 12px; border-radius: 999px; cursor: pointer; }
.toast-action:hover { background: var(--elev-1-hover); }
@media (max-width: 767px) { .toast { bottom: calc(var(--tabs) + 12px + var(--safe-b) + var(--composer-h, 0px)); } body:has(.shell[data-typing]) .toast { bottom: calc(12px + var(--composer-h, 0px)); } }
.toast.bad { color: var(--owes); }

.lightbox { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; background: rgb(10 10 11 / 0.92); animation: fade 0.2s both; outline: none; }
.lightbox.leaving { animation: fade-out 0.18s ease-out both !important; }
.lightbox .bar { display: flex; align-items: center; gap: 4px; padding: calc(10px + var(--safe-t)) 12px 6px 20px; color: var(--on-dark); font-size: 14px; }
.lightbox .bar .grow { flex: 1; }
.lightbox .count { opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox .stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 12px 12px calc(24px + var(--safe-b)); touch-action: none; overflow: hidden; }
.lightbox .stage img { max-width: 100%; max-height: 100%; border-radius: var(--r-md); animation: pop 0.3s var(--ease) both; background: var(--paper); user-select: none; -webkit-user-drag: none; will-change: transform; }
.icon-btn.on-dark { color: rgb(255 255 255 / 0.85); }
.icon-btn.on-dark:hover { background: rgb(255 255 255 / 0.12); color: var(--on-dark); }
.lightbox .lb-nav { position: absolute; top: 50%; margin-top: -20px; background: rgb(255 255 255 / 0.1); }
.lightbox .lb-nav.prev { left: 12px; } .lightbox .lb-nav.next { right: 12px; }
@media (pointer: coarse) { .lightbox .lb-nav { display: none; } }

.grip { display: none; width: 40px; height: 5px; border-radius: 99px; background: var(--track); margin: 8px auto -8px; flex-shrink: 0; }
.dialog-overlay { z-index: 90; }
.dialog { position: fixed; z-index: 91; left: 50%; top: 50%; translate: -50% -50%; width: min(400px, calc(100vw - 32px)); display: grid; gap: 12px;
  padding: 24px; border-radius: var(--r-3xl); background: var(--panel); box-shadow: var(--shadow-overlay); animation: pop 0.25s var(--ease) both; }
.dialog h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.dialog p { color: var(--muted); font-size: 14.5px; }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.skeleton { display: grid; gap: 2px; }
.skeleton.bare { background: none; padding: 0; }
.skeleton.bare .sk-row { padding: 4px 0; }
.sk-row { display: grid; gap: 8px; padding: 14px; }
.sk-line { display: block; height: 12px; border-radius: 99px; background: var(--elev-1-hover); animation: pulse 1.4s ease-in-out infinite; }
.sk-line.sm { height: 10px; opacity: 0.7; }

/* ------------------------------------------------------------ the shell: sidebar on a desk, tabs on a phone */

.shell { display: flex; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; width: var(--side); flex-shrink: 0; display: flex; flex-direction: column; gap: 20px; padding: 28px 20px; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; min-height: 40px; }
.side .brand strong { font-weight: 600; font-size: 15px; display: block; line-height: 1.2; }
.side .brand span { font-size: 13px; color: var(--muted); display: block; }
.side .brand .grow { min-width: 0; flex: 1; }
.side .brand .grow > * { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.side .team { display: grid; gap: 8px; min-width: 0; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; width: fit-content; align-items: center; gap: 10px; height: 38px; padding: 0 14px; border-radius: 999px; text-decoration: none;
  color: var(--soft); font-size: 16px; transition: background-color 0.15s, color 0.15s;
}
.nav a:hover { background: var(--hover); color: var(--fg); }
.nav a[aria-current='page'] { background: var(--elev-1); color: var(--fg); font-weight: 500; }
.nav a .icon { color: var(--muted); }
.nav a[aria-current='page'] .icon { color: var(--fg); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--owes); color: var(--on-state); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.nav a .badge { margin-left: auto; }
.nav a:has(.badge) { width: 100%; }
.badge.waiting { background: var(--check); }
.side .foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 0 0 0 8px; }
.side .foot .grow { flex: 1; min-width: 0; }
.side .foot strong { display: block; font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .foot span { display: block; font-size: 12.5px; color: var(--muted); }
.shop-switch { display: flex; align-items: center; gap: 8px; height: 40px; width: 100%; min-width: 0; padding: 0 14px 0 9px; border: 0; border-radius: 999px; background: var(--elev-1); cursor: pointer; font-size: 14px; color: var(--soft); }
.shop-switch:hover { background: var(--elev-1-hover); }
.shop-switch .grow { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.view { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page.wide { max-width: 1240px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; padding: 8px 14px; border-radius: 99px; background: var(--fg); color: var(--ink); }
.skip:focus { left: 8px; }
.conn-banner { position: fixed; z-index: 75; bottom: calc(24px + var(--safe-b) + var(--composer-h, 0px)); left: 50%; translate: -50% 0; display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 16px 0 14px; border-radius: 999px; background: var(--fg); color: var(--ink); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-overlay);
  animation: rise 0.3s var(--ease) both; max-width: calc(100vw - 24px); white-space: nowrap; }
.conn-banner > span { overflow: hidden; text-overflow: ellipsis; }
.conn-banner.back { background: var(--gets); color: var(--on-state); }
@media (max-width: 767px) { .conn-banner { bottom: calc(var(--tabs) + 12px + var(--safe-b) + var(--composer-h, 0px)); } }
body:has(.toast) .conn-banner { display: none; }
/* Every page sits in the middle of what the sidebar leaves, wide or narrow. */
.page { width: 100%; max-width: 860px; margin: 0 auto; padding: 32px 40px 64px; }
.section-lead { padding: 0 16px 8px; }
@media (min-width: 768px) and (max-width: 1023px) { :root { --side: 212px; } .page { padding: 28px 24px 56px; } .side { padding: 24px 12px; } }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; flex: 1; }

.tabs { display: none; }

@media (max-width: 767px) {
  .side { display: none; }
  .tabs {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(var(--tab-count, 4), 1fr);
    height: calc(var(--tabs) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--glass);
    -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
  }
  .tabs:empty { display: none; }
  .tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; min-height: 48px; }
  .tabs a:active .icon { transform: scale(0.9); }
  .tabs a .icon { transition: transform 0.15s var(--ease); }
  .tabs a[aria-current='page'] { color: var(--fg); }
  .tabs a .badge { position: absolute; top: 4px; left: calc(50% + 8px); }
  .shell[data-typing] .tabs { display: none; }
  .view { padding-bottom: calc(var(--tabs) + var(--safe-b)); }
  .shell[data-typing] .view { padding-bottom: 0; }
  .page { padding: calc(20px + var(--safe-t)) 16px 40px; }
  .view:has(> .phone-top) .page { padding-top: 16px; }
  .view:has(> .phone-top) { --phone-top: calc(52px + var(--safe-t)); }
  .view:has(> .phone-top) .chat-head { padding-top: 10px; }
  .page-head h1 { font-size: 24px; }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: calc(100dvh - 12px - var(--safe-t)); border-radius: var(--r-3xl) var(--r-3xl) 0 0; }
  .sheet.narrow { width: 100%; height: auto; max-height: calc(100dvh - 40px); }
  .sheet .grip { display: block; }
  .sheet > header { touch-action: none; }
  .desk-only { display: none !important; }
  .sheet > header { padding: 20px 20px 8px; }
  .sheet > .body { padding: 0 20px 20px; }
  .sheet > footer { padding: 12px 20px calc(16px + var(--safe-b)); }
  .phone-top { display: flex !important; }
}
.phone-top { display: none; gap: 8px; align-items: center; height: calc(52px + var(--safe-t)); padding: calc(12px + var(--safe-t)) 16px 0; }
.phone-top .shop-switch { flex: 1; }

/* ------------------------------------------------------------ sections, rows and cards */

.section { margin-bottom: 28px; }
.section > h2 { font-size: 13px; font-weight: 500; color: var(--muted); padding: 0 16px 8px; display: flex; align-items: center; gap: 8px; }
.section > h2 .grow { flex: 1; }
.section > p.meta { padding: 0 16px; }
.card { background: var(--elev-1); border-radius: var(--r-3xl); padding: 6px; }
.card.pad { padding: 20px; }
.rows { display: flex; flex-direction: column; gap: 2px; }
.row {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border-radius: var(--r-xl);
  text-decoration: none; color: inherit; transition: background-color 0.15s;
}
a.row:hover, button.row:hover, .row.clickable:hover { background: var(--hover); }
button.row { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--fg); font-size: 16px; font-weight: 500; margin-bottom: 4px; }

.setting { display: flex; align-items: center; gap: 16px; padding: 14px 14px; min-height: 64px; border-radius: var(--r-xl); flex-wrap: wrap; }
.setting .grow { flex: 1; min-width: 200px; }
.setting .title { font-weight: 500; }
.setting .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumb { display: block; width: 72px; height: 54px; border-radius: var(--r-sm); object-fit: cover; background: var(--elev-1); cursor: zoom-in; border: 0; padding: 0; }
.thumb.file { display: grid; place-items: center; color: var(--muted); font-size: 11px; cursor: pointer; }

/* ------------------------------------------------------------ the chat */

.chat-wrap { display: flex; height: 100dvh; min-width: 0; }
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100dvh; }
@media (max-width: 767px) { .chat-wrap, .chat { height: calc(100dvh - var(--tabs) - var(--safe-b) - var(--phone-top, 0px)); } .shell[data-typing] .chat-wrap, .shell[data-typing] .chat { height: calc(100dvh - var(--phone-top, 0px)); } }
.chat-head { position: relative; z-index: 3; padding: calc(10px + var(--safe-t)) 16px 6px 20px; background: var(--ink); }
.chat-title { display: flex; align-items: center; gap: 4px; max-width: 760px; margin: 0 auto; }
.head-button { padding: 0 !important; min-height: 0 !important; gap: 10px !important; flex: 1; min-width: 0; border-radius: var(--r-md) !important; }
.chat-head .grow { flex: 1; min-width: 0; }
.chat-head h1 { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.25; }
.chat-head .status { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 18px; transition: color 0.2s; }
.chat-head .status.busy { color: var(--info); }
.chat-head .status.warn { color: var(--check); }
.chat-head .status .icon { vertical-align: -2px; }
.spinner { display: inline-block; width: 10px; height: 10px; border-radius: 99px; border: 1.6px solid currentColor; border-right-color: transparent; vertical-align: -1px; animation: spin 0.8s linear infinite; } /* design-ok: a spinner is a stroke */
@keyframes spin { to { transform: rotate(360deg); } }
.search-bar { position: relative; display: flex; gap: 8px; align-items: center; max-width: 760px; margin: 0 auto; }
.search-bar .field { height: 38px; flex: 1; }
.search-bar input::-webkit-search-cancel-button { display: none; }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; width: auto; max-height: 60vh; }
.search-results button { align-items: flex-start; padding: 8px 12px; min-height: 48px; }
.search-results button .grow { white-space: normal; line-height: 1.35; min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
mark { background: var(--highlight); color: inherit; border-radius: 3px; padding: 0 1px; }

.chat-mid { position: relative; flex: 1; min-height: 0; display: flex; }
.chat-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  mask-image: linear-gradient(to bottom, transparent 0, black 20px, black calc(100% - 8px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 20px, black calc(100% - 8px), transparent 100%); }
.thread { max-width: 760px; margin: 0 auto; padding: 16px 20px 12px; display: flex; flex-direction: column; touch-action: pan-y; --reveal: 0px; }
.jump {
  position: absolute; right: 18px; bottom: 14px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 12px;
  justify-content: center; border: 0; border-radius: 999px; background: var(--panel);
  box-shadow: var(--shadow-overlay); color: var(--fg); cursor: pointer; font-size: 13px; font-weight: 600; animation: pop 0.2s var(--ease) both;
}
.jump span { color: var(--blue); }
.older { text-align: center; font-size: 12.5px; color: var(--muted); min-height: 24px; padding: 8px 0; }
.filter-bar { position: sticky; top: 8px; z-index: 1; align-self: center; display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 8px; padding: 4px 4px 4px 14px;
  border-radius: 999px; background: var(--panel); box-shadow: var(--shadow-overlay); font-size: 13px; color: var(--soft); }
.day { align-self: center; margin: 18px 0 10px; font-size: 12px; color: var(--muted); font-weight: 500; }
.unread-line { align-self: center; margin: 14px 0 6px; }

.group { display: flex; flex-direction: column; margin-top: 10px; }
.group .who { font-size: 12px; color: var(--muted); padding: 0 12px 2px 50px; }
.group .line { position: relative; display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; transform: translateX(calc(-1 * var(--reveal))); }
.group .under { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-left: 38px; margin-top: 4px; transform: translateX(calc(-1 * var(--reveal))); }
.group.mine .under { align-items: flex-end; padding-left: 0; }
.thread.revealing .line, .thread.revealing .under { transition: none; }
.thread:not(.revealing) .line, .thread:not(.revealing) .under { transition: transform 0.3s var(--ease); }
.group.mine .line { flex-direction: row-reverse; }
.group .line .slot { width: 30px; flex-shrink: 0; align-self: flex-end; }
.group .line .slot .avatar { display: block; margin-bottom: 2px; }
.group .line .body { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; max-width: min(78%, 560px); }
.group.mine .line .body { align-items: flex-end; }
/* Times sit off the right edge; swipe the thread left to see them (a desk shows them in the hover bar). */
.group .line time.stamp { position: absolute; right: -66px; bottom: 8px; width: 60px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.group .line .reply-hint { position: absolute; left: 6px; top: 50%; width: 28px; height: 28px; margin-top: -14px; border-radius: 99px; display: grid; place-items: center;
  background: var(--elev-1); color: var(--muted); opacity: 0; transform: scale(0.6); transition: opacity 0.15s, transform 0.2s var(--ease); pointer-events: none; }
.group.mine .line .reply-hint { left: auto; right: auto; left: 0; }
.group .line.replying .reply-hint { opacity: 1; transform: scale(1); color: var(--fg); }
.group .line.pressed .body { transform: scale(0.97); transition: transform 0.15s var(--ease); }
.group .line.flash .body { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 30% { filter: drop-shadow(0 0 0 transparent) brightness(0.88); } 100% { filter: none; } }
.group .line.fresh .body { animation: rise 0.35s var(--ease) both; }
.group .line.pending .bubble { opacity: 0.85; }
.group .line.pending.failed .bubble { --fill: var(--owes); opacity: 1; }
.group .line.pending.queued .bubble { opacity: 0.6; }
.receipt { align-self: flex-end; display: inline-flex; align-items: center; gap: 4px; margin: 3px 4px 0 0; padding: 0; border: 0; background: none; font-size: 11.5px;
  color: var(--muted); cursor: default; font-weight: 500; }
button.receipt { cursor: pointer; }
.receipt.failed { color: var(--owes); cursor: pointer; }
.receipt.queued { color: var(--check); }
.hover-actions { position: absolute; bottom: 2px; display: none; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow-overlay); z-index: 1;
  animation: pop 0.15s var(--ease) both; }
.group:not(.mine) .hover-actions { left: calc(100% + 6px); }
.group.mine .hover-actions { right: calc(100% + 6px); flex-direction: row-reverse; }
.group .line:hover .hover-actions { display: inline-flex; }
.hover-actions time { font-size: 11.5px; color: var(--muted); padding: 0 6px 0 8px; white-space: nowrap; }
.group.mine .hover-actions time { padding: 0 8px 0 6px; }
.hover-actions button { width: 28px; height: 28px; border: 0; border-radius: 99px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.hover-actions button:hover { background: var(--hover); color: var(--fg); }
@media (hover: none) { .hover-actions { display: none !important; } }

.bubble {
  --fill: var(--bubble);
  position: relative; padding: 7px 13px; border-radius: 18px; background: var(--fill); color: var(--fg); white-space: pre-wrap;
  overflow-wrap: anywhere; line-height: 1.38; font-size: 15.5px; width: fit-content; max-width: 100%; user-select: text; -webkit-user-select: text;
}
.group.mine .bubble { --fill: var(--blue); color: var(--bubble-mine-fg); }
.bubble a { color: inherit; text-decoration: underline; }
.bubble .edited { font-size: 12px; opacity: 0.65; }
.bubble.deleted, .group.mine .bubble.deleted { --fill: var(--well); color: var(--muted); font-style: italic; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
/* iMessage tails: on the last bubble of a run, in the bubble's own fill. */
.bubble.tail::before, .bubble.tail::after { content: ''; position: absolute; bottom: 0; height: 18px; }
.bubble.tail::before { left: -7px; width: 20px; background: var(--fill); border-bottom-right-radius: 16px 14px; }
.bubble.tail::after { left: -10px; width: 10px; background: var(--ink); border-bottom-right-radius: 10px; }
.group.mine .bubble.tail::before { left: auto; right: -7px; border-bottom-right-radius: 0; border-bottom-left-radius: 16px 14px; }
.group.mine .bubble.tail::after { left: auto; right: -10px; border-bottom-right-radius: 0; border-bottom-left-radius: 10px; }
.bubble.deleted::before, .bubble.deleted::after { display: none; }
.bubble .mention { font-weight: 600; }
.bubble .mention.me { background: var(--highlight); border-radius: 4px; padding: 0 2px; }
.group.mine .bubble .mention { color: var(--bubble-mine-fg); }
.bubble.emoji, .group.mine .bubble.emoji { --fill: transparent; color: var(--fg); font-size: 34px; padding: 0 4px; }
.bubble.emoji::before, .bubble.emoji::after { display: none; }
/* A reply carries what it answers inside the same bubble, as on WhatsApp: a tinted well with corners that nest
   (18 outside, 4 padding, 14 inside) and a straight rail on its left edge, clipped by those corners. */
.bubble.has-quote { padding: 4px 4px 7px; min-width: min(220px, 100%); }
.bubble.has-quote > .text { display: block; padding: 3px 9px 0; }
.bubble.has-quote.quote-only { padding-bottom: 4px; }
.quote { position: relative; display: grid; gap: 1px; width: 100%; text-align: left; border: 0; cursor: pointer; padding: 6px 12px 7px 14px; border-radius: 14px;
  font: inherit; font-size: 13.5px; line-height: 1.3; background: var(--well-other); color: var(--soft); overflow: hidden; white-space: normal; }
.quote::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--blue); }
.quote b { font-weight: 600; color: var(--blue); font-size: 13px; }
.quote span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.group.mine .quote { background: var(--well-mine); color: rgb(255 255 255 / 0.85); }
.group.mine .quote::before { background: var(--bubble-mine-fg); }
.group.mine .quote b { color: var(--bubble-mine-fg); }
.quote:hover { filter: brightness(0.97); }
.reactions { display: flex; gap: 4px; flex-wrap: wrap; }
.reaction { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 9px; border-radius: 999px; border: 0; cursor: pointer; font-size: 14px;
  background: var(--elev-1); color: var(--soft); animation: pop 0.2s var(--ease) both; transition: background-color 0.15s; }
.reaction:hover { background: var(--elev-1-hover); }
.reaction.mine { background: var(--tint-blue); color: var(--blue); }
.reaction span { font-size: 12px; font-weight: 600; }

.attach { display: flex; gap: 3px; flex-wrap: wrap; }
.group.mine .attach { justify-content: flex-end; }
.pic { position: relative; display: block; padding: 0; border: 0; background: var(--paper); border-radius: 18px; overflow: hidden; cursor: zoom-in; }
.pic img { display: block; max-width: min(240px, 60vw); max-height: 260px; border-radius: 18px; }
.attach.grid { display: grid; grid-template-columns: 1fr 1fr; width: min(260px, 64vw); }
.attach.grid .pic { aspect-ratio: 1; border-radius: 6px; }
.attach.grid .pic:first-child { border-top-left-radius: 18px; } .attach.grid .pic:nth-child(2) { border-top-right-radius: 18px; }
.attach.grid .pic:nth-last-child(2):nth-child(odd), .attach.grid.n3 .pic:nth-child(3) { border-bottom-left-radius: 18px; }
.attach.grid .pic:last-child { border-bottom-right-radius: 18px; }
.attach.grid.n3 .pic:nth-child(3) { grid-column: 1 / -1; aspect-ratio: 2; }
.attach.grid .pic img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; border-radius: 0; }
.pic[data-more]::after { content: attr(data-more); position: absolute; inset: 0; display: grid; place-items: center; background: rgb(0 0 0 / 0.45); color: var(--on-dark); font-size: 22px; font-weight: 600; }
.pic .facts { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 4px; pointer-events: none; }
.pic .facts i { font-style: normal; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: rgb(10 10 11 / 0.72); color: var(--on-dark);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: rise 0.4s var(--ease) both; font-family: var(--mono); }
.pic .facts i:nth-child(2) { animation-delay: 0.08s; } .pic .facts i:nth-child(3) { animation-delay: 0.16s; }
.pic.scanning::before { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: inherit;
  background: linear-gradient(180deg, transparent 0%, rgb(84 168 255 / 0.0) 40%, rgb(84 168 255 / 0.45) 50%, rgb(84 168 255 / 0) 60%, transparent 100%);
  background-size: 100% 220%; animation: scan 1.3s ease-in-out infinite; }
@keyframes scan { 0% { background-position: 0 120%; } 100% { background-position: 0 -20%; } }
.attach .file, span.file { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 18px; background: var(--bubble); text-decoration: none; font-size: 14px; color: var(--fg); }

.voice { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 20px; background: var(--bubble); width: min(260px, 66vw); color: var(--fg); }
.voice.mine { background: var(--blue); color: var(--bubble-mine-fg); }
.voice.sending { width: auto; padding: 10px 14px; gap: 8px; opacity: 0.8; }
.voice .play { width: 34px; height: 34px; border-radius: 99px; border: 0; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; background: var(--ink); color: var(--fg); }
.voice.mine .play { background: var(--bubble-mine-fg); color: var(--blue); }
.voice .wave-wrap { flex: 1; min-width: 0; display: grid; gap: 2px; }
.voice .wave { height: 26px; display: flex; align-items: center; gap: 2px; cursor: pointer; touch-action: none; }
.voice .wave i { flex: 1; min-height: 3px; border-radius: 2px; background: currentColor; opacity: 0.35; transition: opacity 0.1s; }
.voice .wave i.on { opacity: 1; }
.voice .under { display: flex; align-items: center; gap: 8px; font-size: 11.5px; opacity: 0.8; }
.voice .speed { border: 0; background: rgb(127 127 127 / 0.2); color: inherit; font-size: 11px; font-weight: 600; height: 18px; padding: 0 6px; border-radius: 99px; cursor: pointer; }
.voice .transcript { font-size: 13.5px; margin-top: 4px; }

.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 99px; background: var(--muted); animation: typing 1.2s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; } .typing i:nth-child(3) { animation-delay: 0.3s; }
.skeleton-thread { display: flex; flex-direction: column; gap: 10px; padding: 20px 0; }
.sk-bubble { height: 36px; border-radius: 18px; background: var(--elev-1); animation: pulse 1.4s ease-in-out infinite; }
.sk-bubble.mine { align-self: flex-end; }

/* Cards under a bot message: a question, an OK, a filing on screen, a button, suggestions. */
/* A card is an elev-1 box (24px corners, 12px in); what sits in it nests at 12px. */
/* minmax(0, 1fr): long text inside (a list, a table) wraps or scrolls in its own box instead of widening the card. */
.cardlet { width: min(420px, 100%); background: var(--elev-1); border-radius: var(--r-xl); padding: 14px 12px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.cardlet > .title, .cardlet > .head, .cardlet > ul, .cardlet > .meta, .cardlet > .answered, .cardlet > .who-row { padding: 0 4px; }
.cardlet .title { font-weight: 600; font-size: 15px; line-height: 1.3; }
.cardlet .meta, .cardlet ul { font-size: 14px; color: var(--soft); }
.cardlet ul { margin: 0; list-style: none; display: grid; gap: 2px; }
.cardlet .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cardlet .answered { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.cardlet .options { display: flex; gap: 8px; flex-wrap: wrap; }
.card-progress { display: grid; gap: 6px; animation: rise 0.3s var(--ease) both; }
.card-progress.done .progress i { background: var(--gets); }
.action-card { align-self: flex-start; margin-top: 2px; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; }
.suggest .pill, .suggestions .pill { color: var(--fg); height: 34px; padding: 0 14px; font-size: 14px; transition: background-color 0.15s, transform 0.15s var(--ease); }
.suggest .pill:active, .suggestions .pill:active { transform: scale(0.97); }
.suggestions .pill:disabled { opacity: 0.45; }
.screen { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; border-radius: var(--r-sm); overflow: hidden; background: var(--paper); border: 0; padding: 0; cursor: zoom-in; }
.screen img { display: block; width: 100%; height: 100%; object-fit: cover; }
.progress { height: 4px; border-radius: 99px; background: var(--elev-1-hover); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--info); border-radius: 99px; transition: width 0.6s var(--ease); }
.run-caption { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-height: 24px; }
.cardlet .progress, .cardlet .run-caption { margin: 0 4px; }
.run-caption .chip { flex-shrink: 0; }
.run-caption .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The message menu: reactions on top, actions under. */
.msg-menu { min-width: 240px; }
.emoji-row { display: flex; gap: 2px; padding: 4px; }
.emoji-row button { justify-content: center; width: 40px !important; min-height: 40px; padding: 0 !important; font-size: 22px; border-radius: 99px !important; transition: transform 0.15s var(--ease); }
.emoji-row button:hover, .emoji-row button:focus-visible { transform: scale(1.18); }

/* The message box, as on an iPhone: a round plus, a pill that grows, the blue arrow or the microphone inside it. */
.composer { position: relative; z-index: 2; padding: 6px 16px calc(10px + var(--safe-b)); background: var(--ink); }
.composer.dropping .box { background: var(--tint-blue); }
@media (max-width: 767px) { .composer { padding-bottom: 10px; } .shell[data-typing] .composer { padding-bottom: calc(10px + var(--safe-b)); } }
.composer .inner { position: relative; max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; }
.suggestions { max-width: 760px; margin: 0 auto 8px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 0 48px; }
.suggestions::-webkit-scrollbar { display: none; }
.suggestions .pill { flex-shrink: 0; }
/* A row that scrolls sideways fades at the edge that has more, so it reads as more. */
.hscroll.more-end { mask-image: linear-gradient(to right, black calc(100% - 40px), transparent); -webkit-mask-image: linear-gradient(to right, black calc(100% - 40px), transparent); }
.hscroll.more-start { mask-image: linear-gradient(to right, transparent, black 40px); -webkit-mask-image: linear-gradient(to right, transparent, black 40px); }
.hscroll.more-start.more-end { mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent); -webkit-mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent); }
/* Replying or editing: the same well as a quote in a bubble, above the box. */
.context-bar { max-width: 760px; margin: 0 auto 6px; display: flex; align-items: center; gap: 10px; padding: 0 4px 0 0; margin-left: max(48px, calc((100% - 760px) / 2 + 48px));
  border-radius: 18px; background: var(--elev-1); animation: rise 0.2s var(--ease) both; color: var(--muted); overflow: hidden; position: relative; }
.context-bar::before { content: ''; align-self: stretch; width: 4px; background: var(--blue); flex-shrink: 0; }
.context-bar > .icon { color: var(--blue); }
.context-bar .grow { min-width: 0; display: grid; font-size: 13.5px; line-height: 1.3; padding: 7px 0; }
.context-bar b { color: var(--blue); font-weight: 600; font-size: 13px; }
.context-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plus {
  width: 40px; height: 40px; border-radius: 999px; border: 0; background: var(--elev-1); color: var(--soft); display: grid; place-items: center;
  cursor: pointer; flex-shrink: 0; transition: transform 0.15s var(--ease), background-color 0.15s;
}
.plus:hover { background: var(--elev-1-hover); }
.plus:active { transform: scale(0.92); }
.box {
  flex: 1; min-width: 0; display: flex; flex-direction: column; border-radius: 20px; background: var(--elev-1); transition: background-color 0.15s;
}
.box:focus-within { background: var(--elev-1-hover); }
.box .pending { display: flex; gap: 6px; padding: 8px 8px 0; flex-wrap: wrap; }
.box .pending .thumbwrap { position: relative; }
.box .pending img, .box .pending .pdf { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; display: grid; place-items: center; background: var(--elev-1); font-size: 11px; color: var(--muted); }
.box .pending .uploading img { opacity: 0.55; }
.box .pending .ring { position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 99px;
  background: conic-gradient(var(--on-dark) calc(var(--p) * 1%), rgb(255 255 255 / 0.3) 0); -webkit-mask: radial-gradient(circle, transparent 9px, black 10px); mask: radial-gradient(circle, transparent 9px, black 10px); }
.box .pending .remove { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 99px; border: 0; background: var(--fg); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.box .line { display: flex; align-items: flex-end; }
.box textarea {
  flex: 1; min-width: 0; border: 0; outline: none; resize: none; background: transparent; padding: 9px 4px 9px 16px; font-size: 16px; line-height: 22px;
  max-height: 140px; min-height: 40px; height: 40px;
}
.box textarea:focus-visible { outline: none; }
.action-slot { display: contents; }
.send, .mic {
  width: 32px; height: 32px; margin: 4px; border-radius: 999px; border: 0; display: grid; place-items: center;
  cursor: pointer; flex-shrink: 0; animation: pop 0.2s var(--ease) both; transition: transform 0.15s var(--ease);
}
.send { background: var(--blue); color: var(--bubble-mine-fg); }
.mic { background: transparent; color: var(--muted); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.mic:hover { color: var(--fg); }
.send:active, .mic:active { transform: scale(0.9); }
.send:disabled { opacity: 0.45; }
.composer.recording .box, .composer.recording .plus { visibility: hidden; }
.rec-bar { position: absolute; inset: 0; display: flex; align-items: center; gap: 10px; padding: 0 4px 0 12px; border-radius: 20px; background: var(--raised);
  animation: fade 0.15s both; transform: translateX(var(--slide, 0)); }
.rec-dot { width: 10px; height: 10px; border-radius: 99px; background: var(--owes); animation: pulse 1s ease-in-out infinite; flex-shrink: 0; }
.rec-time { font-size: 14px; font-weight: 600; min-width: 36px; }
.rec-levels { flex: 1; height: 26px; display: flex; align-items: center; gap: 2px; overflow: hidden; color: var(--owes); }
.rec-levels i { flex: 1; min-width: 2px; height: 12%; border-radius: 2px; background: currentColor; opacity: 0.8; transition: height 0.08s; }
.rec-hint { font-size: 12.5px; color: var(--muted); white-space: nowrap; padding-right: 8px; }
.mention-pop { bottom: calc(100% + 6px); left: 60px; position: absolute; }

/* The job being talked about, beside the chat on a wide screen. */
.chat-aside { display: none; }
@media (min-width: 1280px) {
  .chat-aside { display: flex; flex-direction: column; gap: 16px; width: 320px; flex-shrink: 0; margin: 12px 12px 12px 0; padding: 22px 16px 16px; overflow-y: auto;
    background: var(--elev-1); border-radius: var(--r-3xl); height: calc(100dvh - 24px); }
  .chat-aside .aside-head { padding: 0 4px; }
  .chat-aside .aside-head h2 { font-size: 18px; font-weight: 600; margin-top: 2px; }
  .chat-aside .aside-filings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; background: var(--elev-1); border-radius: var(--r-xl); padding: 4px; }
  .chat-aside .aside-filings .row { min-height: 48px; padding: 6px 12px; border-radius: var(--r-lg); }
  .chat-aside .aside-filings > .meta { padding: 8px 12px 4px; }
  .chat-aside .aside-filings .glyph-sq { width: 28px; height: 28px; }
  .chat-aside .aside-filings .row .title { font-size: 14px; }
  .chat-aside .aside-needs { display: grid; gap: 6px; font-size: 14px; padding: 0 4px; }
  .chat-aside .need { display: flex; align-items: center; gap: 8px; color: var(--soft); }
  .chat-aside .need .icon { color: var(--muted); }
  .chat-aside .need .from { font-size: 12.5px; color: var(--muted); }
  .chat-aside .aside-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
  .chat-aside .empty { padding: 32px 8px; }
}

/* ------------------------------------------------------------ activity */

.feed { display: flex; flex-direction: column; gap: 2px; }
.item { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-xl); }
.item .glyph { width: 32px; height: 32px; border-radius: 10px; background: var(--elev-1); display: grid; place-items: center; color: var(--soft); flex-shrink: 0; }
.item .glyph.tone-done { background: var(--tint-done); }
.item .glyph.tone-waiting { background: var(--tint-waiting); }
.item .glyph.tone-moving { background: var(--tint-info); }
.item .glyph.tone-bad { background: var(--tint-bad); }
.item .grow { flex: 1; min-width: 0; display: grid; gap: 6px; }
.item .head { display: flex; gap: 8px; align-items: baseline; }
.item .head .title { flex: 1; font-weight: 500; line-height: 1.35; }
.item .head .chip { align-self: center; }
.item .head time { font-size: 12.5px; color: var(--muted); flex-shrink: 0; }
.item .caption { font-size: 13.5px; color: var(--muted); margin-top: -4px; }
.live-card { display: grid; gap: 12px; padding: 16px; }
.live-card .head { display: flex; gap: 10px; align-items: center; }
.live-card .head .title { flex: 1; font-weight: 600; }
.waiting-list { display: grid; gap: 8px; }
.waiting-list .cardlet { width: 100%; padding: 18px 16px 16px; }
.waiting-list .for { font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------ jobs */

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .field { flex: 1; min-width: 200px; height: 40px; }
.job-row .end { flex-direction: column; align-items: flex-end; gap: 4px; }
.filing { display: grid; gap: 12px; padding: 18px; }
.filing .head { display: flex; align-items: center; gap: 10px; }
.filing .head .title { flex: 1; font-weight: 600; font-size: 16px; }
.filing .facts { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.filing .facts b { color: var(--fg); font-weight: 500; }
.needs { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.needs li { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 28px; }
.needs li .grow { flex: 1; }
.needs li.ok { color: var(--muted); }
.needs li.ok .icon { color: var(--gets); }
.needs li.no .icon { color: var(--muted); }
.needs .from { font-size: 12.5px; color: var(--muted); }
.facts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
@media (max-width: 520px) { .facts-grid { grid-template-columns: 1fr; } }
.fact { display: grid; gap: 1px; padding: 8px 12px; border-radius: var(--r-lg); cursor: text; border: 0; background: transparent; text-align: left; width: 100%; }
.fact:hover { background: var(--hover); }
.fact .label { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.fact .label .icon { opacity: 0; transition: opacity 0.15s; }
.fact:hover .label .icon, .fact:focus-visible .label .icon { opacity: 1; }
@media (hover: none) { .fact .label .icon { opacity: 0.7; } }
.card > .facts-grid + .rows { margin-top: 2px; }
.fact .value { min-height: 22px; overflow-wrap: anywhere; }
.fact .value.missing { color: var(--muted); }
.fact:disabled { cursor: default; color: inherit; }
.fact:disabled:hover { background: transparent; }
.fact input, .fact select { width: 100%; border: 0; outline: 2px solid var(--fg); border-radius: 8px; padding: 2px 6px; margin: -2px -6px; background: var(--panel); }
.fact.invalid input { outline-color: var(--owes); }
.group-title { font-size: 13px; color: var(--muted); font-weight: 500; padding: 14px 12px 4px; grid-column: 1 / -1; }
.group-title:first-child { padding-top: 6px; }

/* ------------------------------------------------------------ sign-in */

/* Sign-in pages sit at a fixed height, so an error under the form never moves what's above it. */
.center { min-height: 100dvh; display: grid; justify-items: center; align-content: start; padding: clamp(40px, 14vh, 140px) 24px calc(32px + var(--safe-b)); }
.signin { width: min(380px, 100%); display: grid; gap: 18px; text-align: center; animation: rise 0.5s var(--ease) both; }
.signin h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.signin p { color: var(--muted); }
.signin .form-error { color: var(--owes); text-align: left; padding: 0 16px; font-size: 14px; animation: rise 0.25s var(--ease) both; }
.signin > .avatar, .signin > .waiting-art { justify-self: center; }
.signin form { display: grid; gap: 10px; margin-top: 6px; }
.signin .hint { font-size: 13px; color: var(--muted); }
.or { font-size: 13px; color: var(--muted); margin: -2px 0; }
.btn.google { width: 100%; }
.btn.google svg { flex-shrink: 0; }


/* ------------------------------------------------------------ Munshi: views, queue, handoffs, live view, dashboards */

/* A tab arrives softly: a short fade and a lift, quicker than a sheet. */
@keyframes view-in { from { opacity: 0; transform: translateY(6px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.view-in { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; animation: view-in 0.26s var(--ease) both; }

/* Cards that wait on the owner breathe a little; approvals press in. */
.cardlet.approve .lines { display: grid; gap: 4px; padding: 0 2px; }
.cardlet.approve .quoteline { white-space: pre-wrap; padding: 10px 12px; border-radius: var(--r-md); background: var(--well); color: var(--soft); font-size: 14.5px; }
.cardlet .answered.tone-bad { color: var(--owes); }
.btn.busy { position: relative; overflow: hidden; }
.btn.busy::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / 0.25) 50%, transparent 80%); animation: shimmer 1s linear infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.cardlet.handoff { display: grid; gap: 12px; }
.cardlet.handoff .head { display: flex; gap: 12px; align-items: flex-start; }
.cardlet.handoff .head .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.countdown { font-size: 12.5px; color: var(--muted); padding-top: 2px; }
.glyph-sq.pulse { position: relative; isolation: isolate; color: var(--fg); }
.glyph-sq.pulse::after { content: ''; position: absolute; inset: -4px; border-radius: 99px; background: var(--tint-info); z-index: -1; animation: breathe 2.2s ease-in-out infinite; }
.code-display { display: flex; justify-content: center; gap: 6px; padding: 16px 12px; border: 0; border-radius: var(--r-lg); background: var(--well); cursor: copy; font-family: var(--mono); }
.code-display .ch { display: grid; place-items: center; width: 32px; height: 44px; border-radius: 10px; background: var(--panel); font-size: 22px; font-weight: 600; color: var(--fg);
  animation: code-in 0.5s var(--ease) both; animation-delay: calc(var(--i) * 45ms); }
.code-display .dash { align-self: center; color: var(--muted); font-size: 20px; }
@keyframes code-in { from { opacity: 0; transform: translateY(10px) scale(0.9); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@media (max-width: 400px) { .code-display { gap: 4px; } .code-display .ch { width: 28px; height: 40px; font-size: 19px; } }
.qr { display: grid; place-items: center; padding: 14px; border-radius: var(--r-lg); background: var(--paper); }
.qr img { width: min(240px, 100%); height: auto; image-rendering: pixelated; animation: pop 0.3s var(--ease) both; }
.code-row { display: flex; gap: 8px; }
.code-row .field { flex: 1; height: 40px; font-family: var(--mono); letter-spacing: 0.12em; }
.code-row .field:placeholder-shown { font-family: var(--font); letter-spacing: normal; }

/* The computer at work, in a card. */
.cardlet.run .head, .live-card .head { display: flex; align-items: center; gap: 8px; }
.cardlet.run.is-live .screen, .live-card.is-live .screen { position: relative; }
.cardlet.run.is-live .screen::after, .live-card.is-live .screen::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, var(--tint-info) 50%, transparent 100%); background-size: 100% 220%; animation: scan 2.4s ease-in-out infinite; opacity: 0.55; }
@keyframes scan { from { background-position: 0 -120%; } to { background-position: 0 220%; } }
.screen img.settle { animation: settle 0.35s var(--ease) both; }
@keyframes settle { from { filter: blur(3px); opacity: 0.7; } to { filter: none; opacity: 1; } }

/* The live view. */
.live { display: grid; gap: 12px; }
.live-stage { position: relative; border-radius: var(--r-xl); overflow: hidden; background: var(--well); min-height: 220px; display: grid; place-items: center; touch-action: pan-y; cursor: pointer; }
.live-stage:focus-visible { outline-offset: -2px; }
.live-frame { display: block; width: auto; max-width: 100%; height: auto; max-height: min(66vh, 620px); opacity: 0; transition: opacity 0.3s; user-select: none; -webkit-user-select: none; }
.live-stage.ready .live-frame { opacity: 1; }
.live-stage.ended .live-frame { filter: grayscale(1) blur(2px); opacity: 0.5; transition: filter 0.4s, opacity 0.4s; }
.live-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 14px; transition: opacity 0.2s; }
.live-stage.ready .live-wait { opacity: 0; pointer-events: none; }
.tap-ripple { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 99px; background: var(--tint-blue); pointer-events: none; animation: ripple 0.5s var(--ease) forwards; }
@keyframes ripple { from { transform: scale(0.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.live-input { display: flex; gap: 8px; }
.live-input .field { flex: 1; }
.live-keys { display: flex; gap: 6px; flex-wrap: wrap; }
.live-status { min-height: 18px; }

/* Queue: the deck of offers. */
.queue .page-head .segmented { flex-shrink: 0; }
.banner-card { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.banner-card .grow { flex: 1; min-width: 200px; display: grid; gap: 2px; }
.offers-pane { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 40px; align-items: start; }
@media (max-width: 1023px) { .offers-pane { grid-template-columns: minmax(0, 1fr); gap: 24px; } }
.deck-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.deck-head { display: flex; align-items: center; gap: 10px; padding: 0 16px; }
.deck-head h2 { font-size: 13px; font-weight: 500; color: var(--muted); flex: 1; }
.replies-pane > .section { margin-top: 28px; }
.deck { position: relative; display: grid; }
.deck:has(.offer-card) { min-height: 420px; }
.deck > * { grid-area: 1 / 1; }
.deck-hint { text-align: center; }
.offer-card { position: relative; z-index: 2; display: grid; border-radius: var(--r-3xl); background: var(--raised); overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  transition: transform 0.35s var(--ease), opacity 0.3s; animation: deal 0.42s var(--ease) both; cursor: grab; --stamp: 0; }
.offer-card.dragging { transition: none; cursor: grabbing; }
.offer-card.under { z-index: 1; transform: scale(0.95) translateY(14px); opacity: 0.55; pointer-events: none; animation: none; filter: blur(1px); }
.offer-card.fling-right { transform: translate(140%, -6%) rotate(18deg) !important; opacity: 0; transition: transform 0.38s cubic-bezier(0.5, 0, 0.75, 0), opacity 0.38s; }
.offer-card.fling-left { transform: translate(-140%, -6%) rotate(-18deg) !important; opacity: 0; transition: transform 0.38s cubic-bezier(0.5, 0, 0.75, 0), opacity 0.38s; }
@keyframes deal { from { opacity: 0; transform: scale(0.94) translateY(16px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.swipe-stamp { position: absolute; z-index: 3; top: 22px; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 15px; letter-spacing: 0.08em; color: var(--on-state);
  opacity: var(--stamp); transform: scale(calc(0.8 + var(--stamp) * 0.2)); pointer-events: none; }
.offer-card.to-post .swipe-stamp { left: 22px; background: var(--gets); }
.offer-card.to-skip .swipe-stamp { right: 22px; background: var(--owes); }
.offer-photos { position: relative; display: flex; gap: 2px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; height: min(360px, 88vw); background: var(--paper); }
.offer-photos::-webkit-scrollbar { display: none; }
.offer-photos.none { display: grid; place-items: center; align-content: center; gap: 6px; color: var(--muted); height: auto; aspect-ratio: 16 / 7; }
.offer-photos .ph { flex: 0 0 100%; scroll-snap-align: center; border: 0; padding: 0; background: none; cursor: zoom-in; }
.offer-photos .ph img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.offer-photos.big { height: min(280px, 70vw); border-radius: var(--r-xl); }
.ph-count { position: absolute; right: 12px; bottom: 12px; padding: 3px 10px; border-radius: 99px; background: var(--glass); font-size: 12px; font-weight: 500;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.offer-body { display: grid; gap: 8px; padding: 16px 20px 6px; }
.offer-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.offer-body h2 { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.offer-body .details { color: var(--soft); font-size: 14.5px; }
.offer-body .caption { white-space: pre-wrap; font-size: 14px; color: var(--soft); padding: 10px 12px; border-radius: var(--r-md); background: var(--well); max-height: 120px; overflow: hidden;
  -webkit-mask-image: linear-gradient(black 75%, transparent); mask-image: linear-gradient(black 75%, transparent); }
.price-line { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.price-line .from { text-decoration: line-through; }
.price-line .to { font-size: 24px; font-weight: 650; color: var(--fg); letter-spacing: -0.02em; animation: pop 0.35s var(--ease) both; }
.price-line .margin { font-size: 12.5px; font-weight: 600; color: var(--gets); background: var(--tint-done); padding: 2px 8px; border-radius: 99px; }
.offer-actions { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; padding: 12px 16px 16px; }
.offer-actions .skip-btn { width: 44px; color: var(--owes); }
.offer-actions .post-btn { background: var(--gets); color: var(--on-state); }
.offer-actions .post-btn:hover:not(:disabled) { background: var(--gets); filter: brightness(1.08); }
.side-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-content: start; }
.side-col .section { margin-bottom: 16px; }
img.mini { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex-shrink: 0; background: var(--elev-1); }
.caption-edit { min-height: 140px; }

/* Queue: replies and orders. */
.reply-list { display: grid; gap: 10px; }
.reply-card { display: grid; gap: 10px; padding: 16px 18px; border-radius: var(--r-2xl); background: var(--raised); animation: rise 0.35s var(--ease) both; }
.reply-card.closed { background: var(--elev-1); }
.reply-card.closed .asked { color: var(--muted); }
.reply-head { display: flex; align-items: center; gap: 12px; }
.reply-head .grow { flex: 1; min-width: 0; }
.reply-head .title { font-weight: 600; }
.reply-card .quoted { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding-left: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reply-card .quoted span { overflow: hidden; text-overflow: ellipsis; }
.reply-card .asked { font-size: 15px; white-space: pre-wrap; padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: var(--bubble); justify-self: start; max-width: 92%; }
.reply-card .reason { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.reply-card .draft-text { font-size: 14.5px; white-space: pre-wrap; color: var(--soft); }
textarea.reply-edit { min-height: 72px; resize: none; border-radius: var(--r-lg); padding: 12px 14px; font-size: 15px; line-height: 1.45; }
.reply-card .actions { display: flex; gap: 8px; justify-content: flex-end; }
.reply-card .answered { font-size: 13px; }
.chip.as-button { border: 0; cursor: pointer; font: inherit; font-size: 12.5px; }

/* Settings: connections, playbooks, plan. */
.conn-card { display: grid; gap: 0; animation: rise 0.3s var(--ease) both; }
.conn-card > .row { padding: 14px 16px; }
.conn-card .end { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.conn-card .sub { white-space: normal; }
.conn-card { container-type: inline-size; }
@container (max-width: 600px) {
  .conn-card > .row { flex-wrap: wrap; row-gap: 10px; }
  .conn-card > .row > .grow { flex-basis: calc(100% - 52px); }
  .conn-card .end { flex-basis: 100%; justify-content: flex-start; padding-left: 46px; }
  .conn-card .end > button:last-child { margin-left: auto; }
}
.conn-card.status-signing_in .glyph-sq { animation: breathe 2s ease-in-out infinite; }
.conn-handoffs { display: grid; gap: 8px; padding: 0 12px 12px; }
.conn-handoffs .cardlet { width: 100%; }
/* Connections are told apart by their icons; colour stays for state (design.md §2). */
.kind-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kind-tile { display: grid; gap: 6px; justify-items: start; text-align: left; padding: 16px; border: 0; border-radius: var(--r-xl); background: var(--elev-1); cursor: pointer;
  transition: background-color 0.15s, transform 0.15s var(--ease); }
.kind-tile:hover:not(:disabled) { background: var(--elev-1-hover); }
.kind-tile:active:not(:disabled) { transform: scale(0.97); }
.kind-tile:disabled { opacity: 0.5; cursor: default; }
.kind-tile strong { font-weight: 600; }
.chat-row .pill { cursor: pointer; }
.pill.role-supplier { background: var(--tint-waiting); color: var(--check); }
.pill.role-own_group { background: var(--tint-done); color: var(--gets); }
.group-title { font-size: 13px; font-weight: 500; color: var(--muted); margin: 8px 4px 6px; }
.explain.small { grid-auto-flow: column; justify-content: start; text-align: left; justify-items: start; align-items: center; padding: 4px 0; }
.setting.stacked { display: grid; gap: 6px; }
.setting.stacked .field { width: 100%; }
.setting .example { color: var(--soft); }
.more-options > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: var(--r-xl); color: var(--muted); font-size: 14px; font-weight: 500; transition: background-color 0.15s, color 0.15s; }
.more-options > summary::-webkit-details-marker { display: none; }
.more-options > summary:hover { background: var(--hover); color: var(--fg); }
.more-options > summary .icon { transition: transform 0.25s var(--ease); }
.more-options[open] > summary .icon { transform: rotate(180deg); }
.more-options[open] > .rows { animation: rise 0.25s var(--ease) both; }
.pack-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill.toggle { border: 0; cursor: pointer; height: 32px; transition: background-color 0.15s, color 0.15s, transform 0.15s var(--ease); }
.pill.toggle[aria-pressed='true'] { background: var(--fg); color: var(--ink); }
.pill.toggle:active:not(:disabled) { transform: scale(0.96); }
.plan-lines { display: grid; gap: 6px; }
.plan-line { display: flex; gap: 12px; font-size: 14.5px; color: var(--soft); }
.plan-line .grow, .labelled-row .grow { flex: 1; min-width: 0; }
.plan-line .tnum { text-align: right; min-width: 72px; }
.progress.plan-bar i { background: var(--fg); }
.progress.plan-bar.near i { background: var(--check); }
.progress.plan-bar.over i { background: var(--owes); }
.plan-line.total { color: var(--fg); padding-top: 6px; font-size: 15.5px; }
.rows.egress .row { min-height: 36px; padding: 4px 12px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.aside-stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; border-radius: var(--r-xl); background: var(--elev-1); cursor: pointer; text-align: left; color: var(--soft);
  transition: background-color 0.15s, transform 0.15s var(--ease); }
.aside-stat:hover { background: var(--elev-1-hover); }
.aside-stat:active { transform: scale(0.98); }
.aside-stat .n { font-size: 26px; font-weight: 650; color: var(--fg); letter-spacing: -0.02em; }
.aside-stat .grow { flex: 1; }
.need.clickable { border: 0; background: none; padding: 4px 0; text-align: left; cursor: pointer; font: inherit; }

/* Dashboards: an empty canvas with a box at the bottom; what you ask for is pinned here. */
.dash-page { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: 0; }
@media (max-width: 767px) { .dash-page { min-height: calc(100dvh - var(--tabs) - var(--safe-b) - var(--phone-top, 0px)); } }
.dash-body { flex: 1; display: flex; flex-direction: column; padding-bottom: 24px; }
.dash-empty { flex: 1; display: grid; place-items: center; min-height: 40vh; }
.dash-empty .empty-state { background: none; max-width: 420px; align-self: center; }
.dash-ask { position: sticky; bottom: 0; z-index: 2; display: grid; gap: 8px; padding: 14px 0 calc(16px + var(--safe-b));
  background: linear-gradient(to bottom, transparent, var(--ink) 20px); }
.dash-ask > * { width: 100%; max-width: 760px; margin-inline: auto; }
@media (max-width: 767px) { .dash-ask { bottom: calc(var(--tabs) + var(--safe-b)); padding-bottom: 12px; } }
.ask-ideas { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-top: 2px; }
.ask-ideas::-webkit-scrollbar { display: none; }
.ask-ideas .pill { flex-shrink: 0; height: 34px; padding: 0 14px; font-size: 14px; color: var(--fg); transition: background-color 0.15s, transform 0.15s var(--ease); }
.ask-ideas .pill .icon { color: var(--muted); }
.ask-ideas .pill:active { transform: scale(0.97); }
.ask-ideas .pill:disabled { opacity: 0.45; }
@media (hover: hover) and (pointer: fine) and (min-width: 1100px) { .ask-ideas { flex-wrap: wrap; } }
.ask-status { display: flex; align-items: center; gap: 6px; padding: 0 16px; }
.ask-box { display: flex; align-items: flex-end; border-radius: 20px; background: var(--elev-1); transition: background-color 0.15s; }
.ask-box:focus-within { background: var(--elev-1-hover); }
.ask-box textarea { flex: 1; min-width: 0; border: 0; outline: none; resize: none; background: transparent; padding: 9px 4px 9px 16px; font-size: 16px; line-height: 22px; min-height: 40px; height: 40px; max-height: 140px; }
.ask-box textarea:focus-visible { outline: none; }
.ask-send { width: 32px; height: 32px; margin: 4px; border-radius: 999px; border: 0; display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
  background: var(--fg); color: var(--ink); transition: transform 0.15s var(--ease), opacity 0.15s; }
.ask-send:active:not(:disabled) { transform: scale(0.9); }
.ask-send:disabled { opacity: 0.3; cursor: default; }
.dash-ask.busy .ask-box { opacity: 0.6; }
/* minmax(0, 1fr) everywhere: a long name in a list ellipsizes inside its widget instead of widening the page. */
.widgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); grid-auto-flow: dense; align-items: start; gap: 12px; }
.widgets.small { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.widget { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-content: start; padding: 18px 20px; border-radius: var(--r-3xl); background: var(--raised); min-width: 0;
  animation: rise 0.45s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.widget h3 { font-size: 13.5px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget.w-table, .widget.w-list, .widget.w-line { grid-column: span 2; }
@media (max-width: 767px) { .widget.w-table, .widget.w-list, .widget.w-line { grid-column: auto; } }
.widgets.small .widget { grid-column: auto; padding: 14px 16px; border-radius: var(--r-xl); background: var(--elev-1); }
.widgets.small .widget:not(.w-stat) { grid-column: 1 / -1; }
.widget-broken .btn { justify-self: start; }
.stat-value { font-size: 40px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.05; animation: pop 0.5s var(--ease) both; }
.widgets.small .stat-value { font-size: 26px; }
.stat-value.small { font-size: 24px; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 40%) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 13.5px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--soft); }
.bar-track { height: 10px; border-radius: 99px; background: var(--elev-1); overflow: hidden; }
.bar-track i { display: block; height: 100%; width: var(--w); border-radius: 99px; background: var(--fg); transform-origin: left; animation: grow-bar 0.7s var(--ease) both; animation-delay: calc(var(--i) * 35ms); }
@keyframes grow-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.bar-value { color: var(--muted); }
.line-wrap { display: grid; gap: 6px; }
.line-now { display: flex; align-items: baseline; gap: 8px; }
.line-chart { width: 100%; height: 110px; overflow: visible; }
.line-chart .line { fill: none; stroke: var(--fg); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1s var(--ease) 0.15s forwards; }
.line-chart .area { fill: var(--elev-1); animation: fade 0.8s ease-out 0.3s both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.line-foot { display: flex; justify-content: space-between; gap: 8px; }
.dash-table table { width: 100%; border-collapse: separate; border-spacing: 0 2px; font-size: 13.5px; }
.dash-table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 6px 10px; white-space: nowrap; text-transform: capitalize; }
.dash-table td { padding: 8px 10px; background: var(--ink); vertical-align: top; white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.dash-table td:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.dash-table td:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.dash-table td.num { text-align: right; }
.widgets.small .dash-table td { background: var(--elev-1); }
.widget .table-wrap { padding: 0; background: transparent; border-radius: 0; max-height: 420px; overflow: auto; }
.dash-list .row { padding: 8px 4px; min-height: 44px; }
.cardlet.dash-card { display: grid; gap: 10px; }

/* One empty state: a soft disc, a line in bold, one sentence, maybe one button. */
.empty-state { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 48px 24px; border-radius: var(--r-3xl); background: var(--elev-1); align-self: start; }
.empty-state .art { width: 56px; height: 56px; border-radius: 99px; display: grid; place-items: center; background: var(--elev-1); color: var(--soft); animation: pop 0.4s var(--ease) both; }
.empty-state .art.tone-done { background: var(--tint-done); color: var(--gets); }
.empty-state strong { font-weight: 600; font-size: 16px; }
.empty-state .meta { max-width: 340px; }
.empty-state .btn { margin-top: 6px; }
.empty-state.small { padding: 24px 20px; gap: 6px; }
.empty-state.small .art { width: 40px; height: 40px; }
.empty-state.small strong { font-size: 15px; }
.chat-empty { display: grid; gap: 8px; justify-items: center; text-align: center; margin: auto; padding: 18vh 24px 24px; max-width: 360px; animation: rise 0.4s var(--ease) both; }
.chat-empty strong { font-size: 17px; font-weight: 600; margin-top: 6px; }
.order-numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.order-end { flex-direction: row; align-items: center; gap: 10px; }
.phone-only-block { display: none; }
@media (max-width: 767px) { .phone-only-block { display: flex; justify-content: center; padding-top: 8px; } }

/* ⌘K and the shortcuts float in the middle of a desk; on a phone they come up from the bottom like other sheets. */
.sheet.floating { top: 12vh; bottom: auto; left: 50%; right: auto; translate: -50% 0; max-height: 76vh; width: min(520px, calc(100vw - 24px)); }
@media (max-width: 767px) { .sheet.floating { top: auto; left: 0; right: 0; bottom: 0; translate: none; width: 100%; height: auto; max-height: calc(100dvh - 40px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}


/* ------------------------------------------------------------ tabs inside a page (dashboards) */

/* ------------------------------------------------------------ jobs: views, filters, the table, cards */

.views-row { display: flex; align-items: center; gap: 4px; margin: -8px 0 12px; }
.views { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.views::-webkit-scrollbar { display: none; }
.view-tab { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 14px; transition: background-color 0.2s, color 0.15s; }
.view-tab:hover { color: var(--fg); background: var(--hover); }
.view-tab[aria-selected='true'] { background: var(--elev-1); color: var(--fg); font-weight: 500; }
.view-tab .count { font-size: 12px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ activity, settings, install */

.item .links { display: flex; gap: 6px; flex-wrap: wrap; margin-left: -12px; }
.item .job-link { color: var(--soft); font-weight: 500; font-size: 13px; height: 30px; gap: 4px; }
.all-clear { display: flex; align-items: center; gap: 8px; margin: -8px 0 24px; padding: 0 16px; font-size: 14px; color: var(--gets); }
.filter-row { margin: 0 0 8px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row .segmented { flex-wrap: nowrap; }
.cardlet.join { width: 100%; }
/* What you choose sits under the name, not under the face. */
.cardlet.join > .labelled-row, .cardlet.join > .actions { padding-left: 52px; }
@media (max-width: 420px) { .cardlet.join > .labelled-row, .cardlet.join > .actions { padding-left: 4px; } }
.who-row { display: flex; gap: 12px; align-items: center; }
.labelled-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.invite { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.invite .grow { flex: 1; min-width: 220px; display: grid; gap: 4px; }
.invite .title { font-weight: 500; }
.invite .sub { font-size: 13px; color: var(--muted); }
.invite .url, .link-box code { display: block; font-family: var(--mono); font-size: 12.5px; padding: 10px 14px; border-radius: var(--r-md); background: var(--elev-1); color: var(--soft);
  overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.invite .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.link-box { display: grid; gap: 10px; }
.quiet-hours { display: flex; align-items: center; gap: 6px; }
.field.sm { height: 34px; width: auto; padding: 0 30px 0 12px; font-size: 14px; background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; }
.explain { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 8px 0; color: var(--soft); }
.explain .art { width: 64px; height: 64px; border-radius: 99px; background: var(--elev-1); display: grid; place-items: center; color: var(--fg); }
.explain .meta { max-width: 300px; }
.explain strong { color: var(--fg); font-weight: 600; }
.install-art { display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.install-art img { border-radius: 18px; }
.install-art div { display: grid; gap: 2px; }
.ios-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.ios-steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.5; }
.ios-steps .n { width: 26px; height: 26px; border-radius: 99px; background: var(--elev-1); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.inline-icon { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: 6px; background: var(--elev-1); vertical-align: -3px; }
.inline-icon .icon { color: var(--fg); }

/* Sign-in pages */
.password { position: relative; }
.password .field { padding-right: 48px; }
.password .reveal { position: absolute; right: 6px; top: 6px; }
.password .reveal[aria-pressed='true'] { color: var(--fg); }
.strength { font-size: 12.5px; text-align: left; padding-left: 16px; min-height: 18px; color: var(--muted); margin-top: -4px; }
.strength.s0 { color: var(--owes); } .strength.s1 { color: var(--check); } .strength.s2 { color: var(--gets); }
.forgot { font-size: 14px; color: var(--muted); }
.forgot summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 4px 10px; }
.forgot summary::-webkit-details-marker { display: none; }
.forgot summary:hover { color: var(--fg); background: var(--hover); }
.forgot summary .icon { transition: transform 0.25s var(--ease); }
.forgot[open] summary .icon { transform: rotate(180deg); }
.forgot p { margin-top: 8px; text-align: left; padding: 14px 16px; border-radius: var(--r-xl); background: var(--elev-1); font-size: 14px; color: var(--soft); animation: rise 0.25s var(--ease) both; }
.readonly-field { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 999px; background: var(--elev-1); color: var(--soft); font-size: 15px; }
.waiting-art { position: relative; justify-self: center; isolation: isolate; }
.pulse-ring { position: absolute; inset: -10px; z-index: -1; border-radius: 99px; background: var(--tint-info); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(0.92); opacity: 0.6; } 50% { transform: scale(1.08); opacity: 1; } }

/* ⌘K and shortcuts */
.palette { display: grid; gap: 10px; padding-top: 4px; }
.palette-list { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; }
.palette-list button { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border: 0; border-radius: var(--r-md); background: transparent; color: var(--soft); text-align: left; cursor: pointer; font-size: 14.5px; }
.palette-list button[aria-selected='true'], .palette-list button:hover { background: var(--elev-1); color: var(--fg); }
.palette-list .grow { flex: 1; }
.shortcuts { display: grid; gap: 10px; }
.shortcut { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--soft); }
kbd { font-family: var(--mono); font-size: 12px; min-width: 64px; padding: 3px 8px; border-radius: 99px; background: var(--elev-1); color: var(--fg); text-align: center; white-space: nowrap; }

/* Not found, and the other pages that are only a message. */
.message-page { display: grid; gap: 14px; justify-items: center; text-align: center; padding: clamp(40px, 16vh, 160px) 24px; }
.message-page h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.message-page p { color: var(--muted); max-width: 340px; }

@media (max-width: 600px) {
  .toolbar { flex-wrap: nowrap; }
  .toolbar .field { min-width: 0; }
  .wide-label { display: none; }
  .toolbar .btn.sm, .page-head .btn.icon-phone { width: 40px; padding: 0; flex-shrink: 0; }
  .shop-row { flex-wrap: wrap; }
  .shop-row .grow { flex-basis: calc(100% - 60px); }
  .shop-row .end { flex-direction: row; flex-wrap: wrap; flex-shrink: 1; min-width: 0; max-width: calc(100% - 48px); margin: -6px 0 0 48px; }
}
.palette-empty { padding: 12px; }
/* With a mouse on a wide screen the ideas wrap; narrower, they scroll sideways and fade at the edge like on a phone. */
@media (hover: hover) and (pointer: fine) and (min-width: 1100px) { .suggestions { flex-wrap: wrap; } }
.phone-only { display: none; }
@media (max-width: 767px) { .phone-only { display: inline-grid; } }
.stack-8 { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.stack-6 { display: grid; gap: 6px; grid-template-columns: minmax(0, 1fr); }
.section-note { padding: 10px 16px 0; }
.field-note { padding-left: 16px; }
.fact.static { cursor: default; }
.fact.static:hover { background: transparent; }
.portal-row .grow { display: grid; gap: 2px; justify-items: start; }
.portal-row .chip { margin-top: 6px; }
.empty-body { display: grid; gap: 12px; justify-items: center; }
.view-tools { display: flex; flex-shrink: 0; }
.sheet .section > h2 { padding-left: 4px; padding-right: 0; }
.sheet .feed .item { padding-left: 4px; padding-right: 4px; }
.google-slot { display: grid; gap: 10px; }
.signin-quiet { justify-self: center; }
/* With a mouse the time shows in the hover bar; the column of times is for swiping on a phone. */
@media not (pointer: coarse) { .group .line time.stamp { display: none; } }
.portal-row .grow > * { max-width: 100%; min-width: 0; }
.portal-row .sub { white-space: normal; }

/* The privacy and terms page. */
.legal { margin: 0 auto; display: grid; gap: 12px; padding-top: clamp(40px, 10vh, 96px); line-height: 1.6; }
.legal h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.legal h2 { font-size: 16px; font-weight: 600; margin-top: 16px; }
.legal p { color: var(--soft); max-width: 640px; }
.legal .btn { margin-top: 16px; }

/* The bot's brain: model accounts, the team's settings for a shop, and what the bot remembers. */
.glyph-sq { width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; background: var(--elev-1); color: var(--soft); flex-shrink: 0; }
.empty-card { display: grid; gap: 6px; }
.empty-card strong { font-weight: 500; }
.memory-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14.5px; line-height: 1.45; color: var(--fg); }
.memory-list li::marker { color: var(--muted); }
textarea.memory-edit { min-height: 260px; font-size: 14px; line-height: 1.5; }
.setting .end { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.setting .stack-6 .progress { max-width: 280px; }
.link-box code.login-url { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.row .sub.wraps { white-space: normal; overflow: visible; text-overflow: clip; }

/* An order on a phone: what and who on top, the total and its status under, so neither is cut short. */
@media (max-width: 520px) {
  .order-row { flex-wrap: wrap; row-gap: 6px; }
  .order-row > .grow { flex-basis: calc(100% - 52px); }
  .order-row > .order-end { margin-left: 48px; }
}
