@layer reset, base, components, chat, utilities, ios;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; min-height: 100%; }
  button, input, textarea, select { font: inherit; }
  img, svg { display: block; max-width: 100%; }
  [hidden] { display: none !important; }
  turbo-cable-stream-source { display: none; }
}

@layer base {
  :root {
    --ink: oklch(23% 0 0);
    --muted: oklch(50% 0 0);
    --paper: oklch(100% 0 0);
    --surface: oklch(100% 0 0);
    --line: oklch(90% 0 0);
    --accent: oklch(55% 0.13 267);
    --accent-soft: oklch(95% 0.02 267);
    --danger: oklch(54% 0.18 27);
    --success: oklch(48% 0.14 145);
    /* The unread avatar ring. Fixed, not theme-derived: unread must read the
       same whichever chat theme the group picked. */
    --radius: 0.55rem;
    --ios-separator: rgb(60 60 67 / 0.29);
    --avatar-background: #848484;
    --avatar-foreground: #000;
    --avatar-person: url("/assets/chat-avatar-person-d8f9377b.svg");
    --avatar-person-filter: none;
    color-scheme: light;
  }

  /* Dark mode swaps token values only; every component color derives from
     these, so no per-component overrides belong here. Surface stays the
     raised layer (lighter than paper) in both schemes. */
  @media (prefers-color-scheme: dark) {
    :root {
      --ink: oklch(92% 0 0);
      --muted: oklch(66% 0 0);
      --paper: oklch(0% 0 0);
      --surface: oklch(21.5% 0.005 267);
      --line: oklch(30% 0 0);
      --accent: oklch(66% 0.12 267);
      --accent-soft: oklch(30% 0.04 267);
      --danger: oklch(64% 0.17 27);
      --success: oklch(72% 0.17 145);
      --ios-separator: rgb(84 84 88 / 0.6);
      --avatar-background: #606060;
      --avatar-foreground: #fff;
      --avatar-person: url("/assets/chat-avatar-person-dark-685e6819.svg");
      --avatar-person-filter: invert(1);
      color-scheme: dark;
    }
  }

  body {
    background: var(--paper);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    line-height: 1.5;
    -webkit-user-select: none;
    user-select: none;
  }

  /* Keep editing available while clicks elsewhere do not select page text. */
  input, textarea, [contenteditable]:not([contenteditable="false"]) {
    -webkit-user-select: text;
    user-select: text;
  }

  a { color: var(--accent); text-decoration: none; }
  @media (hover: hover) and (pointer: fine) { a:hover { text-decoration: underline; } }
  h1, h2, h3, p { margin-block-start: 0; }
  h1 { font-size: clamp(1.7rem, 4vw, 2.35rem); letter-spacing: -0.03em; }
  h2 { font-size: 1.15rem; }
  label { display: block; font-weight: 650; margin-bottom: 0.3rem; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]), textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    background: var(--surface);
    color: var(--ink);
    padding: 0.68rem 0.78rem;
  }
  textarea { min-height: 8rem; resize: vertical; }
  .settings-field textarea::placeholder { color: var(--muted); opacity: 1; }
  input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in oklch, var(--accent) 35%, transparent); border-color: var(--accent); }
}

