/* dentatsu's design tokens: the one set of custom properties the site and the web client both use
 * (design/README.md). Plain CSS: no build step needed to read it.
 *
 * Two attributes on <html> choose the colors (design/theme.js keeps the choice):
 *   data-theme="light" | "dark"                  none: follow the system (prefers-color-scheme)
 *   data-palette="slate" | "sand" | "moss" | "plum"  none: slate
 *
 * A palette sets only a neutral hue and saturation and its accent colors; the light and dark blocks below turn them
 * into surfaces, lines and text. Every text and fill pair is checked for WCAG AA by design/check.mjs (CI step
 * design-check), for every palette in both modes.
 */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
             src: url(inter-regular-ab8eea926994.woff) format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
             src: url(inter-medium-ac40e7e1b389.woff) format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
             src: url(inter-semibold-5fb9ef84a0d0.woff) format("woff"); }

:root {
  /* ---- type: Inter (SIL OFL 1.1, design/fonts/OFL.txt), three weights; no bold above 600 (quiet chrome) */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --text-2xs: 0.6875rem;   /* 11px: badges, counters */
  --text-xs: 0.75rem;      /* 12px: timestamps, captions */
  --text-sm: 0.8125rem;    /* 13px: chrome, menus, labels */
  --text-base: 0.9375rem;  /* 15px: messages, body */
  --text-md: 1.0625rem;    /* 17px: lead text, room titles */
  --text-lg: 1.25rem;      /* 20px: section headings */
  --text-xl: 1.5rem;       /* 24px: page headings in the app */
  --text-2xl: 2rem;        /* 32px: site headings */
  --text-3xl: 2.75rem;     /* 44px: the landing page's title */
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading: 1.5;
  --leading-loose: 1.65;   /* long reading (guides) */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-strong: 600;
  --tracking-tight: -0.02em;   /* headings */
  --tracking-wide: 0.04em;     /* small capitals labels */

  /* ---- spacing: a 4px grid */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  /* ---- radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  /* ---- motion: short and eased out; none under prefers-reduced-motion (below) */
  --dur-instant: 80ms;
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 280ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.36, 0.64, 1);   /* a small overshoot: toasts, popovers */

  /* ---- layers */
  --z-sticky: 10;
  --z-menu: 30;
  --z-dialog: 40;
  --z-toast: 50;

  /* ---- sizes */
  --control-sm: 28px;
  --control: 34px;
  --control-lg: 42px;
  --measure: 68ch;          /* the longest line of reading text */

  /* ---- the palette's parameters (slate: cool grey, blue accent) */
  --n-h: 222;               /* neutral hue */
  --n-s: 12%;               /* neutral saturation: low, so the chrome stays quiet */
  --p-accent: #3d5bd9;      /* the accent as a fill (light mode); white text on it */
  --p-accent-hover: #3049b8;
  --p-accent-text: #3451c9; /* the accent as text on the light background */
  --p-accent-dk: #4a64d6;   /* the accent as a fill (dark mode); white text on it */
  --p-accent-dk-hover: #3f58c4;
  --p-accent-dk-text: #93a7fa;
  --p-accent-soft-h: 226;   /* the hue of selections and soft tints */

  /* ---- avatar tones: eight hues for people without a picture (.dt-avatar[data-tone]); the mode sets how light */
  --tone-1: hsl(8 var(--tone-s) var(--tone-l));
  --tone-2: hsl(32 var(--tone-s) var(--tone-l));
  --tone-3: hsl(52 var(--tone-s) var(--tone-l));
  --tone-4: hsl(140 var(--tone-s) var(--tone-l));
  --tone-5: hsl(178 var(--tone-s) var(--tone-l));
  --tone-6: hsl(208 var(--tone-s) var(--tone-l));
  --tone-7: hsl(248 var(--tone-s) var(--tone-l));
  --tone-8: hsl(312 var(--tone-s) var(--tone-l));
}

:root[data-palette="sand"] {
  --n-h: 32; --n-s: 14%;
  --p-accent: #a8481f; --p-accent-hover: #8e3c19; --p-accent-text: #9e441d;
  --p-accent-dk: #a8481f; --p-accent-dk-hover: #963f1a; --p-accent-dk-text: #f0a57e;
  --p-accent-soft-h: 22;
}
:root[data-palette="moss"] {
  --n-h: 150; --n-s: 8%;
  --p-accent: #2b7049; --p-accent-hover: #225c3c; --p-accent-text: #276843;
  --p-accent-dk: #2b7049; --p-accent-dk-hover: #256341; --p-accent-dk-text: #84d1a3;
  --p-accent-soft-h: 146;
}
:root[data-palette="plum"] {
  --n-h: 275; --n-s: 10%;
  --p-accent: #7c3aae; --p-accent-hover: #682f93; --p-accent-text: #7535a5;
  --p-accent-dk: #7c3aae; --p-accent-dk-hover: #6f33a0; --p-accent-dk-text: #cfa8f2;
  --p-accent-soft-h: 278;
}

/* ---- light (the default) */
:root {
  color-scheme: light;
  --bg: hsl(var(--n-h) var(--n-s) 98.5%);          /* the main pane */
  --surface-1: hsl(var(--n-h) var(--n-s) 95.5%);   /* sidebars, the space rail */
  --surface-2: hsl(var(--n-h) var(--n-s) 100%);    /* cards, menus, dialogs */
  --surface-sunken: hsl(var(--n-h) var(--n-s) 100%); /* inputs */
  --hover: hsl(var(--n-h) var(--n-s) 92%);
  --active: hsl(var(--n-h) var(--n-s) 88.5%);
  --line: hsl(var(--n-h) var(--n-s) 88%);
  --line-strong: hsl(var(--n-h) var(--n-s) 76%);
  --control-line: hsl(var(--n-h) var(--n-s) 51%);  /* an input's border: 3:1 against what it sits on */
  --text: hsl(var(--n-h) 14% 12%);
  --text-dim: hsl(var(--n-h) 8% 38%);
  --text-faint: hsl(var(--n-h) 6% 42.5%);
  --accent: var(--p-accent);
  --accent-hover: var(--p-accent-hover);
  --accent-ink: #ffffff;
  --accent-text: var(--p-accent-text);
  --accent-soft: hsl(var(--p-accent-soft-h) 70% 94%);
  --accent-soft-strong: hsl(var(--p-accent-soft-h) 64% 89%);
  --focus: var(--p-accent-text);
  --ok: #1d7a40; --ok-text: #1a6e3a; --ok-soft: #e3f4e8;
  --warn: #9a5b00; --warn-text: #7d4a00; --warn-soft: #fbf0d9;
  --danger: #c0352b; --danger-hover: #a52c23; --danger-text: #b02f26; --danger-soft: #fbe7e5;
  --on-solid: #ffffff;
  --tone-s: 62%; --tone-l: 86%;
  --scrim: hsl(var(--n-h) 20% 10% / 0.42);
  --shadow-color: 222 30% 20%;
  --shadow-1: 0 1px 2px hsl(var(--shadow-color) / 0.08), 0 1px 1px hsl(var(--shadow-color) / 0.04);
  --shadow-2: 0 2px 6px hsl(var(--shadow-color) / 0.08), 0 8px 24px -6px hsl(var(--shadow-color) / 0.12);
  --shadow-3: 0 4px 12px hsl(var(--shadow-color) / 0.1), 0 24px 56px -12px hsl(var(--shadow-color) / 0.24);
  --edge: inset 0 0 0 1px hsl(var(--n-h) var(--n-s) 20% / 0.08);   /* a hairline that shows on any surface */
}

/* ---- dark: the same block twice, once for the system's choice and once for data-theme="dark"
 * (design/check.mjs fails when the two differ) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: hsl(var(--n-h) var(--n-s) 11.5%);
    --surface-1: hsl(var(--n-h) var(--n-s) 9%);
    --surface-2: hsl(var(--n-h) var(--n-s) 15%);
    --surface-sunken: hsl(var(--n-h) var(--n-s) 8%);
    --hover: hsl(var(--n-h) var(--n-s) 18%);
    --active: hsl(var(--n-h) var(--n-s) 22%);
    --line: hsl(var(--n-h) var(--n-s) 20%);
    --line-strong: hsl(var(--n-h) var(--n-s) 28%);
    --control-line: hsl(var(--n-h) var(--n-s) 48%);
    --text: hsl(var(--n-h) 12% 92%);
    --text-dim: hsl(var(--n-h) 8% 68%);
    --text-faint: hsl(var(--n-h) 6% 58%);
    --accent: var(--p-accent-dk);
    --accent-hover: var(--p-accent-dk-hover);
    --accent-ink: #ffffff;
    --accent-text: var(--p-accent-dk-text);
    --accent-soft: hsl(var(--p-accent-soft-h) 30% 20%);
    --accent-soft-strong: hsl(var(--p-accent-soft-h) 32% 26%);
    --focus: var(--p-accent-dk-text);
    --ok: #25784a; --ok-text: #7fd39c; --ok-soft: #173324;
    --warn: #b07a12; --warn-text: #f0c96a; --warn-soft: #3a2f14;
    --danger: #c63d32; --danger-hover: #b3342a; --danger-text: #ff9c90; --danger-soft: #3d1c1a;
    --on-solid: #ffffff;
    --tone-s: 30%; --tone-l: 30%;
    --scrim: hsl(var(--n-h) 20% 3% / 0.62);
    --shadow-color: 222 40% 2%;
    --shadow-1: 0 1px 2px hsl(var(--shadow-color) / 0.4);
    --shadow-2: 0 2px 6px hsl(var(--shadow-color) / 0.35), 0 8px 24px -6px hsl(var(--shadow-color) / 0.5);
    --shadow-3: 0 4px 12px hsl(var(--shadow-color) / 0.4), 0 24px 56px -12px hsl(var(--shadow-color) / 0.7);
    --edge: inset 0 0 0 1px hsl(var(--n-h) var(--n-s) 90% / 0.07);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: hsl(var(--n-h) var(--n-s) 11.5%);
  --surface-1: hsl(var(--n-h) var(--n-s) 9%);
  --surface-2: hsl(var(--n-h) var(--n-s) 15%);
  --surface-sunken: hsl(var(--n-h) var(--n-s) 8%);
  --hover: hsl(var(--n-h) var(--n-s) 18%);
  --active: hsl(var(--n-h) var(--n-s) 22%);
  --line: hsl(var(--n-h) var(--n-s) 20%);
  --line-strong: hsl(var(--n-h) var(--n-s) 28%);
  --control-line: hsl(var(--n-h) var(--n-s) 48%);
  --text: hsl(var(--n-h) 12% 92%);
  --text-dim: hsl(var(--n-h) 8% 68%);
  --text-faint: hsl(var(--n-h) 6% 58%);
  --accent: var(--p-accent-dk);
  --accent-hover: var(--p-accent-dk-hover);
  --accent-ink: #ffffff;
  --accent-text: var(--p-accent-dk-text);
  --accent-soft: hsl(var(--p-accent-soft-h) 30% 20%);
  --accent-soft-strong: hsl(var(--p-accent-soft-h) 32% 26%);
  --focus: var(--p-accent-dk-text);
  --ok: #25784a; --ok-text: #7fd39c; --ok-soft: #173324;
  --warn: #b07a12; --warn-text: #f0c96a; --warn-soft: #3a2f14;
  --danger: #c63d32; --danger-hover: #b3342a; --danger-text: #ff9c90; --danger-soft: #3d1c1a;
  --on-solid: #ffffff;
  --tone-s: 30%; --tone-l: 30%;
  --scrim: hsl(var(--n-h) 20% 3% / 0.62);
  --shadow-color: 222 40% 2%;
  --shadow-1: 0 1px 2px hsl(var(--shadow-color) / 0.4);
  --shadow-2: 0 2px 6px hsl(var(--shadow-color) / 0.35), 0 8px 24px -6px hsl(var(--shadow-color) / 0.5);
  --shadow-3: 0 4px 12px hsl(var(--shadow-color) / 0.4), 0 24px 56px -12px hsl(var(--shadow-color) / 0.7);
  --edge: inset 0 0 0 1px hsl(var(--n-h) var(--n-s) 90% / 0.07);
}

/* ---- no motion for those who ask for none: every duration is zero, so transitions end at once */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-instant: 0ms; --dur-fast: 0ms; --dur: 0ms; --dur-slow: 0ms; }
}

/* dentatsu's base and components, on design/tokens.css (load that first). Shared by the site and the web client.
 * Every class starts with dt- so it never meets a page's own names. design/style.html shows each one.
 *
 *   base       the page's font, colors, selection and focus ring
 *   .dt-btn    buttons: -primary, -ghost, -danger; -sm, -lg, -icon, -block
 *   .dt-field  a label, a control, a hint or an error; .dt-input, .dt-textarea, .dt-select, .dt-check
 *   .dt-dialog a <dialog>: -head, -body, -foot
 *   .dt-menu   a menu or popover: -item, -sep, -label, -kbd
 *   .dt-toast  in a .dt-toasts region (role=status): data-kind ok, warn, danger
 *   .dt-avatar initials or a picture: data-tone 1..8, data-presence, data-talking; -sm, -lg, -xl, -square
 *   .dt-badge, .dt-card, .dt-kbd, .dt-segmented, .dt-icon, .dt-link
 */

/* ---- base */
html {
  font-family: var(--font-sans);
  font-size: 100%;
  line-height: var(--leading);
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11";          /* Inter's single-storey a: a softer page */
}
::selection { background: var(--accent-soft-strong); color: var(--text); }
:where(a, button, input, select, textarea, summary, [tabindex], [contenteditable]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
:where(.dt-input, .dt-textarea, .dt-select):focus-visible { outline: none; }

/* ---- icons: <svg class="dt-icon"><use href="icons.svg#i-hash"/></svg> */
.dt-icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75;
           stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.25em; }

/* ---- links */
.dt-link { color: var(--accent-text); text-decoration: underline; text-decoration-thickness: 1px;
           text-underline-offset: 0.18em; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
           transition: text-decoration-color var(--dur-fast) var(--ease-out); }
.dt-link:hover { text-decoration-color: currentColor; }

/* ---- buttons */
.dt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: var(--control); padding: 0 var(--space-4);
  border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-1);
  font: var(--weight-medium) var(--text-sm) / 1 var(--font-sans); letter-spacing: -0.003em;
  white-space: nowrap; text-decoration: none; cursor: pointer; user-select: none;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-instant) var(--ease-out);
}
.dt-btn:hover { background: var(--hover); }
.dt-btn:active { background: var(--active); transform: translateY(0.5px); }
.dt-btn:disabled, .dt-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.dt-btn .dt-icon { width: 16px; height: 16px; }
.dt-btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.dt-btn-primary:hover { background: var(--accent-hover); }
.dt-btn-primary:active { background: var(--accent-hover); }
.dt-btn-danger { background: var(--danger); border-color: transparent; color: var(--on-solid); }
.dt-btn-danger:hover, .dt-btn-danger:active { background: var(--danger-hover); }
.dt-btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-dim); }
.dt-btn-ghost:hover { background: var(--hover); color: var(--text); }
.dt-btn-ghost:active { background: var(--active); color: var(--text); }
.dt-btn-sm { height: var(--control-sm); padding: 0 var(--space-3); font-size: var(--text-xs); border-radius: var(--radius-sm); }
.dt-btn-lg { height: var(--control-lg); padding: 0 var(--space-5); font-size: var(--text-base); border-radius: var(--radius-md); }
.dt-btn-icon { width: var(--control); padding: 0; }
.dt-btn-icon.dt-btn-sm { width: var(--control-sm); }
.dt-btn-block { display: flex; width: 100%; }

/* ---- fields */
.dt-field { display: grid; gap: 6px; }
.dt-label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text); }
.dt-hint { font-size: var(--text-xs); color: var(--text-dim); }
.dt-error-text { font-size: var(--text-xs); color: var(--danger-text); }
.dt-input, .dt-textarea, .dt-select {
  width: 100%; min-height: var(--control); padding: 0 var(--space-3);
  border: 1px solid var(--control-line); border-radius: var(--radius-md);
  background: var(--surface-sunken); color: var(--text);
  font: var(--weight-regular) var(--text-base) / var(--leading-snug) var(--font-sans);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.dt-input::placeholder, .dt-textarea::placeholder { color: var(--text-faint); opacity: 1; }
.dt-input:hover, .dt-textarea:hover, .dt-select:hover { border-color: var(--text-faint); }
.dt-input:focus-visible, .dt-textarea:focus-visible, .dt-select:focus-visible {
  border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft-strong);
}
.dt-input[aria-invalid="true"], .dt-textarea[aria-invalid="true"] { border-color: var(--danger-text); }
.dt-input[aria-invalid="true"]:focus-visible, .dt-textarea[aria-invalid="true"]:focus-visible {
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.dt-input:disabled, .dt-textarea:disabled, .dt-select:disabled { opacity: 0.55; cursor: not-allowed; }
.dt-input, .dt-select { height: var(--control); }
.dt-textarea { padding: var(--space-2) var(--space-3); resize: vertical; line-height: var(--leading); }
.dt-select {
  appearance: none; padding-right: var(--space-8); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23808590' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--space-3) center;
}
.dt-check { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); cursor: pointer; }
.dt-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }

/* ---- segmented control (the theme and palette pickers) */
.dt-segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-md); background: var(--hover); }
.dt-segmented button {
  display: inline-flex; align-items: center; gap: 6px; height: calc(var(--control-sm) - 4px); padding: 0 var(--space-3);
  border: 0; border-radius: calc(var(--radius-md) - 2px); background: transparent; color: var(--text-dim);
  font: var(--weight-medium) var(--text-xs) / 1 var(--font-sans); cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.dt-segmented button:hover { color: var(--text); }
.dt-segmented button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-1); }
.dt-swatch { width: 10px; height: 10px; border-radius: var(--radius-full); background: var(--swatch);
             box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15); }

/* ---- dialog: a native <dialog class="dt-dialog">, opened with showModal() */
.dt-dialog {
  width: min(28rem, calc(100vw - 2 * var(--space-4))); max-height: calc(100dvh - 2 * var(--space-8));
  padding: 0; border: 0; border-radius: var(--radius-xl);
  background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-3), var(--edge);
  opacity: 0; transform: translateY(6px) scale(0.98);
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out),
              overlay var(--dur) allow-discrete, display var(--dur) allow-discrete;
}
.dt-dialog[open] { opacity: 1; transform: none; }
@starting-style { .dt-dialog[open] { opacity: 0; transform: translateY(6px) scale(0.98); } }
.dt-dialog::backdrop { background: var(--scrim); opacity: 0;
                       transition: opacity var(--dur) var(--ease-out), overlay var(--dur) allow-discrete,
                                   display var(--dur) allow-discrete; }
.dt-dialog[open]::backdrop { opacity: 1; }
@starting-style { .dt-dialog[open]::backdrop { opacity: 0; } }
.dt-dialog-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-5) var(--space-5) 0; }
.dt-dialog-head h2 { margin: 0; flex: 1; font-size: var(--text-lg); font-weight: var(--weight-strong);
                     letter-spacing: var(--tracking-tight); line-height: var(--leading-tight); }
.dt-dialog-body { padding: var(--space-3) var(--space-5) var(--space-5); color: var(--text-dim); font-size: var(--text-sm); }
.dt-dialog-body > :first-child { margin-top: 0; }
.dt-dialog-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-5);
                  border-top: 1px solid var(--line); background: var(--surface-1);
                  border-radius: 0 0 var(--radius-xl) var(--radius-xl); }