@layer components {
  .page-shell { min-height: 100dvh; }
  .topbar {
    align-items: center; background: color-mix(in oklch, var(--surface) 92%, transparent);
    border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 2.5rem 1fr 2.5rem;
    min-height: 3.5rem; padding: 0.5rem max(1rem, env(safe-area-inset-left)); position: sticky; text-align: center; top: 0; z-index: 20;
    backdrop-filter: blur(16px);
  }
  .topbar-title { color: var(--ink); font-size: 1rem; font-weight: 700; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu-button { align-items: center; background: transparent; border: 0; border-radius: 50%; color: var(--ink); display: flex; height: 2.5rem; justify-content: center; width: 2.5rem; }
  .topbar-back:hover { text-decoration: none; }
  .list-create-action { align-items: center; background: transparent; border: 0; border-radius: 50%; color: var(--accent); display: flex; height: 2.5rem; justify-content: center; width: 2.5rem; }
  .list-create-action:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); text-decoration: none; }
  .list-create-action svg { height: 1.35rem; width: 1.35rem; }
  .page-content { margin: 0 auto; max-width: 58rem; padding: 2rem 1rem 4rem; width: 100%; }
  .auth-content { margin: 16vh auto 0; max-width: 25rem; padding: 1rem; }
  .page-heading { margin-bottom: 1.5rem; }
  .page-actions { margin-top: 2rem; }
  .fab-actions { align-items: center; bottom: calc(1.25rem + env(safe-area-inset-bottom)); display: flex; gap: 0.65rem; left: 50%; position: fixed; transform: translateX(-50%); z-index: 30; }
  .fab-actions .menu-action { height: 3rem; width: 3rem; }
  .page-heading p, .page-intro, .muted { color: var(--muted); }
  .page-intro { margin-bottom: 1.5rem; }
  .stack { display: grid; gap: 1rem; }
  .stack-tight { display: grid; gap: 0.5rem; }
  .split { align-items: center; display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; }
  .grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
  /* Staff token report (heymio-7tl3.14): wide tables scroll on their own. */
  .table-scroll { overflow-x: auto; padding: 0; }
  .token-report { border-collapse: collapse; width: 100%; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
  .token-report th, .token-report td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
  .token-report th:first-child, .token-report td:first-child { text-align: left; }
  .token-report-filter { flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
  .token-report-total { margin-bottom: 1rem; }
  /* A prompt row opens its prompt from anywhere in the row. */
  .admin-prompt-row { position: relative; cursor: pointer; }
  .admin-prompt-row a::after { content: ""; position: absolute; inset: 0; }
  .admin-prompt-row:hover { background: var(--accent-soft); }
  .admin-prompt-folding { display: flex; gap: 0.5rem; }
  /* Each model call starts after clear space and a rule. */
  .admin-prompt-request { border-top: 1px solid var(--line); margin-top: 2.5rem; padding-top: 1.5rem; }
  .admin-prompt-part { margin-bottom: 0.5rem; }
  .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem; }
  .card > :last-child { margin-bottom: 0; }
  /* A filled control wears the theme's own bubble colour and its ink. The
     text accent is a different job — it has to stay dark enough to read as
     text, which on a marigold theme means a brown nobody wants on a button. */
  .button, input[type="submit"] {
    align-items: center; background: var(--c-own-bubble, var(--accent)); border: 0; border-radius: 0.65rem;
    color: var(--c-own-bubble-ink, white);
    cursor: pointer; display: inline-flex; font-weight: 700; justify-content: center; min-height: 2.65rem; padding: 0.55rem 0.95rem;
  }
  .button:hover { color: var(--c-own-bubble-ink, white); text-decoration: none; filter: brightness(0.95); }
  .button.secondary { background: var(--c-accent-soft, var(--accent-soft)); color: var(--c-accent, var(--accent)); }
  .button.danger { background: color-mix(in oklch, var(--danger) 12%, var(--surface)); color: var(--danger); }
  .button.full { width: 100%; }
  /* Turbo confirmations (application.js). */
  .confirm-dialog { outline: none; background: var(--c-bg, var(--surface)); border: 0; border-radius: 1.1rem; box-shadow: 0 20px 60px rgb(0 0 0 / 0.3); color: var(--c-ink, var(--ink)); max-width: min(22rem, calc(100vw - 2rem)); padding: 1.25rem 1.25rem 1rem; }
  .confirm-dialog::backdrop { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); background: rgb(0 0 0 / 0.35); }
  .confirm-dialog[open] { animation: menu-pop 160ms ease both; }
  .confirm-dialog p { font-size: 1rem; line-height: 1.45; margin: 0 0 1.1rem; text-align: center; text-wrap: pretty; }
  .confirm-dialog-actions { display: grid; gap: 0.5rem; grid-template-columns: 1fr 1fr; }
  .confirm-dialog-actions button { border: 0; border-radius: 0.75rem; cursor: pointer; font-size: 0.97rem; font-weight: 650; min-height: 2.75rem; }
  .confirm-dialog-cancel { background: color-mix(in oklch, var(--c-ink, var(--ink)) 8%, transparent); color: #000; }
  .confirm-dialog-confirm { background: color-mix(in oklch, var(--c-ink, var(--ink)) 8%, transparent); color: var(--danger); }
  @media (max-width: 640px) {
    .confirm-dialog { border-radius: 1.25rem; margin: auto auto max(0.75rem, env(safe-area-inset-bottom)); max-width: calc(100vw - 1.5rem); width: 100%; }
    .confirm-dialog[open] { animation: sheet-rise 200ms ease both; }
    .confirm-dialog-actions button { min-height: 3rem; }
  }
  @keyframes sheet-rise { from { transform: translateY(1.5rem); opacity: 0; } }

  /* The iOS switch: a button that posts the other state, so it needs no script. */
  .switch-row { align-items: center; display: flex; gap: 1rem; justify-content: space-between; }
  .switch-row p { font-size: 0.88rem; margin: 0.15rem 0 0; }
  .switch { background: color-mix(in oklch, var(--ink) 16%, transparent); border: 0; border-radius: 999px; cursor: pointer; flex: none; height: 1.95rem; padding: 0.125rem; transition: background 160ms ease; width: 3.2rem; }
  .switch span { background: white; border-radius: 50%; box-shadow: 0 2px 5px rgb(0 0 0 / 0.2); display: block; height: 1.7rem; transition: transform 160ms ease; width: 1.7rem; }
  .switch[aria-checked="true"] { background: var(--brand-ground); }
  .switch[aria-checked="true"] span { transform: translateX(1.25rem); }
  /* A Gmail account row: the address, Remove for an added one, its switch. */
  .mail-account .settings-row-trailing { align-items: center; display: flex; gap: 0.75rem; }
  .mail-account .settings-row-text strong { overflow-wrap: anywhere; }
  .mail-account-remove { background: none; border: 0; color: var(--danger, #c62828); cursor: pointer; font: inherit; font-size: 0.9rem; min-height: 2.75rem; padding: 0 0.25rem; }
  .button_to { display: inline; }
  .form-row { display: grid; gap: 0.35rem; }
  .room-member { align-items: center; display: flex; gap: 0.6rem; margin: 0; padding: 0.45rem 0.25rem; }
  .checkbox-row { align-items: center; display: flex; gap: 0.5rem; }
  .checkbox-row label { margin: 0; }
  .flash { border: 1px solid var(--line); border-radius: 0.65rem; margin-bottom: 1rem; padding: 0.7rem 0.9rem; }
  .flash.notice { background: var(--accent-soft); color: var(--accent); }
  .flash.alert { background: color-mix(in oklch, var(--danger) 10%, var(--surface)); color: var(--danger); }
  .status { border-radius: 999px; display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 0.15rem 0.5rem; background: var(--accent-soft); color: var(--accent); }
  .status-private { align-items: center; background: color-mix(in oklch, var(--ink) 7%, transparent); color: var(--muted); display: inline-flex; gap: 0.25rem; }
  .status-lock { height: 0.8rem; width: 0.8rem; }
  .record { border-bottom: 1px solid var(--line); padding-block: 0.9rem; }
  .record:last-child { border-bottom: 0; }
  .status-quiet { background: color-mix(in oklch, var(--ink) 7%, transparent); color: var(--muted); }
  .status-warn { background: color-mix(in oklch, var(--danger) 12%, var(--surface)); color: var(--danger); }
  /* Administration: user reports. A table on a wide screen, a stack of rows
     on a phone, each row still one report with its dates. */
  .report-list { padding-block: 0.25rem; }
  .report-table { border-collapse: collapse; font-size: 0.95rem; width: 100%; }
  .report-table th, .report-table td { border-bottom: 1px solid var(--line); padding: 0.9rem 0.75rem 0.9rem 0; text-align: left; vertical-align: top; }
  .report-table th { color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; padding-block: 0.75rem 0.6rem; text-transform: uppercase; }
  .report-table th:first-child { width: 50%; }
  .report-table tr:last-child td { border-bottom: 0; }
  .report-table .right { padding-right: 0; text-align: right; }
  .report-title { align-items: baseline; display: flex; font-weight: 600; gap: 0.5rem; }
  .report-number { flex: none; font-variant-numeric: tabular-nums; }
  .report-meta { align-items: center; display: flex; flex-wrap: wrap; font-size: 0.85rem; gap: 0.5rem; margin-top: 0.2rem; }
  .stamp { font-variant-numeric: tabular-nums; white-space: nowrap; }
  .report-footer { font-size: 0.9rem; margin-top: 1.5rem; }
  .report-heading { display: grid; gap: 0.5rem; }
  .report-heading h1 { margin: 0; text-wrap: pretty; }
  .report-back { font-size: 0.9rem; font-weight: 600; }
  .report-reviewed { font-size: 0.9rem; }
  .facts { border-bottom: 1px solid var(--line); display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); margin: 0 0 1.15rem; padding-bottom: 1.15rem; }
  .facts div { display: grid; gap: 0.125rem; }
  .facts dt { color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
  .facts dd { font-weight: 600; margin: 0; }
  .comment { display: flex; gap: 1rem; }
  .comment-author { display: grid; flex: 0 0 8.75rem; font-size: 0.85rem; gap: 0.125rem; }
  .comment-author strong { font-size: 1rem; }
  .comment-body { flex: 1; }
  .comment-body p:last-child { margin-bottom: 0; }
  .form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
  .review-hint { font-size: 0.9rem; margin: 0; }
  @media (max-width: 40rem) {
    .report-table thead { display: none; }
    .report-table tr { border-bottom: 1px solid var(--line); display: grid; gap: 0 0.5rem; grid-template-columns: minmax(0, 1fr) auto; padding-block: 0.9rem; }
    .report-table tr:last-child { border-bottom: 0; }
    .report-table td { border-bottom: 0; grid-column: 1 / -1; padding: 0; }
    .report-table td:first-child { grid-column: 1; grid-row: 1; }
    .report-table td.right { grid-column: 2; grid-row: 1; }
    .report-table td[data-label] { color: var(--muted); font-size: 0.85rem; }
    .report-table td[data-label]::before { content: attr(data-label) " "; }
    .comment { flex-direction: column; gap: 0.25rem; }
    .comment-author { align-items: baseline; display: flex; flex: none; gap: 0.5rem; }
  }
  .actions { align-items: center; display: flex; flex-wrap: wrap; gap: 0.5rem; }
  .photo-crop { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); max-width: min(22rem, 92vw); padding: 1.15rem; }
  .photo-crop::backdrop { background: rgb(0 0 0 / 55%); }
  .photo-crop-hint { color: var(--muted); margin: 0 0 0.75rem; }
  .photo-crop-canvas { aspect-ratio: 1; background: var(--paper); border-radius: var(--radius); cursor: grab; display: block; touch-action: none; width: 100%; }
  .photo-crop-canvas:active { cursor: grabbing; }
  .photo-crop-zoom { display: block; margin-block: 0.9rem; width: 100%; }
  .photo-crop .actions { justify-content: flex-end; }
  .guide { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-inline: auto; max-width: 50rem; padding: clamp(1.25rem, 4vw, 3rem); }
  .guide h1 { margin-bottom: 1.75rem; }
  .guide h2 { border-top: 1px solid var(--line); margin: 2.5rem 0 0.85rem; padding-top: 1.5rem; }
  .guide h3 { margin: 1.75rem 0 0.65rem; }
  .guide ul, .guide ol { padding-inline-start: 1.5rem; }
  .guide li + li { margin-top: 0.3rem; }
  .guide table { border-collapse: collapse; display: block; margin-block: 1.25rem; overflow-x: auto; width: 100%; }
  .guide th, .guide td { border: 1px solid var(--line); min-width: 8rem; padding: 0.55rem 0.7rem; text-align: left; vertical-align: top; }
  .guide th { background: var(--accent-soft); }
  .guide pre { background: var(--paper); border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.85rem; }
  /* Admin reads at the standard size, menu and content alike; only the
     headings are larger. */
  .admin-page .rail-link, .admin-page .rail-section-label, .admin-page .page-content :not(h1, h2, h3) { font-size: 1rem; }
  .rail-link.rail-sublink { padding-left: 1.6rem; }
  .admin-rail .rail-nav { height: 100%; margin-top: 0; padding: 0.9rem 0.6rem 1rem; }
  .system-prompt pre { background: var(--paper); border: 1px solid var(--line); border-radius: 0.5rem; font-size: 0.8rem; overflow-x: auto; padding: 0.85rem; white-space: pre-wrap; }
  .guide code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.9em; }
  .guide :not(pre) > code { background: var(--paper); border-radius: 0.3rem; padding: 0.1rem 0.3rem; }
  .guide blockquote { border-inline-start: 0.25rem solid var(--accent); color: var(--muted); margin-inline: 0; padding-inline-start: 1rem; }

  /* Group switcher: details is the web fallback. Stimulus consumes the
     first outside click while the menu is open. */
  .group-switcher { position: relative; }
  .group-switcher-trigger { align-items: center; background: transparent; border: 0; border-radius: 0.6rem; color: var(--ink); cursor: pointer; display: flex; font-size: 1.02rem; font-weight: 700; gap: 0.5rem; margin-bottom: 0.5rem; padding: 0.35rem 0.6rem; text-align: left; width: 100%; }
  .group-switcher-trigger::-webkit-details-marker { display: none; }
  .group-switcher-trigger::marker { content: ""; }
  .group-switcher-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .group-switcher-status, .group-menu-status { align-items: center; display: flex; gap: 0.45rem; margin-left: auto; }
  .group-switcher-chevron { color: var(--muted); flex: 0 0 1rem; height: 1rem; width: 1rem; }
  /* The red number pill of the apps' switcher (gh-185). */
  .group-unread-count { background: #ff3b30; border-radius: 999px; color: white; display: block; font-size: 0.75rem; font-variant-numeric: tabular-nums; font-weight: 700; line-height: 1.25rem; min-width: 1.25rem; padding: 0 0.375rem; text-align: center; }
  .group-icon { color: inherit; flex: none; }
  .rail .group-switcher .group-icon { height: 1.15rem; opacity: 0.75; width: 1.15rem; }
  .group-avatar { align-items: center; background: oklch(58% 0.12 var(--avatar-h, 267)); border-radius: 50%; color: white; display: inline-flex; flex: 0 0 1.8rem; font-size: 0.85rem; font-weight: 600; height: 1.8rem; justify-content: center; width: 1.8rem; }
  .group-menu { background: var(--surface); border: 1px solid var(--line); border-radius: 0.75rem; box-shadow: 0 12px 32px rgb(0 0 0 / 0.18); display: none; left: 0; max-height: calc(100dvh - 5rem); overflow-y: auto; padding: 0.4rem; position: absolute; top: calc(100% + 0.25rem); width: min(calc(100vw - 1.5rem), 17rem); z-index: 41; }
  .group-switcher[open] .group-menu { display: block; }
  .group-switcher[open] .group-switcher-chevron { transform: rotate(180deg); }
  .group-menu .button_to { display: block; margin: 0; width: 100%; }
  /* One type step above the chat names (gh-186); a line between the rows,
     inset to the names, and no frame around them (gh-184). */
  .group-menu-row { align-items: center; background: transparent; border: 0; border-radius: 0.5rem; color: var(--ink); cursor: pointer; display: flex; font-size: 1.125rem; gap: 0.55rem; padding: 0.55rem 0.6rem; position: relative; text-align: left; width: 100%; }
  .group-menu-row > .group-icon { flex: 0 0 1.8rem; height: 1.8rem; width: 1.8rem; }
  .group-menu-row.current { font-weight: 700; }
  .group-menu-check { color: var(--accent); flex: 0 0 1rem; height: 1rem; width: 1rem; }
  .group-menu-plus { align-items: center; background: color-mix(in oklch, var(--ink) 6%, transparent); border-radius: 50%; display: inline-flex; flex: 0 0 1.8rem; height: 1.8rem; justify-content: center; width: 1.8rem; }
  .group-menu-plus svg { height: 1rem; width: 1rem; }
  .group-menu-divider { border-top: 1px solid var(--line); margin: 0.35rem 0.25rem; }
  @media (hover: hover) and (pointer: fine) {
    .group-switcher-trigger:hover { background: color-mix(in oklch, var(--ink) 5%, transparent); }
    .group-menu-row:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); text-decoration: none; }
  }

  /* Group membership faces are reused in Settings. */
  .group-row-avatars { display: flex; }
  .group-row-avatars .member-avatar { border: 2px solid var(--paper); font-size: 1.05rem; height: 2.6rem; width: 2.6rem; }
  .group-row-avatars .member-avatar + .member-avatar { margin-left: -0.7rem; }
  .member-avatar-photo { object-fit: cover; padding: 0; }
  .member-avatar.member-avatar-lg { flex: none; font-size: 1.5rem; height: 4rem; width: 4rem; }
  /* A face is large when it is the subject of the screen and small when it
     is the marker on a row. Both sizes carry the same editor. */
  .settings-identity .group-member-avatar, .settings-identity .group-avatar { flex: none; font-size: 1.6rem; height: 4.5rem; width: 4.5rem; }
  .settings-row .group-member-avatar, .settings-row .member-avatar.settings-avatar { border: 0; flex: none; font-size: 0.95rem; height: 2.2rem; width: 2.2rem; }
  .settings-field textarea { min-height: 4.5rem; }
  .settings-row .avatar-edit-badge { border-width: 1px; bottom: -0.2rem; height: 1.05rem; right: -0.2rem; width: 1.05rem; }
  .settings-row .avatar-edit-badge svg { height: 0.62rem; width: 0.62rem; }
  .settings-row .avatar-clear { height: 1.05rem; top: -0.2rem; width: 1.05rem; }
  .settings-row .avatar-clear svg { height: 0.6rem; width: 0.6rem; }

  /* The avatar is its own editor: tap it to pick a photo (the input hides
     behind the label), the camera badge is the hint, the ✕ clears. */
  .avatar-editor { align-items: center; display: flex; flex: none; gap: 0.65rem; }
  .avatar-stack { flex: none; position: relative; }
  .avatar-status { color: var(--muted); font-size: 0.8rem; max-width: 8rem; }
  .avatar-status:empty { display: none; }
  .avatar-status[data-state="success"] { color: var(--accent); }
  .avatar-status[data-state="error"] { color: var(--danger); }
  .avatar-edit { cursor: pointer; display: block; margin: 0; position: relative; }
  .avatar-edit:hover .member-avatar-lg { filter: brightness(0.92); }
  .avatar-progress { background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%), color-mix(in oklch, var(--accent) 20%, transparent) 0); border-radius: 50%; inset: 0; mask: radial-gradient(farthest-side, transparent calc(100% - 0.3rem), black calc(100% - 0.29rem)); pointer-events: none; position: absolute; }
  .avatar-progress[hidden] { display: none; }
  .token-meter-row { align-items: center; }
  .token-meter-row .settings-row-text { flex: 1; }
  .token-meter-value { display: flex; flex: none; flex-direction: column; font-variant-numeric: tabular-nums; text-align: right; }
  .token-meter-value small { color: var(--muted); font-size: 0.75rem; }
  .avatar-edit-badge { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 50%; bottom: -0.15rem; box-shadow: 0 1px 3px rgb(0 0 0 / 0.15); color: var(--muted); display: flex; height: 1.5rem; justify-content: center; position: absolute; right: -0.15rem; width: 1.5rem; }
  .avatar-edit-badge svg { height: 0.9rem; width: 0.9rem; }
  .avatar-input { height: 1px; opacity: 0; position: absolute; width: 1px; }
  .avatar-clear { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 50%; box-shadow: 0 1px 3px rgb(0 0 0 / 0.15); color: var(--muted); cursor: pointer; display: flex; height: 1.4rem; justify-content: center; padding: 0; position: absolute; right: -0.15rem; top: -0.15rem; width: 1.4rem; z-index: 1; }
  .avatar-clear[hidden] { display: none; }
  .avatar-clear:hover { color: var(--danger); }
  .avatar-clear svg { height: 0.8rem; width: 0.8rem; }
  .member-avatar { align-items: center; background: #3be37a; border: 2px solid var(--paper); border-radius: 50%; color: white; display: inline-flex; font-size: 0.7rem; font-weight: 600; height: 1.6rem; justify-content: center; width: 1.6rem; }
  .member-avatar + .member-avatar { margin-left: -0.45rem; }

  .sheet-items form.button_to { display: block; }
  .sheet-item { background: transparent; border: 0; border-radius: 0.55rem; color: var(--ink); cursor: pointer; display: block; font-size: 1rem; padding: 0.7rem 0.65rem; text-align: left; width: 100%; }
  .sheet-item:hover, .sheet-item.active { background: color-mix(in oklch, var(--ink) 6%, transparent); text-decoration: none; }
  .sheet-item.active { font-weight: 600; }

  @media (max-width: 899.9px) {
    .page-shell { position: relative; transition: border-radius 240ms ease, transform 240ms ease; z-index: 1; }
    .page-shell { background: var(--paper); }
  }

  /* Settings is one object at every depth: a column of grouped rows on the
     paper. No cards inside cards, no floating buttons, and nothing that
     reads as a popup — the chrome carries the title and the way back. Every
     action either is a row or sits at the trailing edge of one, so the eye
     runs down a single left margin instead of hunting. */
  .settings-screen { display: grid; gap: 1.6rem; margin: 0 auto; max-width: 34rem; min-width: 0; }
  .settings-groups { display: grid; gap: 1.6rem; }
  .account-settings-page .settings-identity + .settings-groups { margin-top: 1.6rem; }

  /* Identity: who or what this screen is about, stated once and quietly. */
  .settings-identity { align-items: center; display: grid; gap: 0.85rem; justify-items: center; text-align: center; }
  .settings-identity-centered { justify-content: center; text-align: center; }
  .settings-identity-centered > div { min-width: 0; overflow-wrap: anywhere; }
  .settings-identity-name { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
  button.settings-identity-name { background: none; border: 0; color: inherit; cursor: pointer; font-family: inherit; padding: 0; }
  .account-identity-email { max-width: 100%; overflow-wrap: anywhere; }
  .settings-identity-meta { color: var(--muted); font-size: 0.88rem; margin: 0; }

  .settings-section { display: grid; gap: 0.5rem; }
  .settings-group-title { color: var(--muted); font-size: 0.72rem; font-weight: 650; letter-spacing: 0.07em; margin: 0 0 0 0.9rem; text-transform: uppercase; }
  .settings-group { background: var(--settings-row-bg); border: 0; border-radius: 0.85rem; overflow: hidden; }
  .settings-group { --settings-divider-inset: .9rem; }
  .settings-group form.button_to { display: block; }
  /* The iOS footnote: the sentence that explains a group without crowding it. */
  .settings-note { color: var(--muted); font-size: 0.82rem; line-height: 1.45; margin: 0 0.9rem; }
  .settings-credit-notes { display: grid; gap: .5rem; padding-block: .75rem; }

  .settings-row { align-items: center; background: transparent; border: 0; border-radius: 0; color: var(--ink); cursor: pointer; display: flex; font-size: 0.97rem; gap: 0.75rem; min-height: 3rem; padding: 0.7rem 0.9rem; text-align: left; width: 100%; }
  @media (hover: hover) and (pointer: fine) {
    .settings-row:hover, .settings-field:hover { background: color-mix(in oklch, var(--ink) 3.5%, transparent); text-decoration: none; }
  }
  a.settings-row:not(.settings-row-action)::after { color: var(--muted); content: "›"; font-size: 1.15rem; margin-left: auto; padding-left: 0.5rem; }
  a.settings-row > .settings-row-text { flex: 1; }
  /* One of a few choices, as iOS Settings marks it: a check, no chevron. */
  a.settings-row.settings-choice::after, button.settings-row.settings-choice::after { color: var(--brand-ground); content: "✓"; font-size: 1.05rem; font-weight: 700; margin-left: auto; padding-left: 0.5rem; visibility: hidden; }
  .settings-row.settings-choice[aria-checked="true"]::after { visibility: visible; }
  .settings-row.settings-choice > .settings-row-text { flex: 1; }
  .settings-row-value { color: var(--muted); margin-left: auto; padding-left: 0.5rem; }
  .settings-more-toggle { list-style: none; }
  .settings-more-toggle::-webkit-details-marker { display: none; }
  .settings-more-chevron { width: 1.1rem; height: 1.1rem; flex: none; margin-left: auto; color: var(--muted); }
  details[open] > .settings-more-toggle .settings-more-chevron { transform: rotate(180deg); }
  .settings-row-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
  .settings-row-text small { color: var(--muted); font-size: 0.82rem; }
  .settings-row-text strong { font-weight: 620; overflow: hidden; text-overflow: ellipsis; }
  .settings-avatar { align-items: center; background: #3be37a; border-radius: 50%; color: white; display: flex; flex: 0 0 2.2rem; font-weight: 600; height: 2.2rem; justify-content: center; width: 2.2rem; }
  .settings-group-avatars { flex: none; }
  .settings-group-avatars .member-avatar { border-color: var(--surface); font-size: 0.8rem; height: 2rem; width: 2rem; }
  .settings-row-action { color: var(--c-accent, var(--accent)); font-weight: 560; }
  .settings-row-danger { color: var(--danger); }
  .settings-row-static { cursor: default; }
  /* Assistant's model: an area, then who pays and its model, two selects
     side by side; under the area's name on a narrow screen. */
  .model-area { flex-wrap: wrap; }
  .model-area > .settings-row-text { flex: 1 1 14rem; }
  .model-area-choices { display: flex; flex: 1 1 18rem; gap: 0.5rem; }
  .model-area-choices > form { display: contents; }
  .model-area-choices select { flex: 1; min-width: 0; }
  .model-area-choices .settings-row-value { margin-left: 0; padding-left: 0; }

  /* Row actions: small, level with each other, always at the trailing edge.
     One weight for the affirmative, one for the destructive, nothing loud —
     a settings screen is not the place for a primary call to action. */
  .settings-row-trailing { display: flex; flex: none; gap: 0.4rem; margin-left: auto; padding-left: 0.5rem; }
  .settings-action { background: color-mix(in oklch, var(--ink) 6%, transparent); border: 0; border-radius: 0.5rem; color: var(--ink); cursor: pointer; font-size: 0.84rem; font-weight: 600; padding: 0.32rem 0.7rem; white-space: nowrap; }
  .settings-action:hover { background: color-mix(in oklch, var(--ink) 11%, transparent); text-decoration: none; }
  .settings-action.accent { background: var(--c-accent-soft, var(--accent-soft)); color: var(--c-accent, var(--accent)); }
  .settings-action.danger { background: transparent; color: var(--danger); }

  /* Forms live inside a group, one field per row, label above value. */
  .settings-field { display: grid; gap: 0.3rem; padding: 0.7rem 0.9rem; }
  .settings-field label { color: var(--muted); font-size: 0.76rem; font-weight: 650; letter-spacing: 0.05em; margin: 0; text-transform: uppercase; }
  .settings-field input, .settings-field select, .settings-field textarea { background: transparent; border: 0; border-radius: 0; padding: 0; }
  .settings-field input:focus, .settings-field select:focus, .settings-field textarea:focus { border: 0; outline: 2px solid color-mix(in oklch, var(--accent) 35%, transparent); outline-offset: 0.25rem; }
  .settings-field p { margin: 0; }
  .settings-submit { display: flex; justify-content: flex-end; }
  .form-error { color: var(--danger); }

  .settings-qr { background: white; border-radius: 0.6rem; margin: 0 auto; padding: 0.9rem; width: fit-content; }
  .settings-qr svg { height: auto; width: 11rem; }
  .settings-link { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; overflow-wrap: anywhere; }

  .rail { display: none; }
  .desktop-chat-placeholder { display: none; }
  .rail-nav { display: flex; flex-direction: column; gap: 0.125rem; margin-top: 0.9rem; }
  .rail-link { align-items: center; border-radius: 0.5rem; color: var(--ink); display: flex; font-size: 0.94rem; gap: 0.6rem; padding: 0.48rem 0.6rem; }
  .rail-link svg { height: 1.15rem; width: 1.15rem; opacity: 0.75; }
  .rail-link:hover { background: color-mix(in oklch, var(--ink) 5%, transparent); text-decoration: none; }
  .rail-link.active { background: color-mix(in oklch, var(--ink) 8%, transparent); font-weight: 600; }
  .rail-link.active svg { opacity: 1; }
  .rail-nav { flex: 1; min-height: 0; overflow-y: auto; }
  .rail-nav form.button_to { display: block; }
  .rail-new-chat { align-items: center; display: flex; gap: 0.4rem; }
  .rail-new-chat svg { flex: none; height: 1.1rem; width: 1.1rem; }
  .list-nav, .list-nav-section, .list-primary-links { display: flex; flex-direction: column; gap: 0.25rem; }
  .list-link { align-items: center; background: transparent; border: 0; border-radius: 0.5rem; color: var(--ink); display: flex; font-size: 0.97rem; gap: 0.4rem; padding: 0.55rem 0.65rem; }
  .list-link { -webkit-tap-highlight-color: transparent; }
  .list-link:hover { text-decoration: none; }
  @media (hover: hover) { .list-link:hover { background: color-mix(in oklch, var(--ink) 5%, transparent); } }
  .list-link:active { background: color-mix(in oklch, var(--ink) 8%, transparent); }
  .list-link .chat-link-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .list-link .member-avatar + .chat-link-title { margin-left: 0.1rem; }
  .list-section-label { color: var(--ink); font-size: 0.92rem; font-weight: 700; letter-spacing: 0; margin-top: 1.8rem; padding: 0 0.65rem 0.5rem; }
  .list-chat-row { align-items: center; gap: 0.6rem; }
  .chat-avatar { align-items: center; display: flex; flex: none; }
  .chat-avatar svg { height: 1.3rem; width: 1.3rem; }
  .list-chat-row .member-avatar { font-size: 1rem; height: 2.6rem; width: 2.6rem; }
  .recent-conversation-row .chat-link-title { flex: 1; min-width: 0; }
  .recent-conversation-tail { align-items: center; display: flex; flex: none; gap: 0.55rem; margin-left: auto; }
  .recent-conversation-tail .unread-dot { margin-left: 0; }
  .recent-conversation-avatars { align-items: center; display: flex; flex: none; }
  .recent-conversation-avatars .member-avatar { border-color: var(--surface); font-size: 0.72rem; height: 1.65rem; width: 1.65rem; }
  .chat-link-body { display: flex; flex: 1; flex-direction: column; gap: 0.1rem; min-width: 0; }
  .chat-link-top { align-items: center; display: flex; gap: 0.4rem; }
  .chat-link-top .chat-link-title { font-weight: 600; }
  .chat-link-meta { align-items: center; color: var(--muted); display: flex; flex: none; font-size: 0.82rem; gap: 0.1rem; margin-left: auto; }
  .chat-link-chevron { color: color-mix(in oklch, var(--muted) 55%, transparent); height: 0.85rem; width: 0.85rem; }
  .chat-link-preview { -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--muted); display: -webkit-box; font-size: 0.88rem; line-height: 1.3; overflow: hidden; }
  .chat-link-top .unread-dot { margin-left: 0; }
  .rail-chat-link { display: flex; align-items: center; gap: 0.4rem; }
  .rail-chat-link .chat-link-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .unread-dot { background: #ff3b30; border-radius: 50%; flex: none; height: 0.5rem; margin-left: auto; width: 0.5rem; }
  .unread-dot[hidden] { display: none; }
  .history-sentinel { height: 1px; }
  .view-all-link { color: var(--muted); font-size: 0.9rem; }
  /* The welcome and the sign-in wear the iOS app's face (E81): the icon's
     flat ground with its near-black for the words, as SignInView.swift paints
     them. Each environment's --brand-ground comes on the body from
     config/brand.yml (heymio-x4nt). */
  body.onboarding-page { --onboarding-chrome: var(--brand-ground); --onboarding-ink: #030505; background: var(--brand-ground); color: #030505; color-scheme: light; }
  .signin { align-items: center; background: var(--brand-ground); color: #030505; color-scheme: light; display: flex; inset: 0; justify-content: center; padding: max(1.5rem, env(safe-area-inset-top)) 2rem max(1.5rem, env(safe-area-inset-bottom)); position: fixed; }
  .signin-card { display: grid; justify-items: center; max-width: 22rem; text-align: center; width: 100%; }
  .signin-icon { height: 9.4rem; margin-bottom: 1.6rem; max-width: 100%; }
  .signin h1 { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
  .signin p { font-size: 1.25rem; line-height: 1.4; margin: 0.4rem 0 3rem; opacity: 0.72; text-wrap: balance; }
  .signin-actions { display: grid; gap: 0.75rem; width: max-content; min-width: 85%; max-width: 100%; }
  .signin-actions form { margin: 0; }
  .signin-button { align-items: center; background: #fff; border: 0; border-radius: 999px; padding: 0.75rem 1.5rem; color: #000; cursor: pointer; display: flex; font-size: 1.06rem; font-weight: 600; gap: 0.75rem; justify-content: center; min-height: 3.1rem; transition: filter 150ms ease; width: 100%; }
  .signin-button svg { height: 1.2rem; width: 1.2rem; }
  .signin-button:hover { filter: brightness(0.96); }
  .onboarding { min-height: 100svh; overflow: hidden; }
  .onboarding-frame { display: grid; grid-template-columns: minmax(22rem, 0.86fr) minmax(30rem, 1.14fr); min-height: 100svh; position: relative; }
  .onboarding-topline { align-items: center; display: flex; justify-content: space-between; left: 0; padding: max(1.35rem, env(safe-area-inset-top)) clamp(1.35rem, 4vw, 4rem); position: absolute; right: 0; top: 0; z-index: 5; }
  .onboarding-brand { align-items: center; display: flex; gap: 0.7rem; }
  .onboarding-brand img { border-radius: 0.65rem; height: 2.4rem; width: 2.4rem; }
  .onboarding-brand strong { font-size: 1.05rem; letter-spacing: -0.02em; }
  .onboarding-topline > span { font-size: 0.72rem; font-weight: 750; letter-spacing: 0.08em; margin-left: auto; opacity: 0.58; }
  /* The preview's way out, after the step count (gh-163). */
  .onboarding-topline > span + .onboarding-close { margin-left: 0.85rem; }
  .onboarding-close { align-items: center; background: #fff; border-radius: 50%; color: #030505; display: inline-flex; font-size: 1.4rem; height: 2.75rem; justify-content: center; line-height: 1; text-decoration: none; width: 2.75rem; }
  .onboarding-close:hover { color: #030505; text-decoration: none; }
  .onboarding-close:focus-visible { outline: 3px solid rgb(3 5 5 / 0.45); outline-offset: 3px; }
  .onboarding-copy { align-self: center; padding: 8rem 2rem 5rem clamp(2rem, 7vw, 7rem); position: relative; z-index: 4; }
  /* Grouping for the phone's benefit; on a wide screen they add no box. */
  .onboarding-body, .onboarding-action { display: contents; }
  .onboarding-eyebrow { color: rgb(3 5 5 / 0.62); font-size: 0.72rem; font-weight: 850; letter-spacing: 0.15em; margin: 0 0 1.5rem; text-transform: uppercase; }
  .onboarding-copy h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(3.4rem, 6vw, 6.4rem); font-weight: 400; letter-spacing: -0.055em; line-height: 0.96; margin: 0 0 2rem; max-width: 9ch; }
  /* The second step carries the code as well as the words, so it gives back
     the room the first step spends on its headline. The padding is for the
     wide layout only: on a phone it would outrank the frame's own bottom
     padding and stand the button 20px higher than on the first step. */
  .onboarding-step-3 .onboarding-copy h1 { font-size: clamp(2.6rem, 4.2vw, 4.4rem); margin-bottom: 1.5rem; max-width: 14ch; }
  @media (min-width: 641px) {
    .onboarding-step-3 .onboarding-copy { padding-block: 6.5rem 2.5rem; }
  }
  .onboarding-intro { font-size: clamp(1rem, 1.5vw, 1.2rem); line-height: 1.65; margin: 0 0 2rem; max-width: 33rem; opacity: 0.77; }
  .onboarding-step-1 .onboarding-copy h1 { white-space: pre-line; max-width: none; font-size: clamp(2rem, 3.6vw, 4rem); }
  .onboarding-heading-mark { display: inline-block; height: 0.7em; width: 1em; vertical-align: baseline; }
  .onboarding-primary { align-items: center; background: #fff; border: 0; border-radius: 999px; color: #030505; cursor: pointer; display: inline-flex; font-weight: 750; justify-content: center; min-height: 2.9rem; padding: 0.75rem 1.05rem 0.8rem 1.4rem; text-decoration: none; transition: filter 180ms ease, transform 180ms ease; }
  .onboarding-primary span { display: inline-block; margin-left: 1.2rem; transition: transform 180ms ease; }
  .onboarding-primary:hover { color: #030505; filter: brightness(1.05); text-decoration: none; transform: translateY(-2px); }
  .onboarding-primary:hover span { transform: translateX(0.25rem); }
  .onboarding-primary:focus-visible, .onboarding-invite button:focus-visible { outline: 3px solid rgb(3 5 5 / 0.45); outline-offset: 3px; }
  .onboarding-action small { display: block; margin-top: 1rem; max-width: 28rem; opacity: 0.58; }
  .onboarding-copy .button_to { display: inline; }
  /* The code to scan, and the link for everybody out of camera range. No card
     around them: the only white on the screen is the quiet zone the QR needs
     to be read at all. */
  .onboarding-invite { display: grid; gap: 0.85rem; justify-items: center; margin: 0 0 1.5rem; max-width: 30rem; width: 100%; }
  /* The three kinds of group, and Connect Gmail, as the same white pills;
     the chosen kind is filled with the ink (E114). */
  .onboarding-kinds { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0 0 1.75rem; }
  .onboarding-kind { background: #fff; border: 0; border-radius: 999px; color: #030505; cursor: pointer; display: inline-flex; font-size: 1rem; font-weight: 750; min-height: 2.75rem; padding: 0.6rem 1.25rem; text-decoration: none; }
  .onboarding-kind[aria-pressed="true"] { background: #030505; color: #fffaf1; }
  .onboarding-kind[data-start="invite"][aria-pressed="false"] { color: #000; }
  .onboarding-kind:focus-visible { outline: 3px solid rgb(3 5 5 / 0.45); outline-offset: 3px; }
  /* The form holds both halves of the group step, so it lays out as if it
     were not there. The card's slot is kept before a pick, so nothing below
     moves when it appears; it wraps its words and opens the sheet. */
  .onboarding-group { display: contents; }
  .onboarding-primary:disabled { cursor: default; opacity: 0.45; }
  .onboarding-about-slot { max-width: 30rem; min-height: 8rem; }
  .onboarding-about { align-items: center; background: #fff; border: 0; border-radius: 1.1rem; color: #030505; cursor: pointer; display: flex; font: inherit; gap: 0.75rem; line-height: 1.4; padding: 0.9rem 0.75rem 0.9rem 1rem; text-align: left; width: 100%; }
  .onboarding-about[hidden] { display: none; }
  .onboarding-about > span:first-child { flex: 1; }
  .onboarding-about-prompt { color: #6b7171; }
  .onboarding-about-chevron { color: #9aa0a0; font-size: 1.5rem; line-height: 1; }
  .onboarding-about:focus-visible { outline: 3px solid rgb(3 5 5 / 0.45); outline-offset: 3px; }
  .onboarding-about-sheet { background: white; border: 0; border-radius: 1rem; box-sizing: border-box; color: #030505; max-width: 34rem; padding: 0; width: 100%; }
  .onboarding-about-sheet::backdrop { background: rgb(0 0 0 / 0.35); }
  .onboarding-about-sheet header { align-items: center; display: grid; grid-template-columns: 1fr auto 1fr; padding: 0.5rem 0.75rem; }
  .onboarding-about-sheet h2 { font-size: 1rem; margin: 0; }
  .onboarding-about-sheet header button { background: none; border: 0; color: #0a5bd3; cursor: pointer; font: inherit; min-height: 2.75rem; padding: 0 0.5rem; }
  .onboarding-about-sheet header button:first-child { justify-self: start; }
  .onboarding-about-done { font-weight: 700; justify-self: end; }
  .onboarding-about-sheet textarea { border: 0; box-sizing: border-box; font: inherit; line-height: 1.4; min-height: 14rem; padding: 0.5rem 1.25rem 1.25rem; resize: vertical; width: 100%; }
  .onboarding-about-sheet textarea:focus-visible { outline: none; }
  .onboarding-mail { color: var(--ink); margin-top: 1.5rem; margin-bottom: 2rem; max-width: 30rem; }
  .onboarding-mail[inert] { opacity: 0.6; }
  .onboarding-invite .onboarding-qr { margin: 0; padding: 0.55rem; width: min(9.5rem, 45vw); }
  .onboarding-invite button { background: #fff; border: 0; border-radius: 0.65rem; color: #030505; cursor: pointer; flex: none; font-size: 0.84rem; font-weight: 750; min-height: 2.4rem; padding: 0.45rem 0.75rem; }
  .onboarding-invite button:disabled { cursor: default; opacity: 0.45; }
  .onboarding-qr-empty { align-content: center; aspect-ratio: 1; box-sizing: border-box; color: rgb(3 5 5 / 0.58); display: grid; font-size: 0.84rem; font-weight: 750; text-align: center; }
  .invite-link { font-size: 0.8rem; overflow-wrap: anywhere; }
  /* The code carries its own paper: dark modules need a light quiet zone to
     scan, whatever the page behind them is doing. */
  .invite-qr { background: #fff; border-radius: 0.6rem; margin: auto; padding: 0.75rem; width: min(16rem, 100%); }
  .invite-qr svg { display: block; width: 100%; }
  .onboarding-scene { min-height: 45rem; position: relative; }
  .onboarding-mascot { height: min(35vw, 31rem); position: absolute; right: 10%; top: 9%; width: min(35vw, 31rem); }
  .onboarding-note { background: rgb(255 252 244 / 0.94); box-shadow: 0 1.2rem 3rem rgb(72 42 25 / 0.18); display: grid; padding: 1.3rem; position: absolute; width: min(18rem, 38vw); z-index: 2; }
  .onboarding-note { color: #3e3227; }
  .onboarding-note > span { color: #007c93; font-size: 0.68rem; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; }
  .onboarding-note > strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.4rem; font-weight: 400; line-height: 1.2; margin-top: 1.2rem; }
  .onboarding-note > em { font-size: 0.74rem; font-style: normal; margin-top: 0.45rem; opacity: 0.55; }
  .onboarding-note-reminder { border-radius: 0.45rem 1.4rem 1.4rem; right: 31%; top: 25%; transform: rotate(-5deg); }
  .onboarding-note-message { border-radius: 1.4rem 1.4rem 0.45rem 1.4rem; right: 6%; top: 49%; transform: rotate(4deg); }
  .onboarding-note-group { border-radius: 0.45rem 1.8rem 1.8rem; right: 12%; top: 30%; transform: rotate(3deg); width: min(23rem, 50vw); }
  .onboarding-note-group > strong { font-size: 1.65rem; }
  .onboarding-avatars { display: flex; margin-top: 1.2rem; }
  .onboarding-avatars b { align-items: center; background: #e8cbb1; border: 2px solid #fffaf1; border-radius: 50%; display: flex; font-size: 0.58rem; height: 1.8rem; justify-content: center; margin-left: -0.35rem; width: 1.8rem; }
  .onboarding-avatars b:first-child { margin-left: 0; }

  @media (max-width: 800px) {
    .onboarding { overflow: visible; }
    .onboarding-frame { grid-template-columns: 1fr; }
    .onboarding-copy { align-self: start; padding: calc(max(6.8rem, env(safe-area-inset-top) + 5rem)) 1.25rem 2rem; }
    .onboarding-copy h1 { font-size: clamp(3.1rem, 13vw, 5rem); }
    .onboarding-step-3 .onboarding-copy h1 { font-size: clamp(2.75rem, 11vw, 4.5rem); }
    .onboarding-intro { max-width: 36rem; }
    .onboarding-scene { min-height: 27rem; }
    .onboarding-mascot { height: 20rem; right: -2rem; top: 0; width: 20rem; }
    .onboarding-note { width: min(16rem, 64vw); }
    .onboarding-note-reminder { right: 26%; top: 8%; }
    .onboarding-note-message { right: 2%; top: 42%; }
    .onboarding-note-group { right: 5%; top: 14%; width: min(21rem, 78vw); }
  }

  /* One phone screen, no scrolling: the drawn scene goes, the daisy of the
     splash stands in its place, and every size that could push the button off
     the bottom is measured against the height of the screen rather than its
     width. */
  @media (max-width: 640px) {
    /* The topline floats and the scene is gone, so the copy is the only row
       there is — and it takes the whole screen to centre itself in. */
    .onboarding-frame { grid-template-rows: 1fr; height: 100svh; min-height: 0; }
    .onboarding-scene { display: none; }
    /* Words in the middle of the screen, button against the bottom of it. */
    .onboarding-copy { align-self: stretch; display: grid; grid-template-rows: 1fr auto; padding: calc(env(safe-area-inset-top) + 4.5rem) 1.25rem calc(env(safe-area-inset-bottom) + 1.25rem); }
    .onboarding-body { align-content: center; display: grid; justify-items: start; }
    .onboarding-action { align-self: end; display: grid; gap: 0.55rem; justify-items: start; padding-top: min(1.25rem, 2.2svh); }
    .onboarding-eyebrow { margin-bottom: min(1rem, 1.8svh); }
    .onboarding-copy h1 { font-size: min(2.9rem, 6.4svh); margin-bottom: min(1.25rem, 2.2svh); }
    .onboarding-step-3 .onboarding-copy h1 { font-size: min(2.4rem, 5.4svh); }
    .onboarding-intro { font-size: 0.98rem; line-height: 1.5; margin-bottom: min(1.5rem, 2.6svh); }
    .onboarding-invite { margin-bottom: 0; width: 100%; }
    .onboarding-invite .onboarding-qr { width: min(9rem, 20svh); }
    .onboarding-action small { margin-top: 0; }
  }

  @media (max-width: 460px) {
    .onboarding-topline { padding-inline: 1.15rem; }
    .onboarding-copy { padding-inline: 1.15rem; }
    .onboarding-note-reminder { right: 18%; }
  }

  @media (prefers-reduced-motion: no-preference) {
    .onboarding-copy > * { animation: onboarding-rise 520ms both; }
    .onboarding-copy > *:nth-child(2) { animation-delay: 60ms; }
    .onboarding-copy > *:nth-child(3) { animation-delay: 120ms; }
    .onboarding-copy > *:nth-child(4) { animation-delay: 180ms; }
    .onboarding-note-reminder { animation: onboarding-note-float 5s ease-in-out infinite; }
    .onboarding-note-message, .onboarding-note-group { animation: onboarding-note-float 5.5s 600ms ease-in-out infinite reverse; }
  }

  @keyframes onboarding-rise { from { opacity: 0; transform: translateY(1rem); } }
  @keyframes onboarding-note-float { 50% { margin-top: -0.6rem; } }
  .chat-shell { position: relative; }
  .rail-section-label { color: var(--ink); font-size: 0.84rem; font-weight: 700; letter-spacing: 0; margin-top: 1.4rem; padding: 0 0.6rem 0.4rem; }
  .recent-menu-section { display: flex; flex-direction: column; gap: 0.125rem; }
  .recent-menu-heading { align-items: center; display: flex; justify-content: space-between; margin-top: 1.4rem; padding: 0 0.6rem 0.4rem; }
  .recent-menu-heading .rail-section-label { margin: 0; padding: 0; }
  .recent-show-all { background: transparent; border: 0; color: var(--accent); cursor: pointer; font-size: 0.78rem; font-weight: 600; padding: 0; }
  .recent-show-all[hidden], .recent-conversation-row[hidden] { display: none; }
  .rail .recent-conversation-avatars .member-avatar { font-size: 0.62rem; height: 1.4rem; width: 1.4rem; }
  .member-avatar { align-items: center; background: #3be37a; border-radius: 50%; color: white; display: inline-flex; flex: none; font-size: 0.7rem; font-weight: 600; height: 1.45rem; justify-content: center; width: 1.45rem; }
  .rail-chat-link .member-avatar + .chat-link-title { margin-left: 0.1rem; }
  .rail-chat-link.active .unread-dot { display: none; }
  .rail-avatar { align-items: center; background: #3be37a; border-radius: 50%; color: white; display: flex; flex: 0 0 2rem; font-size: 0.9rem; font-weight: 600; height: 2rem; justify-content: center; width: 2rem; }

  @media (min-width: 900px) {
    /* Settings is a place you go, not a thing that opened over the app. The
       rail stays beside it and the topbar carries the way back, so nothing
       here floats, dims, or asks to be dismissed. */
    .settings-screen { padding-top: 0.5rem; }
    .rail { background: var(--paper); border-right: 0; display: block; grid-row: 1 / -1; height: 100dvh; min-width: 0; overflow: hidden; position: sticky; top: 0; }
    .rail > .conversation-index, .conversation-master-layout .conversation-index { display: flex; flex-direction: column; height: 100%; margin: 0; max-width: none; min-height: 0; overflow: hidden; padding: 0 1rem; }
    .rail .conversation-list, .conversation-master-layout .conversation-list { min-height: 0; overflow-y: auto; padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
    .conversation-master-layout .conversation-index.selecting .conversation-selection-bar { bottom: 1.4rem; position: absolute; }
    .rail .conversation-row.active { background: color-mix(in oklch, var(--ink) 6%, transparent); border-radius: 0.75rem; }
    .page-shell { display: grid; grid-template-columns: var(--sidebar-width, calc(100vw / 3)) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
    .topbar { grid-column: 2; grid-row: 1; }
    .topbar .menu-button { visibility: hidden; }
    /* A screen deeper than the rail can reach keeps its way back on desktop
       too — otherwise the only exit is the browser's own button. */
    .topbar .topbar-back-declared { visibility: visible; }
    .page-shell > .page-content { grid-column: 2; grid-row: 2; }
    /* Admin is a set of wide tables: a narrow fixed menu, and the content
       takes all the rest of the width. The value on the shell wins over the
       chat width the person set on the body. */
    .admin-page .page-shell { --sidebar-width: 13rem; }
    .admin-page .sidebar-divider { display: none; }
    .admin-page .page-shell > .page-content { max-width: none; padding-inline: 2rem; }
    .page-mobile-menu { display: none; }
    .app-chat-frame { display: grid; grid-template-columns: var(--sidebar-width, calc(100vw / 3)) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
    .app-chat-frame > .rail { grid-column: 1; grid-row: 1; height: 100%; min-height: 0; }
    .app-chat-frame > .chat-shell { grid-column: 2; grid-row: 1; min-height: 0; width: min(100%, 27rem); justify-self: center; }
    .chat-header > .chat-menu-button { visibility: hidden; }
    .conversation-master-layout { grid-template-columns: var(--sidebar-width, calc(100vw / 3)) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100dvh; overflow: hidden; }
    .conversation-master-layout > .page-content { display: grid; grid-column: 1 / -1; grid-row: 1; grid-template-columns: var(--sidebar-width, calc(100vw / 3)) minmax(0, 1fr); height: 100%; max-width: none; padding: 0; }
    .conversation-master-layout .conversation-index { border-right: 0; grid-column: 1; }
    .desktop-chat-placeholder { align-items: center; color: var(--muted); display: flex; flex-direction: column; grid-column: 2; justify-content: center; min-width: 0; }
    .desktop-chat-placeholder img { height: 4.5rem; margin-bottom: 1.25rem; opacity: 0.16; width: 4.5rem; }
    .desktop-chat-placeholder strong { color: var(--ink); font-size: 1.5rem; font-weight: 600; }
    .desktop-chat-placeholder span { font-size: 1.1rem; margin-top: 0.2rem; }
  }
}

@layer chat {
  /* Chat theme contract: every colour inside the chat screen derives from
     these tokens, which default to the standard app palette. Themes change
     colours only — never typography. Each member picks one light and one
     dark theme; the shell carries both as classes and the device colour
     scheme selects the active palette. */
  /* Defaults live on :root so bubbles and proposal cards render correctly
     outside the chat shell too (approvals pages, previews). */
  :root {
    --c-bg: var(--surface);
    --c-ink: var(--ink);
    --c-muted: var(--muted);
    --c-line: var(--line);
    --c-accent: var(--accent);
    --c-accent-soft: var(--accent-soft);
    --c-member: var(--accent);
    --c-member-ink: white;
    --c-assistant: color-mix(in oklch, var(--ink) 6%, var(--surface));
    --c-assistant-ink: var(--ink);
    --c-own-bubble: var(--c-member);
    --c-own-bubble-ink: var(--c-member-ink);
    --c-group-bubble: var(--c-assistant);
    --c-group-bubble-ink: var(--c-assistant-ink);
    --c-agent-bubble: var(--c-accent-soft);
    --c-agent-bubble-ink: var(--c-ink);
    --c-field: color-mix(in oklch, var(--ink) 5%, var(--surface));
  }

  /* Three themes, each carrying its own light and dark and following the
     device, so there is one pick to make instead of a pairing and a switch.

     Chatmio is the house look: marigold on warm paper, the launch colours.
     iOS and Android are what those two systems look like, so somebody
     arriving from either keeps reading the chat the way they already do.
     Neutral is the web on every other system: warm greys and near-black
     controls, between Claude and ChatGPT (E59). Nobody picks one; the
     browser's system does.

     .chat-theme-<name> is what the shell wears and it follows the device.
     .chat-theme-<name>-light / -dark pin one half unconditionally, which is
     how the picker shows both halves whatever the device is doing. */
  .chat-theme-chatmio-light { color-scheme: light; --c-bg: #ffffff; --c-ink: #352800; --c-muted: #8a7a4e; --c-line: #ece5d5; --c-accent: #a8760a; --c-accent-soft: #fdf0cc; --c-member: #f1c453; --c-member-ink: #352800; --c-assistant: #fff0b8; --c-assistant-ink: #352800; --c-own-bubble: #f1c453; --c-own-bubble-ink: #352800; --c-group-bubble: #f7dda0; --c-group-bubble-ink: #352800; --c-agent-bubble: #fff0b8; --c-agent-bubble-ink: #352800; --c-field: #f6f1e6; }
  .chat-theme-chatmio-dark { color-scheme: dark; --c-bg: #000000; --c-ink: #f6ecd2; --c-muted: #b3a276; --c-line: #2b2616; --c-accent: #f1c453; --c-accent-soft: #3a3113; --c-member: #f1c453; --c-member-ink: #241c00; --c-assistant: #3a3113; --c-assistant-ink: #f6ecd2; --c-own-bubble: #e0b23e; --c-own-bubble-ink: #241c00; --c-group-bubble: #4a3d16; --c-group-bubble-ink: #f6ecd2; --c-agent-bubble: #3a3113; --c-agent-bubble-ink: #f6ecd2; --c-field: #17140c; }
  .chat-theme-imessage-light { color-scheme: light; --c-bg: #ffffff; --c-ink: #000000; --c-muted: #8e8e93; --c-line: #e5e5ea; --c-accent: #007aff; --c-accent-soft: #e5f0ff; --c-member: #007aff; --c-member-ink: #ffffff; --c-assistant: #e9e9eb; --c-assistant-ink: #000000; --c-own-bubble: #007aff; --c-own-bubble-ink: #ffffff; --c-group-bubble: #e9e9eb; --c-group-bubble-ink: #000000; --c-agent-bubble: #e5f0ff; --c-agent-bubble-ink: #000000; --c-field: #f2f2f7; }
  .chat-theme-imessage-dark { color-scheme: dark; --c-bg: #000000; --c-ink: #ffffff; --c-muted: #8e8e93; --c-line: #2c2c2e; --c-accent: #0a84ff; --c-accent-soft: #0a2647; --c-member: #0a84ff; --c-member-ink: #ffffff; --c-assistant: #26252a; --c-assistant-ink: #ffffff; --c-own-bubble: #0a84ff; --c-own-bubble-ink: #ffffff; --c-group-bubble: #26252a; --c-group-bubble-ink: #ffffff; --c-agent-bubble: #0a2647; --c-agent-bubble-ink: #ffffff; --c-field: #1c1c1e; }
  .chat-theme-android-light { color-scheme: light; --c-bg: #ffffff; --c-ink: #1f1f1f; --c-muted: #5f6368; --c-line: #e3e3e3; --c-accent: #0b57d0; --c-accent-soft: #d3e3fd; --c-member: #0b57d0; --c-member-ink: #ffffff; --c-assistant: #e3ecfd; --c-assistant-ink: #1a1c1e; --c-own-bubble: #0b57d0; --c-own-bubble-ink: #ffffff; --c-group-bubble: #e3ecfd; --c-group-bubble-ink: #1a1c1e; --c-agent-bubble: #f0e7ff; --c-agent-bubble-ink: #241b35; --c-field: #eef2fb; }
  .chat-theme-android-dark { color-scheme: dark; --c-bg: #131314; --c-ink: #e3e3e3; --c-muted: #9aa0a6; --c-line: #2d2e30; --c-accent: #a8c7fa; --c-accent-soft: #0842a0; --c-member: #0842a0; --c-member-ink: #d3e3fd; --c-assistant: #1e2733; --c-assistant-ink: #e1e6ee; --c-own-bubble: #0842a0; --c-own-bubble-ink: #d3e3fd; --c-group-bubble: #1e2733; --c-group-bubble-ink: #e1e6ee; --c-agent-bubble: #332d41; --c-agent-bubble-ink: #eaddff; --c-field: #1a222c; }
  .chat-theme-neutral-light { color-scheme: light; --c-bg: #ffffff; --c-ink: #1f1e1d; --c-muted: #73716b; --c-line: #e9e7e2; --c-accent: #2f2e2b; --c-accent-soft: #f0eee9; --c-member: #1f1e1d; --c-member-ink: #ffffff; --c-assistant: #f4f3ef; --c-assistant-ink: #1f1e1d; --c-own-bubble: #ebe9e3; --c-own-bubble-ink: #1f1e1d; --c-group-bubble: #f5f4f0; --c-group-bubble-ink: #1f1e1d; --c-agent-bubble: #f7f6f2; --c-agent-bubble-ink: #1f1e1d; --c-field: #f4f3ef; }
  .chat-theme-neutral-dark { color-scheme: dark; --c-bg: #1f1f1e; --c-ink: #ececea; --c-muted: #a3a19b; --c-line: #33322f; --c-accent: #ececea; --c-accent-soft: #2c2b29; --c-member: #ececea; --c-member-ink: #1f1f1e; --c-assistant: #2a2927; --c-assistant-ink: #ececea; --c-own-bubble: #383733; --c-own-bubble-ink: #ececea; --c-group-bubble: #2c2b29; --c-group-bubble-ink: #ececea; --c-agent-bubble: #282725; --c-agent-bubble-ink: #ececea; --c-field: #2a2927; }

  @media (prefers-color-scheme: light) {
    .chat-theme-chatmio { color-scheme: light; --c-bg: #ffffff; --c-ink: #352800; --c-muted: #8a7a4e; --c-line: #ece5d5; --c-accent: #a8760a; --c-accent-soft: #fdf0cc; --c-member: #f1c453; --c-member-ink: #352800; --c-assistant: #fff0b8; --c-assistant-ink: #352800; --c-own-bubble: #f1c453; --c-own-bubble-ink: #352800; --c-group-bubble: #f7dda0; --c-group-bubble-ink: #352800; --c-agent-bubble: #fff0b8; --c-agent-bubble-ink: #352800; --c-field: #f6f1e6; }
    .chat-theme-imessage { color-scheme: light; --c-bg: #ffffff; --c-ink: #000000; --c-muted: #8e8e93; --c-line: #e5e5ea; --c-accent: #007aff; --c-accent-soft: #e5f0ff; --c-member: #007aff; --c-member-ink: #ffffff; --c-assistant: #e9e9eb; --c-assistant-ink: #000000; --c-own-bubble: #007aff; --c-own-bubble-ink: #ffffff; --c-group-bubble: #e9e9eb; --c-group-bubble-ink: #000000; --c-agent-bubble: #e5f0ff; --c-agent-bubble-ink: #000000; --c-field: #f2f2f7; }
    .chat-theme-android { color-scheme: light; --c-bg: #ffffff; --c-ink: #1f1f1f; --c-muted: #5f6368; --c-line: #e3e3e3; --c-accent: #0b57d0; --c-accent-soft: #d3e3fd; --c-member: #0b57d0; --c-member-ink: #ffffff; --c-assistant: #e3ecfd; --c-assistant-ink: #1a1c1e; --c-own-bubble: #0b57d0; --c-own-bubble-ink: #ffffff; --c-group-bubble: #e3ecfd; --c-group-bubble-ink: #1a1c1e; --c-agent-bubble: #f0e7ff; --c-agent-bubble-ink: #241b35; --c-field: #eef2fb; }
    .chat-theme-neutral { color-scheme: light; --c-bg: #ffffff; --c-ink: #1f1e1d; --c-muted: #73716b; --c-line: #e9e7e2; --c-accent: #2f2e2b; --c-accent-soft: #f0eee9; --c-member: #1f1e1d; --c-member-ink: #ffffff; --c-assistant: #f4f3ef; --c-assistant-ink: #1f1e1d; --c-own-bubble: #ebe9e3; --c-own-bubble-ink: #1f1e1d; --c-group-bubble: #f5f4f0; --c-group-bubble-ink: #1f1e1d; --c-agent-bubble: #f7f6f2; --c-agent-bubble-ink: #1f1e1d; --c-field: #f4f3ef; }
  }
  @media (prefers-color-scheme: dark) {
    .chat-theme-chatmio { color-scheme: dark; --c-bg: #000000; --c-ink: #f6ecd2; --c-muted: #b3a276; --c-line: #2b2616; --c-accent: #f1c453; --c-accent-soft: #3a3113; --c-member: #f1c453; --c-member-ink: #241c00; --c-assistant: #3a3113; --c-assistant-ink: #f6ecd2; --c-own-bubble: #e0b23e; --c-own-bubble-ink: #241c00; --c-group-bubble: #4a3d16; --c-group-bubble-ink: #f6ecd2; --c-agent-bubble: #3a3113; --c-agent-bubble-ink: #f6ecd2; --c-field: #17140c; }
    .chat-theme-imessage { color-scheme: dark; --c-bg: #000000; --c-ink: #ffffff; --c-muted: #8e8e93; --c-line: #2c2c2e; --c-accent: #0a84ff; --c-accent-soft: #0a2647; --c-member: #0a84ff; --c-member-ink: #ffffff; --c-assistant: #26252a; --c-assistant-ink: #ffffff; --c-own-bubble: #0a84ff; --c-own-bubble-ink: #ffffff; --c-group-bubble: #26252a; --c-group-bubble-ink: #ffffff; --c-agent-bubble: #0a2647; --c-agent-bubble-ink: #ffffff; --c-field: #1c1c1e; }
    .chat-theme-android { color-scheme: dark; --c-bg: #131314; --c-ink: #e3e3e3; --c-muted: #9aa0a6; --c-line: #2d2e30; --c-accent: #a8c7fa; --c-accent-soft: #0842a0; --c-member: #0842a0; --c-member-ink: #d3e3fd; --c-assistant: #1e2733; --c-assistant-ink: #e1e6ee; --c-own-bubble: #0842a0; --c-own-bubble-ink: #d3e3fd; --c-group-bubble: #1e2733; --c-group-bubble-ink: #e1e6ee; --c-agent-bubble: #332d41; --c-agent-bubble-ink: #eaddff; --c-field: #1a222c; }
    .chat-theme-neutral { color-scheme: dark; --c-bg: #1f1f1e; --c-ink: #ececea; --c-muted: #a3a19b; --c-line: #33322f; --c-accent: #ececea; --c-accent-soft: #2c2b29; --c-member: #ececea; --c-member-ink: #1f1f1e; --c-assistant: #2a2927; --c-assistant-ink: #ececea; --c-own-bubble: #383733; --c-own-bubble-ink: #ececea; --c-group-bubble: #2c2b29; --c-group-bubble-ink: #ececea; --c-agent-bubble: #282725; --c-agent-bubble-ink: #ececea; --c-field: #2a2927; }
  }

  /* The picker's preview tiles: a tiny two-bubble chat rendered from the
     same tokens the real shell uses. */
  .theme-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); margin-top: 1rem; }
  .theme-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 0.75rem; cursor: pointer; display: flex; flex-direction: column; overflow: hidden; padding: 0; text-align: left; }
  .theme-tile.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
  .theme-tile-screen { background: var(--c-bg); display: flex; flex-direction: column; gap: 0.35rem; padding: 0.75rem; }
  .theme-tile-bubble { border-radius: 0.6rem; font-size: 0.8rem; padding: 0.25rem 0.55rem; width: fit-content; }
  .theme-tile-bubble.opponent { background: var(--c-group-bubble); border-bottom-left-radius: 0.2rem; color: var(--c-group-bubble-ink); }
  .theme-tile-bubble.member { align-self: flex-end; background: var(--c-own-bubble); border-bottom-right-radius: 0.2rem; color: var(--c-own-bubble-ink); }
  .theme-tile-name { border-top: 1px solid var(--line); color: var(--ink); font-size: 0.85rem; font-weight: 600; padding: 0.5rem 0.75rem; }
  /* One swatch three ways: the assistant's shapes, in whichever theme the
     page is wearing. The samples repeat the thread's own rules at tile size. */
  .bubble-tile-screen { justify-content: center; min-height: 3.5rem; }
  .bubble-tile-sample { color: var(--c-ink); font-size: 0.8rem; padding: 0.25rem 0.55rem; width: fit-content; }
  .bubble-sample-none { padding-left: 0; }
  .bubble-sample-filled { background: var(--c-agent-bubble); border-radius: 0.6rem 0.6rem 0.6rem 0.2rem; color: var(--c-agent-bubble-ink); }
  .bubble-sample-outlined { border: 0.5px solid color-mix(in srgb, var(--c-agent-bubble) 72%, var(--c-ink)); border-radius: 0.6rem 0.6rem 0.6rem 0.2rem; }
  /* The tile shows what banded is: the fill reaching both edges of the little
     screen, so it cancels the screen's own padding. */
  .bubble-sample-banded {
    background: color-mix(in oklch, var(--c-agent-bubble) 55%, var(--c-bg));
    color: var(--c-agent-bubble-ink);
    margin-inline: -0.75rem; padding-inline: 1.3rem; width: auto;
  }
  /* A theme is a pair, so the tile shows the pair — both halves at once,
     whatever the device happens to be doing. */

  .app-chat-frame { background: var(--paper); height: 100dvh; overflow: hidden; overscroll-behavior: none; }
  /* One row height for the header, shared with the menu anchor that floats
     over it — the anchor is a sibling, so it cannot read this off the header
     itself. */
  .chat-shell { --chat-header-row: 2.75rem; display: flex; flex-direction: column; height: 100%; background: var(--c-bg); color: var(--c-ink); }
  .chat-shell a { color: var(--c-accent); }
  .chat-shell .button { background: var(--c-member); color: var(--c-member-ink); }
  .chat-shell .button.secondary { background: var(--c-accent-soft); color: var(--c-accent); }
  .chat-header { align-items: center; background: color-mix(in oklch, var(--c-bg) 86%, transparent); border-bottom: 0; display: grid; grid-template-columns: 2.5rem 1fr var(--chat-header-row); min-height: 3.5rem; padding: max(0.45rem, env(safe-area-inset-top)) 0.65rem 0.45rem; text-align: center; z-index: 10; }
  .chat-header form { display: contents; }
  .chat-shell a.chat-heading { color: var(--c-ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .chat-heading:active .chat-heading-pill { background: color-mix(in oklch, var(--c-field) 90%, var(--c-ink) 10%); }
  .chat-heading-avatars .member-avatar-photo { object-fit: cover; }
  .chat-heading { align-items: center; display: flex; flex-direction: column; min-width: 0; padding-block: 0.3rem; }
  .chat-heading-avatars { display: flex; justify-content: center; margin-bottom: -0.4rem; position: relative; z-index: 1; }
  .chat-heading-avatars .member-avatar { border: 2px solid var(--c-bg); font-size: 1.1rem; height: 2.75rem; width: 2.75rem; }
  .chat-heading-avatars .member-avatar + .member-avatar { margin-left: -0.65rem; }
  .chat-heading-more { background: var(--c-field); color: var(--c-ink); }
  .chat-heading .chat-heading-pill { align-items: center; background: color-mix(in oklch, var(--c-field) 65%, transparent); border: 1px solid color-mix(in oklch, var(--c-ink) 8%, transparent); border-radius: 2rem; display: flex; font-size: 0.9rem; gap: 0.25rem; max-width: 100%; padding: 0.45rem 0.75rem 0.45rem 1rem; }
  .chat-heading-avatars + .chat-heading-pill { padding-top: 0.75rem; }
  .chat-heading-chevron { color: color-mix(in oklch, var(--c-ink) 45%, transparent); flex: none; }
  .chat-menu-button { align-items: center; background: transparent; border: 0; border-radius: 50%; color: var(--c-ink); display: flex; height: 2.5rem; justify-content: center; width: 2.5rem; }

  /* The + popup rises from the + beside the field and holds what can be
     added. Each row is the system picker wearing a row, so a tap opens the
     picker and nothing else (issue #115). Camera is for touch screens. */
  .composer-add { align-self: flex-end; flex: none; position: relative; }
  .chat-add-scrim { display: none; inset: 0; position: fixed; z-index: 40; }
  .chat-add-menu { animation: menu-pop 140ms ease both; background: var(--surface); border: 1px solid color-mix(in oklch, var(--c-ink) 8%, transparent); border-radius: 0.9rem; bottom: calc(100% + 0.6rem); box-shadow: 0 10px 34px rgb(0 0 0 / 0.16); display: none; left: 0; padding: 0.3rem; position: absolute; transform-origin: bottom left; width: 14rem; z-index: 41; }
  body.chat-add-open .chat-add-menu, body.chat-add-open .chat-add-scrim { display: block; }
  .chat-add-menu label.chat-menu-row { cursor: pointer; font-weight: inherit; margin: 0; }
  .chat-add-file-input { height: 1px; opacity: 0; position: absolute; width: 1px; }
  /* GIFs from Giphy (E104): a panel above the composer, wide as the field,
     with the search, a grid of moving pictures, and Giphy's credit. */
  .gif-panel { background: #fff; border: 1px solid color-mix(in oklch, var(--c-ink) 8%, transparent); border-radius: 0.9rem; bottom: calc(100% + 0.6rem); box-shadow: 0 10px 34px rgb(0 0 0 / 0.16); display: grid; gap: 0.5rem; grid-template-rows: auto minmax(0, 1fr) auto; height: min(24rem, 55svh); left: 0; padding: 0.6rem; position: absolute; width: min(26rem, calc(100vw - 2rem)); z-index: 41; }
  .gif-panel[hidden] { display: none; }
  .gif-panel-top { align-items: center; display: flex; gap: 0.4rem; }
  .gif-panel-query { background: var(--c-bg); border: 1px solid color-mix(in oklch, var(--c-ink) 12%, transparent); border-radius: 999px; color: var(--c-ink); flex: 1; font-size: 1rem; min-height: 2.4rem; padding: 0.4rem 0.9rem; }
  .gif-panel-close { background: transparent; border: 0; color: var(--c-ink); cursor: pointer; height: 2.4rem; padding: 0.5rem; width: 2.4rem; }
  .gif-panel-grid { display: grid; gap: 0.3rem; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: max-content; align-content: start; align-items: start; min-height: 0; overflow-y: auto; }
  .gif-panel-item { position: relative; width: 100%; min-width: 0; aspect-ratio: 1; background: color-mix(in oklch, var(--c-ink) 6%, transparent); border: 0; border-radius: 0.5rem; cursor: pointer; overflow: hidden; padding: 0; }
  .gif-panel-item img { position: absolute; inset: 0; display: block; height: 100%; object-fit: cover; width: 100%; }
  .gif-panel-note { grid-column: 1 / -1; margin: 1rem 0; opacity: 0.6; text-align: center; }
  .gif-panel-credit { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; margin: 0; opacity: 0.55; text-align: right; }
  .chat-menu-row { align-items: center; background: transparent; border: 0; border-radius: 0.6rem; color: var(--c-ink); cursor: pointer; display: flex; font-size: 0.97rem; gap: 0.7rem; padding: 0.65rem 0.7rem; text-align: left; width: 100%; }
  @media (hover: hover) and (pointer: fine) { .chat-menu-row:hover { background: color-mix(in oklch, var(--c-ink) 8%, transparent); text-decoration: none; } }
  .chat-menu-row svg { flex: 0 0 1.1rem; height: 1.1rem; width: 1.1rem; }

  /* The theme popup: a framed, labelled preview pane on top, the mode
     switch (auto follows the device, light/dark pin one pick), the two
     tile grids, and Apply. Tiles only repaint the preview; Apply persists
     and recolours the real shell. The popup's own chrome uses the app
     tokens so it matches the rest of the UI — only the preview pane is
     themed. Padding doubles as room for the selected tile's outline
     inside the scrollable box. */
  /* The preview and actions stay visible while only the tile grids scroll,
     so users can always cancel or apply their selection. */
  .chat-theme-sticky { background: var(--surface); flex: 0 0 auto; }
  .theme-preview-frame { background: var(--surface); border: 1.5px dashed color-mix(in oklch, var(--muted) 55%, transparent); border-radius: 0.9rem; padding: 0.45rem; }
  .theme-preview { background: var(--c-bg); border-radius: 0.6rem; color: var(--c-ink); overflow: hidden; }
  .theme-preview-thread { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.75rem; }
  .theme-preview-thread .msg-row { margin: 0; }
  .theme-preview .bubble { font-size: 0.85rem; padding: 0.4rem 0.7rem; }
  .theme-preview .assistant-output { font-size: 0.85rem; padding-block: 0.4rem; }
  .theme-preview-composer { align-items: center; border-top: 1px solid var(--c-line); display: flex; gap: 0.45rem; padding: 0.5rem 0.75rem; }
  .theme-preview-field { background: var(--c-field); border-radius: 1rem; color: var(--c-muted); flex: 1; font-size: 0.85rem; padding: 0.3rem 0.7rem; }
  .theme-preview-mic { background: var(--c-member); border-radius: 50%; flex: 0 0 1.6rem; height: 1.6rem; }
  /* Popup buttons keep the app's own accent — the shell-level theme button
     override must not leak into the popup chrome. */
  /* The theme screen scrolls with the page: the preview and the modes stay
     in view while the tiles scroll past them. */
  .chat-theme-page { gap: 1rem; max-width: 28rem; }
  .chat-theme-form { display: grid; gap: 0.5rem; }
  .chat-theme-sticky { background: var(--paper); padding-bottom: 0.5rem; position: sticky; top: 0; z-index: 1; }
  .chat-theme-actions { display: flex; margin-top: 0.5rem; }
  .chat-theme-actions .button { flex: 1; }
  .chat-theme-options { padding: 0 0.15rem 0.15rem; }
  .chat-theme-page .theme-grid { gap: 0.5rem; grid-template-columns: 1fr 1fr; margin-top: 0; }
  .chat-theme-page .theme-grid.bubble-grid { grid-template-columns: repeat(2, 1fr); }
  .chat-theme-modes { background: color-mix(in oklch, var(--ink) 7%, transparent); border-radius: 0.6rem; display: flex; gap: 0.2rem; margin-top: 0.85rem; padding: 0.2rem; }
  .chat-theme-mode { background: transparent; border: 0; border-radius: 0.45rem; color: var(--ink); cursor: pointer; flex: 1; font-size: 0.85rem; font-weight: 600; padding: 0.35rem 0; }
  .chat-theme-mode.selected { background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / 0.15); }
  .chat-theme-menu-label { color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; margin: 0.8rem 0 0.35rem 0.1rem; text-transform: uppercase; }
  .theme-preview-frame .chat-theme-menu-label { margin: 0 0 0.3rem 0.3rem; }
  /* overflow-anchor: none — loadEarlier compensates its own prepend by
     scrollTop arithmetic; WebKit's native scroll anchoring (new in iOS 26)
     compensated it a second time, and the double correction leapt the
     reader down the thread on every history load. All anchoring in this
     scroller is manual. */
  /* One spacing scale for everything in the timeline, the same on web, iOS
     and Android (E116, rails/docs/timeline-spacing.md). Every row stands
     --space-row below the one above; a change of sender adds a gap: your
     own new post the most, the first post after yours the least. */
  .chat-thread { --space-row: 0.375rem; --space-own: 1.125rem; --space-after-own: 0.375rem; --space-other: 0.75rem;
    --space-bubble-block: 0.5rem; --space-bubble-inline: 0.75rem;
    --chat-thread-inline: max(1rem, env(safe-area-inset-left)); flex: 1; overflow-anchor: none; overflow-y: auto; overscroll-behavior: contain; padding: 0.8rem var(--chat-thread-inline); }
  /* Mio's own colours, as the new chat + in the list (gh-187). */
  .msg-row { display: flex; margin-top: calc(var(--space-row, 0.375rem) + var(--space-other, 0.75rem)); }
  .msg-row-own { margin-top: calc(var(--space-row, 0.375rem) + var(--space-own, 1.125rem)); }
  .msg-row-own + .msg-row:not(.msg-row-own) { margin-top: calc(var(--space-row, 0.375rem) + var(--space-after-own, 0.375rem)); }
  .msg-row, .composer-form { margin-inline: auto; max-width: 42rem; }
  .msg-row-own { justify-content: flex-end; }
  .room-message-avatar { align-items: center; align-self: flex-end; background: var(--c-member); border: 2px solid var(--c-bg); border-radius: 50%; color: var(--c-member-ink); display: inline-flex; flex: 0 0 2rem; font-size: 0.75rem; font-weight: 600; height: 2rem; justify-content: center; object-fit: cover; width: 2rem; }
  .room-member-avatar { margin: 0 0.4rem 0.05rem 0; }
  .msg-author { display: block; font-size: 0.72rem; margin-bottom: 0.125rem; opacity: 0.72; }
  .msg-row:has(> .msg-author) { flex-wrap: wrap; }
  .msg-row > .msg-author { flex: 0 0 100%; color: var(--c-muted); }
  .msg-row:has(> .room-member-avatar) > .msg-author { padding-inline-start: 2.4rem; }
  .msg-row-same-sender > .msg-author, .msg-row-own > .msg-author { display: none; }
  .msg-edited { display: block; font-size: 0.65rem; margin-top: 0.15rem; opacity: 0.65; }
  .reply-source { display: block; font-size: 0.7rem; margin-bottom: 0.35rem; opacity: 0.72; }
  .extraction-columns { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .extraction-columns h3 { font-size: 0.85rem; }
  .extraction-columns small { color: var(--muted); display: block; margin-top: 0.25rem; }
  .source-quote { font-style: italic; }
  @media (max-width: 700px) { .extraction-columns { grid-template-columns: 1fr; } }
  .msg-row[data-role="assistant"] { justify-content: flex-start; }
  .msg-row.msg-row-same-sender { margin-top: var(--space-row, 0.375rem); }
  .msg-time { align-self: flex-end; color: var(--c-muted); font-size: 0.68rem; margin: 0 0.45rem 0.1rem; opacity: 0.8; }
  .msg-row-own .msg-time { order: -1; }
  .day-separator { color: var(--c-muted); font-size: 0.75rem; margin: 1rem auto 0.5rem; max-width: 42rem; text-align: center; }
  .day-separator + .msg-row { margin-top: var(--space-row, 0.375rem); }
  .bubble { border-radius: 1.25rem; font-size: 1rem; line-height: 1.42; max-width: 76%; overflow-wrap: anywhere; padding: var(--space-bubble-block, 0.5rem) var(--space-bubble-inline, 0.75rem); white-space: normal; }
  .msg-body { display: block; white-space: pre-wrap; }
  /* A quotation in a post or an answer: a bar of the words' own ink, the
     words a shade quieter, no extra indent beyond the bar (E45). */
  :is(.msg-body, .assistant-output) blockquote { border-inline-start: 3px solid color-mix(in oklch, currentColor 45%, transparent); margin: 0.3em 0; opacity: 0.82; padding-inline: 0.7rem 0; }
  .msg-body blockquote { white-space: pre-wrap; }
  .msg-body blockquote + blockquote { margin-top: 0; }
  /* The card of a linked page, under the words, in the bubble's own tones. */
  .link-preview { background: rgb(0 0 0 / 6%); border-radius: 0.9rem; color: inherit; display: flex; flex-direction: column; margin-top: 0.5rem; max-width: 20rem; overflow: hidden; text-decoration: none; }
  .link-preview-image { aspect-ratio: 1.91; display: block; object-fit: cover; width: 100%; }
  .link-preview-picture .link-preview-image { height: auto; max-height: 22rem; }
  /* A card is the bubble's own ink, not a blue link over a blue bubble. */
  .chat-shell a.link-preview { color: inherit; }
  .link-preview-text { display: flex; flex-direction: column; gap: 0.125rem; padding: 0.5rem 0.625rem; }
  .link-preview-title { font-size: 0.92rem; line-height: 1.3; }
  .link-preview-description { -webkit-box-orient: vertical; -webkit-line-clamp: 2; display: -webkit-box; font-size: 0.82rem; line-height: 1.3; opacity: 0.8; overflow: hidden; }
  .link-preview-site { font-size: 0.75rem; opacity: 0.65; text-transform: lowercase; }
  .bubble-member { background: var(--c-group-bubble); border-bottom-left-radius: 0.35rem; color: var(--c-group-bubble-ink); }
  .msg-row:not(.msg-row-own) .bubble-member:not(.bubble-emoji):not(.bubble-gif):not(.bubble-gift) { border: 0.5px solid var(--ios-separator); }
  .msg-row-own .bubble-member { background: var(--c-own-bubble); border-bottom-left-radius: 1.25rem; border-bottom-right-radius: 0.35rem; color: var(--c-own-bubble-ink); }
  /* One to three emoji are the emoji themselves, larger than in Messages (E58). */
  .bubble-member.bubble-emoji, .msg-row-own .bubble-member.bubble-emoji { background: none; box-shadow: none; line-height: 1.1; padding-inline: 0.1rem; }
  .bubble-member.bubble-gif, .msg-row-own .bubble-member.bubble-gif { background: none; box-shadow: none; padding: 0; }
  .bubble-emoji .msg-body { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
  .bubble-emoji-1 .msg-body { font-size: 5rem; }
  .bubble-emoji-2 .msg-body { font-size: 4rem; }
  .bubble-emoji-3 .msg-body { font-size: 3.25rem; }
  .assistant-output { color: var(--c-ink); flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; padding-block: 0.5rem; white-space: normal; }
  .assistant-output-text { line-height: 1.42; }
  /* The assistant's messages can wear a bubble too. Both shapes share the
     member bubble's geometry and take their colour from the theme's agent
     tokens, so a pick is a shape and never a palette. */
  :is(.assistant-bubble-filled, .assistant-bubble-outlined) .assistant-output {
    border-radius: 1.25rem 1.25rem 1.25rem 0.35rem; max-width: 76%; padding: var(--space-bubble-block, 0.5rem) var(--space-bubble-inline, 0.75rem);
  }
  .assistant-bubble-filled .assistant-output { background: var(--c-agent-bubble); color: var(--c-agent-bubble-ink); }
  /* The fill read as a bubble on its own; a hairline of it does not, so the
     outline is the same tone taken far enough towards the ink to be seen. */
  .assistant-bubble-outlined .assistant-output { background: var(--c-bg); border: 0.5px solid color-mix(in srgb, var(--c-agent-bubble) 72%, var(--c-ink)); }
  /* Banded keeps the theme's agent fill and drops the bubble entirely: square,
     and running the full width of the thread, so a long answer reads as a
     passage rather than as something said. It cancels the thread's own inline
     padding to reach the edges and pads its text back by the same amount, so
     the words stay in line with every other bubble. On a wide window the
     thread is a centred column, so the band spans that column rather than the
     whole window. */
  .assistant-bubble-banded .assistant-output {
    background: color-mix(in oklch, var(--c-agent-bubble) 55%, var(--c-bg));
    color: var(--c-agent-bubble-ink); flex: 1 1 auto;
    margin-inline: calc(-1 * var(--chat-thread-inline, 0px));
    padding: 0.5rem var(--chat-thread-inline, 0px);
  }
  /* Mio at work, as Mio's bubble at the end of the thread (app-chat#showTyping;
     Martin, 2026-11-09). It wears the chosen assistant bubble (.assistant-output),
     so it looks like the answer that takes its place. 44 px high and about
     200 px wide, and the label and the dots share one cell, so the label
     changing to the dots never moves or resizes it. */
  .turn-bubble { --turn-dim: var(--c-muted); --turn-lit: var(--c-ink);
    align-items: center; appearance: none; background: none; border: 0; border-radius: 0; display: grid; font: inherit;
    grid-template-columns: minmax(0, 1fr); line-height: 1.42; margin: 0; min-height: 44px; min-width: min(12.5rem, 100%); padding-inline: 0; text-align: start; }
  :is(.assistant-bubble-filled, .assistant-bubble-banded) .turn-bubble { --turn-dim: color-mix(in oklch, var(--c-agent-bubble-ink) 55%, transparent); --turn-lit: var(--c-agent-bubble-ink); }
  /* The member's own turn: the bubble is a button, and its menu stops the
     work. Another member's turn is only shown. */
  .turn-row:not(.turn-own) > .turn-bubble-own, .turn-row.turn-own > .turn-bubble-other { display: none; }
  .turn-bubble-own { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .turn-bubble-own:active { opacity: 0.7; }
  .turn-bubble > * { grid-area: 1 / 1; transition: opacity 0.22s ease; }
  .turn-dots { align-items: center; display: flex; gap: 0.32rem; height: 1.42em; }
  .turn-dots span { animation: typing-blink 1.2s infinite both; background: var(--turn-dim); border-radius: 50%; height: 0.45rem; width: 0.45rem; }
  .turn-dots span:nth-child(2) { animation-delay: 0.2s; }
  .turn-dots span:nth-child(3) { animation-delay: 0.4s; }
  /* The work's name, with a light passing over it. */
  .turn-label { animation: turn-light 2.2s linear infinite; -webkit-background-clip: text; background-clip: text; color: transparent; font-style: normal; min-width: 0; opacity: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    background-image: linear-gradient(100deg, var(--turn-dim) 35%, var(--turn-lit) 50%, var(--turn-dim) 65%); background-size: 250% 100%; }
  .turn-row.working .turn-label { opacity: 1; }
  /* One at a time (heymio-f2yb): the one that goes goes at once, the one
     that comes fades in, so the name and the dots never show together. */
  .turn-row.working .turn-dots, .turn-row:not(.working) .turn-label { opacity: 0; transition: none; }
  @keyframes turn-light { from { background-position: 100% 0; } to { background-position: 0% 0; } }
  /* An end with nothing to show: the bubble fades and its height goes
     (app-chat#fadeTyping sets the height and the margin). */
  .turn-row.turn-closing { opacity: 0; overflow: hidden; transition: height 0.26s ease, margin-top 0.26s ease, opacity 0.26s ease; }
  /* The bubble's menu, anchored at it, over the thread above it. */
  .turn-menu { animation: menu-pop 140ms ease both; background: var(--surface); border: 1px solid color-mix(in oklch, var(--c-ink) 8%, transparent); border-radius: 0.9rem; bottom: calc(100% + 0.35rem); box-shadow: 0 10px 34px rgb(0 0 0 / 0.16); left: 2.4rem; min-width: 11rem; padding: 0.3rem; position: absolute; transform-origin: bottom left; z-index: 5; }
  @media (prefers-reduced-motion: reduce) {
    .turn-dots span { animation: none; opacity: 1; }
    .turn-label { animation: none; background: none; color: var(--turn-dim); }
    .turn-bubble > *, .turn-row.turn-closing { transition: none; }
    .turn-menu { animation: none; }
  }
  /* Under the member's own message they stopped, as "Not Delivered" in
     Messages (Martin, 2026-11-09, 5A). */
  .msg-row:has(> .msg-stopped) { flex-wrap: wrap; }
  .msg-stopped { color: var(--c-muted); flex: 0 0 100%; font-size: 0.75rem; line-height: 1.3; margin-top: 0.2rem; text-align: end; }
  /* What the phone or a shared position gave Mio's answer (heymio-fvpl):
     muted under Mio's bubble, or under the member's message, as Stopped. */
  .msg-row:has(> .msg-caption) { flex-wrap: wrap; }
  .msg-caption { color: var(--c-muted); flex: 0 0 100%; font-size: 0.75rem; line-height: 1.3; margin-top: 0.2rem; text-align: end; }
  .msg-row:is([data-role="assistant"], .turn-row) > .msg-caption { text-align: start; }
  .msg-row:is([data-role="assistant"], .turn-row):has(> .room-member-avatar) > .msg-caption { padding-inline-start: 2.4rem; }
  /* Reactions: one quiet pill hanging off the bubble's lower corner, the
     first three kinds and the total. The pill opens the message menu. */
  .msg-row { position: relative; }
  /* Drawings and stickers over the thread (heymio-jtyo): placed from the
     bubble's top-left corner, above every bubble, never part of the layout. */
  /* The drawing mode's paper kept in the thread (gh-194): an empty row of
     its drawing's height, the drawing on it from its top-left corner. */
  .paper-row { flex-shrink: 0; pointer-events: none; position: relative; width: 100%; }
  .scribble-layer { height: 0; left: 0; overflow: visible; pointer-events: none; position: absolute; top: 0; width: 0; z-index: 3; }
  .scribble { align-items: center; display: flex; justify-content: center; position: absolute; transform-origin: center; }
  .scribble svg { overflow: visible; }
  .scribble polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; }
  .scribble-emoji span { line-height: 1; }
  .scribble-text span { font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; text-align: center; white-space: pre-wrap; }
  .scribble-photo img { height: 100%; object-fit: contain; width: 100%; }
  /* The pill rides 8px up over the bubble's lower edge, as on iOS and
     Android (heymio-5jxq): its 1.6rem height less --reaction-overlap
     hangs below. Bare answer text has no edge, so there it starts below. */
  .msg-row, :is(.assistant-bubble-filled, .assistant-bubble-outlined) .assistant-output { --reaction-overlap: 0.5rem; }
  .assistant-output { --reaction-overlap: 0rem; }
  .msg-row:has(.reaction-pill) { margin-bottom: calc(1.6rem - var(--reaction-overlap)); }
  .bubble-reactions { bottom: calc(var(--reaction-overlap) - 1.6rem); display: flex; left: 0.6rem; position: absolute; z-index: 2; }
  .msg-row:has(.room-message-avatar) .bubble-reactions { left: 3rem; }
  .msg-row-own .bubble-reactions { left: auto; right: 0.6rem; }
  .assistant-output { position: relative; }
  .assistant-output > .bubble-reactions { left: 0.2rem; }
  :is(.assistant-bubble-filled, .assistant-bubble-outlined) .assistant-output > .bubble-reactions { left: 0.6rem; }
  .msg-row[data-role="assistant"]:has(.reaction-pill) { margin-bottom: 0; }
  .assistant-output:has(.reaction-pill) { margin-bottom: calc(1.6rem - var(--reaction-overlap)); }
  .reaction-pill { align-items: center; background: var(--c-bg); border: 1px solid var(--c-line); border-radius: 999px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.1); color: var(--c-muted); cursor: pointer; display: inline-flex; font-size: 0.95rem; gap: 0.05rem; height: 1.6rem; line-height: 1; padding: 0 0.42rem; }
  .reaction-pill-emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
  .reaction-pill-count { font-size: 0.72rem; font-variant-numeric: tabular-nums; font-weight: 650; margin-left: 0.2rem; }
  .reaction-pill.reaction-own { background: color-mix(in oklch, var(--c-accent) 12%, var(--c-bg)); border-color: color-mix(in oklch, var(--c-accent) 35%, var(--c-line)); color: var(--c-accent); }
  @media (hover: hover) and (pointer: fine) { .reaction-pill:hover { border-color: color-mix(in oklch, var(--c-ink) 22%, var(--c-line)); } }

  /* Records an answer made or showed, under the answer (elfmio-36o4): one
     scale for every card, as iOS draws them (elfmio-wkt2). */
  .msg-row:has(.record-cards) { flex-wrap: wrap; }
  .record-cards { display: grid; flex-basis: 100%; gap: 0.5rem; justify-items: start; margin-top: 0.4rem; }
  .msg-row:has(.room-message-avatar) .record-cards { padding-left: 2.4rem; }
  .msg-continue-button.game-reminder-play { color: var(--success); display: inline-block; margin-top: 0.5rem; text-decoration: none; }
  .msg-continue-button.key-failed-open { display: inline-block; margin-top: 0.5rem; text-decoration: none; }
  .msg-continue-button { background: var(--c-field); border: 0; border-radius: 999px; box-shadow: 0 0 0 0.5px color-mix(in oklch, var(--c-ink) 14%, transparent), 0 1px 2px rgb(0 0 0 / 0.06); color: var(--c-ink); cursor: pointer; font: inherit; font-size: 0.875rem; line-height: 1.4; padding: 0.4rem 0.9rem; }
  /* A card wears the assistant's bubble (.assistant-output) in the chosen
     theme, so it reads as something Mio said rather than a panel of its own
     (E43, elfmio-8xuu). Its rows reach the bubble's edges through --card-inset,
     which is the bubble's own side padding for each shape. */
  .record-card { --card-inset: 0px; display: grid; max-width: min(21.25rem, 100%); padding-bottom: 0; width: 100%; }
  :is(.assistant-bubble-filled, .assistant-bubble-outlined) .record-card { --card-inset: 0.85rem; max-width: min(21.25rem, 100%); }
  .assistant-bubble-banded .record-card { --card-inset: var(--chat-thread-inline, 0px); max-width: none; }
  .record-card-heading { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.375rem; font-size: 1.05rem; font-weight: 650; }
  .record-card-icon { flex: none; width: 24px; height: 24px; font-size: 24px; line-height: 1; }
  .record-card-list-icon { display: flex; justify-content: center; width: 1.4rem; }
  .record-card-title { font-size: 1.05rem; font-weight: 650; line-height: 1.3; }
  .record-card p { margin: 0; }
  .record-card-when { font-variant-numeric: tabular-nums; margin-top: 0.2rem !important; }
  .record-card-cancelled { opacity: 0.62; text-decoration: line-through; }
  .record-card-note { font-size: 0.92rem; opacity: 0.62; }
  .record-card-body { margin-top: 0.25rem !important; white-space: pre-line; }
  .record-card > p:last-of-type, .record-card-items, .record-card > form:not(:last-child) { margin-bottom: 0.55rem !important; }
  .record-card-items { display: grid; list-style: none; margin: 0.15rem 0 0; padding: 0; }
  .record-card form { margin: 0; }
  .record-card-tick { align-items: center; background: transparent; border: 0; color: inherit; cursor: pointer; display: flex; font-size: 1rem; gap: 0.75rem; margin-inline: calc(-1 * var(--card-inset)); min-height: 2.75rem; padding: 0 var(--card-inset); text-align: left; width: calc(100% + 2 * var(--card-inset)); }
  @media (hover: hover) and (pointer: fine) { .record-card-tick:hover { background: color-mix(in oklch, var(--c-ink) 5%, transparent); } }
  .record-card-box { align-items: center; border: 2px solid color-mix(in oklch, currentColor 45%, transparent); border-radius: 50%; display: flex; flex: none; height: 1.4rem; justify-content: center; width: 1.4rem; }
  /* The mark is clear until ticked; the box keeps the ink for its outline. */
  .record-card-box svg { color: transparent; height: 0.95rem; width: 0.95rem; }
  .record-card-tick.done { opacity: 1; }
  .record-card-tick.done .record-card-box { background: #3be37a; border-color: #3be37a; opacity: 1; }
  .record-card-tick.done .record-card-box svg { color: #000; }
  .record-card-tick.done .record-card-label { opacity: 0.62; text-decoration: line-through; }
  .record-card-tick:active .record-card-box { transform: scale(0.9); }
  .record-card-add-new { align-items: center; color: var(--c-muted); display: flex; font-size: 1rem; gap: 0.75rem; min-height: 2.75rem; }
  .record-card-add-new input { background: transparent; border: 0; border-radius: 0; box-shadow: none; color: inherit; flex: 1; font: inherit; min-width: 0; padding: 0; outline: none; }
  .record-card-add-new input::placeholder { color: var(--c-muted); opacity: 1; }
  .record-card-add-new:focus-within { color: var(--c-ink); }
  .record-card-add-confirm { background: transparent; border: 0; color: #007aff; cursor: pointer; font-size: 1.3rem; min-height: 2.75rem; min-width: 2.75rem; }
  .record-card-add-new:not(:focus-within) .record-card-add-confirm { display: none; }
  .record-card-add-new [role="alert"] { color: var(--c-ink); font-size: 0.85rem; }
  .record-card [contenteditable] { cursor: text; min-width: 0; outline: none; overflow-wrap: anywhere; white-space: pre-wrap; }
  .record-card [contenteditable]:empty::before { content: "\200b"; }
  .record-card [data-placeholder]:empty:not(:focus)::before { content: attr(data-placeholder); color: var(--c-ink); opacity: 0.62; pointer-events: none; }
  .record-card-heading [contenteditable] { flex: 1; }
  .record-card-edit-row { display: flex; align-items: center; gap: 0.75rem; min-height: 2.75rem; }
  .record-card-edit-row[hidden] { display: none; }
  .record-card-edit-row > form { flex: none; }
  .record-card-edit-row .record-card-tick { width: auto; margin: 0; padding: 0; }
  .record-card-edit-row > .record-card-label { flex: 1; padding-block: 0.5rem; }
  .record-card-edit-row.done > .record-card-label { opacity: 0.62; text-decoration: line-through; }
  .record-card-status, .record-note-more { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; padding: 0; text-align: start; }
  .record-card-status { flex: 1; min-height: 2.75rem; }
  .record-note-body .record-card-body { line-height: 1.4; min-height: 1.4em; }
  .record-note-body:not(.expanded) .record-card-body:not(:focus) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden; }
  .record-note-more { min-height: 2.75rem; opacity: 0.62; }
  .record-editor-confirm { position: fixed; right: 1rem; bottom: 0.5rem; z-index: 90; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: var(--c-surface, white); color: #198b39; font-size: 1.5rem; cursor: pointer; box-shadow: 0 2px 10px #0002; }
  .record-editor-confirm[hidden], .record-note-more[hidden] { display: none; }
  .record-editor-error { max-width: min(24rem, 90vw); border: 0; border-radius: 1rem; padding: 1.5rem; }
  .record-editor-error::backdrop { background: #0005; }
  .record-editor-error button { margin-top: 1rem; }
  /* Approve sits above Delete on a card: the safe act is the one that looks
     like a button, the destructive one stays a plain row (elfmio-ik0p). */
  .record-card-approve { align-items: center; background: var(--accent); border: 0; border-radius: 0.6rem; color: var(--on-accent, #fff); cursor: pointer; display: flex; font-size: 0.94rem; font-weight: 650; justify-content: center; margin-top: 0.7rem; min-height: 2.6rem; padding: 0 0.9rem; width: 100%; }
  @media (hover: hover) and (pointer: fine) { .record-card-approve:hover { filter: brightness(1.06); } }
  /* A sign-in card's three actions (heymio-3db010aa): forms from button_to
     stack like the link beside them. */
  .record-card-actions { display: grid; gap: 0.5rem; margin-top: 0.7rem; }
  .record-card-actions .record-card-approve, .record-card-actions .record-card-secondary { margin-top: 0; text-decoration: none; }
  /* "Open sign-in" is a link: .chat-shell a would give it the accent colour
     on its accent background (heymio-56aa9db7.10). */
  .record-card-actions a.record-card-approve { color: var(--on-accent, #fff); }
  /* A sign-in's steps are messages (heymio-yc52.16): the host under Mio's
     words, the fields and the choices in the message. Older steps keep
     their choices, inactive. */
  .sign-in-step-host { color: var(--c-muted, var(--muted)); font-size: 0.85rem; margin-top: 0.15rem !important; }
  .sign-in-step-form fieldset { border: 0; display: grid; gap: 0.35rem; margin: 0.6rem 0 0; min-width: 0; padding: 0; }
  .sign-in-step-form label { color: var(--c-muted, var(--muted)); font-size: 0.85rem; margin-top: 0.35rem; }
  .sign-in-step-form input:not([type="submit"]) { background: var(--c-field, var(--surface)); border: 1px solid var(--c-line, var(--line)); border-radius: 0.6rem; color: inherit; font: inherit; font-size: max(1rem, 16px); min-height: 2.75rem; padding: 0 0.75rem; width: 100%; }
  .sign-in-step-form fieldset:disabled, .sign-in-step-actions :disabled { cursor: default; opacity: 0.45; }
  .sign-in-step-actions .record-card-secondary { min-height: 2.6rem; width: 100%; }
  /* "Open the check" beside "Let Mio confirm" (heymio-yc52.4). */
  .record-card-actions a.record-card-secondary { align-items: center; display: flex; justify-content: center; }
  /* A text message's Send is an sms: link (gh-190). */
  .record-card a.record-card-approve { color: var(--on-accent, #fff); text-decoration: none; }
  .record-card-actions form { margin: 0; }
  .record-card-secondary { background: transparent; border: 1px solid var(--c-line); border-radius: 0.6rem; color: inherit; cursor: pointer; font-size: 0.94rem; min-height: 2.6rem; padding: 0 0.9rem; width: 100%; }

  /* The hover button beside a bubble. Present for the keyboard everywhere,
     visible only on hover or focus where there is a pointer; a touch screen
     long-presses the bubble instead. */
  .msg-menu-button { align-items: center; align-self: center; background: transparent; border: 0; border-radius: 50%; color: var(--c-muted); cursor: pointer; display: flex; flex: none; height: 2rem; justify-content: center; opacity: 0; padding: 0; transition: opacity 120ms ease, background-color 120ms ease; width: 2rem; }
  .msg-menu-button svg { height: 1.2rem; width: 1.2rem; }
  .msg-row-own .msg-menu-button { order: -2; }
  .msg-row:hover .msg-menu-button, .msg-menu-button:focus-visible, .msg-row-menu .msg-menu-button { opacity: 1; }
  .msg-menu-button:hover, .msg-row-menu .msg-menu-button { background: color-mix(in oklch, var(--c-ink) 7%, transparent); color: var(--c-ink); }
  @media not ((hover: hover) and (pointer: fine)) {
    .msg-menu-button { height: 1px; margin: 0; opacity: 0; overflow: hidden; position: absolute; width: 1px; }
  }
  /* Copy is available in the message menu on both pointer and touch devices.
     Apply this to descendants too: selection is not inherited consistently. */
  .chat-thread :is(.bubble, .assistant-output),
  .chat-thread :is(.bubble, .assistant-output) * {
    -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  }
  .chat-thread :is(input, textarea, [contenteditable]:not([contenteditable="false"])),
  .chat-thread [contenteditable]:not([contenteditable="false"]) * {
    -webkit-user-select: text; user-select: text;
  }

  .message-menu-scrim { inset: 0; position: fixed; z-index: 60; }
  .message-menu-scrim-dim { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); background: color-mix(in oklch, var(--c-bg) 45%, rgb(0 0 0 / 0.25)); animation: menu-fade 160ms ease both; }
  .msg-row-lifted { opacity: 1 !important; z-index: 61; }
  .msg-row-lifted :is(.bubble, .assistant-output) { animation: bubble-lift 180ms ease both; }
  .message-menu { --c-ink: #1c1c1e; --c-muted: #636366; color-scheme: light; animation: menu-pop 150ms ease both; display: grid; gap: 0.4rem; left: 0; position: fixed; top: 0; width: min(17.5rem, calc(100vw - 1rem)); z-index: 62; }
  .message-menu[hidden] { display: none; }
  .message-menu-reactions, .message-menu-picker, .message-menu-actions, .message-menu-reactors {
    background: #fff; border: 1px solid color-mix(in oklch, var(--c-ink) 8%, transparent);
    box-shadow: 0 10px 34px rgb(0 0 0 / 0.16), 0 1px 3px rgb(0 0 0 / 0.08); color: var(--c-ink);
  }
  .message-menu-reactions { align-items: center; border-radius: 999px; display: flex; justify-content: space-between; padding: 0.25rem; }
  .message-menu-reactions[hidden], .message-menu-picker[hidden], .message-menu-reactors[hidden] { display: none; }
  .message-menu-emoji { align-items: center; background: transparent; border: 0; border-radius: 50%; cursor: pointer; display: flex; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 1.45rem; height: 2.3rem; justify-content: center; padding: 0; transition: transform 120ms ease, background-color 120ms ease; width: 2.3rem; }
  @media (hover: hover) and (pointer: fine) { .message-menu-emoji:hover { background: color-mix(in oklch, var(--c-ink) 8%, transparent); transform: scale(1.12); } }
  .message-menu-emoji:active { transform: scale(0.92); }
  .message-menu-emoji.selected { background: color-mix(in oklch, var(--c-accent) 22%, transparent); }
  .message-menu-more { background: color-mix(in oklch, var(--c-ink) 7%, transparent); color: var(--c-muted); }
  .message-menu-more svg { height: 1.15rem; width: 1.15rem; }
  .message-menu-more[aria-expanded="true"] svg { transform: rotate(45deg); }
  .message-menu-picker { border-radius: 1.1rem; display: grid; gap: 0.1rem; grid-template-columns: repeat(auto-fill, minmax(2.3rem, 1fr)); max-height: 13.5rem; overflow-y: auto; overscroll-behavior: contain; padding: 0.4rem; }
  .message-menu-reactors { border-radius: 0.9rem; display: grid; font-size: 0.82rem; gap: 0.2rem; list-style: none; margin: 0; padding: 0.5rem 0.75rem; }
  .message-menu-reactors li { align-items: center; color: var(--c-muted); display: flex; gap: 0.45rem; }
  .message-menu-reactors li span { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 1rem; }
  .message-menu-actions { border-radius: 0.9rem; display: grid; overflow: hidden; }
  .message-menu-action { align-items: center; background: transparent; border: 0; color: var(--c-ink); cursor: pointer; display: flex; font-size: 0.97rem; justify-content: space-between; min-height: 2.75rem; padding: 0 0.95rem; text-align: left; width: 100%; }
  .message-menu:has(.message-menu-links:not([hidden])) { max-height: calc(100dvh - 1rem); overflow-y: auto; }
  .message-menu-links { max-height: 40dvh; overflow-y: auto; }
  .message-menu-links .message-menu-action { overflow-wrap: anywhere; padding-block: 0.65rem; }
  .message-menu-action[hidden] { display: none; }
  .message-menu-action:not([hidden]) ~ .message-menu-action:not([hidden]),
  .message-menu-records .message-menu-action,
  .message-menu-records:not([hidden]) ~ .message-menu-action:not([hidden]) { border-top: 1px solid color-mix(in oklch, var(--c-ink) 8%, transparent); }
  .message-menu-records { display: contents; }
  .message-menu-records[hidden] { display: none; }
  .message-menu-action svg { flex: none; height: 1.15rem; width: 1.15rem; }
  @media (hover: hover) and (pointer: fine) { .message-menu-action:hover { background: color-mix(in oklch, var(--c-ink) 6%, transparent); } }
  .message-menu-action:active { background: color-mix(in oklch, var(--c-ink) 10%, transparent); }
  .message-menu-danger { color: var(--danger); }
  .message-menu-actions:not(:has(.message-menu-action:not([hidden]))) { display: none; }
  .message-menu-touch { width: min(15.5rem, calc(100vw - 1rem)); }
  @keyframes menu-pop { from { opacity: 0; transform: scale(0.96); } }
  @keyframes menu-fade { from { opacity: 0; } }
  @keyframes bubble-lift { to { transform: scale(1.03); } }
  @media (prefers-reduced-motion: reduce) { .message-menu, .message-menu-scrim-dim, .msg-row-lifted :is(.bubble, .assistant-output) { animation: none; } }
  /* The bar is padded for the mic's full halo (0.7rem taller than the
     pill on each side), while the input pill itself stays slim. */
  /* The composer floats over the thread rather than sitting under it, so
     the newest message keeps its full width of screen and slides beneath
     instead of stopping at a hard edge. No blur — like iMessage, a veil of
     the background colour lightens the bubbles as they slide under. The
     veil starts only at the pill's top edge (2.6rem, the top padding) and
     is full by the pill's bottom, so bubbles stay crisp until they are
     actually under the input (elfmio-orfh). With the keyboard up, Safari
     moves the whole page, the composer with it (app_chat_controller). */
  .chat-composer {
    background: linear-gradient(to bottom, transparent 2.6rem, color-mix(in oklch, var(--c-bg) 88%, transparent) 5.2rem);
    bottom: 0;
    left: 0; right: 0;
    padding: 2.6rem 0.65rem max(1.1rem, env(safe-area-inset-bottom));
    position: absolute;
    z-index: 10;
  }
  /* With the keyboard away the pill rests translucent over the thread,
     iMessage-style; focusing it (the keyboard rising) makes it solid. */
  /* Above the pill's top edge, at the trailing side (E121). */
  .chat-to-end { align-items: center; background: color-mix(in oklch, var(--c-field) 85%, transparent); border: 0; border-radius: 50%;
    box-shadow: 0 1px 4px color-mix(in oklch, var(--c-ink) 18%, transparent); color: var(--c-ink); cursor: pointer; display: flex;
    height: 2.5rem; justify-content: center; position: absolute; right: 0.9rem; top: -0.4rem; width: 2.5rem; -webkit-tap-highlight-color: transparent; }
  .chat-to-end[hidden] { display: none; }
  .chat-composer:not(:focus-within) .composer-field { background: color-mix(in oklch, var(--c-field) 60%, transparent); }
  /* Room for the composer to stand over, so the last message still scrolls
     clear of it. The composer grows by the bottom safe area on devices with
     a home indicator, so the reserve grows with it. */
  .chat-thread { padding-bottom: var(--composer-height, calc(6rem + env(safe-area-inset-bottom))); }
  .composer-form { align-items: flex-end; display: flex; gap: 0.5rem; }
  .composer-input { background: var(--c-field); border-radius: 0.7rem; color: var(--c-ink); font-size: 1rem; line-height: 1.35; max-height: 7.5rem; min-height: 2.5rem; padding: 0.575rem 0.85rem; resize: none; }
  .composer-input::placeholder { color: var(--c-muted); }
  /* One rounded pill holds the text field and the mic; the send circle stays
     outside. While recording, the input fades out (keeping its height, so
     the composer never moves) and the live waveform draws over it. */
  .composer-field { flex-direction: column; align-items: stretch; background: var(--c-field); border-radius: 1.25rem; display: flex; flex: 1; min-width: 0; position: relative; transition: background-color 150ms ease; }
  .composer-text-row { align-items: flex-end; display: flex; min-width: 0; }
  .composer-attachments { display: flex; gap: 0.6rem; overflow-x: auto; padding: 0.65rem; }
  .composer-attachments[hidden] { display: none; }
  .composer-attachment { align-items: center; border-radius: 0.75rem; display: flex; flex: 0 0 5rem; height: 5rem; justify-content: center; overflow: hidden; position: relative; }
  .composer-attachment img, .composer-attachment video { height: 100%; object-fit: cover; position: absolute; width: 100%; }
  .composer-attachment span { font-size: 0.7rem; overflow-wrap: anywhere; padding: 0.4rem; }
  .composer-attachment button { background: rgb(0 0 0 / 65%); border: 0; border-radius: 50%; color: white; height: 1.5rem; line-height: 1; padding: 0; position: absolute; right: 0.2rem; top: 0.2rem; width: 1.5rem; z-index: 1; }
  .attachment-status { color: var(--c-muted); display: block; font-size: 0.8rem; margin-inline: auto; max-width: 42rem; }
  .composer-field .composer-input { background: transparent; border: 0; border-radius: 1.25rem; flex: 1; min-width: 0; }
  .composer-field .composer-input:focus { border: 0; outline: none; }
  /* The voice action lives inside the field's pill, as on iOS
     (elfmio-vtvb): an ink microphone at the trailing edge when idle, a red
     stop while recording; with text it gives its place to Send in the
     accent. */
  .composer-mic, .composer-btn { align-items: center; align-self: flex-end; border: 0; border-radius: 50%; display: flex; flex: none; height: 2.1rem; justify-content: center; margin: 0.2rem 0.2rem 0.2rem 0; padding: 0; transition: transform 120ms ease, background-color 120ms ease; width: 2.1rem; }
  .composer-mic { background: transparent; color: var(--c-ink); }
  .composer-mic:active, .composer-btn:active { transform: scale(0.9); }
  .composer-mic svg { height: 1.35rem; width: 1.35rem; }
  .composer-mic.recording { background: var(--danger); color: white; }
  .composer-mic[disabled] { box-shadow: none; opacity: 0.45; }
  .composer-plus { align-items: center; background: var(--c-field); border: 0; border-radius: 50%; color: var(--c-ink); cursor: pointer; display: flex; height: 2.5rem; justify-content: center; padding: 0; transition: transform 160ms ease, background-color 120ms ease; width: 2.5rem; }
  .composer-plus svg { height: 1.4rem; width: 1.4rem; transition: transform 160ms ease; }
  body.chat-add-open .composer-plus svg { transform: rotate(45deg); }
  .composer-plus:active { transform: scale(0.92); }
  .chat-composer:not(:focus-within) .composer-plus { background: color-mix(in oklch, var(--c-field) 60%, transparent); }
  .composer-wave { color: var(--c-accent); display: none; height: 100%; inset: 0 2.6rem 0 0.85rem; position: absolute; width: calc(100% - 3.45rem); }
  .composer-field.recording .composer-input { opacity: 0; }
  .composer-field.recording .composer-wave { display: block; }
  .composer-btn { background: var(--c-member); color: var(--c-member-ink); }
  .composer-btn[disabled] { opacity: 0.5; }
  .composer-btn svg { height: 1.15rem; width: 1.15rem; }
  .btn-send { display: none; }
  .has-text .btn-send { display: flex; }
  .has-text .btn-mic { display: none; }
  /* Errors only — recording and transcribing speak through the waveform and
     the input's placeholder, so this line stays empty in the normal flow. */
  .voice-status { color: var(--c-muted); display: block; font-size: 0.8rem; padding-bottom: 0.35rem; text-align: center; }
  .voice-status:empty { display: none; }
  .msg-row[hidden] { display: none; }
  @keyframes typing-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
  .proposal-card { white-space: normal; }
  .proposal-when, .proposal-attendees, .proposal-description { color: var(--c-muted); font-size: 0.92rem; margin: 0.15rem 0 0; }
  .proposal-description { white-space: pre-wrap; }
  .proposal-state { margin: 0.4rem 0 0; }
  .proposal-failed, .proposal-dismissed { color: var(--danger); }
  .proposal-actions { display: flex; gap: 0.5rem; margin-top: 0.55rem; }
  .proposal-actions .button { min-height: 2.2rem; padding: 0.35rem 0.8rem; }
  .join-request-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  /* Action cards share the reminder card width, outline and emoji header. */
  .assistant-output.action-chat-card { padding-top: calc(var(--space-bubble-block, 0.5rem) + 2px); padding-bottom: 0.625rem; }
  .action-chat-card .record-card-heading, .action-chat-card .sign-in-card-site { align-items: flex-start; gap: 0.5rem; }
  .action-chat-card .record-card-approve, .action-chat-card .record-card-secondary,
  .action-chat-card .join-request-actions .button, .chat-shell .action-chat-card a.record-card-approve,
  .chat-shell .action-chat-card a.record-card-secondary {
    background: var(--settings-row-bg); border: 0; border-radius: 999px;
    color: var(--success); min-height: 2.75rem; width: 100%;
  }
  .action-chat-card .join-request-actions .join-request-reject { color: var(--danger); }
  .join-request-actions > form { min-width: 0; }
  .join-request-actions .button { width: 100%; min-height: 2.75rem; white-space: nowrap; }
  .proposal-actions .join-request-approve, .proposal-actions .join-request-reject { background: var(--settings-row-bg); }
  .proposal-actions .join-request-approve { color: var(--success); }
  .proposal-actions .join-request-reject { color: var(--danger); }
  .chat-markdown p, .chat-markdown ul, .chat-markdown ol, .chat-markdown pre, .chat-markdown blockquote { margin: 0.45em 0; }
  .chat-markdown > :first-child, .assistant-output-text > :first-child { margin-top: 0; }
  .chat-markdown > :last-child, .assistant-output-text > :last-child { margin-bottom: 0; }
  .chat-markdown pre { overflow-x: auto; }
  /* A heading inside one chat entry keeps its meaning but not its size. One
     voice is speaking; a 2rem line halfway through reads as shouting rather
     than structure. The guides share .chat-markdown and keep real headings. */
  :is(.bubble, .assistant-output) h1, :is(.bubble, .assistant-output) h2, :is(.bubble, .assistant-output) h3, :is(.bubble, .assistant-output) h4 { font-size: 1em; font-weight: 650; letter-spacing: normal; margin: 0.45em 0; }

  @media (min-width: 900px) {
    .chat-header { padding-top: 0.45rem; }
  }
}

@layer utilities {
  .sr-only { clip: rect(0, 0, 0, 0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }
}

@layer components {
  @media (max-width: 640px) {
    .page-content { padding-top: 1.25rem; }
  }
}

@layer components {
  .page-content:has(> .conversation-index) { max-width: none; padding: 0; }
  /* The list wears the chat theme too, but only where the theme is the
     subject: the ground it sits on and the unread dot. Rows, names and
     times keep the app's own colours (issue #126). */
  .conversation-index {
    --conversation-accent: oklch(91% 0.2 101);
    background: var(--conversation-list-background, var(--c-bg, var(--surface)));
    color: var(--c-ink, var(--ink));
    margin: 0 auto;
    max-width: 44rem;
    min-height: 100dvh;
    padding: 0 1rem;
    position: relative;
  }
  .conversation-index-header { align-items: start; align-self: stretch; flex: 0 0 auto; background: var(--conversation-list-background, var(--c-bg, var(--surface))); display: flex; min-height: 3.5rem; padding-block: .5rem 1rem; margin-bottom: 0.6rem; position: relative; z-index: 10; }
  .conversation-index-group { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: .75rem; width: 100%; min-width: 0; }
  .conversation-index-toolbar { display: flex; align-items: center; gap: .25rem; min-height: 2.75rem; flex: none; }
  .conversation-index-toolbar > .conversation-index-settings:not(.conversation-account-settings) { margin-left: auto; }
  .conversation-index-toolbar > .conversation-account-settings { margin-inline-end: auto; }
  .conversation-index-toolbar > * { flex-shrink: 0; }
  .conversation-index .group-switcher { position: relative; }
  .conversation-index .group-switcher-trigger { background: transparent; border: 0; color: var(--ink); gap: 0.35rem; margin: 0; padding: 0.4rem 0; }
  .conversation-index .group-switcher-trigger > .group-icon { display: none; }
  .group-unread-indicator:not(:has(.group-unread-count)), .group-switcher-others-unread:not(:has(.group-unread-count)) { display: none; }
  .conversation-index .group-switcher-chevron { flex: 0 0 1.5rem; height: 1.5rem; width: 1.5rem; }
  .conversation-index .group-switcher-name { font-size: 1.5rem; font-weight: 700; white-space: normal; overflow-wrap: anywhere; }
  .conversation-index-settings { align-items: center; border-radius: 50%; color: var(--ink); display: flex; height: 2.75rem; justify-content: center; width: 2.75rem; }
  @media (hover: hover) and (pointer: fine) { .conversation-index-settings:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); text-decoration: none; } }
  .conversation-index-settings svg { height: 1.55rem; width: 1.55rem; }
  .conversation-list, .recent-conversations { align-content: start; display: grid; }
  .conversation-list { flex: 1 1 0; min-height: 0; margin-inline: -0.75rem; }
  /* Swipe to delete, the way iMessage does it. The row slides under the
     finger across the plain list, uncovering a red circle that stretches
     with it and keeps the trash in its middle. Past the threshold the pill
     arms: the trash slides to its left end and the phone taps back, so
     letting go there deletes. Letting go before it rests the row on the
     circle, which is a button too. The pill width follows the drag, and one
     custom property drives all of it. */
  .conversation-swipe { --pill: max(2.75rem, calc(var(--swipe, 0px) - 1rem)); overflow: hidden; position: relative; }
  .conversation-swipe.deleting { display: none; }
  .conversation-swipe-sheet { background: var(--conversation-list-background, var(--c-bg, var(--surface))); position: relative; transform: translateX(calc(var(--swipe, 0px) * -1)); z-index: 1; }
  /* Only while the row settles back or springs open: during the drag it must
     sit exactly under the finger. */
  .conversation-swipe.settling .conversation-swipe-sheet, .conversation-swipe.settling .conversation-delete { transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), width 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  .conversation-delete-form { align-items: center; bottom: 0; display: flex; position: absolute; right: 0.5rem; top: 0; }
  .conversation-delete { background: var(--danger); border: 0; border-radius: 999px; color: white; display: block; height: 2.75rem; padding: 0; position: relative; width: var(--pill); }
  /* The trash sits in the middle of the pill, and at its left end once the
     swipe is armed. Both are plain layout positions: the middle follows a
     stretching pill by itself, and the left end does not move at all, so
     nothing animates towards a target that changes every frame. */
  .conversation-delete-icon { display: flex; left: 50%; margin: -0.65rem 0 0 -0.65rem; position: absolute; top: 50%; }
  .conversation-swipe.armed .conversation-delete-icon { left: 1.15rem; margin-left: 0; }
  /* Only the flip itself slides. */
  .conversation-swipe.arming .conversation-delete-icon { transition: left 160ms ease; }
  .conversation-delete svg { height: 1.3rem; width: 1.3rem; }
  .conversation-row { -webkit-tap-highlight-color: transparent; align-items: center; border-radius: 0.75rem; color: var(--ink); display: grid; gap: 0.5rem; grid-template-columns: auto minmax(0, 1fr); min-height: 4.4rem; padding: 0.55rem 0.75rem; transition: background-color 100ms ease; }
  .conversation-row, .conversation-row:is(:hover, :active, :focus) { text-decoration: none; }
  .conversation-row, .conversation-row * { -webkit-user-select: none; user-select: none; }
  .conversation-row img, .conversation-row svg { -webkit-user-drag: none; }
  .conversation-row.pending { background: color-mix(in oklch, var(--ink) 7%, transparent); text-decoration: none; }
  .conversation-row-avatars { border-radius: 50%; display: block; flex: none; height: 2.75rem; width: 2.75rem; }
  .conversation-row-avatars .member-avatar { border: 2px solid var(--paper); border-radius: 50%; font-size: 0.9rem; height: 100%; margin: 0; min-width: 0; width: 100%; }
  .conversation-person-avatar, .conversation-group-avatar { background: color-mix(in oklch, var(--c-accent, var(--conversation-accent)) 14%, var(--surface)); padding: 0.55rem; }
  .member-avatar.conversation-mosaic { background: var(--avatar-background); border: 0; border-radius: 50%; container-type: inline-size; display: block; overflow: hidden; padding: 0; position: relative; }
  .conversation-mosaic-tile { background: var(--avatar-background); display: block; overflow: hidden; position: absolute; }
  .conversation-mosaic-person { filter: var(--avatar-person-filter); height: auto; left: var(--person-x); max-width: none; position: absolute; top: var(--person-y); transform: translate(-50%, -50%); width: var(--person-width); }
  .conversation-mosaic-photo { height: 100%; inset: 0; object-fit: cover; position: absolute; width: 100%; }
  .conversation-mosaic-count { color: var(--avatar-foreground); font-size: 19cqw; font-weight: 600; left: var(--person-x); line-height: 1; position: absolute; top: var(--person-y); transform: translate(-50%, -50%); }
  .chat-photo-settings > .member-avatar { height: 5.5rem; width: 5.5rem; }
  .chat-photo-faces { display: flex; }
  .chat-photo-faces .member-avatar { border: 3px solid var(--paper); font-size: 1.6rem; height: 4.4rem; width: 4.4rem; }
  .chat-photo-faces .member-avatar + .member-avatar { margin-left: -1.2rem; }
  .chat-photo-faces .chat-heading-more { background: color-mix(in oklch, var(--ink) 8%, var(--surface)); color: var(--muted); font-size: 1.1rem; }
  .chat-photo-actions { display: flex; gap: 0.5rem; }
  .chat-photo-actions form { margin: 0; }
  .chat-photo-choose { cursor: pointer; display: inline-block; margin: 0; }
  .chat-details-assistant { background: transparent; object-fit: contain; }
  .chat-person-choice, .chat-choice { cursor: pointer; font-weight: inherit; margin: 0; }
  .chat-person-check, .chat-choice input { accent-color: var(--c-accent, var(--accent)); flex: none; height: 1.3rem; margin-left: auto; width: 1.3rem; }
  .settings-row-text + .chat-person-check, .settings-row-text + input { margin-left: auto; }
  .settings-field select { appearance: auto; }
  .conversation-row-content { display: grid; gap: 0.16rem; min-width: 0; }
  .conversation-row-topline, .conversation-row-bottomline { align-items: center; display: flex; gap: 0.5rem; min-width: 0; }
  .conversation-row-topline strong { flex: 1; font-size: 1rem; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .conversation-row-topline time { color: var(--muted); flex: none; font-size: 0.75rem; }
  .conversation-row-preview { color: var(--muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; flex: 1; font-size: 0.86rem; line-height: 1.4; min-height: 2.8em; overflow: hidden; overflow-wrap: anywhere; white-space: normal; }
  .recent-conversations > :is(.conversation-swipe, .conversation-row) { border-bottom: 1px solid var(--line); }
  .conversation-row-file { color: var(--muted); flex: none; height: 0.95rem; width: 0.95rem; }
  .conversation-row-avatars { position: relative; }
  /* Unread is a dot in the leading gutter, left of the avatar, as in
     iMessage, in Mio's green like the + button (heymio-891z). Every row
     keeps the gutter, so a row does not move when it is read. */
  .conversation-row { padding-inline-start: 1.6rem; position: relative; }
  .conversation-row .unread-dot { height: 0.625rem; left: 0.5rem; margin: -0.3125rem 0 0; position: absolute; top: 50%; width: 0.625rem; }
  .conversation-row.active .unread-dot { display: none; }
  /* The empty list. Its whole job is to point at the button that ends it, so
     the inline plus is drawn to match the real one, and the invite sits
     apart, below a rule, as the second thing to do rather than the first. */
  /* Underlined, because it is the one tappable word in a sentence and colour
     alone does not say so. */
  .conversation-list-empty a { color: var(--c-accent, var(--accent)); text-decoration: underline; text-underline-offset: 0.2em; }
  /* Center the empty state in the list below the toolbar. */
  /* A streamed row must clear the empty state in the same paint, before
     the later group refresh replaces the surrounding list. */
  .conversation-list:has(> .conversation-list-empty):not(:has(> .recent-conversations > :not([hidden]))) { align-content: center; }
  .conversation-list:has(> .recent-conversations > :not([hidden])) > .conversation-list-empty { display: none; }
  .conversation-list-empty { align-content: start; color: var(--muted); display: grid; gap: 0.35rem; justify-items: center; margin: 0 auto; max-width: 21rem; padding: 1rem; text-align: center; }
  .elephant-outline { background: currentColor; display: inline-block; flex: none; mask: url("/elephant-head.svg") center / contain no-repeat; -webkit-mask: url("/elephant-head.svg") center / contain no-repeat; }
  .conversation-list-empty-mark { color: var(--ink); display: grid; place-items: center; height: 58px; width: 76px; }
  .conversation-list-empty-mark .elephant-outline { width: 76px; aspect-ratio: 2351 / 1650; clip-path: polygon(50% 50%, 50% 50%, 50% 50%); }
  @media (prefers-reduced-motion: reduce) { .conversation-list-empty-mark .elephant-outline { clip-path: none; } }
  .invitation-mark { height: 64px; width: 64px; }
  .conversation-list-empty strong { color: var(--ink); font-size: 1.05rem; font-weight: 650; margin-top: 0.75rem; }
  .conversation-list-empty p { font-size: 0.9rem; line-height: 1.5; margin: 0; }
  .conversation-list-empty-plus { background: var(--c-own-bubble, var(--conversation-accent)); border-radius: 50%; color: oklch(20% 0.02 101); display: inline-grid; height: 1.15rem; place-items: center; vertical-align: -0.2rem; width: 1.15rem; }
  .conversation-list-empty-plus svg { height: 0.7rem; width: 0.7rem; }
  .conversation-list-empty-invite { border-top: 1px solid var(--line); display: grid; gap: 0.6rem; justify-items: center; margin-top: 2rem; padding-top: 1.75rem; width: 100%; }
  .conversation-list-empty-invite h2 { color: var(--ink); font-size: 0.95rem; margin: 0; }
  .conversation-list-empty-invite .invite-qr { box-shadow: 0 0.4rem 1.4rem rgb(0 0 0 / 0.1); margin: 0.15rem 0; width: min(11rem, 70%); }
  .conversation-list-empty-invite .button { margin-top: 0.2rem; }
  /* Mio's own colours, its face's ground and ink, in every chat theme
     (gh-187): green in the store and on staging, red on dev. */
  .conversation-new-form { margin: 0; }
  .conversation-new-button { align-items: center; background: var(--brand-ground); border: 0; border-radius: 50%; color: white; cursor: pointer; display: flex; height: 2.75rem; justify-content: center; padding: 0; transition: background-color 150ms ease, transform 150ms ease; width: 2.75rem; }
  .conversation-new-button:active { transform: scale(0.94); }
  @media (hover: hover) and (pointer: fine) {
    .conversation-new-button:hover { background: color-mix(in oklch, var(--brand-ground) 92%, #030505); }
  }
  .conversation-new-button svg { height: 1.55rem; width: 1.55rem; }
  /* Selecting several chats (#136). Select stands by the gear; while picking,
     the count takes the group's name's place, Done takes Select's, and the
     red Delete appears at the bottom. Each row that can go gets a check
     circle before its avatar; a row that can neither be deleted nor left
     fades and takes no taps. */
  .conversation-select { background: none; border: 0; border-radius: 1.375rem; color: var(--ink); cursor: pointer; font: inherit; font-weight: 500; margin-left: auto; min-height: 2.75rem; padding: 0 0.75rem; }
  @media (hover: hover) and (pointer: fine) { .conversation-select:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); } }
  .conversation-selection-count, .conversation-selection-bar { display: none; }
  .conversation-index:is(.selecting, .pinning) :is(.group-switcher, .conversation-index-settings, .conversation-new-form) { display: none; }
  .conversation-index:is(.selecting, .pinning) .conversation-selection-count { display: block; font-size: 1rem; font-weight: 600; }
  .conversation-index.selecting .conversation-list { padding-bottom: 7rem; }
  .conversation-index.selecting .conversation-swipe-sheet { transform: none; }
  .conversation-index.selecting .conversation-swipe .conversation-row { grid-template-columns: auto auto minmax(0, 1fr); }
  .conversation-index.selecting .conversation-swipe .conversation-row::before { border: 2px solid var(--line); border-radius: 50%; content: ""; height: 1.5rem; width: 1.5rem; }
  .conversation-index.selecting .conversation-swipe.selected .conversation-row::before { background: var(--c-accent, var(--conversation-accent)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 1rem no-repeat; border-color: var(--c-accent, var(--conversation-accent)); }
  .conversation-index.selecting .recent-conversations > :not(.conversation-swipe) { opacity: 0.4; pointer-events: none; }
  .conversation-index.selecting .conversation-selection-bar { bottom: max(1.4rem, env(safe-area-inset-bottom)); display: flex; left: 50%; position: fixed; transform: translateX(-50%); z-index: 25; }
  .conversation-selection-delete { background: var(--danger); border: 0; border-radius: 999px; box-shadow: 0 0.7rem 1.8rem rgb(0 0 0 / 0.12); color: white; cursor: pointer; font: inherit; font-weight: 600; min-height: 3.25rem; padding: 0 2rem; }
  .conversation-selection-delete:disabled { cursor: default; opacity: 0.4; }

  @media (min-width: 641px) {
    .conversation-index { padding: 0 2rem; }
    .conversation-index-header { margin-bottom: 0.9rem; }
  }

  @media (max-width: 899.9px) {
    /* The rail is in the document on every screen and only hidden here, so
       this has to ask whether the list is what you are looking at — otherwise
       a form screen inherits the list's ground and wears a grey panel over
       its own. */
    html:has(.conversation-index):not(:has(.chat-action-page)),
    body:has(.conversation-index):not(:has(.chat-action-page)),
    .page-shell:has(.conversation-index):not(:has(.chat-action-page)) { background: var(--surface); }
    /* Dock the header on mobile web: the index becomes a locked grid and the
       rows scroll inside it, exactly as the rail does on a wide screen and as
       the chat holds its composer. Sticky rides the document scroller, which
       iOS Safari moves under its own toolbars, so the header drifted off with
       the rows. */
    .conversation-index { display: flex; flex-direction: column; height: 100dvh; min-height: 0; overflow: hidden; }
    .conversation-index-header { margin-bottom: 0; }
    .conversation-list { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; padding-bottom: max(1rem, env(safe-area-inset-bottom)); padding-top: 0.6rem; }
  }

  @media (min-width: 900px) {
    .rail .conversation-index-header, .conversation-master-layout .conversation-index-header { margin-bottom: 0; }
  }

  @media (min-width: 900px) and (prefers-color-scheme: light) {
    .conversation-index { --conversation-list-background: #fafafa; }
  }

  .chat-action-page { display: grid; gap: 2rem; margin: 0 auto; max-width: 34rem; }
  /* These screens are a form on a page, not cards on a board, so they sit on
     the chat's own ground rather than the grey the grouped settings need
     (elfmio-pnxz). --surface is white by day but a raised grey by night,
     which left a panel floating behind them; the theme's background is white
     and black, which is what the eye expects either way. */
  body:has(.chat-action-page), body:has(.chat-action-page) .page-shell { background: var(--c-bg, var(--surface)); }
  /* One quiet action, and the invitation itself once there is one. No icon
     badge and no second colour: inviting somebody is not the loudest thing
     on a screen listing the people already here. */
  .chat-invite-card { display: grid; gap: 0.75rem; justify-items: center; padding: 1rem; }
  .chat-invite-qr { background: white; border-radius: 0.6rem; padding: 0.75rem; }
  .chat-invite-qr svg { height: auto; width: 10rem; }
  .chat-invite-link { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; margin: 0; overflow-wrap: anywhere; text-align: center; }
  .chat-action-page header h1 { margin: 0 0 0.5rem; }
  .chat-action-page header p:last-child { color: var(--muted); }
  .eyebrow { color: var(--muted); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.08em; margin-bottom: 0.45rem; text-transform: uppercase; }
  .chat-action-list { display: grid; }
  .chat-action-row { align-items: center; color: var(--ink); display: grid; gap: 0.9rem; grid-template-columns: auto 1fr; min-height: 4.6rem; padding: 0.65rem 0; }
  .chat-action-row + .chat-action-row { border-top: 1px solid var(--line); }
  .chat-action-row:hover { text-decoration: none; }
  .chat-action-row > span:last-child { display: grid; }
  .chat-action-row strong { font-weight: 600; }
  .chat-action-row small { color: var(--muted); }
  .chat-action-icon { align-items: center; background: var(--accent-soft); border-radius: 50%; color: var(--accent); display: flex; height: 2.8rem; justify-content: center; width: 2.8rem; }
  .chat-action-icon svg { height: 1.4rem; width: 1.4rem; }
  .conversation-file-form { display: grid; gap: 1rem; }
  .conversation-file-picker { align-items: center; border: 1.5px dashed var(--line); border-radius: 1rem; cursor: pointer; display: flex; flex-direction: column; gap: 0.3rem; justify-content: center; min-height: 13rem; padding: 2rem; text-align: center; }
  .conversation-file-picker:hover { background: var(--accent-soft); border-color: var(--accent); }
  .conversation-file-picker svg { color: var(--accent); height: 2.3rem; margin-bottom: 0.4rem; width: 2.3rem; }
  .conversation-file-picker small { color: var(--muted); }
  .conversation-file-picker input { margin-top: 1rem; }
}

@layer chat {
  .chat-header { grid-template-columns: 5.25rem minmax(0, 1fr) 5.25rem; }
  .chat-header-actions { align-items: center; align-self: start; display: flex; gap: .25rem; justify-content: flex-end; }
  .chat-header-actions form { margin: 0; }
  .chat-header .conversation-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* A file sits in the thread where it was added. A picture fills its own
     bubble, edge to edge, because a photo cropped by padding reads as a
     mistake; everything else keeps the filename and the reading state. */
  .bubble-file { background: var(--c-group-bubble); border-bottom-left-radius: 0.35rem; color: var(--c-group-bubble-ink); overflow: hidden; padding: 0.4rem 0.55rem; }
  /* A picture bubble owns its full width from the first paint. Left to
     shrink-to-fit, it hugs the filename until the image bytes arrive and
     then widens — growing the whole row after render, which shifts the
     thread under the reader however well the image's own box is reserved. */
  .bubble-file:has(.file-preview) { width: min(76%, 22rem); }
  .msg-row-own .bubble-file { background: var(--c-own-bubble); border-bottom-left-radius: 1.25rem; border-bottom-right-radius: 0.35rem; color: var(--c-own-bubble-ink); }
  .file-preview { display: block; margin: -0.4rem -0.55rem 0.35rem; }
  .file-preview:hover { text-decoration: none; }
  .file-image { border-radius: 0.9rem; display: block; height: auto; max-height: 22rem; object-fit: cover; width: 100%; }
  /* A file whose analysis hasn't produced dimensions renders without the
     width/height attributes that reserve its box — pin those to a fixed
     ratio (cover crops the excess) so their late load can never shift the
     thread. */
  .file-image:not([width]) { aspect-ratio: 4 / 3; }
  /* Outranks .chat-shell a, so the filename takes the bubble's ink rather
     than the link accent — which on an own-bubble is the background. */
  .bubble-file .file-line { align-items: center; color: inherit; display: flex; gap: 0.4rem; min-width: 0; }
  .file-line:hover { text-decoration: none; }
  .file-icon { flex: none; height: 1.15rem; width: 1.15rem; }
  .file-name { font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .file-state { display: block; font-size: 0.72rem; opacity: 0.75; }
  .file-state-failed { color: var(--danger); opacity: 1; }
  .msg-row[data-role="system"] { justify-content: center; margin-top: 0.8rem; }
  .system-message { color: var(--c-muted); font-size: 0.74rem; max-width: 80%; text-align: center; }
}

/* Quiet hours: the two times show only while the switch is on. */
.quiet-hours:has(input[type="checkbox"]:not(:checked)) .quiet-hours-times { display: none; }
.quiet-hours-times { display: grid; grid-template-columns: repeat(2, minmax(0, 8rem)); justify-content: center; gap: .5rem; padding: .5rem .75rem; }
.quiet-hours-times > .settings-field { min-width: 0; padding: .25rem; justify-items: center; }
.quiet-hours .quiet-hours-times input { width: auto; max-width: 100%; }
.quiet-hours-times input::-webkit-datetime-edit { display: block; text-align: center; }
.quiet-hours .quiet-hours-times .settings-field > :is(label, input) { text-align: center; }
.quiet-hours-times input::-webkit-date-and-time-value { text-align: center; }
.settings-field-inline { align-items: center; display: flex; flex-direction: row; gap: 0.5rem; }

/* Mini games keep their board in the message, on every screen size. */
.msg-row:has(> .mini-game) { display: flex; flex-wrap: wrap; justify-content: center; }
.mini-game { width: 80%; flex: 0 0 80%; min-width: 0; padding: 10px; border-radius: 16px; background: var(--surface); color: var(--ink); }
.player-0 { color: #0bd65e; }
.player-1 { color: #ff4d47; }
.mini-game-status { text-align: center; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 12px 0; }
.mini-game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mini-game-cell { position: relative; aspect-ratio: 1; padding: 0; min-width: 0; border: 0; background: transparent; color: inherit; cursor: pointer; display: grid; place-items: center; }
.mini-game-cell:disabled { opacity: 1; cursor: default; }
.mini-game-cell:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; z-index: 1; }
.mini-game-grid.tic_tac_toe .mini-game-cell { border: 1px solid #89efa5; font-size: clamp(28px, 8vw, 88px); font-weight: 900; }
.mini-game-grid.checkers { position: relative; grid-template-columns: repeat(6, minmax(0, 1fr)); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.checkers .mini-game-cell { background: #fff; }
.checkers .mini-game-cell.dark { background: #78a887; }
.mini-game-piece { width: 74%; height: 74%; border-radius: 50%; background: currentColor; box-shadow: 0 2px 3px #0005, inset 0 0 0 2px #ffffffaa; display: grid; place-items: center; font-size: 1.5em; }
.mini-game-piece::after { content: ''; position: absolute; inset: 20%; border: 1px solid white; border-radius: 50%; }
.mini-game-cell.selected { outline: 3px solid white; outline-offset: -4px; }
.mini-game-cell.destination::after { content: ''; width: 25%; height: 25%; background: #ffffffaa; border-radius: 50%; }
.mini-game-grid.memory { gap: 6px; }
.memory .mini-game-cell { aspect-ratio: 1.25; border-radius: 10px; background: transparent; font-size: clamp(24px, 7vw, 70px); perspective: 700px; opacity: 1; container-type: inline-size; }
.memory-flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 400ms ease-in-out; }
.memory-flip.face-up { transform: rotateY(180deg); }
.memory-face { position: absolute; inset: 0; display: grid; place-items: center; border: 1px solid #b5dcc2; border-radius: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.memory-back { background: #0bd65e; }
.memory-animal { font-size: 60cqw; line-height: 1; }
.memory-front { background: #d9fbe4; transform: rotateY(180deg); }
@media (prefers-reduced-motion: reduce) { .memory-flip { transition: none; } }
.memory .mini-game-cell img { width: 60%; height: 75%; object-fit: contain; }
.mini-game-match { position: absolute; right: 4px; bottom: 4px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #808080; color: white; font-size: 14px; font-weight: 700; }
.mini-game-match[hidden] { display: none; }
.mini-game-match.player-0 { background: #0bd65e; }
.mini-game-match.player-1 { background: #ff4d47; }
.mini-game-hint { text-align: center; font-size: 0.8rem; color: var(--muted); }
.mini-game [role=alert]:empty { display: none; }
.mini-game-picker { width: min(92vw, 420px); padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); }
.mini-game-picker::backdrop { background: #0006; }
.mini-game-picker label { display: grid; gap: 8px; margin: 20px 0; }
.mini-game-picker select { width: 100%; padding: 12px; border-radius: 10px; }
.mini-game-picker-actions { display: flex; justify-content: space-between; gap: 12px; }
.mini-game-picker-actions button { padding: 12px; }

.mini-game-crown { color: white; z-index: 1; }

.mini-game-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border: 0; padding: 0; margin: 16px 0; }
.mini-game-choices legend { margin-bottom: 10px; }
.mini-game-picker .mini-game-choice { position: relative; display: flex; flex-direction: column; gap: 8px; align-items: center; min-width: 0; margin: 0; padding: 6px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 12px; }
.mini-game-choice img { width: 100%; aspect-ratio: 1; border-radius: 8px; }
.mini-game-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mini-game-choice:has(input:checked) { border: 2px solid #0bd65e; background: #0bd65e18; }
.mini-game-choice:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }

.checker-layer { position: absolute; inset: 0; pointer-events: none; }
.checker-layer .mini-game-piece { position: absolute; width: 12.333333%; height: 12.333333%; opacity: 1; transition: left 350ms ease-in-out, top 350ms ease-in-out; }
@media (prefers-reduced-motion: reduce) { .checker-layer .mini-game-piece { transition: none; } }

.mini-game:has(.tic_tac_toe) .player-0 { color: #3be37a; }
.mini-game:has(.tic_tac_toe) .player-1 { color: #ff2020; }

.tic-tac-toe-mark { position: relative; width: 65%; height: 65%; box-sizing: border-box; }
.tic-tac-toe-mark.ring { border: 8px solid currentColor; border-radius: 50%; }
.tic-tac-toe-mark.cross::before, .tic-tac-toe-mark.cross::after { content: ''; position: absolute; top: calc(50% - 4px); left: 0; width: 100%; height: 8px; background: currentColor; border-radius: 4px; transform: rotate(45deg); }
.tic-tac-toe-mark.cross::after { transform: rotate(-45deg); }

/* Settings icons use iOS blue. Assistant icons use the approved brand green. */
@layer components {
  .settings-icon { align-items: center; background: #007aff; border-radius: 0.5rem; color: white; display: inline-flex; flex: none; height: 2rem; justify-content: center; width: 2rem; }
  .settings-icon svg { height: 1.2rem; width: 1.2rem; }
  .settings-icon-assistant { background: #3be37a; color: white; }
  .settings-email-row { display: flex; align-items: center; padding-right: .9rem; }
  .settings-email-row > .settings-row { flex: 1; min-width: 0; }
  .settings-copy { flex: none; margin-left: auto; }
  .settings-copy-button { display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border: 0; border-radius: .5rem; background: transparent; color: var(--ink); cursor: pointer; }
  .settings-copy-button:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); }
  .settings-copy-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .settings-copy-button svg { width: 1.2rem; height: 1.2rem; }
  .settings-row-text .settings-group-email { font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .settings-icon-diary { background: #ffcc00; }
  .settings-icon-mail { background: var(--danger); }
  .settings-icon-neutral { background: var(--muted); }
  .settings-icon-notifications { background: #6554c0; }
  .settings-field-icon { column-gap: 0.75rem; grid-template-columns: 2rem minmax(0, 1fr); }
  .settings-field-icon > .settings-icon { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
  .settings-field-icon > :not(.settings-icon) { grid-column: 2; }
  .settings-field-label { color: var(--muted); font-size: 0.72rem; font-weight: 700; }
  /* The original edit form still owns both fields and its save feedback. */
  .chat-settings-basics { display: flex; flex-direction: column; }
  .chat-settings-edit-form, .chat-settings-edit-fields { display: contents; }
  .chat-settings-basics .settings-group { border: 0; border-radius: 0; }
  .chat-setting-photo { order: 1; }
  .chat-setting-name { order: 2; }
  .chat-setting-mute { order: 3; }
  .chat-setting-assistant { order: 4; }
  .chat-setting-instructions { order: 5; }
  .chat-setting-replies { order: 7; }
  .chat-settings-edit-form > .settings-note { order: 6; }
  .chat-settings-basics .settings-note { margin: 0; padding: 0.5rem 0.9rem 0.75rem; }

  .chat-photo-actions { flex-wrap: wrap; }
  .settings-screen .switch:disabled { cursor: default; opacity: 0.5; }
}

/* The naming page shares the onboarding layout and fixed action. */
.onboarding-name { box-sizing: border-box; width: 100%; max-width: 30rem; min-height: 3.5rem; border: 0; border-radius: 1rem; background: #fff; color: #030505; font: inherit; padding: 1rem; }

/* One optional draft hint above the normal composer. */
.reply-suggestion {
  display: block;
  width: fit-content;
  max-width: calc(100% - 24px);
  margin: 0 auto 6px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.4;
  cursor: pointer;
}
.reply-suggestion[hidden] { display: none; }
/* A hint that acts shows its effect; one that cannot be undone is ink
   (heymio-1zrm, Martin 2026-11-08, design B). The touch area is at least
   44 px tall. */
.ask-hint { position: relative; }
.ask-hint::after { content: ""; inset: -4px 0; position: absolute; }
.ask-hint-acts { align-items: center; display: inline-flex; gap: 0.4em; }
.ask-hint-acts svg { fill: none; flex: none; height: 1em; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.2; width: 1em; }
.ask-hint-strong { background: var(--c-ink); color: var(--c-bg); font-weight: 600; }

/* Mio at work holds the hints' place: none shows while Mio's bubble is
   open at the end of the thread. */
.chat-shell:has(.turn-row:not([hidden])) :is(.reply-suggestion, .ask-hints) { display: none; }

/* Mio's open question: its answers above the field (asks_controller). */
.ask-hints { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 0 12px 6px; }
.ask-hints[hidden] { display: none; }
.ask-hints .reply-suggestion { margin: 0; }
.ask-hints .reply-suggestion[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px #3be37a; }

/* Reply: the message answered, above the field and in the answer's bubble. */
.composer-quote { align-items: center; background: var(--c-field); border-radius: 14px; box-shadow: 0 0 0 0.5px color-mix(in oklch, var(--c-ink) 14%, transparent); display: flex; gap: 8px; margin: 0 12px 6px; padding: 6px 6px 6px 12px; }
.composer-quote[hidden] { display: none; }
.composer-quote-text { border-left: 3px solid #3be37a; display: flex; flex: 1; flex-direction: column; min-width: 0; padding-left: 8px; }
.composer-quote-text strong { font-size: 0.8125rem; }
.composer-quote-text span, .msg-quote span { color: color-mix(in oklch, currentColor 70%, transparent); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-quote-close { background: none; border: 0; color: var(--c-ink); cursor: pointer; display: flex; padding: 4px; }
.composer-quote-close svg { height: 1.1rem; width: 1.1rem; }
.msg-quote { border-left: 3px solid currentColor; color: inherit; display: flex; flex-direction: column; margin: 0 0 4px; max-width: 100%; min-width: 0; opacity: 0.85; padding-left: 8px; text-decoration: none; }
.msg-quote strong { font-size: 0.8125rem; }

/* Account preference switches retain native keyboard and label behaviour. */
.settings-toggle {
  appearance: none;
  width: 2.75rem;
  height: 1.5rem;
  flex: 0 0 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 1rem;
  background: #8e8e93;
  position: relative;
  cursor: pointer;
}
.settings-toggle::before {
  content: "";
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  top: .125rem;
  left: .125rem;
  border-radius: 50%;
  background: white;
}
.settings-toggle:checked { background: var(--brand-ground); }
.settings-toggle:checked::before { transform: translateX(1.25rem); }
.settings-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* Pin mode stays on the list while Turbo replaces its rows. Grid order also
   keeps new activity below pinned rows, including after a stream prepend. */
.conversation-edit { margin-right: 0; position: relative; }
.conversation-edit summary { list-style: none; display: flex; align-items: center; }
.conversation-edit summary::-webkit-details-marker { display: none; }
.conversation-edit-menu { position: absolute; left: 0; z-index: 30; min-width: 10rem; padding: .4rem; background: var(--surface); border-radius: 1rem; box-shadow: 0 .3rem 1rem #0003; }
.conversation-edit-menu button { display: block; width: 100%; text-align: left; padding: .75rem; background: none; color: var(--ink); border: 0; font: inherit; cursor: pointer; }
.conversation-edit-done, .conversation-pin { display: none; }
.conversation-index:is(.selecting, .pinning) .conversation-edit { display: none; }
.conversation-index:is(.selecting, .pinning) .conversation-edit-done { display: block; }
.conversation-index.pinning .conversation-swipe-sheet { transform: none; }
.conversation-index.pinning .conversation-swipe-sheet .conversation-row { pointer-events: none; }
.conversation-index.pinning .conversation-pin { display: grid; place-items: center; position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: #ffcc00; color: white; cursor: pointer; }
.conversation-pin[aria-pressed="true"] { background: #34c759 !important; }
.conversation-pin svg { width: 1.4rem; height: 1.4rem; }
.conversation-index.pinning .conversation-delete-form { display: none; }

.conversation-index.selecting .conversation-swipe:not([data-removal]) { opacity: .4; pointer-events: none; }

/* Device-local group navigation, with touch/keyboard reorder controls. */
.group-tabs:not([hidden]) { display: flex; flex-wrap: wrap; align-items: start; align-content: start; position: static; gap: .5rem; max-width: 100%; min-width: 0; padding-block: .25rem; }
.group-tabs > div { flex: 0 0 auto; min-width: 0; max-width: 100%; }
.group-tab { max-width: 100%; white-space: normal; overflow-wrap: anywhere; font-size: 1.15rem; font-weight: 650; }
.group-tab, .group-order-open { display: flex; gap: .4rem; align-items: center; white-space: normal; border: 1px solid currentColor; border-radius: 2rem; background: transparent; color: inherit; min-height: 44px; padding: .5rem .85rem; font: inherit; cursor: pointer; }
.group-tab { font-size: 1.15rem; font-weight: 650; }
.group-tab[aria-current="page"] { background: var(--ink, #222); color: var(--surface, white); }
.group-order-dialog { color: var(--ink, #222); background: var(--surface, white); width: min(32rem, 100%); max-height: 80dvh; border: 0; border-radius: 1rem; padding: 1rem; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.group-order-dialog::backdrop { background: #0006; }
.group-order-dialog header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.group-order-dialog h2 { font-size: 1.25rem; }
.group-order-row { display: flex; align-items: center; gap: .25rem; }
.group-order-row form { flex: 1; min-width: 0; }
.group-order-name { width: 100%; text-align: start; overflow-wrap: anywhere; }
.group-order-dialog button { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.group-order-dialog button:focus:not(:focus-visible) { outline: none; }
.group-order-dialog button:focus-visible { outline: 2px solid var(--muted); outline-offset: -2px; border-radius: .5rem; }
.group-order-dialog button:disabled { opacity: .3; cursor: default; }
.group-order-name[aria-current="page"] { font-weight: bold; }
.group-order-new { display: block; padding: 1rem .25rem; color: var(--ink); }
.conversation-edit-menu [aria-pressed="true"]::after { content: "✓"; margin-left: auto; }

.gift-dialog { width: min(38rem, calc(100% - 2rem)); max-height: 85dvh; overflow: auto; border: 0; border-radius: 1rem; padding: 1.25rem; background: var(--surface); color: var(--ink); }
.gift-dialog::backdrop { background: #0006; }
.settings-compact .settings-field { gap: .15rem; padding-block: .45rem; }
.settings-text-preview { display: block; width: 100%; min-width: 0; min-height: 1.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.settings-text-preview:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.settings-text-dialog { width: min(38rem, calc(100% - 2rem)); max-height: 85dvh; overflow: auto; border: 0; border-radius: 1rem; padding: 1.25rem; background: var(--surface); color: var(--ink); }
.settings-text-dialog::backdrop { background: #0006; }
.settings-text-dialog label { display: grid; gap: .75rem; }
.settings-text-dialog textarea { resize: vertical; min-height: 8rem; max-height: 50dvh; }
.settings-text-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.chat-setting-instructions { gap: .15rem .75rem; padding-block: .45rem; }
.chat-setting-instructions > .settings-icon { grid-row: 1; align-self: center; }
.chat-setting-instructions, .chat-setting-instructions > label { cursor: pointer; }
.settings-row.chat-add-people { color: var(--success); }
.chat-setting-instructions > label { display: flex; align-items: center; min-height: 2rem; font-size: .97rem; }
.gift-dialog fieldset { border: 0; padding: 0; }
.gift-styles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-block: .75rem; }
.gift-style { border: 2px solid transparent; border-radius: .75rem; padding: .5rem; cursor: pointer; }
.gift-style:has(input:checked) { border-color: currentColor; }
.gift-style img { display: block; width: 100%; height: auto; }
.gift-message { display: grid; gap: .5rem; margin-top: 1rem; }
.gift-message input { width: 100%; box-sizing: border-box; padding: .75rem; font: inherit; }
.gift-actions { display: flex; justify-content: flex-end; gap: .75rem; }
.gift-actions button { min-height: 44px; padding: .5rem 1rem; font: inherit; }

.conversation-edit-menu > a { display: block; padding: .75rem; color: inherit; text-decoration: none; }

.conversation-index-group > :is(.conversation-edit, .conversation-index-settings, .conversation-edit-done) { flex-shrink: 0; }
.conversation-index.selecting .group-tabs { display: none; }
.conversation-index.pinning .conversation-row-topline time { display: none; }
.conversation-index.pinning .conversation-row-content { padding-right: 3.25rem; }

/* Grouped settings use the iOS neutral row colours in each appearance. */
:root { --settings-row-bg: #f2f2f7; }
@media (prefers-color-scheme: dark) { :root { --settings-row-bg: #1c1c1e; } }
.page-shell:has(.settings-screen) .topbar {
  border-bottom: 0;
  background: color-mix(in oklch, var(--paper) 65%, transparent);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.chat-header {
  position: absolute; top: 0; left: 0; right: 0;
  background: transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  pointer-events: none;
}
.chat-header > * { pointer-events: auto; }
.chat-header-actions { grid-column: 3; }
.chat-thread { padding-top: calc(var(--chat-header-height, 3.5rem) + .8rem); }
.bubble.bubble-gift { background: transparent; padding: 0; border: 0; box-shadow: none; overflow: hidden; }
.gift-style { min-width: 0; padding: .25rem; font-size: .8rem; overflow-wrap: anywhere; }
.onboarding-about { display: block; min-height: 7rem; resize: vertical; cursor: text; box-sizing: border-box; }
.onboarding-about-slot { margin-bottom: 1.5rem; }
.onboarding-name { margin-bottom: 1.5rem; }
.onboarding-mascot { display: grid; place-items: center; }
.onboarding-elephant { width: 88%; height: 88%; object-fit: contain; transform: scaleX(-1); }
.onboarding-invite-actions { display: flex; gap: 1rem; align-items: center; }
.onboarding-invite-actions > * { flex: 1; min-width: 0; }
.onboarding-invite-actions .button_to .onboarding-primary { width: 100%; }
.onboarding-invite-actions .onboarding-primary { text-align: center; }
.conversation-edit-menu > :is(button, a) { display: flex; align-items: center; gap: .7rem; white-space: nowrap; }
.conversation-edit-menu svg { width: 1.2rem; height: 1.2rem; flex: none; }
@media (min-width: 900px) {
  .conversation-master-layout .conversation-index.selecting .conversation-selection-bar,
  .rail .conversation-index.selecting .conversation-selection-bar { bottom: calc(1.4rem + 50px); }
}

@media (min-width: 900px) {
  .rail .conversation-index.selecting .conversation-selection-bar { position: absolute; }
  .rail .conversation-index.selecting .conversation-list, .conversation-master-layout .conversation-index.selecting .conversation-list { padding-bottom: calc(6.75rem + 50px); }
}

/* Native select widgets add their own text inset. Use the same text origin
   as the label, input and textarea while keeping a visible dropdown arrow. */
.settings-field > :is(label, .settings-field-label, input, textarea, select, p) { min-width: 0; margin-inline: 0; text-align: start; text-indent: 0; }
.settings-field select {
  appearance: none; -webkit-appearance: none;
  padding-inline: 0 1.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right center; background-size: 1rem;
}
/* Clicking or tapping a dropdown must not leave a frame around its row.
   Keep the focus indicator for keyboard navigation. */
.settings-screen :is(select, summary):focus:not(:focus-visible) { outline: none; }
.settings-profile-heading { margin: 0; padding: .7rem .9rem; }

.invitation-green { background: var(--settings-row-bg); color: var(--brand-ground); justify-content: center; }
.invitation-green:hover { background: color-mix(in oklch, var(--settings-row-bg) 94%, var(--ink)); color: var(--brand-ground); }
.invitation-start { justify-content: flex-start; text-align: left; }
.invitation-centered { justify-content: center; text-align: center; }
.autosave-status { min-height: 1.3rem; display: flex; align-items: center; gap: .6rem; }
.autosave-status button { font: inherit; border: 0; background: transparent; color: var(--accent); text-decoration: underline; cursor: pointer; }
.sidebar-divider { display: none; }
@media (min-width: 900px) {
  .sidebar-divider { display: block; position: fixed; top: 0; bottom: 0; left: var(--sidebar-width, calc(100vw / 3)); width: 8px; transform: translateX(-50%); z-index: 35; cursor: ew-resize; touch-action: none; }
  .sidebar-divider::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; transform: translateX(-50%); background: #fff; pointer-events: none; }
  .sidebar-resizing { cursor: ew-resize; user-select: none; }
  .app-chat-frame > .chat-shell { width: 100%; }
}
/* Keep the content column bounded even when the sidebar is hidden. */
.chat-thread { padding-inline: max(1rem, calc((100% - 28.75rem) / 2)); }
.chat-header { padding-inline: max(.65rem, calc((100% - 31.05rem) / 2 + .65rem)); }
.chat-composer { left: 50%; right: auto; width: min(100%, 31.05rem); transform: translateX(-50%); }

.chat-settings-edit-form > .autosave-status { order: 6; }
:is(.chat-settings-page, .group-settings-page) .settings-screen { padding-bottom: 3rem; }
.account-settings-page .settings-screen { padding-bottom: calc(2lh + env(safe-area-inset-bottom, 0px)); }

.group-settings-page .settings-screen, .group-settings-page .settings-screen *, .group-settings-page .topbar-title { font-weight: 400; }

.settings-toggle-row { margin: 0; font-weight: 400; }
.settings-toggle-row .settings-toggle { margin: 0 0 0 auto; flex: none; }
.chat-context-menu { position: fixed; inset: auto; margin: 0; border: 0; z-index: 70; min-width: 15rem; max-width: calc(100vw - 16px); padding: .4rem; border-radius: .85rem; background: var(--surface); color: var(--ink); box-shadow: 0 .3rem 1.5rem #0003; }
.chat-context-menu button { white-space: nowrap; display: flex; align-items: center; gap: .7rem; width: 100%; border: 0; background: transparent; color: inherit; font: inherit; padding: .75rem; text-align: left; cursor: pointer; border-radius: .5rem; }
.chat-context-menu button.danger { color: var(--danger); }
.chat-context-menu button:disabled { opacity: .4; cursor: default; }
.chat-context-menu svg { height: 1.2rem; width: 1.2rem; flex: none; }
.chat-context-menu p { max-width: 18rem; padding: .5rem; margin: 0; color: var(--danger); }

:is(.group-settings-page, .large-settings-heading) .topbar-title { font-weight: 400; font-size: clamp(1.35rem, 2vw, 1.8rem); line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
:is(.group-settings-page, .large-settings-heading) .topbar { min-height: 4.5rem; }

.conversation-edit-menu { min-width: 16.5rem; padding: .5rem; }
.conversation-edit-menu > :is(button, a) { padding-inline: .8rem 1rem; }
.conversation-edit-menu hr { border: 0; border-top: 1px solid color-mix(in oklch, var(--muted) 20%, transparent); margin: .35rem .5rem; }

.onboarding-invite .onboarding-share { display: grid; place-items: center; width: 3rem; height: 3rem; padding: .5rem; background: transparent; color: #000; border: 0; }
.onboarding-share svg { width: 1.75rem; height: 1.75rem; }
.onboarding-invite-actions { flex-direction: column; justify-content: center; max-width: 30rem; width: 100%; }
.onboarding-invite-actions > * { flex: none; }
.onboarding-step-4 .onboarding-action small { max-width: 30rem; text-align: center; }

/* All settings separators share the same inset and theme color. */
.settings-group > :not([hidden]) ~ :not([hidden], .settings-divider, .chat-settings-edit-form, .chat-settings-edit-fields),
.chat-settings-basics :is(.chat-setting-name, .chat-setting-instructions) { position: relative; border-top: 0; }
.settings-group > :not([hidden]) ~ :not([hidden], .settings-divider, .chat-settings-edit-form, .chat-settings-edit-fields)::before,
.chat-settings-basics :is(.chat-setting-name, .chat-setting-instructions)::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline: var(--settings-divider-inset, .9rem);
  border-top: 1px solid var(--line);
  pointer-events: none;
}
.settings-group > .settings-divider + :not([hidden])::before { content: none; }
.settings-group > .settings-divider { border: 0; border-top: 1px solid var(--line); margin: .5rem var(--settings-divider-inset, .9rem); padding: 0; }

.invitation-text { color: var(--brand-ground); }

.group-order-dialog .group-order-handle { cursor: grab; touch-action: none; flex: none; display: grid; place-items: center; }
.group-order-handle svg { width: 1.3rem; height: 1.3rem; }
.group-order-row.dragging { background: var(--settings-row-bg); }
.group-order-row.dragging .group-order-handle { cursor: grabbing; }

.bubble-gift .file-preview { margin: 0; }
.bubble-gift .file-image { aspect-ratio: 480 / 420; max-height: none; object-fit: contain; }
.camera-dialog { background: var(--surface); color: var(--ink); border: 0; border-radius: 1rem; width: min(36rem, calc(100vw - 2rem)); padding: 1rem; }
.camera-dialog::backdrop { background: #0006; }
.camera-dialog video { display: block; width: 100%; max-height: 65dvh; object-fit: contain; background: #000; border-radius: .75rem; }
.camera-actions { display: flex; justify-content: center; gap: 1rem; }
.camera-actions button { background: var(--settings-row-bg); color: var(--ink); border: 0; border-radius: .75rem; padding: .75rem 1rem; font: inherit; }
.camera-actions button:disabled { opacity: .4; }

.settings-row.settings-brand-action { color: var(--brand-ground); }

.toolbar-glass {
  background: color-mix(in oklch, var(--surface) 80%, transparent);
  border: 1px solid color-mix(in oklch, var(--ink) 10%, transparent);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .7), 0 2px 8px rgb(0 0 0 / .08);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  text-decoration: none;
}
.conversation-index-toolbar { gap: .5rem; }
.chat-header-actions { gap: .5rem; }
.chat-header-actions .toolbar-glass, .chat-header > .chat-menu-button.toolbar-glass { width: 2.75rem; height: 2.75rem; color: var(--c-ink); background: color-mix(in oklch, var(--c-bg) 80%, transparent); }
@media (hover: hover) and (pointer: fine) {
  .toolbar-glass:hover { background: var(--surface); text-decoration: none; }
  .chat-header-actions .toolbar-glass:hover, .chat-header > .chat-menu-button.toolbar-glass:hover { background: var(--c-bg); }
}
@media (min-width: 900px) {
  /* Keep Safari's document overscroll outside the application frame. */
  html:has(.page-shell), html:has(.app-chat-frame) { overflow: hidden; overscroll-behavior: none; }
  body:has(> .page-shell), body.app-chat-frame { margin: 0; padding: 0; overscroll-behavior: none; }
  .page-shell, body.app-chat-frame { position: fixed; inset: 0; margin: 0; }
  .page-shell { overflow-y: auto; overscroll-behavior: none; }
  .conversation-master-layout { overflow: hidden; }
  .chat-header-actions { position: absolute; top: .5rem; right: 50px; }
}

/* Initial onboarding only; long pages scroll inside the existing layout. */
.onboarding-examples { display: flex; flex-direction: column; gap: 30px; }
.onboarding-example { background: white; color: #101010; border-radius: 22px 22px 22px 4px; padding: 16px; max-width: 280px; align-self: flex-start; white-space: pre-line; font-size: 17px; line-height: 1.3; }
.onboarding-example:nth-of-type(even) { align-self: flex-end; border-radius: 22px 22px 4px 22px; }
.onboarding-feature { display: flex; gap: 24px; align-items: center; margin: 28px 0; color: #101010; }
.onboarding-feature > span { flex: 1; }
.onboarding-feature strong { display: block; font-size: 21px; line-height: 1.2; margin-bottom: 10px; }
.onboarding-feature span span { font-size: 16px; line-height: 1.35; }
.onboarding-feature input { appearance: none; flex: 0 0 58px; width: 58px; height: 35px; border: 0; border-radius: 30px; background: #0002; padding: 3px; cursor: pointer; }
.onboarding-feature input::before { content: ""; display: block; width: 29px; height: 29px; background: white; border-radius: 50%; transition: transform .15s; }
.onboarding-feature input:checked { background: #153e2b; }
.onboarding-feature input:checked::before { transform: translateX(23px); }
.onboarding-feature input:focus-visible { outline: 2px solid black; outline-offset: 3px; }
.onboarding-feature input:disabled { opacity: .5; cursor: default; }

.onboarding-step-6 .onboarding-copy, :is(.onboarding-step-7, .onboarding-step-8, .onboarding-step-9) .onboarding-copy { min-height: 0; }
:is(.onboarding-step-7, .onboarding-step-8, .onboarding-step-9) .onboarding-body { display: block; }
@media (max-width: 640px) {
  .onboarding-step-6 .onboarding-copy, :is(.onboarding-step-7, .onboarding-step-8, .onboarding-step-9) .onboarding-copy { grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
  .onboarding-step-6 .onboarding-body, :is(.onboarding-step-7, .onboarding-step-8, .onboarding-step-9) .onboarding-body { min-height: 0; overflow-y: auto; padding-block: 24px; }
  .onboarding-step-6 .onboarding-example { flex-shrink: 0; }
}

/* Examples end with Continue inside the scrollable page. */
.onboarding-step-6 .onboarding-copy { display: block; height: 100svh; min-height: 0; padding-bottom: 0; }
.onboarding-example-scroll { height: 100%; min-height: 0; overflow-y: auto; }
.onboarding-step-6 .onboarding-body { overflow: visible; padding-block: 16px; }
.onboarding-step-6 .onboarding-examples-action { display: flex; padding-top: 48px; padding-bottom: calc(env(safe-area-inset-bottom) + 16px); }
.onboarding-scroll-arrow { position: absolute; right: 1.25rem; bottom: calc(env(safe-area-inset-bottom) + 1.25rem); width: 48px; height: 48px; display: grid; place-items: center; color: black; background: transparent; border: 0; cursor: pointer; }
:is(.onboarding-step-7, .onboarding-step-8, .onboarding-step-9) .onboarding-body { padding-top: 4px; padding-bottom: 12px; }
:is(.onboarding-step-7, .onboarding-step-8, .onboarding-step-9) .onboarding-copy h1 { font-size: clamp(2.75rem, 4vw, 4.5rem); max-width: none; margin-bottom: 2rem; line-height: 1.05; }
@media (min-width: 801px) {
  :is(.onboarding-step-7, .onboarding-step-8, .onboarding-step-9) { grid-template-columns: minmax(0, 64%) minmax(0, 36%); }
  :is(.onboarding-step-7, .onboarding-step-8, .onboarding-step-9) .onboarding-settings-panel { max-width: 38rem; }
}
.onboarding-feature { gap: 16px; margin-block: 24px; padding-right: 4px; }
.onboarding-feature > span { min-width: 0; }
.onboarding-feature input { box-sizing: border-box; margin: 0; }

/* Bubble geometry follows the 393px onboarding reference. */
.onboarding-step-6 .onboarding-examples { gap: 0; padding-top: 36px; padding-bottom: 0; }
.onboarding-step-6 .onboarding-examples h1 { margin: 0 0 0 2.83%; }
.onboarding-step-6 .onboarding-example { box-sizing: border-box; align-self: flex-start; max-width: none; padding: 11.5px 19.55px; font-size: 20.7px; line-height: 1.22; }
.onboarding-step-6 .onboarding-example:nth-of-type(1) { width: 74.277%; margin-left: 3.399%; margin-top: 58px; border-radius: 25.3px 25.3px 25.3px 4.6px; }
.onboarding-step-6 .onboarding-example:nth-of-type(2) { width: 82.748%; margin-left: 17.252%; margin-top: 31px; border-radius: 25.3px 25.3px 4.6px 25.3px; }
.onboarding-step-6 .onboarding-example:nth-of-type(3) { width: 70.694%; margin-left: 21.530%; margin-top: 31px; border-radius: 25.3px 25.3px 25.3px 4.6px; }
.onboarding-step-6 .onboarding-example:nth-of-type(4) { width: 67.436%; margin-left: 11.898%; margin-top: 37px; border-radius: 25.3px 25.3px 25.3px 4.6px; }
.onboarding-step-6 .onboarding-example:nth-of-type(5) { width: 71.671%; margin-left: 28.329%; margin-top: 38px; border-radius: 25.3px 25.3px 4.6px 25.3px; }
.onboarding-step-6 .onboarding-example:nth-of-type(6) { width: 88.612%; margin-left: 3.399%; margin-top: 41px; border-radius: 25.3px 25.3px 25.3px 4.6px; }
.onboarding-step-6 .onboarding-example:nth-of-type(7) { width: 88.612%; margin-left: 11.388%; margin-top: 41px; border-radius: 25.3px 25.3px 4.6px 25.3px; }
.onboarding-step-6 .onboarding-example:nth-of-type(8) { width: 88.612%; margin-left: 9.348%; margin-top: 52px; border-radius: 25.3px 25.3px 4.6px 25.3px; }
.onboarding-step-6 .onboarding-examples-action { padding-top: 118px; }

.onboarding-scroll-arrow { transition: opacity 250ms ease-in-out; }
.onboarding-scroll-arrow.is-hidden { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .onboarding-scroll-arrow { transition: none; }
}

.onboarding-settings-panel { background: white; border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 24px; }
.onboarding-settings-panel .onboarding-feature { margin: 0; padding-right: 0; }
.onboarding-settings-panel .onboarding-feature input:checked { background: #28b75e; }

.onboarding-back { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; margin-right: 12px; color: #030505; font-size: 1.5rem; text-decoration: none; }
.onboarding-back:focus-visible { outline: 3px solid rgb(3 5 5 / 0.45); outline-offset: 3px; }

/* The welcome cards size to their translated text. Foreground cards cut
   into their neighbours with a rounded, brand-colour gutter. */
.onboarding-step-1 { grid-template-columns: minmax(0, 42%) minmax(0, 58%); }
.onboarding-step-1 .onboarding-copy { padding: 8rem 1rem 5rem clamp(1.25rem, 4vw, 4rem); }
.onboarding-step-1 .onboarding-copy h1 { font-size: clamp(2.5rem, 5.2vw, 5.4rem); }
.onboarding-scene-intro { display: flex; flex-direction: column; align-self: center; gap: 1.5rem; min-width: 0; min-height: 0; padding: 8rem 3rem 5rem 0.75rem; }
.onboarding-scene-intro .onboarding-example { box-sizing: border-box; position: relative; flex: none; min-width: 0; max-width: none; margin: 0; padding: 1.25rem 1.5rem; border-radius: 1.4rem; font-size: clamp(1rem, 1.4vw, 1.4rem); line-height: 1.4; overflow-wrap: anywhere; animation: none; }
.onboarding-example-row { display: flex; align-items: flex-start; justify-content: space-between; }
.onboarding-example-row-top { align-items: flex-end; padding-left: 10%; padding-right: 5%; }
.onboarding-example-row-top .onboarding-example-husband { width: 61%; padding-right: 3rem; }
.onboarding-example-row-top .onboarding-example-location { width: 47%; margin-left: -8%; z-index: 1; box-shadow: 0 0 0 0.7rem var(--brand-ground); }
.onboarding-example-row-middle { padding-left: 2%; }
.onboarding-example-row-middle .onboarding-example-kids { width: 54%; padding-bottom: 1.7rem; }
.onboarding-example-row-middle .onboarding-example-news { width: 44%; }
.onboarding-example-row-bottom { align-items: center; margin-top: -2rem; padding-right: 9%; }
.onboarding-example-row-bottom .onboarding-example-sister { width: 49%; margin-top: 2rem; }
.onboarding-example-row-bottom .onboarding-example-tasks { width: 49%; z-index: 1; box-shadow: 0 0 0 0.7rem var(--brand-ground); }
.onboarding-scene-intro > .onboarding-example-shopping { width: 43%; margin-left: 3%; margin-top: -0.8rem; }
@media (max-width: 1100px) {
  .onboarding-step-1 { grid-template-columns: 1fr; height: auto; min-height: 100svh; grid-template-rows: auto auto; }
  .onboarding-step-1 .onboarding-copy { padding: 7rem 1.5rem 2rem; }
  .onboarding-step-1 .onboarding-copy h1 { font-size: clamp(2.5rem, 7vw, 4.5rem); }
  .onboarding-scene-intro { width: 100%; max-width: 52rem; box-sizing: border-box; justify-self: center; padding: 1rem 1.5rem 3rem; }
}
@media (max-width: 640px) {
  .onboarding-step-1 .onboarding-copy { gap: 1rem; }
  .onboarding-scene-intro { gap: 1rem; }
  .onboarding-scene-intro .onboarding-example { padding: 1rem; font-size: 1rem; }
  .onboarding-example-row { flex-direction: column; gap: 1rem; padding: 0; align-items: stretch; }
  .onboarding-scene-intro .onboarding-example-row .onboarding-example { width: 90%; margin: 0; box-shadow: none; }
  .onboarding-scene-intro .onboarding-example-row .onboarding-example:nth-child(even) { align-self: flex-end; }
  .onboarding-example-row-bottom { margin-top: 0; }
  .onboarding-scene-intro > .onboarding-example-shopping { width: 90%; margin: 0; }
}

.settings-row.settings-account-delete { background: var(--settings-row-bg); color: var(--danger); font-weight: 400; }
.settings-row.settings-account-delete:hover { background: color-mix(in oklch, var(--settings-row-bg) 94%, var(--ink)); color: var(--danger); }

.settings-account-deletion-note { padding-bottom: 0; }

/* Useful features: quiet text and a clear gap before the next action. */
.onboarding-settings-panel .onboarding-feature,
.onboarding-settings-panel .onboarding-feature strong,
.onboarding-settings-panel .onboarding-feature span { font-weight: 400; }
:is(.onboarding-step-7, .onboarding-step-8, .onboarding-step-9) .onboarding-action { display: flex; padding-top: 36px; }
.onboarding-toast { position: fixed; z-index: 100; bottom: calc(env(safe-area-inset-bottom) + 24px); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box; margin: 0; padding: 12px 18px; border-radius: 14px; background: #222; color: white; font-size: 15px; font-weight: 400; line-height: 1.4; box-shadow: 0 4px 20px #0003; pointer-events: none; }
.onboarding-toast[hidden] { display: none; }

/* The shared invitation card keeps its actions together without row dividers. */
.settings-group.invitation-actions > :not([hidden]) ~ :not([hidden])::before { content: none; }

/* Invitation actions use the same type size and weight, including Share. */
.invitation-actions button.settings-row { font-size: .97rem; font-weight: 400; }
.invitation-actions button[data-action="share-link#send"] { color: var(--ink); }

.owner-settings-locked { width: 100%; box-sizing: border-box; cursor: pointer; }
.owner-settings-locked > * { pointer-events: none; }
.settings-field:has(:disabled) label,
.settings-field:has(:disabled) :disabled {
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
  opacity: 1;
}
.settings-field:has(:disabled) :disabled::placeholder { color: var(--muted); }
.settings-field:has(:disabled) > .settings-icon { background: var(--muted); }

/* Editable space fields share the credit row's inset and trailing values. */
.settings-compact .settings-field.settings-field-row {
  grid-template-columns: 2rem minmax(0, 1fr) minmax(0, 1fr) 1rem;
  align-items: center;
  gap: .75rem;
  min-height: 3rem;
  padding: .7rem .9rem;
  font-size: .97rem;
}
.settings-field-row > .settings-icon { grid-column: 1; grid-row: 1; }
.settings-field-row > label {
  grid-column: 2;
  grid-row: 1;
  color: var(--ink);
  font-size: inherit;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}
.settings-field-row > :is(input, .settings-text-preview, select) {
  grid-column: 3;
  grid-row: 1;
  text-align: right;
}
.settings-field.settings-field-row > select {
  grid-column: 3 / 5;
  text-align-last: right;
  padding-inline-end: 1.75rem;
}
.settings-field-disclosure::after {
  content: "›";
  grid-column: 4;
  grid-row: 1;
  color: var(--muted);
  font-size: 1.15rem;
  text-align: right;
  pointer-events: none;
}
.owner-settings-toast {
  opacity: 0;
  transition: opacity 300ms ease-in-out;
  pointer-events: none;
  position: fixed;
  z-index: 10000;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: 16px;
  background: #222;
  color: #fff;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 4px 20px #0003;
}
.owner-settings-toast.visible { opacity: 1; }

.settings-row-muted { filter: grayscale(1); opacity: 0.6; }
.settings-assistant-name > :not(.settings-assistant-name-value) { filter: grayscale(1); opacity: 0.6; }
.settings-assistant-name-value { color: var(--muted); margin-inline-start: auto; text-align: right; }

/* Shared appearance for web dialogs and their action buttons. */
dialog {
  background: var(--surface);
  color: var(--ink);
  border: 0;
  border-radius: 1rem;
  padding: 1.25rem;
}
dialog::backdrop { background: #0006; }
dialog :is(input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), textarea, select):focus {
  border-color: var(--line);
  outline: none;
}
dialog .dialog-action {
  background: var(--settings-row-bg);
  border: 0;
  border-radius: .55rem;
  min-height: 2.75rem;
  padding: .65rem 1rem;
  font: inherit;
  cursor: pointer;
}
dialog .dialog-action-cancel, dialog .dialog-action-danger { color: var(--danger); }
dialog .dialog-action-confirm { color: var(--success); }
.settings-field-disclosure, .settings-field-disclosure > label { cursor: pointer; }

/* The chat's edges (heymio-3ad6), as in the iOS app (softBottomScrollEdge,
   floatingComposer) and Messages: no bars, soft edges. Bubbles fade out
   under the header's buttons, and above the composer: solid from a little
   above the pill's top edge down (Martin,
   2026-10-31: solid from the pill's own edge felt cut off). The fade is
   measured from the bottom, so a reply suggestion or a taller draft does
   not move it. The pill, the plus and the suggestion have a surface of
   their own. */

.chat-composer {
  --composer-rest: max(1.1rem, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--c-bg) calc(var(--composer-rest) + 3rem), transparent calc(var(--composer-rest) + 4.5rem));
}
.chat-composer .composer-field, .chat-composer:not(:focus-within) .composer-field,
.composer-plus, .chat-composer:not(:focus-within) .composer-plus, .reply-suggestion {
  background: var(--c-field);
  box-shadow: 0 0 0 0.5px color-mix(in oklch, var(--c-ink) 14%, transparent), 0 1px 2px rgb(0 0 0 / 0.06);
}
.reply-suggestion { -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--c-ink); font-size: 0.875rem; margin-bottom: 0.5rem; padding: 0.4rem 0.9rem; }

/* With the keyboard up, Safari moves the page and the header leaves the
   top (Martin, 2026-10-31). It is hidden while the keyboard moves, then put
   at the top of what is visible and faded in, never sliding down
   (app_chat_controller#placeHeader). */
.chat-header { transform: translateY(var(--page-shift, 0px)); transition: opacity 0.25s ease; }
/* Visible by default, including before controller setup and after a refresh. */
.chat-shell.header-settling .chat-header { opacity: 0; transition: opacity 0.1s ease; }
.chat-shell.header-settling .chat-header > * { pointer-events: none; }

/* Mail whose sender Cloudflare could not confirm (heymio-adp8.1.9). */
.sender-unverified { color: var(--danger); font-weight: 600; }

.conversation-account-settings { padding: 0; overflow: hidden; }
.conversation-account-settings .member-avatar { width: 100%; height: 100%; flex: 1 1 auto; border: 0; border-radius: inherit; object-fit: cover; font-size: 14px; }

.account-deletion-note { text-align: center; }

/* New-chat participant picker: the same material as the web toolbar. */
.new-chat-menu {
  position: fixed; inset: auto; margin: 0; box-sizing: border-box;
  width: min(20rem, calc(100vw - 24px)); padding: .5rem 0;
  color: var(--ink); background: var(--surface);
  border: 1px solid color-mix(in oklch, var(--surface) 70%, transparent);
  border-radius: 1.5rem;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .7), 0 8px 32px rgb(0 0 0 / .16);
  overflow: auto;
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .new-chat-menu {
    background: color-mix(in oklch, var(--surface) 62%, transparent);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    backdrop-filter: blur(24px) saturate(140%);
  }
}
.new-chat-menu::backdrop { background: transparent; }
.new-chat-menu form, .new-chat-menu fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
.new-chat-people { max-height: min(24rem, 60dvh); overflow-y: auto; }
.new-chat-person { position: relative; display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; min-height: 3.5rem; box-sizing: border-box; cursor: pointer; }
.new-chat-person::after { content: ""; position: absolute; bottom: 0; left: 4.25rem; right: 1rem; border-bottom: 1px solid color-mix(in oklch, var(--muted) 22%, transparent); }
.new-chat-person .member-avatar { width: 2.5rem; height: 2.5rem; flex: none; }
.new-chat-person-name { flex: 1; min-width: 0; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: .125rem; }
.new-chat-person-name small { color: var(--muted); font-size: .8rem; }
.new-chat-person input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 1.375rem; height: 1.375rem; flex: none; margin: 0; border: 1.5px solid var(--muted); border-radius: 50%; background: transparent; display: grid; place-content: center; cursor: pointer; }
.new-chat-person input[type="checkbox"]:checked { background: #3be37a; border-color: #3be37a; }
.new-chat-person input[type="checkbox"]:checked::after { content: ""; width: .55rem; height: .3rem; border-left: 2px solid white; border-bottom: 2px solid white; transform: translateY(-.06rem) rotate(-45deg); }
.new-chat-create { display: block; width: calc(100% - 2rem); margin: .25rem 1rem 0; padding: .75rem; min-height: 3rem; border: 0; border-radius: 1rem; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.new-chat-create:disabled { opacity: .4; cursor: default; }
.new-chat-invitation { position: relative; }
.new-chat-invitation::after { content: ""; position: absolute; bottom: 0; left: 4.25rem; right: 1rem; border-bottom: 1px solid color-mix(in oklch, var(--muted) 22%, transparent); }
.new-chat-invitation .settings-row { padding: .5rem 1rem; min-height: 3.5rem; background: transparent; color: var(--ink); }
.new-chat-invitation .settings-row-text strong { font-weight: 400; }
.new-chat-invitation .settings-icon { width: 2.5rem; height: 2.5rem; border-radius: 50%; background: color-mix(in oklch, var(--ink) 4%, transparent); color: var(--ink); }
.new-chat-invitation .settings-icon svg { width: 1.25rem; height: 1.25rem; }
@media (hover: hover) { .new-chat-invitation .settings-row:hover { background: color-mix(in oklch, var(--ink) 5%, transparent); } }
.new-chat-error { margin: .5rem 1rem; color: var(--ink); font-size: .85rem; }
.new-chat-person:has(input:focus-visible), .new-chat-create:focus-visible { outline: 2px solid var(--ink); outline-offset: -3px; border-radius: .5rem; }
@media (hover: hover) { .new-chat-person:hover, .new-chat-create:enabled:hover { background: color-mix(in oklch, var(--ink) 5%, transparent); } }
@media (prefers-reduced-transparency: reduce) { .new-chat-menu { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; } }
@media (forced-colors: active) { .new-chat-person input[type="checkbox"] { appearance: auto; } }

.mini-game-menu { padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
.mini-game-menu button { padding: 12px 20px; color: inherit; }

/* The mask never touches the canvas pixels saved by Use photo. */
.photo-crop-viewport { width: min(240px, 100%); margin-inline: auto; position: relative; border-radius: 50%; box-shadow: 0 4px 14px rgb(0 0 0 / 18%); }
.photo-crop-viewport .photo-crop-canvas { border-radius: 50%; }
.photo-crop-circle { position: absolute; inset: 0; border: 1.5px solid rgb(255 255 255 / 90%); border-radius: 50%; pointer-events: none; }
.photo-crop-spinner { position: absolute; left: calc(50% - 18px); top: calc(50% - 18px); width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: photo-generation-spin 0.8s linear infinite; }
.photo-crop-spinner[hidden] { display: none; }
@keyframes photo-generation-spin { to { transform: rotate(360deg); } }

/* Keep calendar connection labels black on a light button surface. */
.calendar-connect-button { color: #000; background: #fff; }

.photo-crop-prompt:not([hidden]) { display: grid; gap: 12px; margin-block: 16px; }
.photo-crop-description { width: 100%; box-sizing: border-box; padding: 16px; border: 0; border-radius: 0.85rem; background: var(--settings-row-bg); color: var(--ink); font: inherit; }
.photo-crop .photo-crop-generate { justify-self: center; padding: 16px 48px; border: 0; border-radius: 0.85rem; background: color-mix(in srgb, var(--ink) 10%, var(--surface)); color: #000; text-align: center; }
.photo-crop .photo-crop-generate:disabled { color: #808080; opacity: 1; cursor: default; }

.settings-add-members-locked { opacity: 0.4; }

/* Account and member initials also override chat-layer message backgrounds. */
span:is([data-user-avatar], [data-membership-avatar]):not(.member-avatar-photo) { background: var(--avatar-background); color: #fff; }
.conversation-mosaic-initial { position: absolute; left: var(--person-x); top: var(--person-y); transform: translate(-50%, -50%); color: #fff; font-size: 24cqw; font-weight: 600; line-height: 1; }
.conversation-mosaic-2 .conversation-mosaic-initial { font-size: 29cqw; }
.conversation-mosaic-6 .conversation-mosaic-initial { font-size: 20cqw; }

.onboarding-invitation-input { display: flex; align-items: center; gap: 12px; }
.onboarding-invitation-input input { flex: 1; min-width: 0; }
.onboarding-camera { color: #000; background: transparent; border: 0; width: 44px; height: 56px; cursor: pointer; flex-shrink: 0; }
.onboarding-camera svg { width: 28px; height: 28px; }
.onboarding-scanner { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; background: #000; color: white; padding: max(20px, env(safe-area-inset-top)) 20px; }
.onboarding-scanner video { width: 100%; height: 85%; object-fit: contain; }
.onboarding-scanner button { color: white; background: transparent; border: 0; font: inherit; padding: 12px; }

.waiting-group-page .auth-content { margin: 0; max-width: none; padding: 0; }
.waiting-group { position: relative; min-height: 100dvh; display: grid; place-items: center; }
.waiting-group-actions { position: absolute; top: 0; right: 0; z-index: 1; display: flex; justify-content: flex-end; gap: 0.5rem; padding: max(1rem, env(safe-area-inset-top)) 1rem 0; }
.waiting-group-actions button:disabled { opacity: 0.35; cursor: default; }
.waiting-group-actions details { position: relative; }
.waiting-group-menu { position: absolute; right: 0; z-index: 2; display: grid; gap: 0.5rem; min-width: 12rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; }
.waiting-group-message { display: grid; justify-items: center; gap: 20px; padding: 2rem; text-align: center; }
.waiting-group-elephant { width: 72px; height: 72px; }
.waiting-group-message p { margin: 0; color: var(--muted); max-width: 24rem; }

.join-request-message { width: 76%; }
.assistant-bubble-banded .join-request-message, .assistant-bubble-none .join-request-message { width: 100%; }

/* Chat settings use one member picker, like the native apps. */
.chat-photo-label { color: var(--ink); cursor: pointer; font-weight: 600; list-style: none; }
.chat-photo-label::-webkit-details-marker { display: none; }
.chat-members-dialog { background: var(--paper); border: 0; border-radius: 1.25rem; color: var(--ink); max-height: 85dvh; padding: 1.25rem; width: min(32rem, calc(100vw - 2rem)); }
.chat-members-dialog::backdrop { background: rgb(0 0 0 / 0.35); }
.chat-members-header { align-items: center; display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.chat-members-header h2 { font-size: 1.15rem; margin: 0; }
.chat-setting-instructions .settings-text-preview:empty { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; }
.chat-header .toolbar-glass { -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Keep photo actions and account controls neutral. */
.photo-crop .actions { justify-content: center; }
.photo-crop .actions .dialog-action { color: var(--muted); }
:is(.account-settings-page, .chat-settings-page) .settings-screen :is(strong, label, button, summary, input, select, textarea, .settings-identity-name, .settings-row-action, .settings-field-label) { font-weight: 400; }
:is(.account-settings-page, .chat-settings-page) .settings-group-title { font-family: inherit; font-size: .97rem; letter-spacing: normal; text-transform: none; }
.account-edit-menu { position: relative; }
.account-edit-menu > summary { list-style: none; }
.account-edit-menu > summary::-webkit-details-marker { display: none; }
.account-edit-menu .button { background: var(--settings-row-bg); color: var(--ink); }
.account-edit-actions { position: absolute; z-index: 20; top: calc(100% + .35rem); left: 50%; transform: translateX(-50%); width: max-content; min-width: 13rem; display: grid; gap: .25rem; padding: .4rem; background: var(--settings-row-bg); border-radius: .85rem; box-shadow: 0 5px 24px rgb(0 0 0 / .15); }
.account-edit-actions .button { text-align: start; width: 100%; }
.account-edit-actions .account-remove-photo { color: var(--danger); }
.account-settings-page .avatar-clear { display: none; }
.account-settings-page .account-identity-email { margin-top: -.6rem; }

.chat-setting-photo > .member-avatar { width: 2rem; height: 2rem; flex: none; object-fit: cover; border-radius: 50%; }
:is(.assistant-bubble-none, .assistant-bubble-banded) .msg-row:has(> .room-member-avatar) > .assistant-output { max-width: calc(100% - 5rem); margin-inline: 0; }
:is(.account-settings-page, .chat-settings-page) .settings-screen :is(label, .settings-field-label) { text-transform: none; letter-spacing: normal; }

.record-details-dialog { position: fixed; inset: 0; margin: auto; box-sizing: border-box; border: 0; border-radius: 1rem; padding: clamp(1.5rem, 3vw, 3rem); width: fit-content; min-width: min(24rem, calc(100vw - 2rem)); max-width: calc(100vw - 2rem); max-height: calc(100dvh - 3rem); overflow-y: auto; color: var(--c-ink, var(--ink)); background: var(--c-bg, var(--surface)); }
.record-details-dialog::backdrop { background: rgb(0 0 0 / 0.35); }

/* Linked-record pickers share the modal surface; only adjacent rows divide. */
.record-dialog-toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.record-dialog-close { margin-left: auto; }
.record-picker-items { list-style: none; margin: 0; padding: 0; background: transparent; }
.record-picker-items li + li { border-top: 1px solid var(--c-line, var(--line)); }
.record-picker-items button { display: block; width: 100%; padding: 1rem 0; border: 0; border-radius: 0; background: transparent; color: #000; text-align: left; }
.record-picker-dialog .record-dialog-toolbar { color: #000; }
.record-picker-dialog .record-dialog-toolbar button { color: inherit; }
.record-details-dialog:has([data-record-editor-active]) { background: var(--c-bg, var(--surface)); }
@media (prefers-color-scheme: dark) {
  .record-picker-items button, .record-picker-dialog .record-dialog-toolbar { color: #fff; }
}

/* Sharing follows the grouped reminder editor: heading, then member rows. */
.record-details-dialog .record-list-sharing { margin-top: 16px; }
.record-details-dialog .record-list-sharing h3 { margin: 0 0 12px; font-size: 1.125rem; font-weight: 700; color: var(--muted); }
.record-details-dialog .record-list-sharing form { padding: 0; border: 0; background: transparent; display: grid; gap: 12px; }
.record-details-dialog .record-list-sharing .settings-row { padding: 0; min-height: 44px; font-weight: 400; }
.record-details-dialog .record-list-sharing p { margin: 0; font-size: 0.875rem; }
.record-details-dialog .record-card:not([data-record-editor-active]) .record-list-sharing { display: none; }

.record-details-dialog [data-record-editor-active] .record-card-items { border: 0; background: transparent; border-radius: 0; }

.record-centered-dialog { min-height: 50dvh; }
.record-centered-dialog[open]:not(:has([data-record-editor-active])) { display: flex; flex-direction: column; }
.record-centered-dialog:not(:has([data-record-editor-active])) > .record-card { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; width: 100%; }
.record-centered-dialog:not(:has([data-record-editor-active])) .record-card-status { text-align: center; }
.record-details-dialog .record-note-more { display: none; }

.email-draft-form .settings-field { background: color-mix(in oklch, var(--ink) 7%, var(--surface)); border-radius: 12px; padding: 16px; }

.record-details-dialog .email-content-label { display: block; margin-top: 1lh; }
.record-details-dialog .email-status-label { padding-top: 1lh; }

/* Record dialogs are independent of the selected chat bubble theme. */
@media (min-width: 48rem) {
  .record-details-dialog { max-width: 60vw; }
}
.record-details-dialog .record-card.assistant-output {
  --card-inset: 0px;
  width: 100%; max-width: none; min-width: 0; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none; color: inherit;
}
.record-details-dialog .record-card[hidden], .record-email-editor[hidden] { display: none; }
.record-details-dialog .record-dialog-toolbar button {
  appearance: none; border: 0; outline: none; box-shadow: none; background: transparent;
  color: inherit; font: inherit; padding: .5rem 0; cursor: pointer;
}
.record-details-dialog .record-dialog-toolbar button:focus-visible { text-decoration: underline; text-underline-offset: .25em; }
.record-details-dialog .record-dialog-toolbar button:disabled { opacity: .5; cursor: default; }
.record-details-dialog .record-card-tick:active .record-card-box { transform: none; }
.record-details-dialog .record-editor-confirm { position: sticky; bottom: 0; margin: 1rem 0 0 auto; }
.record-details-dialog .email-draft-form { min-width: 0; width: min(36rem, 100%); }
.record-details-dialog .email-draft-form :is(.settings-group, .settings-field) { background: transparent; border: 0; box-shadow: none; }
.record-details-dialog .email-draft-form .settings-field { padding: .75rem 0; }
.record-details-dialog .record-list-sharing .settings-toggle { margin-left: auto; }

.record-details-dialog .record-editor-confirm { display: none; }
.record-details-dialog .record-card-box svg { display: none; }

.settings-text-dialog form > .settings-text-actions:first-child { margin: 0 0 1rem; }

.settings-row.settings-members-action { color: #000; }

/* Use the same heading and content hierarchy for every record modal. */
.record-details-dialog :is(.record-card-title, .record-list-sharing h3, .email-content-label, .email-draft-form .settings-field > label, .record-card > p > strong) { font-size: 1.125rem; font-weight: 700; }
.record-details-dialog :is(.record-card-body, .record-card-label, .record-card-when, .record-card-note, .record-card-status, .record-list-sharing .settings-row, .record-list-sharing .settings-row-text, .email-draft-form input, .email-draft-form textarea, .record-picker-items button) { font-weight: 400; }
.record-details-dialog .action-chat-card .record-card-title:has(> strong) { font-size: 1rem; font-weight: 400; }
.record-details-dialog .action-chat-card .record-card-title > strong { font-size: 1.125rem; font-weight: 700; }

.calendar-sharing-group { padding: 16px; background: var(--surface); border: 1px solid var(--line); }
.calendar-sharing-group form { padding: 0; border: 0; background: transparent; display: grid; gap: 12px; }
.calendar-sharing-group .settings-row { padding: 0; min-height: 44px; font-weight: 400; border: 0; }
.calendar-sharing-group .settings-toggle { margin-left: auto; }
.calendar-sharing-picker { position: relative; min-height: 44px; display: flex; align-items: center; color: var(--ink); margin-bottom: 12px; }
.calendar-sharing-picker select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.calendar-sharing-picker:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }

/* Onboarding motion: the same soft ground, artwork and spring feedback as native. */
.onboarding-frame[data-controller~="onboarding-motion"] { isolation: isolate; }
.onboarding-motion-ground { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background: radial-gradient(circle 250px at calc(var(--onboarding-position) * 35px) calc(var(--onboarding-position) * 28px), #ffffff48, transparent), radial-gradient(circle 240px at 80% 70%, #153c2512, transparent); }
.onboarding-motion-ground::before, .onboarding-motion-ground::after { content: ""; position: absolute; left: 50%; top: calc(43% + var(--onboarding-position) * 3.5%); width: calc(500px + var(--onboarding-position) * 22px); aspect-ratio: 1; border: 1px solid #ffffff20; border-radius: 50%; transform: translate(-50%, -50%); }
.onboarding-motion-ground::after { width: calc(650px + var(--onboarding-position) * 22px); }
.onboarding-motion-progress { position: absolute; height: 2px; bottom: 0; left: clamp(1.15rem, 4vw, 4rem); right: clamp(1.15rem, 4vw, 4rem); background: #153c2514; overflow: hidden; }
.onboarding-motion-progress-fill { height: 100%; background: #173d25cc; transform: scaleX(var(--onboarding-progress)); transform-origin: left; }
.onboarding-motion-art { height: 120px; width: 160px; margin-bottom: 20px; position: relative; display: flex; align-items: center; pointer-events: none; }
.onboarding-motion-welcome::before, .onboarding-motion-welcome::after { content: ""; position: absolute; width: 100px; height: 100px; border: 1px solid #ffffff50; background: #ffffff20; border-radius: 50%; left: 10px; }
.onboarding-motion-welcome::after { width: 120px; height: 120px; left: 0; background: transparent; }
.onboarding-motion-welcome img { position: relative; width: 76px; height: 76px; object-fit: contain; margin-left: 22px; }
.onboarding-motion-people { gap: 10px; }
.onboarding-motion-people i { position: relative; width: 42px; height: 70px; }
.onboarding-motion-people i:nth-child(2) { margin-top: -24px; }
.onboarding-motion-people i::before { content: ""; position: absolute; left: 8px; width: 26px; height: 26px; background: #fffef6; border-radius: 50%; }
.onboarding-motion-people i::after { content: ""; position: absolute; bottom: 0; width: 42px; height: 34px; background: #fffef6; border-radius: 20px 20px 10px 10px; }
.onboarding-motion-initial { width: 86px; height: 86px; display: grid; place-items: center; border-radius: 26px; background: #ffffffa6; font: 44px Georgia, serif; transform: rotate(-7deg); }
.onboarding-motion-mail i { display: block; width: 99px; height: 66px; background: #fffef8; border-radius: 14px; transform: rotate(-8deg); box-shadow: 0 12px 20px #1e6b2915; overflow: hidden; }
.onboarding-motion-mail i::before { content: ""; display: block; height: 42px; background: #eaf4e3; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.onboarding-frame[data-controller~="onboarding-motion"] .onboarding-copy > * { animation: none; }
.onboarding-primary, .onboarding-kind { transition: transform 300ms cubic-bezier(.2,1.5,.4,1), background-color 250ms, color 250ms, box-shadow 250ms; }
.onboarding-primary:not(:disabled):active, .onboarding-kind:active { transform: scale(.95); }
.onboarding-kind[aria-pressed="true"] { transform: translateY(-3px); box-shadow: 0 4px 12px #17432320; }
.onboarding-kind[aria-pressed="true"]:active { transform: translateY(-3px) scale(.95); }
.onboarding-qr { box-shadow: 0 12px 28px #12572312; }
.onboarding-name { transition: box-shadow 250ms; }
.onboarding-name:focus { box-shadow: 0 0 0 4px #ffffff35; }
@media (max-width: 640px) {
  .onboarding-frame[data-controller~="onboarding-motion"] { min-height: 100svh; height: auto; }
  .onboarding-motion-art { height: min(120px, 16svh); margin-bottom: min(20px, 2.5svh); }
  .onboarding-motion-welcome::after { width: min(120px, 16svh); height: min(120px, 16svh); }
}
@media (prefers-reduced-motion: no-preference) {
  .onboarding-motion-welcome img, .onboarding-motion-people, .onboarding-elephant { animation: onboarding-mio-float 4.8s ease-in-out infinite; }
  .onboarding-motion-welcome::after { animation: onboarding-mio-breathe 4.8s ease-in-out infinite; }
  .onboarding-motion-mail i { animation: onboarding-mail-float 4.8s ease-in-out infinite; }
  html[data-onboarding-direction] .onboarding-copy { view-transition-name: onboarding-copy; }
  html[data-onboarding-direction]::view-transition-old(root), html[data-onboarding-direction]::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
  html[data-onboarding-direction]::view-transition-old(onboarding-copy) { animation: onboarding-page-out 180ms ease-in both; }
  html[data-onboarding-direction]::view-transition-new(onboarding-copy) { animation: onboarding-page-in 450ms cubic-bezier(.16,1,.3,1) both; }
  html[data-onboarding-direction="back"] { --onboarding-slide: -45px; }
  html[data-onboarding-direction="forward"] { --onboarding-slide: 45px; }
}
@keyframes onboarding-page-in { from { opacity: 0; transform: translateX(var(--onboarding-slide)); } }
@keyframes onboarding-page-out { to { opacity: 0; transform: translateX(calc(var(--onboarding-slide) * -1)); } }
@keyframes onboarding-mio-float { 50% { transform: translateY(-6px) rotate(-5deg); } }
@keyframes onboarding-mail-float { 0%, 100% { transform: rotate(-8deg); } 50% { transform: translateY(-6px) rotate(-8deg); } }
@keyframes onboarding-mio-breathe { 50% { transform: scale(1.06); opacity: .5; } }
@media (prefers-reduced-motion: reduce) {
  .onboarding-frame *, .onboarding-frame *::before, .onboarding-frame *::after { animation: none !important; transition: none !important; }
  .onboarding-kind[aria-pressed="true"], .onboarding-kind:active, .onboarding-primary:not(:disabled):active, .onboarding-primary:hover, .onboarding-primary:hover span { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-onboarding-direction]::view-transition-group(*), html[data-onboarding-direction]::view-transition-old(*), html[data-onboarding-direction]::view-transition-new(*) { animation: none !important; }
}

/* Only the elephant moves. The green circle stays fixed. The dot is also
   replaced by read-state broadcasts, so reading stops the motion at once. */
.conversation-row .conversation-agent-avatar { overflow: hidden; }
.new-chat-menu:popover-open .assistant-tilt-mark,
.conversation-row:has(.unread-dot[data-assistant-unread="true"]:not([hidden])) .assistant-tilt-mark {
  transform-origin: 512px 570px;
  animation: assistant-playful-tilt 3s linear infinite;
}
@keyframes assistant-playful-tilt {
  0.0000% { transform: rotate(0.0000deg); }
  4.1667% { transform: rotate(0.1560deg); }
  8.3333% { transform: rotate(1.1250deg); }
  12.5000% { transform: rotate(3.1820deg); }
  16.6667% { transform: rotate(5.8457deg); }
  20.8333% { transform: rotate(8.1110deg); }
  25.0000% { transform: rotate(9.0000deg); }
  29.1667% { transform: rotate(8.1110deg); }
  33.3333% { transform: rotate(5.8457deg); }
  37.5000% { transform: rotate(3.1820deg); }
  41.6667% { transform: rotate(1.1250deg); }
  45.8333% { transform: rotate(0.1560deg); }
  50.0000% { transform: rotate(0.0000deg); }
  54.1667% { transform: rotate(-0.1560deg); }
  58.3333% { transform: rotate(-1.1250deg); }
  62.5000% { transform: rotate(-3.1820deg); }
  66.6667% { transform: rotate(-5.8457deg); }
  70.8333% { transform: rotate(-8.1110deg); }
  75.0000% { transform: rotate(-9.0000deg); }
  79.1667% { transform: rotate(-8.1110deg); }
  83.3333% { transform: rotate(-5.8457deg); }
  87.5000% { transform: rotate(-3.1820deg); }
  91.6667% { transform: rotate(-1.1250deg); }
  95.8333% { transform: rotate(-0.1560deg); }
  100.0000% { transform: rotate(-0.0000deg); }
}
@media (prefers-reduced-motion: reduce) {
  .conversation-row .assistant-tilt-mark, .new-chat-menu .assistant-tilt-mark { animation: none !important; }
}

.task-edit-form { width: 100%; text-align: start; }
.task-edit-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.task-edit-form .record-dialog-toolbar { justify-content: space-between; }
.task-edit-fields { display: grid; gap: 20px; }
.task-edit-form .settings-group { margin: 0; padding: 16px; border: 0; border-radius: 12px; background: color-mix(in oklch, var(--ink) 7%, var(--surface)); }
.task-edit-form .settings-field { display: grid; gap: 8px; }
.task-edit-form :is(input:not([type="checkbox"]), textarea, select) { width: 100%; box-sizing: border-box; font: inherit; color: inherit; }
.task-edit-form input[name="title"] { font-weight: 700; }
.task-edit-form h3 { margin: 0 0 12px; font-size: 1.125rem; }
.task-edit-form .settings-row { padding: 8px 0; }

.task-edit-form[hidden], [data-record-read-toolbar][hidden] { display: none; }
.record-details-dialog.task-editing { background: var(--c-bg, var(--surface)); }

/* Shared + menu action layout: call left, chat right. */
.new-chat-menu { min-width: min(304px, calc(100vw - 24px)); max-width: calc(100vw - 24px); }
.new-chat-group { display: block; padding: 8px 16px; }
.new-chat-group select { width: 100%; background: transparent; color: inherit; border: 0; font: inherit; padding: 8px; }
.new-chat-actions { display: flex; align-items: stretch; margin-top: 12px; padding: 0 4px; }
.new-chat-actions > button { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px; margin: 0; border-radius: 0; flex: 1; width: 0; min-height: 56px; padding: 16px; border: 0; background: transparent; color: inherit; font: 600 17px/1.3 system-ui; text-align: center; }
.new-chat-action-icon { display: grid; place-items: center; width: 24px; height: 24px; flex: none; }
.new-chat-action-icon svg { display: block; width: 24px; height: 24px; }
.new-chat-action-icon .new-chat-action-icon-chat { transform: scale(.9); }
.new-chat-actions > button:disabled { opacity: .35; cursor: default; }
.web-voice-call { width: min(360px, calc(100vw - 32px)); border: 0; border-radius: 24px; padding: 24px; background: var(--surface, Canvas); color: var(--text, CanvasText); text-align: center; }
.web-voice-call::backdrop { background: rgb(0 0 0 / .3); }
.web-voice-call > strong, .web-voice-call > span { display: block; margin-top: 8px; }
.web-voice-call .member-avatar { width: 72px; height: 72px; margin: auto; }

.new-chat-person:last-child::after, .new-chat-invitation::after { display: none; }

.record-dialog-share-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.record-details-dialog .record-dialog-toolbar .record-dialog-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
}
.record-details-dialog .record-dialog-toolbar .record-dialog-icon:focus-visible {
  outline: 2px solid currentColor; outline-offset: 2px; border-radius: .5rem;
}

/* Mio / People share one fixed header; labels never scale or move on press. */
.conversation-index-toolbar { position: relative; min-height: 3rem; }
.chat-filter-segments { position: absolute; left: 50%; transform: translateX(-50%); display: flex; width: min(12.5rem, calc(100% - 7rem)); padding: .2rem; box-sizing: border-box; }
.chat-filter-segment { flex: 1; display: flex; align-items: center; justify-content: center; gap: .25rem; min-height: 2rem; border-radius: 999px; color: var(--ink); font-size: .825rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.chat-filter-segment[aria-current="page"] { background: color-mix(in oklch, var(--ink) 9%, transparent); }
.chat-filter-segment:is(:hover, :active) { color: var(--ink); transform: none; text-decoration: none; }
.chat-filter-unread { font-variant-numeric: tabular-nums; }
.conversation-row-meta { flex: none; max-width: 7.5rem; display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; color: var(--muted); font-size: .75rem; }
.conversation-row-group { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .7rem; }
.conversation-row-avatars { width: 2.475rem; height: 2.475rem; }
/* The time stands at the end of the row, not under the avatar. */
.conversation-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.conversation-index.selecting .conversation-swipe .conversation-row { grid-template-columns: auto auto minmax(0, 1fr) auto; }
/* Every chat in Mio is with Mio alone, so its rows have no avatar (Martin, 2026-11-22). */
.chat-filter-mio .conversation-row-avatars { display: none; }
.chat-filter-mio .conversation-row { grid-template-columns: minmax(0, 1fr) auto; }
.conversation-index.selecting.chat-filter-mio .conversation-swipe .conversation-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.conversation-row-preview { -webkit-line-clamp: 1; min-height: 1.4em; }
.conversation-row-content { flex: 1; }
.chat-list-bottom-controls { display: flex; align-items: center; gap: 1rem; padding: .75rem 0 max(.75rem, env(safe-area-inset-bottom)); flex: none; background: var(--conversation-list-background, var(--surface)); z-index: 10; }
.chat-list-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6rem; padding: .65rem .9rem; }
.chat-list-search input { min-width: 0; width: 100%; border: 0; background: transparent; color: var(--ink); padding: 0; margin: 0; outline: none; }
.conversation-index.selecting .chat-filter-segments, .conversation-index.selecting .chat-list-bottom-controls { display: none; }
.conversation-index.pinning .conversation-row-meta { visibility: hidden; }

.location-map-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 48px 0 0;
  border: 0;
  border-radius: 20px;
  overflow: hidden;
}
.location-map-dialog::backdrop { background: rgb(0 0 0 / 40%); }
.location-map-dialog iframe { display: block; border: 0; width: 100%; height: min(420px, 60dvh); }
.location-map-close {
  position: absolute; top: 4px; right: 4px;
  width: 40px; height: 40px; border: 0; background: transparent;
  color: inherit; font-size: 28px; cursor: pointer;
}

/* Calendar setup uses matching initial connection rows. */
.onboarding-step-9 .calendar-connect-button { box-sizing: border-box; min-height: 60px; display: flex; align-items: center; width: 100%; }
.onboarding-calendar-account { display: flex; align-items: center; gap: 14px; min-height: 60px; }
.onboarding-calendar-account > span:first-child { flex: 1; overflow-wrap: anywhere; }
.onboarding-calendar-remove { color: #000; background: transparent; border: 0; cursor: pointer; padding: 10px 0; font: inherit; }
.onboarding-calendar-check { color: #16803c; }

.onboarding-sharing-actions { display: grid; gap: 16px; margin-top: 28px; }
.onboarding-sharing-dialog { width: min(560px, calc(100vw - 32px)); max-height: 85dvh; overflow-y: auto; padding: 24px; border: 0; border-radius: 24px; color: #172a24; background: #fff; }
.onboarding-sharing-dialog::backdrop { background: rgb(0 0 0 / 35%); }
.onboarding-sharing-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.onboarding-sharing-toolbar h2 { font-size: 22px; }
.onboarding-sharing-toolbar button { border: 0; background: none; font-size: 28px; min-width: 44px; min-height: 44px; cursor: pointer; }
.onboarding-sharing-dialog [hidden] { display: none; }

.settings-section.calendar-shared-with-you { margin-top: 40px; }

.onboarding-sharing-actions .button { display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 18px 24px; background: #fff; color: #000; border: 0; border-radius: 22px; font-size: 18px; font-weight: 600; text-align: left; }
.onboarding-sharing-actions .button svg { flex-shrink: 0; }

.onboarding-step-10 .onboarding-motion-art { margin-bottom: 8px; }

/* Account lists its Groups behind one row, as the native Settings do. */
.account-settings-page .settings-identity-name { font-size: 1rem; letter-spacing: normal; }
.account-group-squares { display: flex; flex: none; }
.account-group-squares .account-group-mark { width: 29px; height: 29px; font-size: .8rem; border: 2px solid var(--surface, #fff); }
.account-group-squares .account-group-mark + .account-group-mark { margin-left: -11px; }
.account-group-mark { display: grid; place-items: center; flex: none; box-sizing: border-box; width: 29px; height: 29px; border-radius: 24%; background: var(--group-color); color: #fff; font-weight: 700; font-size: .8rem; }
img.account-group-mark, svg.account-group-mark { border-radius: 50%; }

/* The People new chat: a sheet from the bottom (design B3). */
.new-people-chat-sheet { box-sizing: border-box; width: min(100vw, 560px); max-width: 100vw; max-height: calc(100dvh - 48px); margin: auto auto 0; padding: 0; border: 0; border-radius: 28px 28px 0 0; background: var(--canvas, #f2f2f7); color: var(--ink); }
.new-people-chat-sheet::backdrop { background: rgb(0 0 0 / 28%); }
.new-people-chat-sheet form { display: flex; flex-direction: column; gap: 8px; max-height: calc(100dvh - 48px); padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); box-sizing: border-box; }
.new-people-chat-header { display: flex; align-items: center; justify-content: space-between; }
.new-people-chat-header h2 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.new-people-chat-close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--surface, #fff); color: inherit; font-size: 1.5rem; cursor: pointer; }
.new-people-chat-search { box-sizing: border-box; width: 100%; min-height: 40px; padding: 0 16px; border: 0; border-radius: 20px; background: rgb(118 118 128 / 12%); color: inherit; font: inherit; }
.new-people-chat-groups { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.new-people-chat-group { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 34px; padding: 0 14px 0 6px; border-radius: 18px; background: var(--surface, #fff); cursor: pointer; white-space: nowrap; }
.new-people-chat-group input { position: absolute; opacity: 0; pointer-events: none; }
.new-people-chat-group:not(:has(.account-group-mark)) { padding-left: 14px; }
.new-people-chat-group:has(input:checked) { background: var(--ink); color: var(--canvas, #fff); }
.new-people-chat-group:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.new-people-chat-group .account-group-mark, .new-people-chat-squares .account-group-mark { width: 22px; height: 22px; font-size: .7rem; }
.new-people-chat-people { overflow-y: auto; min-height: 0; flex: 1; margin: 0; padding: 0; border: 0; border-radius: 22px; background: var(--surface, #fff); }
.new-people-chat-person { position: relative; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 6px 16px; cursor: pointer; }
.new-people-chat-person[hidden] { display: none; }
.new-people-chat-person { max-height: 80px; overflow: hidden; transition: opacity .25s ease, max-height .25s ease, min-height .25s ease, padding .25s ease; }
.new-people-chat-person.is-hidden { opacity: 0; max-height: 0; min-height: 0; padding-block: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .new-people-chat-person { transition: none; } }
.new-people-chat-check { position: absolute; opacity: 0; pointer-events: none; }
.new-people-chat-face { position: relative; display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 50%; }
.new-people-chat-face > * { width: 40px; height: 40px; }
.new-people-chat-person:has(.new-people-chat-check:checked) .new-people-chat-face { box-shadow: inset 0 0 0 2px var(--ink); }
.new-people-chat-person:has(.new-people-chat-check:checked) .new-people-chat-face::after { content: "✓"; position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 20px; height: 20px; border: 2px solid var(--surface, #fff); border-radius: 50%; background: var(--ink); color: var(--surface, #fff); font-size: .7rem; font-weight: 700; }
.new-people-chat-person:has(.new-people-chat-check:focus-visible) { outline: 2px solid var(--ink); outline-offset: -2px; }
.new-people-chat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.new-people-chat-squares { display: flex; gap: 4px; flex: none; }
.new-people-chat-start { min-height: 52px; border: 0; border-radius: 26px; background: var(--ink); color: var(--canvas, #fff); font: inherit; font-weight: 600; cursor: pointer; }
.new-people-chat-start:disabled { background: rgb(118 118 128 / 16%); color: var(--muted); cursor: default; }

.new-chat-add-group { display: block; padding: 8px 24px; color: inherit; text-decoration: none; }