/* ---- menu (role=menu, or a popover's list) */
.dt-menu {
  min-width: 12rem; margin: 0; padding: var(--space-1); list-style: none;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-2);
  font-size: var(--text-sm); z-index: var(--z-menu);
  animation: dt-pop var(--dur) var(--ease-out);
  transform-origin: var(--menu-origin, top left);
}
.dt-menu-item {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: 30px; padding: 0 var(--space-2);
  border: 0; border-radius: var(--radius-sm); background: none; color: inherit;
  font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.dt-menu-item:hover, .dt-menu-item:focus-visible { background: var(--hover); outline: none; }
.dt-menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.dt-menu-item .dt-icon { width: 16px; height: 16px; color: var(--text-dim); }
.dt-menu-item[aria-checked="true"]::after, .dt-menu-item[aria-current="true"]::after {
  content: ""; margin-left: auto; width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--accent-text);
}
.dt-menu-item.dt-danger { color: var(--danger-text); }
.dt-menu-item.dt-danger .dt-icon { color: inherit; }
.dt-menu-item.dt-danger:hover { background: var(--danger-soft); }
.dt-menu-sep { height: 1px; margin: var(--space-1) var(--space-1); background: var(--line); border: 0; }
.dt-menu-label { padding: var(--space-2) var(--space-2) var(--space-1); color: var(--text-faint);
                 font-size: var(--text-2xs); font-weight: var(--weight-strong); letter-spacing: var(--tracking-wide);
                 text-transform: uppercase; }
.dt-menu-kbd { margin-left: auto; color: var(--text-faint); font-size: var(--text-xs); }

/* ---- toasts: a .dt-toasts region (role=status aria-live=polite) holding .dt-toast items */
.dt-toasts { position: fixed; right: var(--space-4); bottom: var(--space-4); z-index: var(--z-toast);
             display: grid; gap: var(--space-2); width: min(22rem, calc(100vw - 2 * var(--space-4))); }
.dt-toast {
  display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-3);
  font-size: var(--text-sm); line-height: var(--leading-snug);
  animation: dt-toast-in var(--dur-slow) var(--ease-spring);
}
.dt-toast::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 0.4em; border-radius: var(--radius-full);
                    background: var(--toast-mark, var(--accent-text)); }
.dt-toast[data-kind="ok"] { --toast-mark: var(--ok-text); }
.dt-toast[data-kind="warn"] { --toast-mark: var(--warn-text); }
.dt-toast[data-kind="danger"] { --toast-mark: var(--danger-text); }
.dt-toast b, .dt-toast strong { font-weight: var(--weight-strong); }
.dt-toast .dt-toast-body { flex: 1; min-width: 0; }
.dt-toast .dt-toast-body p { margin: 2px 0 0; color: var(--text-dim); }
.dt-toast .dt-btn { margin: -4px -8px -4px 0; }
@media (max-width: 600px) {
  .dt-toasts { left: 50%; right: auto; top: var(--space-3); bottom: auto; transform: translateX(-50%); }
}

/* ---- avatars */
.dt-avatar {
  --size: 32px;
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--size); height: var(--size); border-radius: var(--radius-full);
  background: var(--tone-6); color: var(--text);
  font: var(--weight-strong) calc(var(--size) * 0.4) / 1 var(--font-sans); letter-spacing: -0.01em;
  user-select: none; transition: box-shadow var(--dur) var(--ease-out);
}
.dt-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.dt-avatar-sm { --size: 24px; }
.dt-avatar-lg { --size: 48px; }
.dt-avatar-xl { --size: 80px; }
.dt-avatar-square { border-radius: var(--radius-lg); }
.dt-avatar-sm.dt-avatar-square { border-radius: var(--radius-sm); }
.dt-avatar[data-tone="1"] { background: var(--tone-1); }
.dt-avatar[data-tone="2"] { background: var(--tone-2); }
.dt-avatar[data-tone="3"] { background: var(--tone-3); }
.dt-avatar[data-tone="4"] { background: var(--tone-4); }
.dt-avatar[data-tone="5"] { background: var(--tone-5); }
.dt-avatar[data-tone="6"] { background: var(--tone-6); }
.dt-avatar[data-tone="7"] { background: var(--tone-7); }
.dt-avatar[data-tone="8"] { background: var(--tone-8); }
.dt-avatar[data-presence]::after {
  content: ""; position: absolute; right: -1px; bottom: -1px;
  width: max(8px, calc(var(--size) * 0.3)); height: max(8px, calc(var(--size) * 0.3)); border-radius: var(--radius-full);
  background: var(--text-faint); box-shadow: 0 0 0 2px var(--avatar-ring, var(--bg));
}
.dt-avatar[data-presence="online"]::after { background: var(--ok-text); }
.dt-avatar[data-presence="away"]::after { background: var(--warn-text); }
.dt-avatar[data-talking] { box-shadow: 0 0 0 2px var(--avatar-ring, var(--bg)), 0 0 0 4px var(--ok-text); }

/* ---- small things */
.dt-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
            padding: 0 6px; border-radius: var(--radius-full); background: var(--accent); color: var(--accent-ink);
            font: var(--weight-strong) var(--text-2xs) / 1 var(--font-sans); font-variant-numeric: tabular-nums; }
.dt-badge-quiet { background: var(--hover); color: var(--text-dim); }
.dt-badge-danger { background: var(--danger); color: var(--on-solid); }
.dt-card { padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-lg);
           background: var(--surface-2); box-shadow: var(--shadow-1); }
.dt-kbd { display: inline-block; min-width: 1.6em; padding: 1px 5px; border: 1px solid var(--line-strong);
          border-bottom-width: 2px; border-radius: var(--radius-xs); background: var(--surface-2); color: var(--text-dim);
          font: var(--weight-medium) var(--text-xs) / 1.4 var(--font-mono); text-align: center; }

/* ---- motion */
@keyframes dt-pop { from { opacity: 0; transform: scale(0.97) translateY(-2px); } to { opacity: 1; transform: none; } }
@keyframes dt-toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes dt-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dt-menu, .dt-toast { animation: none; }
  .dt-dialog, .dt-dialog::backdrop { transition: none; }
}

/* The web client's own rules, on the shared design (design/tokens.css and design/components.css, which build.mjs puts
 * before this file in the one stylesheet). Colors, type, spacing, radii and motion come from the tokens only; every
 * transition here is one of the --dur-* durations, which are 0 under prefers-reduced-motion (tokens.css).
 *
 *   base and the front pages (sign-in, adding the browser)   .front, .front-card, .callout
 *   the shell                                               .app, .side, .rail, .rooms, .main, .room-head, .members-panel
 *   the messages                                            .msg-list, .msg, .msg-actions, .reactions, .composer
 *   calls                                                   .call-bar, .tiles, .stage
 *   at a phone's width                                      the drawers, at the end
 */

/* ---- base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-size: var(--text-base); line-height: var(--leading-snug); background: var(--bg); color: var(--text); overflow: hidden; }
#app { height: 100%; }
h1, h2, h3 { margin: 0; font-weight: var(--weight-strong); letter-spacing: var(--tracking-tight); line-height: var(--leading-tight); }
b, strong { font-weight: var(--weight-strong); }
p { margin: 0; }
input, textarea, button, select { font: inherit; color: inherit; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
.dim { color: var(--text-dim); }
.small { font-size: var(--text-xs); }
.center { text-align: center; }
.warn { color: var(--warn-text); }
.grow { flex: 1; min-width: 0; }
/* a person's drawn picture (kit.tsx, Art) fills their avatar */
.dt-avatar .art { display: block; width: 100%; height: 100%; color: var(--text); clip-path: circle(50%); }
.dt-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.dt-input-lg { height: var(--control-lg); font-size: var(--text-md); }
.danger-text { color: var(--danger-text); }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent-text); font-weight: var(--weight-medium); cursor: pointer;
            text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 0.18em; }
.link-btn:hover { text-decoration-color: currentColor; }
.link-btn.center { display: block; margin: 0 auto; }
.boot { height: 100%; display: grid; place-items: center; }

/* a spinner: a ring with a gap, turning (still under reduced motion: it then pulses nothing and simply shows) */
.spinner { display: inline-block; width: 14px; height: 14px; flex: none; vertical-align: -2px; border-radius: var(--radius-full);
           border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor;
           animation: dt-spin 0.8s linear infinite; }
.boot .spinner { width: 22px; height: 22px; color: var(--text-faint); }
@keyframes dt-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* icon buttons: quiet until hovered; their tooltips come from data-tip */
.icon-btn { position: relative; display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0;
            border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-dim); cursor: pointer;
            transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.icon-btn:hover:not(:disabled), .icon-btn[aria-expanded="true"] { background: var(--hover); color: var(--text); }
.icon-btn:active:not(:disabled) { background: var(--active); }
.icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.icon-btn[aria-pressed="true"] { color: var(--text); background: var(--accent-soft); }
.icon-btn .dt-icon { width: 20px; height: 20px; }
.icon-btn.sm { width: 26px; height: 26px; border-radius: var(--radius-sm); }
.icon-btn.sm .dt-icon { width: 16px; height: 16px; }
.icon-btn.off { color: var(--danger-text); }

/* tooltips: one element for the page (kit.tsx, Tooltips), placed beside whatever carries data-tip, on hover (after a
 * short wait) and on keyboard focus; none on touch, where the button's label says it */
.tooltip { position: fixed; z-index: var(--z-toast); pointer-events: none; max-width: 16rem; width: max-content; padding: 5px 8px;
           border-radius: var(--radius-sm); background: var(--text); color: var(--bg); box-shadow: var(--shadow-2);
           font: var(--weight-medium) var(--text-xs) / 1.3 var(--font-sans); text-align: center;
           animation: dt-fade-in var(--dur-fast) var(--ease-out); }

/* menus anchored to their buttons */
.menu-anchor { position: relative; display: inline-flex; }
.popover { position: absolute; z-index: var(--z-menu); }
.popover.at-below { top: calc(100% + 4px); }
.popover.at-above { bottom: calc(100% + 4px); --menu-origin: bottom left; }
.popover.align-start { left: 0; }
.popover.align-end { right: 0; --menu-origin: top right; }
.popover.at-above.align-end { --menu-origin: bottom right; }
.dt-menu-item:disabled { opacity: 0.55; cursor: default; }
.dt-menu-item:disabled:hover { background: none; }

/* callouts: a line of information, a warning or an error, in a card's flow */
.callout { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3); border-radius: var(--radius-md);
           background: var(--surface-1); border: 1px solid var(--line); color: var(--text); font-size: var(--text-sm); text-align: left; }
.callout > .dt-icon { margin-top: 1px; color: var(--text-dim); }
.callout b { display: block; margin-bottom: 2px; }
.callout p + p { margin-top: var(--space-1); }
.callout.ok { background: var(--ok-soft); border-color: transparent; }
.callout.ok > .dt-icon { color: var(--ok-text); }
.callout.warn { background: var(--warn-soft); border-color: transparent; }
.callout.warn > .dt-icon { color: var(--warn-text); }
.callout.danger { background: var(--danger-soft); border-color: transparent; }
.callout.danger > .dt-icon { color: var(--danger-text); }

/* ---- the front pages: sign-in, adding this browser, the phrase */
.front { min-height: 100%; overflow: auto; display: grid; place-items: center; padding: var(--space-8) var(--space-4);
         background: radial-gradient(60rem 30rem at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.front-card { width: min(26rem, 100%); display: grid; gap: var(--space-4); padding: var(--space-8); border-radius: var(--radius-xl);
              background: var(--surface-2); box-shadow: var(--shadow-3), var(--edge); animation: dt-rise var(--dur-slow) var(--ease-out); }
.front-card h1 { font-size: var(--text-xl); }
.front-card .lead { color: var(--text-dim); margin-top: calc(-1 * var(--space-2)); }
.brand { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.brand img { border-radius: 11px; }
.wordmark { font-size: var(--text-lg); font-weight: var(--weight-strong); letter-spacing: var(--tracking-tight); }
.fine { color: var(--text-faint); font-size: var(--text-xs); text-align: center; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); font-size: var(--text-sm); color: var(--text-dim); }
.steps li { display: flex; gap: var(--space-3); align-items: flex-start; }
.steps .dt-icon { margin-top: 1px; color: var(--accent-text); }
.more summary { cursor: pointer; color: var(--text-dim); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.more[open] { display: grid; gap: var(--space-3); }
.more[open] summary { margin-bottom: 0; }
.more .dt-btn { justify-self: start; }
.phrase { font-family: var(--font-mono); font-size: var(--text-md); line-height: var(--leading); padding: var(--space-4);
          border: 1px dashed var(--line-strong); border-radius: var(--radius-md); word-spacing: .3rem; background: var(--surface-1); }
@keyframes dt-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- the shell: rail | rooms | main | members */
.app { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; height: 100%; height: 100dvh; }
.side { display: grid; grid-template-columns: 72px 15.5rem; grid-template-rows: minmax(0, 1fr) auto auto;
        grid-template-areas: "rail rooms" "rail call" "rail user"; min-height: 0; background: var(--surface-1); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.scrim { display: none; }

/* the rail: a tile per space, the pill on its left marks the one shown (tall), one with news (a dot) */
.rail { grid-area: rail; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-3) 0;
        overflow-y: auto; scrollbar-width: none; border-right: 1px solid var(--line); background: var(--surface-1); }
.rail-mark img { display: block; border-radius: 10px; }
.rail-sep { width: 32px; height: 1px; flex: none; background: var(--line-strong); margin: var(--space-1) 0; }
.rail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.rail-item { position: relative; display: grid; place-items: center; width: 72px; }
.rail-pill { position: absolute; left: 0; top: 50%; width: 4px; height: 0; border-radius: 0 4px 4px 0; background: var(--text);
             transform: translateY(-50%); transition: height var(--dur) var(--ease-out); }
.rail-item.unread .rail-pill { height: 8px; }
.rail-item:hover .rail-pill { height: 18px; }
.rail-item.sel .rail-pill { height: 36px; }
.rail-tile { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius-full);
             background: var(--surface-2); color: var(--text); box-shadow: var(--edge); cursor: pointer;
             font: var(--weight-strong) var(--text-sm) / 1 var(--font-sans); letter-spacing: 0.01em;
             transition: border-radius var(--dur) var(--ease-out), background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.rail-tile[data-tone="1"] { background: var(--tone-1); } .rail-tile[data-tone="2"] { background: var(--tone-2); }
.rail-tile[data-tone="3"] { background: var(--tone-3); } .rail-tile[data-tone="4"] { background: var(--tone-4); }
.rail-tile[data-tone="5"] { background: var(--tone-5); } .rail-tile[data-tone="6"] { background: var(--tone-6); }
.rail-tile[data-tone="7"] { background: var(--tone-7); } .rail-tile[data-tone="8"] { background: var(--tone-8); }
.rail-tile:hover, .rail-item.sel .rail-tile { border-radius: var(--radius-lg); }
.rail-item.sel .rail-tile { box-shadow: 0 0 0 2px var(--surface-1), 0 0 0 4px var(--accent-text); }
.rail-tile.conduit { background: var(--surface-2); color: var(--accent-text); font-size: var(--text-lg); }
.rail-tile.add { background: transparent; color: var(--text-dim); box-shadow: inset 0 0 0 1px var(--line-strong); }
.rail-tile.add:hover { background: var(--hover); color: var(--text); }
.rail-tile.add .dt-icon { width: 20px; height: 20px; }
.rail-badge { position: absolute; right: 8px; bottom: -2px; box-shadow: 0 0 0 3px var(--surface-1); }

/* the rooms: the space's name (its menu), then the categories */
.rooms { grid-area: rooms; display: flex; flex-direction: column; min-height: 0; font-size: var(--text-sm); }
.space-head { display: flex; align-items: center; gap: var(--space-2); width: 100%; height: 52px; flex: none; padding: 0 var(--space-4);
              border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; cursor: pointer;
              font: var(--weight-strong) var(--text-base) / 1.2 var(--font-sans); letter-spacing: var(--tracking-tight);
              transition: background-color var(--dur-fast) var(--ease-out); }
.space-head:hover:not(.static) { background: var(--hover); }
.space-head.static { cursor: default; }
.space-head.placeholder { cursor: default; }
.space-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rooms .menu-anchor { display: block; }
.rooms .menu-anchor > .dt-menu { left: var(--space-2); right: var(--space-2); }
.room-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-2) var(--space-2) var(--space-4); }
.category { margin-top: var(--space-3); }
.category:first-child { margin-top: var(--space-1); }
.category-head { display: flex; align-items: center; padding-right: var(--space-1); }
.category-toggle { flex: 1; display: flex; align-items: center; gap: 2px; padding: var(--space-1) var(--space-1); border: 0; background: none;
                   color: var(--text-faint); cursor: pointer; text-align: left;
                   font: var(--weight-strong) var(--text-2xs) / 1.2 var(--font-sans); letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.category-toggle:hover { color: var(--text); }
.category-toggle .dt-icon { width: 12px; height: 12px; transition: transform var(--dur-fast) var(--ease-out); }
.category.shut .category-toggle .dt-icon { transform: rotate(-90deg); }
.room-list { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 1px; }
.room { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: 32px; padding: 0 var(--space-2);
        border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-dim); text-align: left; cursor: pointer;
        font: var(--weight-medium) var(--text-sm) / 1.25 var(--font-sans);
        transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.room .dt-icon { width: 18px; height: 18px; color: var(--text-faint); }
.room:hover { background: var(--hover); color: var(--text); }
.room.sel { background: var(--active); color: var(--text); }
.room.sel .dt-icon { color: var(--text-dim); }
.room.unread { color: var(--text); font-weight: var(--weight-strong); }
.room-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-sub { color: var(--text-faint); font-weight: var(--weight-regular); font-size: var(--text-xs); }
.room-tag { flex: none; padding: 1px 6px; border-radius: var(--radius-full); background: var(--hover); color: var(--text-dim);
            font-size: var(--text-2xs); font-weight: var(--weight-medium); }
.unread-dot { flex: none; width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--text); }
.unread-dot.on-icon { position: absolute; top: 5px; right: 5px; box-shadow: 0 0 0 2px var(--bg); background: var(--accent-text); }
.live-dot { flex: none; width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--ok-text); }
.call-badge { display: inline-flex; align-items: center; gap: 2px; flex: none; color: var(--ok-text); font-size: var(--text-xs); }
.call-badge .dt-icon { width: 14px; height: 14px; color: currentColor; }
.call-badge.ringing { color: var(--warn-text); animation: dt-ring 1.2s var(--ease-in-out) infinite; }
@keyframes dt-ring { 50% { opacity: 0.45; } }
.room-peers { list-style: none; margin: 2px 0 var(--space-1); padding: 0 0 0 30px; display: grid; gap: 2px; }
.room-peers li { display: flex; align-items: center; gap: var(--space-2); min-height: 26px; color: var(--text-dim); font-size: var(--text-xs); }
.room-peers li.talking { color: var(--text); }
.room-peers .dt-icon { width: 14px; height: 14px; color: var(--text-faint); }
.room-peers.outside li { color: var(--text-faint); }   /* who is in a call this page isn't in */
.room-peer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-tag { flex: none; padding: 1px 5px; border-radius: var(--radius-xs); background: var(--danger); color: var(--on-solid);
            font: var(--weight-strong) var(--text-2xs) / 1.3 var(--font-sans); letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.side-empty { display: grid; gap: var(--space-2); justify-items: start; padding: var(--space-4) var(--space-2); color: var(--text-dim); }
.side-form { margin-top: var(--space-3); }
.side-form .dt-input { height: var(--control-sm); font-size: var(--text-sm); }
.rooms .callout { margin: var(--space-1) 0 var(--space-3); font-size: var(--text-xs); }
.rooms .dt-btn-block { margin-bottom: var(--space-2); }
.skeleton .bone { display: block; height: 10px; margin: 11px var(--space-2); border-radius: var(--radius-full); background: var(--hover);
                  animation: dt-bone 1.4s var(--ease-in-out) infinite; }
.skeleton .bone.round { width: 40px; height: 40px; margin: 0; }
@keyframes dt-bone { 50% { opacity: 0.5; } }
@media (prefers-reduced-motion: reduce) { .skeleton .bone, .call-badge.ringing { animation: none; } }

/* the call bar and the user bar, at the bottom of the rooms */
.call-bar { grid-area: call; margin: 0 var(--space-2) var(--space-2); padding: var(--space-2) var(--space-3) var(--space-3);
            border-radius: var(--radius-lg); background: var(--surface-2); box-shadow: var(--shadow-1), var(--edge); font-size: var(--text-sm);
            animation: dt-rise var(--dur) var(--ease-out); }
.call-head { display: grid; gap: 1px; margin-bottom: var(--space-2); }
.call-state { display: flex; align-items: center; gap: var(--space-1); color: var(--ok-text); font-weight: var(--weight-strong); font-size: var(--text-xs); }
.call-bar:not(.connected) .call-state { color: var(--warn-text); }
.call-state .dt-icon { width: 15px; height: 15px; }
.call-where { display: flex; align-items: center; gap: 4px; color: var(--text-dim); font-size: var(--text-xs); }
.call-where .dt-icon { width: 13px; height: 13px; }
.call-peers { list-style: none; margin: 0 0 var(--space-2); padding: 0; display: grid; gap: 2px; }
.call-peers li { display: flex; align-items: center; gap: var(--space-2); min-height: 26px; font-size: var(--text-xs); color: var(--text-dim); }
.call-peers li.talking { color: var(--text); }
.call-peer-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-buttons { display: flex; gap: var(--space-1); }
.voice-buttons .icon-btn { flex: 1; width: auto; background: var(--hover); }
.voice-buttons .icon-btn:hover:not(:disabled) { background: var(--active); }
.voice-buttons .icon-btn.leave { color: var(--on-solid); background: var(--danger); }
.voice-buttons .icon-btn.leave:hover { background: var(--danger-hover); color: var(--on-solid); }
.call-bar .ptt { margin-top: var(--space-2); font-size: var(--text-xs); color: var(--text-dim); }
.call-bar .dt-btn-block { margin-top: var(--space-2); }
.call-bar .held { background: var(--accent); color: var(--accent-ink); }
.call-bar video.screen { width: 100%; max-height: 30vh; margin-bottom: var(--space-2); background: #000; border-radius: var(--radius-md); }
/* noise suppression: on or off and its strength, in the call bar and the user menu */
.noise-controls { display: grid; gap: var(--space-1); font-size: var(--text-xs); color: var(--text-dim); }
.noise-controls.call { margin-top: var(--space-2); }
.noise-controls.menu { padding: 0 var(--space-2) var(--space-2); }
.noise-strength { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px var(--space-2); }
.noise-strength input[type=range] { width: 100%; min-width: 0; margin: 0; accent-color: var(--accent); }
.noise-strength > span { grid-column: 2; }
.noise-strength.off { opacity: 0.55; }
.noise-controls p { margin: 0; }
.call-note { grid-area: call; margin: 0 var(--space-2) var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md);
             background: var(--warn-soft); color: var(--warn-text); font-size: var(--text-xs); }
.user-bar { grid-area: user; display: flex; align-items: center; gap: 2px; height: 56px; padding: 0 var(--space-2);
            border-top: 1px solid var(--line); background: var(--surface-1); }
.user-menu-anchor { flex: 1; min-width: 0; }
.user-menu-anchor > .dt-menu { width: 15rem; max-height: calc(100dvh - 72px); overflow-y: auto; }
.user-chip { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-width: 0; height: 44px; padding: 0 var(--space-2);
             border: 0; border-radius: var(--radius-md); background: none; text-align: left; cursor: pointer; --avatar-ring: var(--surface-1);
             transition: background-color var(--dur-fast) var(--ease-out); }
.user-chip:hover, .user-chip[aria-expanded="true"] { background: var(--hover); --avatar-ring: var(--hover); }
.user-text { display: grid; min-width: 0; }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); font-weight: var(--weight-strong); }
.status { font-size: var(--text-xs); color: var(--text-dim); }
.status.online { color: var(--ok-text); }
.status.offline { color: var(--danger-text); }
.menu-who { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); }
.menu-who > div { display: grid; min-width: 0; }
.menu-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-row { display: flex; gap: var(--space-1); padding: var(--space-1) var(--space-2) var(--space-2); }
.palette-pick { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: var(--radius-full);
                background: none; cursor: pointer; }
.palette-pick:hover { background: var(--hover); }
.palette-pick .dt-swatch { width: 18px; height: 18px; }
.palette-pick[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--accent-text); }
.logo-row { display: flex; gap: var(--space-1); padding: var(--space-1) var(--space-2) var(--space-2); }
.logo-pick { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: var(--radius-md);
             background: none; cursor: pointer; }
.logo-pick:hover { background: var(--hover); }
.logo-pick img { display: block; border-radius: 7px; }
.logo-pick[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--accent-text); }

/* the room's header */
.room-head { display: flex; align-items: center; gap: var(--space-3); height: 52px; flex: none; padding: 0 var(--space-3) 0 var(--space-4);
             border-bottom: 1px solid var(--line); background: var(--bg); position: relative; z-index: var(--z-sticky); }
.drawer-btn { display: none; }
.room-title { display: flex; align-items: center; gap: var(--space-2); min-width: 0; flex: none; max-width: 40%;
              font-size: var(--text-md); font-weight: var(--weight-strong); }
.room-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-title .dt-icon { width: 20px; height: 20px; color: var(--text-faint); }
.room-topic { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim);
              font-size: var(--text-sm); padding-left: var(--space-3); border-left: 1px solid var(--line); }
.chip { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 2px 8px; border-radius: var(--radius-full);
        background: var(--hover); color: var(--text-dim); font-size: var(--text-xs); font-weight: var(--weight-medium); cursor: default; }
.chip .dt-icon { width: 13px; height: 13px; }
.head-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; flex: none; }
.search { position: relative; margin: 0 var(--space-1); }
.search form { display: flex; align-items: center; gap: var(--space-1); width: 11rem; height: 30px; padding: 0 var(--space-2);
               border-radius: var(--radius-md); background: var(--surface-1); box-shadow: inset 0 0 0 1px var(--line);
               color: var(--text-faint); transition: width var(--dur) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.search.open form { width: 16rem; box-shadow: inset 0 0 0 1px var(--focus), 0 0 0 3px var(--accent-soft-strong); }
.search .dt-icon { width: 16px; height: 16px; }
.search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: var(--text); font-size: var(--text-sm); }
.search input:focus-visible { outline: none; }
.search input::placeholder { color: var(--text-faint); }
.hits { position: absolute; top: calc(100% + 6px); right: 0; width: min(26rem, 90vw); max-height: 60vh; overflow: auto; padding: var(--space-1); }
.hits-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-1) var(--space-2); color: var(--text-dim); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.hits ul { list-style: none; margin: 0; padding: 0; }
.hit { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--space-2); width: 100%; padding: var(--space-2); border: 0;
       border-radius: var(--radius-sm); background: none; color: var(--text); text-align: left; cursor: pointer; }
.hit:hover, .hit:focus-visible { background: var(--hover); }
.hit-room { color: var(--text-faint); font-size: var(--text-xs); }
.hit .who { font-size: var(--text-xs); }
.hit-text { grid-column: 1 / -1; font-size: var(--text-sm); }

/* notices under the header: a new device (a security warning, quiet but set apart), offline, a call ringing */
.device-notices { display: grid; gap: var(--space-1); padding: var(--space-2) var(--space-4) 0; }
.notice-bar { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
              border-radius: var(--radius-md); background: var(--surface-1); box-shadow: var(--edge); font-size: var(--text-sm);
              border-left: 3px solid var(--line-strong); animation: dt-rise var(--dur) var(--ease-out); }
.notice-bar.warn { border-left-color: var(--warn); }
.notice-bar > .dt-icon { width: 18px; height: 18px; color: var(--text-dim); }
.notice-bar.warn > .dt-icon { color: var(--warn-text); }
.notice-bar p { flex: 1; min-width: 0; color: var(--text-dim); }
.notice-bar p b { color: var(--text); }
.notice-bar .mono { color: var(--text-faint); }
.conn-bar { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); background: var(--warn-soft);
            color: var(--warn-text); font-size: var(--text-sm); animation: dt-rise var(--dur) var(--ease-out); }
.conn-bar .dt-icon { width: 16px; height: 16px; }
.ring { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-2) var(--space-4) 0; padding: var(--space-3) var(--space-4);
        border-radius: var(--radius-lg); background: var(--surface-2); box-shadow: var(--shadow-2), var(--edge); animation: dt-toast-in var(--dur-slow) var(--ease-spring); }
.ring .dt-avatar { animation: dt-pulse 1.4s var(--ease-in-out) infinite; }
.ring-text { flex: 1; min-width: 0; }
@keyframes dt-pulse { 50% { box-shadow: 0 0 0 6px var(--accent-soft-strong); } }
@media (prefers-reduced-motion: reduce) { .ring .dt-avatar { animation: none; } }
.error-toast { position: fixed; top: var(--space-3); left: 50%; transform: translateX(-50%); z-index: var(--z-toast);
               display: flex; align-items: center; gap: var(--space-2); max-width: min(36rem, calc(100vw - 2 * var(--space-4)));
               padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3); border-radius: var(--radius-md);
               background: var(--danger); color: var(--on-solid); box-shadow: var(--shadow-3); font-size: var(--text-sm);
               animation: dt-toast-in var(--dur-slow) var(--ease-spring); }
.error-toast .icon-btn { color: var(--on-solid); }
.error-toast .icon-btn:hover { background: color-mix(in srgb, var(--on-solid) 18%, transparent); color: var(--on-solid); }
.toast-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); }

/* ---- the messages */
.messages { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.scroll-wrap { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.msg-list { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: var(--space-4) 0 var(--space-2); overscroll-behavior: contain; }
.msg-list > li.older { display: grid; place-items: center; padding: var(--space-2) var(--space-4) var(--space-4); }
.room-start { justify-self: stretch; display: grid; gap: var(--space-2); padding: var(--space-6) var(--space-2) var(--space-2); }
.room-start h2 { font-size: var(--text-xl); }
.msg { position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr); padding: 1px var(--space-4) 1px 0;
       transition: background-color var(--dur-fast) var(--ease-out); }
.msg.head { margin-top: var(--space-3); padding-top: 2px; }
.msg:hover, .msg:focus-within, .msg.active { background: color-mix(in srgb, var(--hover) 55%, transparent); }
.msg:focus-visible { outline: none; box-shadow: inset 2px 0 0 var(--focus); }
.msg-gutter { display: flex; justify-content: center; padding-top: 2px; }
.msg.head .msg-gutter { padding-top: 3px; }
.msg-gutter .dt-avatar { --size: 36px; }
.hover-time { opacity: 0; padding-top: 3px; color: var(--text-faint); font-size: var(--text-2xs); font-variant-numeric: tabular-nums;
              transition: opacity var(--dur-fast) var(--ease-out); }
.msg:hover .hover-time, .msg:focus-within .hover-time, .msg.active .hover-time { opacity: 1; }
.msg-head { display: flex; align-items: baseline; gap: var(--space-2); }
.who { font-weight: var(--weight-strong); color: var(--text); }
.who-rest { color: var(--text-faint); font-weight: var(--weight-medium); }
.who-handle { margin-left: var(--space-2); color: var(--text-faint); font-weight: var(--weight-regular); font-size: var(--text-xs); }
.msg-head time { color: var(--text-faint); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: var(--leading); }
.text.gone { color: var(--text-faint); font-style: italic; }
.edited { color: var(--text-faint); font-size: var(--text-xs); }
.msg.pending .text { color: var(--text-dim); }
.send-state { display: flex; align-items: center; gap: var(--space-2); margin-top: 2px; color: var(--text-faint); font-size: var(--text-xs); }
.send-state .dt-icon { width: 13px; height: 13px; }
.send-state .failed { display: inline-flex; align-items: center; gap: 4px; color: var(--danger-text); font-weight: var(--weight-medium); }
.msg.pending.failed { background: color-mix(in srgb, var(--danger-soft) 60%, transparent); }
.msg.pending.sending .text, .msg.pending.stored .text { animation: dt-fade-in var(--dur) var(--ease-out); }
.msg.mention { background: color-mix(in srgb, var(--warn-soft) 70%, transparent); box-shadow: inset 2px 0 0 var(--warn); }
.msg.mention:hover, .msg.mention:focus-within { background: var(--warn-soft); }
.room-head.bare { border-bottom-color: transparent; }
.room-head.bare .head-actions { display: none; }
.msg.new { animation: dt-rise var(--dur-slow) var(--ease-out); }
.reply-quote { display: flex; align-items: center; gap: var(--space-1); max-width: 100%; margin: 0 0 2px; padding: 0; border: 0; background: none;
               color: var(--text-dim); font-size: var(--text-xs); text-align: left; cursor: pointer; }
.reply-quote .dt-icon { width: 13px; height: 13px; flex: none; color: var(--text-faint); transform: scaleY(-1); }
.reply-quote .who { flex: none; white-space: nowrap; font-size: var(--text-xs); }
.reply-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-quote:hover .reply-text { color: var(--text); }

/* a message's actions: a small toolbar at its top right, on hover, focus or a tap */
.msg-actions { position: absolute; top: -14px; right: var(--space-4); display: flex; gap: 1px; padding: 2px; border-radius: var(--radius-md);
               background: var(--surface-2); box-shadow: var(--shadow-1), var(--edge); opacity: 0; pointer-events: none;
               transform: translateY(2px); transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); z-index: 2; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions, .msg.active .msg-actions, .msg-actions:has([aria-expanded="true"]) {
  opacity: 1; pointer-events: auto; transform: none; }
.msg-actions .icon-btn { width: 30px; height: 28px; border-radius: var(--radius-sm); }
.msg-actions .icon-btn .dt-icon { width: 17px; height: 17px; }
.msg.head .msg-actions { top: -12px; }
.emoji-row { display: grid; grid-template-columns: repeat(4, 36px); gap: 2px; }
.emoji { justify-content: center; width: 36px; min-height: 34px; padding: 0; font-size: 18px; }

/* reactions as chips */
.reactions { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-1); align-items: center; }
.react { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border: 1px solid var(--line);
         border-radius: var(--radius-full); background: var(--surface-1); color: var(--text-dim); cursor: pointer;
         font-size: var(--text-xs); font-weight: var(--weight-medium); font-variant-numeric: tabular-nums;
         transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-instant) var(--ease-out); }
.react:hover { border-color: var(--line-strong); background: var(--hover); color: var(--text); }
.react:active { transform: scale(0.96); }
.react.mine { border-color: var(--accent-text); background: var(--accent-soft); color: var(--text); }
.react-key { font-size: 14px; line-height: 1; }
.reactions .menu-anchor .icon-btn { width: 28px; height: 24px; border-radius: var(--radius-full); opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
.msg:hover .reactions .icon-btn, .msg:focus-within .reactions .icon-btn, .msg.active .reactions .icon-btn,
.reactions .icon-btn[aria-expanded="true"] { opacity: 1; }
.reactions .icon-btn .dt-icon { width: 15px; height: 15px; }

/* editing in place */
.edit-box { display: grid; gap: var(--space-1); margin: 2px 0; }
.edit-box .dt-textarea { min-height: 38px; max-height: 40vh; resize: none; }
.edit-hint { display: flex; align-items: center; gap: var(--space-3); }

/* the lines: a day, the "new messages" line, a restore's gap */
.msg-list > li.day { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-5) var(--space-4) var(--space-1);
                     color: var(--text-faint); font-size: var(--text-xs); font-weight: var(--weight-strong); }
.msg-list > li.day::before, .msg-list > li.day::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.msg-list > li.new-line { display: flex; align-items: center; margin: var(--space-3) var(--space-4) 0 56px; border-top: 1px solid var(--danger-text); height: 0; }
.msg-list > li.new-line span { margin-left: auto; transform: translateY(-50%); padding: 0 6px; border-radius: var(--radius-xs);
                               background: var(--danger); color: var(--on-solid); font-size: var(--text-2xs); font-weight: var(--weight-strong);
                               letter-spacing: var(--tracking-wide); text-transform: uppercase; line-height: 16px; }
.msg-list > li.gap { text-align: center; margin: var(--space-3) var(--space-4); font-size: var(--text-sm); color: var(--warn-text); }

/* back to the newest */
.jump { position: absolute; left: 50%; bottom: var(--space-3); transform: translateX(-50%); display: inline-flex; align-items: center; gap: var(--space-2);
        height: 30px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text);
        box-shadow: var(--shadow-2), var(--edge); cursor: pointer; font-size: var(--text-xs); font-weight: var(--weight-medium);
        animation: dt-toast-in var(--dur) var(--ease-out); z-index: 3; }
.jump .dt-icon { width: 15px; height: 15px; }
.jump.has-new { background: var(--accent); color: var(--accent-ink); }

/* the composer */
.composer { flex: none; padding: 0 var(--space-4) var(--space-4); }
.composer-box { display: flex; align-items: flex-end; gap: var(--space-1); padding: 5px; border-radius: var(--radius-lg); background: var(--surface-1);
                box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--dur-fast) var(--ease-out); }
.composer-box:focus-within { box-shadow: inset 0 0 0 1px var(--focus), 0 0 0 3px var(--accent-soft-strong); }
.composer textarea { flex: 1; min-width: 0; min-height: 32px; max-height: 40vh; padding: 6px var(--space-1); border: 0; background: none;
                     color: var(--text); resize: none; line-height: var(--leading-snug); font-size: var(--text-base); overflow-y: auto; }
.composer textarea:focus-visible { outline: none; }
.composer textarea::placeholder { color: var(--text-faint); }
.composer textarea:disabled { cursor: not-allowed; }
.composer .icon-btn { width: 32px; height: 32px; }
.composer .send:not(:disabled) { background: var(--accent); color: var(--accent-ink); }
.composer .send:not(:disabled):hover { background: var(--accent-hover); color: var(--accent-ink); }
.composer.disabled .composer-box { opacity: 0.7; }
.reply-bar { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3);
             margin: 0 var(--space-2); border-radius: var(--radius-md) var(--radius-md) 0 0; background: var(--hover);
             color: var(--text-dim); font-size: var(--text-xs); animation: dt-rise var(--dur-fast) var(--ease-out); }
.reply-bar .dt-icon { width: 14px; height: 14px; transform: scaleY(-1); }
.reply-bar .reply-text { flex: 1; }
.cinvite { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-4) var(--space-2); color: var(--text-dim); }
.cinvite .dt-input { height: var(--control-sm); font-size: var(--text-sm); }

/* empty and waiting states in the main area */
.empty-main { justify-content: center; }
.empty { display: grid; justify-items: center; gap: var(--space-3); max-width: 26rem; margin: auto; padding: var(--space-8) var(--space-4);
         text-align: center; color: var(--text-dim); animation: dt-fade-in var(--dur-slow) var(--ease-out); }
.empty h2 { color: var(--text); font-size: var(--text-lg); }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--radius-full); background: var(--hover); color: var(--text-dim); }
.empty-icon .dt-icon { width: 26px; height: 26px; }
.room-start .empty-icon { width: 48px; height: 48px; }
.welcome { display: grid; justify-items: center; gap: var(--space-4); max-width: 34rem; margin: auto; padding: var(--space-8) var(--space-4);
           text-align: center; animation: dt-rise var(--dur-slow) var(--ease-out); }
.welcome-mark { display: block; width: auto; max-width: 100%; height: 72px; margin: 0 auto; }
.welcome h1 { font-size: var(--text-2xl); }
.welcome .lead { color: var(--text-dim); font-size: var(--text-md); line-height: var(--leading); }
.welcome-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); width: 100%; margin-top: var(--space-2); }
.welcome-card { display: grid; justify-items: start; gap: var(--space-1); padding: var(--space-5); border: 0; border-radius: var(--radius-lg);
                background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-1), var(--edge); text-align: left; cursor: pointer;
                transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.welcome-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2), var(--edge); }
.welcome-card.quiet { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.welcome-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: var(--space-2); border-radius: var(--radius-md);
                background: var(--accent-soft); color: var(--accent-text); }
.welcome-card.quiet .welcome-icon { background: var(--hover); color: var(--text-dim); }
.welcome-card .dim { font-size: var(--text-sm); }

/* the dialogs' insides */
.dt-dialog.wide { width: min(40rem, calc(100vw - 2 * var(--space-4))); }
.dt-dialog-head .icon-btn { margin-right: calc(-1 * var(--space-2)); }
.dt-dialog-body p + p { margin-top: var(--space-2); }
.dialog-form { display: grid; gap: var(--space-4); color: var(--text); }
.dialog-form .dt-check { color: var(--text); }
.dialog-alt { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); text-align: center; }
.copy-row { display: flex; gap: var(--space-2); margin: var(--space-3) 0; }
.copy-row .dt-input { flex: 1; font-size: var(--text-sm); }
.dt-input.placeholder { display: flex; align-items: center; gap: var(--space-2); color: var(--text-faint); }
.device-list { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-2); color: var(--text); }
.device-row { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface-1); }
.device-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: var(--radius-sm); background: var(--hover); color: var(--text-dim); }
.device-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.online-tag { margin-left: var(--space-2); color: var(--ok-text); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.dt-dialog .callout { margin-bottom: var(--space-3); }

/* the members */
.members-panel { display: flex; flex-direction: column; width: 15.5rem; min-height: 0; border-left: 1px solid var(--line); background: var(--surface-1);
                 animation: dt-slide-left var(--dur) var(--ease-out); }
@keyframes dt-slide-left { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; height: 52px; flex: none; padding: 0 var(--space-2) 0 var(--space-4);
              border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: var(--text-sm); }
.panel-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-2); }
.panel-label { margin: var(--space-4) var(--space-2) var(--space-1); color: var(--text-faint); font-size: var(--text-2xs);
               font-weight: var(--weight-strong); letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.panel-scroll > div:first-child > .panel-label:first-child { margin-top: var(--space-2); }
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.member { display: flex; align-items: center; gap: var(--space-2); min-height: 36px; padding: 0 var(--space-2); border-radius: var(--radius-sm);
          font-size: var(--text-sm); --avatar-ring: var(--surface-1); }
.member:hover { background: var(--hover); --avatar-ring: var(--hover); }
.member.outside { color: var(--text-dim); }
.member.outside .dt-avatar { opacity: 0.7; }
.member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-name .you { color: var(--text-faint); }
.member-handle { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--text-faint); font-size: var(--text-2xs); line-height: 1.2; }
.member-call { width: 15px; height: 15px; color: var(--ok-text); }
.member.offline .member-name { color: var(--text-dim); }
.member.offline .dt-avatar { opacity: 0.6; }
.member-status { display: block; color: var(--text-faint); font-size: var(--text-2xs); line-height: 1.2; }
.member-status.dnd { color: var(--danger-text); }

/* presence (phase 5's web shell): a dot on the avatar; idle a crescent, do not disturb a bar, offline a ring */
.dt-avatar[data-presence="idle"]::after { background: radial-gradient(circle at 30% 30%, transparent 38%, var(--warn-text) 40%); }
.dt-avatar[data-presence="dnd"]::after {
  background: linear-gradient(var(--bg), var(--bg)) center / 56% 24% no-repeat, var(--danger-text); }
.dt-avatar[data-presence="offline"]::after, .dt-avatar[data-presence="invisible"]::after {
  background: var(--avatar-ring, var(--bg)); box-shadow: 0 0 0 2px var(--avatar-ring, var(--bg)), inset 0 0 0 2px var(--text-faint); }
.status-pick { display: inline-block; width: 9px; height: 9px; margin-right: var(--space-2); border-radius: var(--radius-full);
               vertical-align: 1px; background: var(--ok-text); }
.status-pick.dnd { background: var(--danger-text); }
.status-pick.offline { background: transparent; box-shadow: inset 0 0 0 2px var(--text-faint); }

/* who types (phase 5's web shell): a quiet line above the composer, its height kept */
.typing-line { flex: none; height: 20px; padding: 0 var(--space-4); display: flex; align-items: center; gap: var(--space-2);
               color: var(--text-dim); font-size: var(--text-xs); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: var(--radius-full); background: var(--text-faint);
                 animation: typing-dot 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-dot { 0%, 60%, 100% { opacity: 0.35; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .typing-dots i { animation: none; opacity: 0.7; } }
.row-action { opacity: 0.55; }
.member:hover .row-action, .row-action:focus-visible { opacity: 1; }
.add-btn { height: 24px; padding: 0 var(--space-2); }
.panel-action { margin: var(--space-2) var(--space-1) 0; }
.space-members .warn { text-transform: none; letter-spacing: 0; font-weight: var(--weight-medium); }

/* calls in the main area */
.voice-room { overflow-y: auto; padding: var(--space-4); }
.stage { margin: var(--space-3) var(--space-4) var(--space-2); display: flex; flex-direction: column; align-items: center; min-height: 0; flex: none; }
.stage video.screen { width: 100%; max-height: 55vh; object-fit: contain; background: #000; border-radius: var(--radius-lg); box-shadow: var(--shadow-2); }
.voice-room .stage { margin: 0 0 var(--space-4); }
.voice-room .stage video.screen { max-height: 62vh; }
.stage figcaption { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-2); color: var(--text-dim); font-size: var(--text-sm); }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
.tile { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-6) var(--space-3) var(--space-4);
        border-radius: var(--radius-lg); background: var(--surface-1); box-shadow: var(--edge); --avatar-ring: var(--surface-1);
        animation: dt-pop var(--dur) var(--ease-out); transition: box-shadow var(--dur) var(--ease-out); }
.tile.talking { box-shadow: inset 0 0 0 2px var(--ok-text); }
.tile .name { font-weight: var(--weight-strong); max-width: 100%; text-align: center; overflow-wrap: anywhere; }
.tile .icons { min-height: 1.3rem; display: flex; gap: var(--space-1); align-items: center; color: var(--text-dim); }
.tile .icons .dt-icon { width: 16px; height: 16px; }

/* ---- narrower: the members over the messages */
@media (max-width: 1099px) {
  .members-open .members-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: var(--z-dialog); box-shadow: var(--shadow-3); width: min(85vw, 18rem); }
  .members-open .scrim { display: block; position: fixed; inset: 0; z-index: calc(var(--z-dialog) - 1); background: var(--scrim);
                         animation: dt-fade-in var(--dur) var(--ease-out); }
  .room-topic { display: none; }
  .room-title { max-width: none; flex: 1; }
}

/* ---- a phone: the rail and rooms are a drawer from the left */
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; top: 0; left: 0; bottom: 0; z-index: var(--z-dialog); grid-template-columns: 64px minmax(0, 1fr);
          width: min(88vw, 21rem); box-shadow: var(--shadow-3); transform: translateX(-102%); visibility: hidden;
          transition: transform var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow); }
  .drawer-open .side { transform: none; visibility: visible; transition: transform var(--dur-slow) var(--ease-out), visibility 0s; }
  .rail-item { width: 64px; }
  .drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: calc(var(--z-dialog) - 1); background: var(--scrim);
                        animation: dt-fade-in var(--dur) var(--ease-out); }
  .drawer-btn { display: inline-grid; margin-left: calc(-1 * var(--space-2)); }
  .room-head { gap: var(--space-2); padding: 0 var(--space-2) 0 var(--space-3); }
  .chip { display: none; }
  .search form { width: 2.25rem; padding: 0 var(--space-2); }
  .search form input { opacity: 0; }
  .search.open form { position: absolute; right: 0; top: -15px; width: calc(100vw - 2 * var(--space-3)); max-width: 22rem; background: var(--surface-2); z-index: 2; }
  .search.open form input { opacity: 1; }
  .msg { grid-template-columns: 48px minmax(0, 1fr); padding-right: var(--space-3); }
  .msg-gutter .dt-avatar { --size: 32px; }
  .msg-actions { right: var(--space-3); }
  .composer { padding: 0 var(--space-2) var(--space-2); }
  .msg-list > li.new-line { margin-left: 48px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); }
  .welcome-actions { grid-template-columns: 1fr; }
  .device-notices { padding: var(--space-2) var(--space-2) 0; }
  .front-card { padding: var(--space-6) var(--space-5); }
}
@media (hover: none) {
  .reactions .menu-anchor .icon-btn { opacity: 1; }
}

/* the sign-in while it waits for the person's server: the busy button stays readable */
.front-card[aria-busy="true"] .dt-btn-primary:disabled { opacity: 0.9; cursor: progress; }

/* ---- notification settings (phase 5 slice 5) */
.notify-section { display: grid; gap: var(--space-3); padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.notify-section:first-child { border-top: 0; padding-top: 0; }
.notify-section h3 { margin: 0; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text); }
.notify-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.notify-line .dt-field.inline { flex: 1 1 8rem; }
.notify-days { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.day-pick {
  min-width: 2.75rem; height: var(--control-sm); padding: 0 var(--space-2); border: 1px solid var(--control-line);
  border-radius: var(--radius-full); background: transparent; color: var(--text-dim); cursor: pointer;
  font: var(--weight-medium) var(--text-xs) / 1 var(--font-sans);
}
.day-pick[aria-pressed="true"] { background: var(--accent-soft-strong); border-color: var(--accent); color: var(--text); }
.dt-select-sm { height: var(--control-sm); min-height: var(--control-sm); width: auto; font-size: var(--text-sm); }
.notify-space { border: 1px solid var(--line); border-radius: var(--radius-md); }
.notify-space + .notify-space { margin-top: var(--space-2); }
.notify-space summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-2) var(--space-3); cursor: pointer; list-style-position: inside;
}
.notify-space-name { font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-rooms { display: grid; gap: var(--space-2); padding: 0 var(--space-3) var(--space-3); }
.notify-room { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.notify-room-name { display: inline-flex; align-items: center; gap: var(--space-1); min-width: 0; color: var(--text-dim); }
@media (max-width: 520px) {
  .notify-room, .notify-space summary { flex-wrap: wrap; }
  .dt-select-sm { width: 100%; }
}
/* ---- roles and permissions (phase 5 slice 6: web/src/ui/roles.tsx) */
.block { display: block; }
.templates { border: 0; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--space-2); }
.template-card { display: grid; gap: var(--space-1); align-content: start; padding: var(--space-3); text-align: left;
                 border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1);
                 color: var(--text); font: inherit; cursor: pointer; }
.template-card:hover { border-color: var(--line-strong); }
.template-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--accent-soft); }
.template-title { font-weight: var(--weight-semibold); }
.template-blurb { font-size: var(--text-xs); color: var(--text-dim); }
.template-what { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--space-1); }
.role-chip, .room-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: var(--radius-full);
                         background: var(--hover); font-size: var(--text-xs); color: var(--text-dim); }
.room-chip .dt-icon { width: 12px; height: 12px; }
.dt-dialog.wide:has(.roles-layout), .dt-dialog.wide:has(.adv-perms), .dt-dialog.wide:has(.simple-perms),
.dt-dialog.wide:has(.why) { width: min(52rem, calc(100vw - 2 * var(--space-4))); }
.roles-layout { display: grid; grid-template-columns: minmax(12rem, 15rem) 1fr; gap: var(--space-4); }
@media (max-width: 640px) { .roles-layout { grid-template-columns: 1fr; } }
.role-list { list-style: none; margin: var(--space-2) 0; padding: 0; display: grid; gap: 2px; }
.role-row { display: flex; align-items: center; gap: 2px; border-radius: var(--radius-md); }
.role-row.sel { background: var(--hover); }
.role-row.dragging { opacity: 0.5; }
.role-row[draggable="true"] { cursor: grab; }
.role-pick { flex: 1; display: flex; align-items: center; gap: var(--space-2); min-width: 0; padding: 6px var(--space-2);
             border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.role-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--weight-medium); }
.role-move { display: flex; }
.icon-btn.up .dt-icon { transform: rotate(180deg); }
.new-role .dt-input { width: 100%; }
.role-editor { display: grid; gap: var(--space-3); align-content: start; }
.role-head { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; }
.role-head h3 { margin: 0; font-size: var(--text-md); }
.grow { flex: 1; }
.color-row { display: flex; align-items: center; gap: 6px; }
.color-pick { width: 22px; height: 22px; padding: 0; border: 2px solid transparent; border-radius: var(--radius-full);
              background: var(--swatch); cursor: pointer; display: grid; place-items: center; color: var(--text-dim); }
.color-pick.none { background: var(--hover); }
.color-pick.none .dt-icon { width: 12px; height: 12px; }
.color-pick.on { border-color: var(--text); }
.color-custom { width: 26px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
.caps, .bits ul, .role-picks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.bits { display: grid; gap: var(--space-3); max-height: 50vh; overflow: auto; padding-right: var(--space-2); }
.switch-row { display: flex; gap: var(--space-2); align-items: flex-start; cursor: pointer; }
.switch-row input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.switch-row input:disabled + span { opacity: 0.55; }
.cap.partly .partly { color: var(--warn-text, var(--text-dim)); font-size: var(--text-xs); }
code.api { font-size: 10px; color: var(--text-faint); letter-spacing: 0.02em; }
.bit.danger b { color: var(--danger-text); }
.role-foot { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.role-label { margin-top: var(--space-3); }
.simple-perms { display: grid; gap: var(--space-3); }
.simple-perms fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: var(--space-1); }
.role-picks { margin-left: var(--space-5); display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); }
.role-picks .dt-check { gap: 6px; }
.adv-perms { display: grid; gap: var(--space-3); }
.adv-targets { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.adv-targets .target { padding: 3px 10px; border: 1px solid var(--line); border-radius: var(--radius-full); background: none;
                       color: var(--text); font: inherit; font-size: var(--text-xs); cursor: pointer; }
.adv-targets .target.on { background: var(--accent-soft); border-color: var(--accent); }
.adv-grid { width: 100%; border-collapse: collapse; }
.adv-grid th { text-align: left; font-weight: normal; padding: 6px 0; }
.adv-grid td { text-align: right; padding: 6px 0; vertical-align: top; }
.adv-grid tr + tr { border-top: 1px solid var(--line); }
.tri button { min-width: 30px; justify-content: center; }
.tri button.deny[aria-pressed="true"] { color: var(--danger-text); }
.tri button.allow[aria-pressed="true"] { color: var(--ok-text); }
.tri button:disabled { opacity: 0.4; cursor: default; }
.why { display: grid; gap: var(--space-3); }
.why-ask { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.why-steps { margin: 0; padding-left: var(--space-5); display: grid; gap: var(--space-1); }
.why-steps li.takes { color: var(--danger-text); }
.why-steps li.gives { color: var(--ok-text); }
.why-steps li.yes, .why-steps li.no { font-weight: var(--weight-semibold); }
.callout.inherit { align-items: center; }
.callout.inherit .dt-btn { margin-left: auto; }
.why-ask .dt-select, .adv-targets .dt-select { width: auto; max-width: 16rem; }

/* files and photos (phase 5 slice 3): a message's album and files, the lightbox, the composer's tray */
.attachments { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-1); max-width: min(520px, 100%); }
.album { display: grid; gap: 3px; border-radius: var(--radius-md); overflow: hidden; }
.album-1 { grid-template-columns: 1fr; max-width: 420px; }
.album-2 { grid-template-columns: 1fr 1fr; }
.album-3, .album-4 { grid-template-columns: repeat(3, 1fr); }
.album-4 { grid-template-columns: repeat(2, 1fr); }
.album-tile { position: relative; display: block; padding: 0; border: 0; aspect-ratio: 1; background: var(--surface-2) center / cover no-repeat;
  cursor: zoom-in; overflow: hidden; }
.album-1 .album-tile { aspect-ratio: auto; max-height: 420px; min-height: 120px; }
.album-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.album-tile:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.file-chip, .file-line { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); color: var(--text); text-decoration: none;
  max-width: 100%; }
.file-chip:hover, .file-line:hover { background: var(--hover); }
.file-chip .file-name { font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-chip .file-meta { color: var(--text-dim); font-size: var(--text-sm); white-space: nowrap; }
.file-video video { display: block; max-width: 100%; max-height: 360px; border-radius: var(--radius-md); background: #000; }
.file-video .file-line { border: 0; padding: var(--space-1) 0; background: none; font-size: var(--text-sm); color: var(--text-dim); }
.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto 1fr; background: rgba(0, 0, 0, 0.88); }
.lightbox:focus { outline: none; }
.lightbox-bar { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); color: #fff; }
.lightbox-bar .lightbox-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-bar .icon-btn { color: #fff; }
.lightbox-img { place-self: center; max-width: calc(100vw - 32px); max-height: calc(100vh - 72px); object-fit: contain;
  background: center / cover no-repeat; }
.lightbox-prev, .lightbox-next { position: fixed; top: 50%; color: #fff; background: rgba(0, 0, 0, 0.4); }
.lightbox-prev { left: var(--space-3); }
.lightbox-next { right: var(--space-3); }
.composer.drop-over .composer-box { box-shadow: inset 0 0 0 2px var(--accent); }
.tray { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-2); }
.tray-files { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 2px; }
.tray-item { position: relative; flex: none; width: 88px; display: flex; flex-direction: column; gap: 2px; }
.tray-item img, .tray-file { width: 88px; height: 88px; object-fit: cover; border-radius: var(--radius-md); background: var(--surface-2);
  display: grid; place-items: center; color: var(--text-dim); }
.tray-name { font-size: var(--text-xs); color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-x { position: absolute; top: 2px; right: 2px; background: var(--surface-1); }
.tray-original { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); color: var(--text-dim); }
.tray-progress { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-dim); }
.tray-progress .bar { flex: 1; height: 4px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; }
.tray-progress .bar i { display: block; height: 100%; background: var(--accent); transition: width var(--dur-fast) var(--ease-out); }
.tray-why { font-size: var(--text-sm); }
