/* Offgrid — neutral, minimal theme (shadcn "neutral" palette, like Sharkord). */

/* ---------- tokens ----------
   Every size in this file comes from the scales below: type, spacing,
   control heights, radii, shadows. Colours are defined per theme. */
:root {
  /* type scale (rem: follows the browser's font-size setting) */
  --fs-2xs: .75rem;     /* 12px: badges, counters, tiny labels */
  --fs-xs: .8125rem;    /* 13px: secondary text, timestamps, hints */
  --fs-sm: .875rem;     /* 14px: small UI text, tabs, chips, meta */
  --fs-base: .9375rem;  /* 15px: body UI: channels, menus, buttons */
  --fs-md: 1rem;        /* 16px: message text, inputs */
  --fs-lg: 1.0625rem;   /* 17px: header titles */
  --fs-xl: 1.25rem;     /* 20px: dialog / page headings */
  --fs-2xl: 1.5rem;     /* 24px: hero headings */
  --lh: 1.5;
  --lh-tight: 1.3;

  /* spacing scale */
  --s-0: 2px;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  /* control sizes (raised to 44px on touch screens below) */
  --tap: 38px;          /* buttons, inputs, selects */
  --ibtn: 36px;         /* icon buttons */
  --row: 36px;          /* list rows: channels, menu items, settings nav */
  --bar-h: 56px;        /* every header bar */
  --icon: 20px;
  --icon-sm: 16px;
  --nav-w: 280px;
  --members-w: 256px;

  /* avatars (mirror AVATAR_PX in users.js) */
  --av-xs: 24px; --av-sm: 32px; --av-md: 40px; --av-lg: 56px; --av-xl: 88px;

  /* radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;

  /* No generic system-ui: on some Linux setups fontconfig resolves it to a
     monospace face. Named platform UI fonts first, then the sans-serif default. */
  --font: "Inter", "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto,
          "Adwaita Sans", Cantarell, Ubuntu, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Adwaita Mono", "DejaVu Sans Mono", monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* light theme colours */
  --bg: #ffffff;
  --sidebar: #fafafa;
  --card: #ffffff;
  --muted: #f4f4f5;
  --hover: #f4f4f5;
  --active: #ebebec;
  --line: #e5e5e5;
  --input: #dcdcdc;
  --fg: #0a0a0a;
  --fg-2: #5c5c5c;      /* secondary text: 6.1:1 on --muted */
  --fg-3: #6b6b6b;      /* tertiary text: 4.85:1 on --muted */
  --primary: #171717;
  --primary-fg: #fafafa;
  --focus: #737373;     /* focus ring: ≥3:1 on every surface */
  --ring: rgba(115, 115, 115, .28);
  --danger: #b91c1c;    /* danger text */
  --danger-solid: #dc2626; /* filled danger (white text 4.8:1) */
  --danger-soft: rgba(220, 38, 38, .09);
  --ok: #15803d;
  --ok-ring: #16a34a;
  --warn: #b45309;
  --warn-strong: #92400e;
  --warn-soft: rgba(217, 119, 6, .1);
  --link: #1d4ed8;
  --mention: rgba(37, 99, 235, .1);
  --mention-me: rgba(217, 119, 6, .14);
  --stage: #f4f4f5;
  --tile: #e7e7e9;
  --spoiler: #b8b8b8;
  --thumb-off: #ffffff;
  --thumb-on: #ffffff;
  --scrim: rgba(0, 0, 0, .45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow: 0 8px 24px -6px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .05);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .25), 0 4px 12px rgba(0, 0, 0, .06);
  color-scheme: light;
}

@media (pointer: coarse) {
  :root { --tap: 44px; --ibtn: 44px; --row: 44px; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --sidebar: #121212;
    --card: #171717;
    --muted: #262626;
    --hover: #1c1c1c;
    --active: #2a2a2a;
    --line: rgba(255, 255, 255, .1);
    --input: rgba(255, 255, 255, .16);
    --fg: #fafafa;
    --fg-2: #b0b0b0;
    --fg-3: #999999;
    --primary: #e5e5e5;
    --primary-fg: #171717;
    --focus: #a3a3a3;
    --ring: rgba(163, 163, 163, .3);
    --danger: #ff6b6b;
    --danger-solid: #dc2626;
    --danger-soft: rgba(255, 107, 107, .14);
    --ok: #4ade80;
    --ok-ring: #22c55e;
    --warn: #fbbf24;
    --warn-strong: #fbbf24;
    --warn-soft: rgba(251, 191, 36, .12);
    --link: #7ab4fb;
    --mention: rgba(96, 165, 250, .16);
    --mention-me: rgba(251, 191, 36, .12);
    --stage: #0a0a0a;
    --tile: #1c1c1c;
    --spoiler: #3d3d3d;
    --thumb-off: #d4d4d4;
    --thumb-on: #171717;
    --scrim: rgba(0, 0, 0, .6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 8px 24px -6px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .7), 0 4px 12px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --sidebar: #121212;
  --card: #171717;
  --muted: #262626;
  --hover: #1c1c1c;
  --active: #2a2a2a;
  --line: rgba(255, 255, 255, .1);
  --input: rgba(255, 255, 255, .16);
  --fg: #fafafa;
  --fg-2: #b0b0b0;
  --fg-3: #999999;
  --primary: #e5e5e5;
  --primary-fg: #171717;
  --focus: #a3a3a3;
  --ring: rgba(163, 163, 163, .3);
  --danger: #ff6b6b;
  --danger-solid: #dc2626;
  --danger-soft: rgba(255, 107, 107, .14);
  --ok: #4ade80;
  --ok-ring: #22c55e;
  --warn: #fbbf24;
  --warn-strong: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .12);
  --link: #7ab4fb;
  --mention: rgba(96, 165, 250, .16);
  --mention-me: rgba(251, 191, 36, .12);
  --stage: #0a0a0a;
  --tile: #1c1c1c;
  --spoiler: #3d3d3d;
  --thumb-off: #d4d4d4;
  --thumb-on: #171717;
  --scrim: rgba(0, 0, 0, .6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 8px 24px -6px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .7), 0 4px 12px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
html { font-size: 100%; }

#app { height: var(--vvh, 100dvh); }

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { -webkit-user-select: none; user-select: none; }
a { color: var(--link); text-underline-offset: 2px; }
[hidden] { display: none !important; }
time, .badge, .counter, .volume-pct, .side-time { font-variant-numeric: tabular-nums; }

/* One focus ring for every interactive element (keyboard only). Rows inside
   clipped lists draw it inset so it is never cut off. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ch:focus-visible, .vu:focus-visible, .member:focus-visible, .menu-item:focus-visible, .sheet-item:focus-visible,
.list-row:focus-visible, .set-nav-item:focus-visible, .role-row:focus-visible, .suggest-item:focus-visible,
.search-hit:focus-visible, .nav-head:focus-visible, .emoji-cell:focus-visible, .tile:focus-visible,
.reply-ref:focus-visible, .who:focus-visible, .tabs button:focus-visible { outline-offset: -2px; }

* { scrollbar-width: thin; scrollbar-color: var(--active) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--active); border-radius: var(--radius-full); border: 2px solid transparent; background-clip: padding-box; }

h1, h2, h3 { line-height: var(--lh-tight); }
p { margin: 0 0 var(--s-3); }
p:last-child { margin-bottom: 0; }
.muted { color: var(--fg-2); }
.small { font-size: var(--fs-xs); }
.mono { font-family: var(--mono); font-size: var(--fs-xs); word-break: break-all; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: var(--s-2); }
.row.wrap { flex-wrap: wrap; }
.row > .input { flex: 1; min-width: 0; }
.error { color: var(--danger); font-size: var(--fs-sm); }
.flip { transform: rotate(180deg); }
.truncate, .title, .name, .n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lucide icons (sprite symbols via <use>); every presentation attribute inherits into the symbol. */
svg.i { width: var(--icon); height: var(--icon); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
svg.i.sm { width: var(--icon-sm); height: var(--icon-sm); }

/* ---------- boot / centered screens ---------- */
.boot, .center {
  min-height: var(--vvh, 100dvh);
  display: grid;
  place-items: center;
  padding: max(var(--s-4), env(safe-area-inset-top)) max(var(--s-4), env(safe-area-inset-right))
           max(var(--s-4), env(safe-area-inset-bottom)) max(var(--s-4), env(safe-area-inset-left));
}
.spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--muted);
  border-top-color: var(--fg-2);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner.sm { width: 20px; height: 20px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s-8);
  box-shadow: var(--shadow-sm);
}
.card h1 { margin: 0 0 var(--s-1); font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -.015em; overflow-wrap: anywhere; }
.card > p.muted { font-size: var(--fs-base); }
.card form { margin-top: var(--s-2); }
@media (max-width: 480px) { .card { padding: var(--s-6) var(--s-5); } }

/* ---------- forms ---------- */
.field { display: grid; gap: var(--s-2); margin-bottom: var(--s-5); min-width: 0; }
.field > label { font-size: var(--fs-sm); font-weight: 500; color: var(--fg); }
.field .hint, .hint { font-size: var(--fs-xs); color: var(--fg-2); line-height: 1.45; }
.field .error { font-size: var(--fs-sm); }

.input, select.input, textarea.input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  background: transparent;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  font-size: 16px; /* 16px prevents the iOS zoom on focus */
  line-height: var(--lh-tight);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { padding: var(--s-2) var(--s-3); line-height: var(--lh); resize: vertical; }
select.input { padding-right: var(--s-8); appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-2) 50%), linear-gradient(135deg, var(--fg-2) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
@media (pointer: fine) { .input, select.input, textarea.input { font-size: var(--fs-base); } }
.input::placeholder { color: var(--fg-3); }
.input:focus, .input:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--ring); }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.input:disabled, .input[readonly] { background: var(--muted); }
.input:disabled { opacity: .6; cursor: not-allowed; }
select.input option { background: var(--card); color: var(--fg); }
/* Drawn with gradients: the CSP allows no data: images. */
input[type=search]::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; cursor: pointer; opacity: .7;
  background: linear-gradient(45deg, transparent 43%, var(--fg-2) 43%, var(--fg-2) 57%, transparent 57%),
              linear-gradient(-45deg, transparent 43%, var(--fg-2) 43%, var(--fg-2) 57%, transparent 57%);
}
input[type=search]::-webkit-search-cancel-button:hover { opacity: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 var(--s-4);
  border: 1px solid transparent; border-radius: var(--radius-md);
  background: var(--muted); color: var(--fg);
  font-size: var(--fs-base); font-weight: 500; line-height: 1.2; white-space: nowrap;
  cursor: pointer; touch-action: manipulation;
  transition: background .15s, opacity .15s, box-shadow .15s;
}
.btn:hover { background: var(--active); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--primary); color: var(--primary-fg); box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 88%, var(--bg)); }
.btn.danger { background: var(--danger-solid); color: #fff; box-shadow: var(--shadow-sm); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger-solid) 88%, #000); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--muted); }
.btn.block { width: 100%; }
.btn .i { width: var(--icon-sm); height: var(--icon-sm); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: var(--ibtn); height: var(--ibtn); flex: none; padding: 0;
  border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--fg-2);
  cursor: pointer; touch-action: manipulation;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--muted); color: var(--fg); }
.icon-btn:active { background: var(--active); }
.icon-btn.on { color: var(--fg); background: var(--muted); }
.icon-btn.danger-on { color: var(--danger); }
.icon-btn:disabled { opacity: .4; pointer-events: none; }

.tabs { display: flex; gap: var(--s-1); padding: var(--s-1); background: var(--muted); border-radius: var(--radius); margin: var(--s-5) 0; }
.tabs button {
  flex: 1; min-width: 0; min-height: calc(var(--tap) - 4px); padding: 0 var(--s-3);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--fg-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
  cursor: pointer; transition: background .15s, color .15s;
}
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { background: var(--bg); color: var(--fg); box-shadow: var(--shadow-sm); }
@media (pointer: coarse) { .tabs button { min-height: 44px; } }
.tabs.compact { margin: 0; }

.alert { padding: var(--s-3) var(--s-4); border-radius: var(--radius-md); border: 1px solid var(--line); font-size: var(--fs-sm); line-height: 1.45; margin-bottom: var(--s-4); overflow-wrap: anywhere; }
.alert.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn-strong); }
.alert.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert.info { background: var(--muted); border-color: transparent; }
.alert .btn { margin-top: var(--s-2); }

.check { display: flex; gap: var(--s-3); align-items: flex-start; cursor: pointer; font-size: var(--fs-base); }
.check input { margin: 3px 0 0; width: 18px; height: 18px; flex: none; accent-color: var(--primary); }
.check .hint { margin-top: 2px; }

/* switch (shadcn-like) */
.switch-row { display: flex; align-items: center; gap: var(--s-4); min-height: 52px; padding: var(--s-3) 0; cursor: pointer; border-bottom: 1px solid var(--line); position: relative; }
.switch-row:last-child { border-bottom: 0; }
.switch-row .sw-text { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: var(--fs-base); }
.switch-row .hint { font-size: var(--fs-xs); color: var(--fg-2); }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { flex: none; width: 40px; height: 24px; border-radius: var(--radius-full); background: var(--input); position: relative; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--thumb-off); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s var(--ease); }
.switch-row input:checked + .switch { background: var(--primary); }
.switch-row input:checked + .switch::after { transform: translateX(16px); background: var(--thumb-on); }
.switch-row + .field, .switch-row + .row { margin-top: var(--s-4); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch-row input:disabled + .switch { opacity: .4; }
.switch-row:has(input:disabled) { cursor: not-allowed; }
.switch-row:has(input:disabled) .sw-text { opacity: .6; }

/* range sliders */
input[type=range] { accent-color: var(--primary); height: 24px; margin: 0; cursor: pointer; }
@media (pointer: coarse) { input[type=range] { height: 44px; } }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; z-index: 100; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%); display: grid; gap: var(--s-2); width: min(420px, calc(100vw - 32px)); pointer-events: none;
}
/* Desktop: above the composer / call controls. Phones: under the header,
   clear of the composer, the call controls and the on-screen keyboard. */
@media (max-width: 899px) {
  .toasts { bottom: auto; top: calc(var(--bar-h) + max(var(--s-2), env(safe-area-inset-top))); }
}
.toast {
  padding: var(--s-3) var(--s-4); border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow); font-size: var(--fs-base); line-height: 1.4;
  overflow-wrap: anywhere; animation: toast-in .18s ease-out;
}
.toast.danger { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- shell ---------- */
.shell {
  height: var(--vvh, 100dvh);
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--bg);
}
.pane-nav { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pane-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.pane-members { width: var(--members-w); background: var(--sidebar); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.shell.no-members .pane-members { display: none; }
.backdrop { display: none; }
/* Large screens: everything one notch bigger (the type scale is in rem). */
@media (min-width: 1600px) { :root { --nav-w: 300px; --members-w: 280px; } html { font-size: 106.25%; } }

@media (max-width: 899px) {
  .shell { display: block; position: relative; }
  .pane-nav, .pane-main, .pane-members { position: absolute; inset: 0; width: 100%; transition: transform .22s var(--ease); }
  /* Promote the sliding panes only while they move (nav.js), not forever. */
  .shell.panes-moving .pane-nav, .shell.panes-moving .pane-members { will-change: transform; }
  .pane-nav { width: min(88vw, 340px); z-index: 3; transform: translateX(-100%); }
  .pane-members { left: auto; right: 0; width: min(84vw, 320px); z-index: 3; transform: translateX(100%); display: flex !important; }
  .shell[data-pane="nav"] .pane-nav, .shell[data-pane="members"] .pane-members { transform: none; box-shadow: var(--shadow-lg); }
  .backdrop { display: block; position: absolute; inset: 0; z-index: 2; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .22s; }
  .shell[data-pane="nav"] .backdrop, .shell[data-pane="members"] .backdrop { opacity: 1; pointer-events: auto; }
  .pane-nav { padding-left: env(safe-area-inset-left); }
  .pane-members { padding-right: env(safe-area-inset-right); }
}
@media (min-width: 900px) { .mobile-only { display: none !important; } }

.bar {
  flex: none; height: var(--bar-h);
  display: flex; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-3) 0 var(--s-4);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top); box-sizing: content-box;
  min-width: 0;
}
.bar > .icon-btn.mobile-only:first-child { margin-left: calc(-1 * var(--s-2)); }
.bar .title { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.bar .topic { color: var(--fg-2); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.bar .topic::before { content: ""; display: inline-block; width: 1px; height: 18px; background: var(--line); margin: 0 var(--s-3) 0 var(--s-1); vertical-align: -4px; }
.bar .topic:empty { display: none; }
@media (max-width: 599px) { .bar .topic { display: none; } }
.bar > .i { color: var(--fg-2); }
.bar > .avatar { margin-right: var(--s-1); }
.bar .icon-btn { color: var(--fg-2); }
.bar .icon-btn:hover { color: var(--fg); }

/* ---------- sidebar ---------- */
.pane-nav > .bar .title, .bar .title.grow { flex: 1; }
.nav-tabs { margin: var(--s-3) var(--s-3) 0 !important; }
.nav-scroll { flex: 1; overflow-y: auto; padding: var(--s-2) var(--s-2) var(--s-4); overscroll-behavior: contain; }
.nav-section { margin-top: var(--s-4); }
.nav-section:first-child { margin-top: var(--s-1); }
.nav-head {
  display: flex; align-items: center; gap: var(--s-1); min-height: 32px; padding: 0 var(--s-1) 0 var(--s-2);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em; color: var(--fg-2);
  cursor: pointer; user-select: none; border-radius: var(--radius-sm);
}
.nav-head > span:first-of-type, .nav-head .nh-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-head:hover { color: var(--fg); }
.nav-head .chev { transition: transform .15s; width: 14px; height: 14px; }
.nav-head.collapsed .chev { transform: rotate(-90deg); }
.nav-head .icon-btn { width: 28px; height: 28px; margin-left: auto; opacity: 0; }
.nav-head:hover .icon-btn, .nav-head:focus-within .icon-btn, .nav-head.static .icon-btn { opacity: 1; }
.nav-head.static { cursor: default; }
@media (pointer: coarse) {
  .nav-head { min-height: 44px; }
  .nav-head .icon-btn { opacity: 1; width: 44px; height: 44px; margin-right: calc(-1 * var(--s-1)); }
}
.nav-head.drop-into { background: var(--muted); }

.ch {
  display: flex; align-items: center; gap: var(--s-2);
  min-height: var(--row); padding: 0 var(--s-2) 0 var(--s-3); margin: 1px 0;
  border-radius: var(--radius-md); color: var(--fg-2); font-size: var(--fs-base);
  cursor: pointer; user-select: none; position: relative; -webkit-touch-callout: none;
  transition: background .1s, color .1s;
}
.ch:has(> .avatar) { padding-left: var(--s-2); min-height: max(var(--row), 44px); gap: var(--s-3); }
.ch:hover { background: var(--hover); color: var(--fg); }
.ch.active { background: var(--active); color: var(--fg); font-weight: 500; }
.ch.unread { color: var(--fg); font-weight: 600; }
.ch.unread::before { content: ""; position: absolute; left: calc(-1 * var(--s-2) + 1px); top: 50%; width: 4px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: var(--fg); }
.ch.muted { opacity: .55; }
.ch .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch > .i { color: var(--fg-3); width: 18px; height: 18px; }
.ch.active > .i, .ch:hover > .i { color: var(--fg-2); }
.ch.dragging { opacity: .4; }
.ch.drop-before { box-shadow: inset 0 2px 0 var(--fg); }
.ch.drop-after { box-shadow: inset 0 -2px 0 var(--fg); }
.ch .dm-close { width: 28px; height: 28px; opacity: 0; margin-right: calc(-1 * var(--s-1)); }
.ch:hover .dm-close, .ch:focus-within .dm-close { opacity: 1; }
@media (pointer: coarse) { .ch .dm-close { opacity: 1; width: 44px; height: 44px; } }

.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-full);
  background: var(--danger-solid); color: #fff; font-size: var(--fs-2xs); font-weight: 700; line-height: 1;
  display: inline-grid; place-items: center; flex: none;
}
.badge.soft { background: var(--active); color: var(--fg); }

.voice-users { margin: 0 0 var(--s-1) var(--s-6); }
.vu { display: flex; align-items: center; gap: var(--s-2); min-height: 32px; padding: 0 var(--s-2); border-radius: var(--radius-sm); font-size: var(--fs-sm); color: var(--fg-2); cursor: pointer; }
@media (pointer: coarse) { .vu { min-height: 44px; } }
.vu:hover { background: var(--hover); color: var(--fg); }
.vu .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vu .i { width: var(--icon-sm); height: var(--icon-sm); color: var(--fg-3); }
.vu .i.red { color: var(--danger); }

.voice-panel, .me-panel { flex: none; border-top: 1px solid var(--line); }
/* Status and channel on the left, call buttons on the right. */
.voice-panel { padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3); display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "status buttons" "where buttons"; align-items: center; column-gap: var(--s-2); }
.voice-panel[hidden] { display: none; }
.voice-panel .status { grid-area: status; font-size: var(--fs-sm); font-weight: 600; color: var(--ok); display: flex; align-items: center; gap: var(--s-2); min-width: 0; white-space: nowrap; }
.voice-panel .status.warn { color: var(--warn); }
.voice-panel .where { grid-area: where; font-size: var(--fs-xs); color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; padding-left: 24px; border-radius: var(--radius-xs); }
.voice-panel .where:hover { color: var(--fg); text-decoration: underline; }
.voice-panel .row { grid-area: buttons; gap: 0; }
.voice-panel .row .spacer { display: none; }
@media (pointer: coarse) { .voice-panel .where { min-height: 44px; display: flex; align-items: center; margin-top: -10px; } }
.me-panel { display: flex; align-items: center; gap: var(--s-0); min-height: 64px; padding: var(--s-2); padding-bottom: max(var(--s-2), env(safe-area-inset-bottom)); }
.me-panel .who { flex: 1; min-width: 0; cursor: pointer; border-radius: var(--radius-md); padding: var(--s-1) var(--s-2) var(--s-1) var(--s-1); display: flex; align-items: center; gap: var(--s-3); min-height: 48px; }
.me-panel .who:hover { background: var(--hover); }
.me-panel .who > div { flex: 1; min-width: 0; }
.me-panel .who .n { display: block; font-weight: 500; font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-panel .icon-btn { color: var(--fg-2); }

/* ---------- avatars & members ---------- */
/* The one avatar: a perfect circle at a fixed scale (sizes mirror AVATAR_PX
   in users.js). Picture or initial, the box and the dot never move. */
.avatar {
  --size: var(--av-md);
  width: var(--size); height: var(--size); flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: max(12px, calc(var(--size) * .42)); font-weight: 600; line-height: 1;
  background: var(--active); color: var(--fg-2);
  position: relative; user-select: none;
}
.avatar.av-xs { --size: var(--av-xs); }
.avatar.av-sm { --size: var(--av-sm); }
.avatar.av-md { --size: var(--av-md); }
.avatar.av-lg { --size: var(--av-lg); }
.avatar.av-xl { --size: var(--av-xl); }
.avatar > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; -webkit-user-drag: none; }
.avatar.has-img { background: var(--muted); }
.avatar .av-i { pointer-events: none; }
/* Dot: same proportion and offset at every size; the ring matches what is behind it. */
.avatar .dot {
  --d: max(10px, calc(var(--size) * .28));
  position: absolute; right: calc(var(--size) * -.04); bottom: calc(var(--size) * -.04);
  width: var(--d); height: var(--d); border-radius: 50%;
  border: max(2px, calc(var(--size) * .06)) solid var(--av-ring, var(--sidebar));
  background: var(--fg-3); box-sizing: border-box;
}
.avatar .dot.online { background: var(--ok-ring); }
.popover .avatar, .modal .avatar { --av-ring: var(--card); }
.chat .avatar, .settings .avatar { --av-ring: var(--bg); }
.pane-members .avatar, .pane-nav .avatar { --av-ring: var(--sidebar); }
.ch.active .avatar { --av-ring: var(--active); }
.avatar.speaking { box-shadow: 0 0 0 2px var(--sidebar), 0 0 0 4px var(--ok-ring); }

/* Ambient glow from the avatar's dominant colours (--c1..--c5, set by
   avatarGlow()). Static: drawn once, no animation. The scrim mixes in the
   page background so text stays readable in light and dark. */
.av-glow {
  position: absolute; inset: -25%; pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, var(--c1) 0, transparent 34%),
    radial-gradient(circle at 24% 30%, var(--c2) 0, transparent 40%),
    radial-gradient(circle at 78% 28%, var(--c3) 0, transparent 40%),
    radial-gradient(circle at 26% 76%, var(--c4) 0, transparent 40%),
    radial-gradient(circle at 76% 74%, var(--c5) 0, transparent 40%),
    color-mix(in srgb, var(--c1) 55%, var(--tile));
  filter: blur(40px) saturate(1.3);
}
.av-glow::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 38%, transparent); }
.tile.has-glow { background: var(--tile); }
.card-glow { inset: -40px -40px auto -40px; height: 160px; filter: blur(36px) saturate(1.2); opacity: .7; }
.user-card { position: relative; }
.user-card > .pbody { position: relative; }
.tile.has-glow .tile-label, .tile.has-glow .tile-actions { z-index: 2; }
.profile-edit { display: flex; gap: var(--s-5); align-items: center; flex-wrap: wrap; margin-bottom: var(--s-5); }
.profile-edit .small { margin-top: var(--s-2); }
.profile-edit .grow { min-width: 200px; }
.profile-preview { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--radius); margin-top: var(--s-2); min-width: 0; }
.profile-preview .pv-name { font-weight: 600; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-preview .pv-user { font-size: var(--fs-sm); color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-preview > div { min-width: 0; }

.members-filter { margin: var(--s-3) var(--s-3) 0 !important; width: calc(100% - 2 * var(--s-3)) !important; flex: none; }
.members-scroll { flex: 1; overflow-y: auto; padding: var(--s-1) var(--s-2) max(var(--s-4), env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.members-group { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em; color: var(--fg-2); padding: var(--s-4) var(--s-2) var(--s-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member { display: flex; align-items: center; gap: var(--s-3); min-height: 44px; padding: 0 var(--s-2); border-radius: var(--radius-md); cursor: pointer; }
.member:hover { background: var(--hover); }
.member .n { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-base); }
.member.offline { opacity: .55; }
.member.banned .n { text-decoration: line-through; }
.pane-members .muted.small { padding: var(--s-2) !important; }

.empty { flex: 1; display: grid; place-items: center; text-align: center; padding: var(--s-6); color: var(--fg-2); font-size: var(--fs-base); }
.empty.small { font-size: var(--fs-sm); padding: var(--s-4); }
.empty h2 { color: var(--fg); margin: 0 0 var(--s-2); font-size: var(--fs-xl); font-weight: 600; }
.empty p { margin-bottom: var(--s-4); }
.empty .btn { margin: var(--s-2) auto; }

.overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: var(--scrim); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); padding: var(--s-4); }
.overlay .card { text-align: center; display: grid; gap: var(--s-3); justify-items: center; }
.overlay .card > .i { width: 32px; height: 32px; color: var(--fg-2); }
.overlay h2 { margin: 0; font-size: var(--fs-xl); }

/* ---------- modal / sheet / menu / popover ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: var(--s-6); background: rgba(0, 0, 0, 0); transition: background .18s; }
.scrim.open { background: var(--scrim); }
.modal {
  width: 100%; max-width: 480px; max-height: min(86dvh, 760px);
  display: flex; flex-direction: column; min-width: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .18s, transform .18s var(--ease);
}
.modal.wide { max-width: 680px; }
.scrim.open .modal { opacity: 1; transform: none; }
.modal-head { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-4) var(--s-3) var(--s-1) var(--s-6); min-height: 60px; }
.modal-head h2 { flex: 1; min-width: 0; margin: 0; font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: var(--s-2) var(--s-6) var(--s-6); overflow-y: auto; min-width: 0; overscroll-behavior: contain; }
.modal-body > p.muted { font-size: var(--fs-base); line-height: var(--lh); overflow-wrap: anywhere; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s-2); padding: 0 var(--s-6) var(--s-6); }
@media (max-width: 899px) {
  .scrim { place-items: end stretch; padding: 0; }
  /* Sheets stay above the on-screen keyboard: --vvh is the visual viewport. */
  .modal { max-width: none; max-height: calc(var(--vvh, 100dvh) - max(24px, env(safe-area-inset-top))); border-radius: 20px 20px 0 0; border-bottom: 0; transform: translateY(40px); padding-bottom: env(safe-area-inset-bottom); }
  .modal::before { content: ""; width: 40px; height: 5px; border-radius: var(--radius-full); background: var(--active); margin: var(--s-2) auto 0; flex: none; }
  .modal-head { padding: var(--s-2) var(--s-2) 0 var(--s-5); min-height: 56px; }
  .modal-head h2 { font-size: var(--fs-lg); }
  .modal-body { padding: var(--s-2) var(--s-5) var(--s-5); }
  .modal-actions { padding: 0 var(--s-5) var(--s-5); }
  .modal-actions .btn { flex: 1; }
}
.sheet-list { display: grid; padding-bottom: var(--s-2); }
.sheet-list hr, .menu hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-1) 0; width: 100%; }
.sheet-item { display: flex; align-items: center; gap: var(--s-4); min-height: 52px; padding: 0 var(--s-2); margin: 0 calc(-1 * var(--s-2)); border: 0; background: none; text-align: left; font-size: var(--fs-md); border-radius: var(--radius-md); cursor: pointer; color: var(--fg); }
.sheet-item:hover, .sheet-item:active { background: var(--muted); }
.sheet-item .i { color: var(--fg-2); width: 22px; height: 22px; }
.sheet-item.danger, .sheet-item.danger .i, .menu-item.danger { color: var(--danger); }
.sheet-preview { font-size: var(--fs-sm); color: var(--fg-2); padding: 0 0 var(--s-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.floating { position: fixed; z-index: 70; }
.menu { min-width: 220px; max-width: 300px; padding: var(--s-1); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: grid; animation: pop-in .12s ease-out; }
.menu-item { display: flex; align-items: center; gap: var(--s-3); min-height: var(--row); padding: 0 var(--s-3) 0 var(--s-2); border: 0; border-radius: var(--radius-sm); background: none; text-align: left; cursor: pointer; font-size: var(--fs-base); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item .i { color: var(--fg-2); }
.menu-item:hover, .menu-item:focus-visible { background: var(--muted); }
.menu-item.danger .i { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
@keyframes pop-in { from { opacity: 0; transform: scale(.97); } }

.popover { width: 320px; max-width: calc(100vw - 16px); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; animation: pop-in .12s ease-out; }
.popover .pbody { padding: var(--s-5); }
.popover:not(.user-card):not(.pinned-pop) { padding: var(--s-4) !important; }
.popover > .small:first-child { font-size: var(--fs-sm); font-weight: 600; margin-bottom: var(--s-2) !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.volumes { display: grid; gap: var(--s-3); width: 320px !important; max-width: calc(100vw - 16px); }
.volume-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s-1) var(--s-3); }
.volume-row .volume-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-base); font-weight: 500; }
.volume-row .volume-slider { grid-column: 1 / -1; }
.volume-slider { flex-wrap: nowrap; }
.volume-slider input { flex: 1; min-width: 0; }
.volume-pct { width: 48px; text-align: right; font-size: var(--fs-sm) !important; }
.pname { display: block; font-weight: 600; font-size: var(--fs-xl); line-height: var(--lh-tight); letter-spacing: -.01em; overflow-wrap: anywhere; }
.puser { font-size: var(--fs-sm); color: var(--fg-2); word-break: break-all; margin-top: 2px; }
.popover .pstatus { font-size: var(--fs-sm); color: var(--fg-2); margin-top: var(--s-1); }
.popover .psection { font-size: var(--fs-xs); font-weight: 600; color: var(--fg-2); margin: var(--s-4) 0 var(--s-1); }
.user-card .pbody > .row:first-child { gap: var(--s-4); align-items: center; }
.user-card .pbody > .row:first-child > div { min-width: 0; }
.user-card .small { font-size: var(--fs-sm); }
.user-card .row:last-child .btn { flex: 1; }
.popover.in-sheet { width: auto; max-width: none; border: 0; box-shadow: none; background: transparent; margin: calc(-1 * var(--s-2)) calc(-1 * var(--s-5)) 0; border-radius: 0; animation: none; }
.popover.in-sheet .card-glow { inset: -20px -40px auto -40px; }
/* The profile sheet shows the name in the card itself. */
.modal:has(.user-card.in-sheet) .modal-head h2 { visibility: hidden; }
.pop-title { padding: var(--s-4) var(--s-4) var(--s-2); font-size: var(--fs-md); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-top: var(--s-2); }
.chip { display: inline-flex; align-items: center; gap: var(--s-1); min-height: 24px; padding: 0 var(--s-2); border-radius: var(--radius-full); border: 1px solid var(--line); font-size: var(--fs-2xs); font-weight: 500; line-height: 1.2; background: transparent; color: var(--fg); white-space: nowrap; vertical-align: middle; }
.chips .chip, .user-card .chip { font-size: var(--fs-xs); min-height: 26px; padding: 0 10px; }
.chip button { border: 0; background: none; padding: 0; color: var(--fg-3); cursor: pointer; display: grid; border-radius: var(--radius-full); }
.chip button:hover { color: var(--fg); }
.chip button .i { width: 14px; height: 14px; }
.chip.danger { border-color: transparent; background: var(--danger-soft); color: var(--danger); }
.chip.add { border-style: dashed; cursor: pointer; color: var(--fg-2); }
.chip.add:hover { color: var(--fg); border-color: var(--fg-3); }
@media (pointer: coarse) {
  .chips button.chip, .chips .chip:has(button) { min-height: 44px; padding: 0 var(--s-3); font-size: var(--fs-sm); }
  .chip button { width: 32px; height: 44px; place-items: center; margin-right: calc(-1 * var(--s-2)); }
}
.code-chip { font-family: var(--mono); font-size: var(--fs-xs); background: var(--muted); padding: 2px var(--s-2); border-radius: var(--radius-sm); flex: none; }

/* ---------- chat ---------- */
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.messages { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: var(--s-2) 0 var(--s-4); overflow-anchor: none; }
.sentinel { height: 1px; }
.loading-row { display: grid; place-items: center; padding: var(--s-6); }
.beginning { padding: var(--s-8) var(--s-4) var(--s-2); }
.beginning .big-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--muted); color: var(--fg-2); display: grid; place-items: center; margin-bottom: var(--s-4); }
.beginning .big-icon .i { width: 30px; height: 30px; }
.beginning .big-avatar { margin-bottom: var(--s-4); }
.beginning h2 { margin: 0 0 var(--s-1); font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.015em; overflow-wrap: anywhere; }
.beginning p { margin: 0; font-size: var(--fs-base); }
.beginning .retention-note { margin-top: var(--s-2); font-size: var(--fs-sm); }

.day-sep, .new-sep { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-5) var(--s-4) var(--s-1); font-size: var(--fs-xs); font-weight: 500; color: var(--fg-3); }
.day-sep::before, .day-sep::after, .new-sep::before, .new-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.new-sep { color: var(--danger); font-weight: 600; }
.new-sep::before, .new-sep::after { background: var(--danger); opacity: .45; }

.msg { position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr); padding: var(--s-1) var(--s-4) var(--s-1) 0; margin-top: var(--s-3); }
.msg.grouped { margin-top: 0; padding-top: 1px; padding-bottom: 1px; }
.msg:hover { background: color-mix(in srgb, var(--muted) 55%, transparent); }
.msg.pinged { background: var(--mention-me); box-shadow: inset 3px 0 0 var(--warn); }
.msg.pending { opacity: .55; }
.msg.failed .msg-content { color: var(--danger); }
.msg.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--mention); } }
.msg-body { min-width: 0; }
.msg-avatar { grid-row: span 2; display: flex; justify-content: center; padding-top: 2px; cursor: pointer; }
.side-time { font-size: var(--fs-2xs); color: var(--fg-3); text-align: center; line-height: calc(var(--fs-md) * var(--lh)); opacity: 0; user-select: none; white-space: nowrap; }
.msg.grouped:hover .side-time, .msg.grouped:focus-within .side-time { opacity: 1; }
.msg-head { display: flex; align-items: baseline; gap: var(--s-2); min-width: 0; line-height: 1.4; }
.msg-head .author { font-size: var(--fs-md); font-weight: 600; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.msg-head .author:hover { text-decoration: underline; }
.msg-head time { font-size: var(--fs-xs); color: var(--fg-3); white-space: nowrap; flex: none; }
.msg-content { overflow-wrap: anywhere; word-break: break-word; font-size: var(--fs-md); line-height: var(--lh); }
.msg-content p { margin: 0; }
.msg-content p + p { margin-top: var(--s-1); }
.msg-content code { font-family: var(--mono); font-size: .875em; background: var(--muted); padding: .1em .35em; border-radius: var(--radius-xs); }
.msg-content pre.code { margin: var(--s-1) 0; background: var(--muted); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--s-3) var(--s-4); overflow-x: auto; max-width: 100%; font-size: var(--fs-sm); line-height: 1.55; }
.msg-content pre.code code { background: none; padding: 0; white-space: pre; font-size: inherit; }
.msg-content blockquote { margin: var(--s-1) 0; padding-left: var(--s-3); border-left: 3px solid var(--active); color: var(--fg-2); }
.msg-content ul, .msg-content ol { margin: var(--s-1) 0; padding-left: var(--s-6); }
.msg-content a { word-break: break-all; }
.msg-content.big-emoji { font-size: 2.5rem; line-height: 1.25; }
.edited { font-size: var(--fs-2xs); color: var(--fg-3); white-space: nowrap; }
.spoiler { background: var(--spoiler); color: transparent; border-radius: var(--radius-xs); cursor: pointer; transition: background .15s; }
.spoiler.shown { background: var(--muted); color: inherit; cursor: auto; }
.spoiler:not(.shown) * { color: transparent !important; background: transparent !important; text-decoration: none; pointer-events: none; }
.mention { background: var(--mention); color: var(--link); padding: 0 .2em; border-radius: var(--radius-xs); font-weight: 500; cursor: pointer; }
.mention:hover { text-decoration: underline; }
.mention.me { background: var(--mention-me); color: var(--warn-strong); }
.msg.pinged .mention.me { background: color-mix(in srgb, var(--warn) 18%, transparent); }
.mention.role { cursor: default; }
.mention.role:hover, .mention.channel.unknown:hover { text-decoration: none; }
.mention.channel.unknown { opacity: .6; cursor: default; }
.reply-ref { grid-column: 2; display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--fg-2); cursor: pointer; min-width: 0; margin-bottom: 2px; line-height: 1.4; }
.reply-ref .i { color: var(--fg-3); width: 14px; height: 14px; }
.reply-ref .rn { font-weight: 600; flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.reply-ref .rx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }
.reply-ref:hover .rx { color: var(--fg); }
.pinned-flag { font-size: var(--fs-xs); color: var(--fg-3); display: flex; align-items: center; gap: var(--s-1); margin-top: 2px; }
.pinned-flag .i { width: 14px; height: 14px; }
.failed-note { font-size: var(--fs-sm); color: var(--danger); display: flex; gap: var(--s-3); flex-wrap: wrap; }
.link-btn { border: 0; background: none; color: var(--fg); cursor: pointer; padding: 0; font-size: inherit; text-decoration: underline; }

.reactions { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-top: var(--s-1); }
.reaction { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--radius-full); border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: var(--fs-sm); font-weight: 500; font-variant-numeric: tabular-nums; transition: background .1s, border-color .1s; }
.reaction:hover { background-color: var(--muted); border-color: var(--input); }
.reaction .e { font-size: 1.125rem; line-height: 1; }
.reaction .c { color: var(--fg-2); min-width: 1ch; }
.reaction.mine { border-color: color-mix(in srgb, var(--link) 55%, transparent); background-color: var(--mention); }
.reaction.mine .c { color: var(--link); }
.reaction:disabled { cursor: default; }
@media (pointer: coarse) {
  /* 36px pill, 44px target: a transparent outer border extends the hit area. */
  .reactions { gap: 0; margin-left: -4px; }
  .reaction { height: 44px; min-width: 44px; padding: 0 12px; border: 4px solid transparent; background-clip: padding-box; box-shadow: inset 0 0 0 1px var(--line); }
  .reaction:hover { border-color: transparent; }
  .reaction.mine { border-color: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--link) 55%, transparent); }
  /* Tap areas grown without moving the layout. */
  .msg-head .author { padding: 11px 0; margin: -11px 0; }
  .reply-ref { padding: 12px 0; margin: -12px 0 -10px; }
}

.msg-actions { position: absolute; right: var(--s-4); top: -18px; display: none; gap: 2px; padding: 3px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow); z-index: 1; }
@media (hover: hover) and (pointer: fine) { .msg:hover .msg-actions, .msg:focus-within .msg-actions { display: flex; } }
.msg-actions .icon-btn { width: 32px; height: 32px; }
.msg-actions .icon-btn .i { width: 18px; height: 18px; }
.msg.compact { margin-top: 0; cursor: pointer; }
.msg-edit { display: grid; gap: var(--s-1); }
.edit-hint { font-size: var(--fs-2xs); color: var(--fg-3); }

.jump-bar {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 2;
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 36px; padding: 0 var(--s-4); border: 1px solid var(--line); border-radius: var(--radius-full);
  background: var(--card); color: var(--fg); font-size: var(--fs-sm); font-weight: 500; box-shadow: var(--shadow); cursor: pointer; white-space: nowrap;
}
@media (pointer: coarse) { .jump-bar { min-height: 44px; } }
.typing-line { min-height: 24px; padding: 0 var(--s-4); font-size: var(--fs-xs); color: var(--fg-2); display: flex; align-items: center; gap: var(--s-2); overflow: hidden; white-space: nowrap; }
.typing-line > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.typing-dots { display: inline-flex; gap: 3px; flex: none; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ch .typing-dots { color: var(--fg-3); }

.reply-bar { display: flex; align-items: center; gap: var(--s-2); margin: 0 var(--s-4); padding: var(--s-1) var(--s-1) var(--s-1) var(--s-4); background: var(--muted); border-radius: var(--radius) var(--radius) 0 0; font-size: var(--fs-sm); color: var(--fg-2); min-width: 0; }
.reply-bar > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar strong { color: var(--fg); font-weight: 600; }
.reply-bar + .composer .composer-box { border-top-left-radius: 0; border-top-right-radius: 0; }
.no-send { margin: var(--s-2) var(--s-4) max(var(--s-4), env(safe-area-inset-bottom)); padding: var(--s-4); border-radius: var(--radius); border: 1px dashed var(--input); color: var(--fg-2); text-align: center; font-size: var(--fs-sm); }

.composer { position: relative; padding: 0 var(--s-4) max(var(--s-4), env(safe-area-inset-bottom)); }
.composer.compact { padding: 0; }
.composer-box { display: flex; align-items: flex-end; gap: var(--s-0); background: var(--card); border: 1px solid var(--input); border-radius: var(--radius-lg); padding: var(--s-1) var(--s-1) var(--s-1) var(--s-4); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.composer-box:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--ring); }
.composer-input { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: transparent; padding: 10px 0; font-size: 16px; line-height: 1.5; max-height: 40vh; min-height: 44px; }
.composer-input:focus-visible { outline: none; }
.composer-input::placeholder { color: var(--fg-3); }
.composer-box .icon-btn { width: 40px; height: 40px; margin-bottom: 2px; }
@media (pointer: coarse) { .composer-box .icon-btn { width: 44px; height: 44px; margin-bottom: 0; } }
.composer .counter { align-self: center; font-size: var(--fs-2xs); color: var(--fg-3); padding: 0 var(--s-1); }
.composer .counter.over { color: var(--danger); font-weight: 600; }
.composer .send { color: var(--fg); }
.suggest { position: absolute; left: var(--s-4); right: var(--s-4); bottom: calc(100% + var(--s-1)); z-index: 5; max-height: min(320px, 50dvh); overflow-y: auto; padding: var(--s-1); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.composer.compact .suggest { left: 0; right: 0; }
.suggest-item { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-2); border-radius: var(--radius-sm); cursor: pointer; min-height: 44px; font-size: var(--fs-base); }
.suggest-item.active, .suggest-item:hover { background: var(--muted); }
.suggest-item .sl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .sh { font-size: var(--fs-xs); color: var(--fg-2); flex: 0 1 auto; min-width: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .se { font-size: 1.25rem; width: 32px; text-align: center; }
.suggest-item > .i { color: var(--fg-2); width: 32px; }

/* emoji picker */
.emoji-picker { width: 368px; height: 420px; max-height: calc(100dvh - 16px); display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-2); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.modal .emoji-picker { width: auto; height: min(60dvh, 520px); border: 0; box-shadow: none; padding: 0; background: transparent; }
.emoji-cats { display: flex; gap: var(--s-0); overflow-x: auto; flex: none; scrollbar-width: none; }
.emoji-cats .icon-btn { font-size: 1.125rem; flex: none; width: 36px; height: 36px; }
@media (pointer: coarse) { .emoji-cats .icon-btn { width: 44px; height: 44px; } }
.emoji-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); align-content: start; overscroll-behavior: contain; }
@media (pointer: coarse) { .emoji-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); } }
.emoji-head { grid-column: 1 / -1; font-size: var(--fs-xs); font-weight: 600; color: var(--fg-2); padding: var(--s-3) var(--s-1) var(--s-1); position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal .emoji-head { background: var(--card); }
.emoji-cell { width: 100%; aspect-ratio: 1; border: 0; background: none; border-radius: var(--radius-md); font-size: 1.5rem; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.emoji-cell:hover { background: var(--muted); }
.quick-react { display: flex; justify-content: space-between; gap: var(--s-1); padding: var(--s-1) 0 var(--s-3); border-bottom: 1px solid var(--line); margin-bottom: var(--s-1); }
.quick-react .emoji-cell { width: 48px; height: 48px; aspect-ratio: auto; background: var(--muted); border-radius: 50%; flex: none; }
@media (max-width: 359px) { .quick-react .emoji-cell { width: 44px; height: 44px; } }
.pinned-pop { width: 440px; max-height: min(70vh, 640px); overflow-y: auto; }
.pinned-list { display: grid; padding-bottom: var(--s-2); }
.pinned-list > .empty { padding: var(--s-6) var(--s-4); }
.pinned-list .msg *, .search-hit .msg * { pointer-events: none; }
.search { display: grid; gap: var(--s-3); }
.search > .row { flex-wrap: wrap; }
.search > .row > .input[type=search] { flex: 2 1 220px; }
.search > .row > select.input { flex: 1 1 160px; }
.search-results { display: grid; gap: var(--s-1); max-height: 60dvh; overflow-y: auto; margin: 0 calc(-1 * var(--s-2)); }
.search-results > .muted, .search-results > .error { padding: var(--s-2); }
.search-hit { border-radius: var(--radius-md); cursor: pointer; padding: var(--s-1) 0 var(--s-2); }
.search-hit:hover { background: var(--muted); }
.search-hit .hit-ch { font-size: var(--fs-xs); font-weight: 500; color: var(--fg-2); padding: var(--s-1) var(--s-2) 0 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit .msg { margin-top: 2px; }
.search-hit .msg:hover { background: none; }

.type-cards { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin-bottom: var(--s-5); }
.type-card { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); padding: var(--s-4); border-radius: var(--radius); border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: var(--fs-base); font-weight: 500; transition: border-color .15s, background .15s; }
.type-card .i { color: var(--fg-2); width: 24px; height: 24px; }
.type-card:hover { background: var(--hover); }
.type-card[aria-pressed="true"] { border-color: var(--fg); background: var(--muted); box-shadow: inset 0 0 0 1px var(--fg); }

/* ---------- settings ---------- */
.settings { position: fixed; inset: 0 0 auto 0; height: var(--vvh, 100dvh); z-index: 40; display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); background: var(--bg); }
@media (min-width: 1400px) { .settings { grid-template-columns: 1fr minmax(0, 1060px) 1fr; } .set-side { grid-column: 1; } .set-main { grid-column: 2 / 4; } .set-nav { margin-left: auto; width: 280px; } }
.set-side { background: var(--sidebar); border-right: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.set-side > .bar { padding-top: 0; }
.set-nav { padding: var(--s-6) var(--s-3); display: grid; gap: 2px; align-content: start; }
.set-nav-title { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em; color: var(--fg-2); padding: 0 var(--s-3) var(--s-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-nav-sep { font-size: var(--fs-xs); font-weight: 600; color: var(--fg-2); padding: var(--s-4) var(--s-3) var(--s-1); }
.set-nav-item { display: flex; align-items: center; gap: var(--s-3); min-height: 40px; padding: 0 var(--s-3); border: 0; border-radius: var(--radius-md); background: none; text-align: left; cursor: pointer; color: var(--fg-2); font-size: var(--fs-base); }
.set-nav-item .i { width: 18px; height: 18px; }
.set-nav-item:hover { background: var(--hover); color: var(--fg); }
.set-nav-item[aria-current="true"] { background: var(--active); color: var(--fg); font-weight: 500; }
.set-nav-item .chev-r { display: flex; margin-left: auto; transform: rotate(180deg); color: var(--fg-3); }
.set-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.set-main > .bar { padding-left: var(--s-8); }
.set-title { margin: 0; font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-content { flex: 1; overflow-y: auto; padding: var(--s-8) max(var(--s-8), env(safe-area-inset-right)) 0 var(--s-8); width: 100%; overscroll-behavior: contain; }
.set-content > * { max-width: 760px; }
.set-content > .roles-layout { max-width: 980px; }
.set-content > :last-child:not(.sticky-actions) { margin-bottom: max(var(--s-10), env(safe-area-inset-bottom)); }
@media (max-width: 899px) {
  .settings { display: block; }
  .set-side, .set-main { position: absolute; inset: 0; transition: transform .22s var(--ease); }
  .set-side { border-right: 0; }
  .set-main > .bar { padding-left: var(--s-3); }
  .settings[data-view="nav"] .set-main { transform: translateX(100%); }
  .settings[data-view="page"] .set-side { transform: translateX(-30%); visibility: hidden; }
  .set-nav { padding: var(--s-3) var(--s-3); }
  .set-nav-item { min-height: 52px; font-size: var(--fs-md); }
  .set-nav-title { display: none; }
  .set-title { font-size: var(--fs-lg); }
  .set-content { padding: var(--s-5) max(var(--s-4), env(safe-area-inset-right)) 0 max(var(--s-4), env(safe-area-inset-left)); }
}
.set-section { margin-bottom: var(--s-8); }
.set-section h3 { font-size: var(--fs-md); font-weight: 600; margin: 0 0 var(--s-3); }
.set-section > .muted:not(.small) { font-size: var(--fs-base); }
.set-content > .row { flex-wrap: wrap; margin-bottom: var(--s-4); }
.set-content > p.muted.small { margin: 0 0 var(--s-4); }
.set-content > .input[type=search] { margin-bottom: var(--s-4); }
.sticky-actions { position: sticky; bottom: 0; z-index: 1; display: flex; gap: var(--s-2); justify-content: flex-end; flex-wrap: wrap; padding: var(--s-4) 0 max(var(--s-4), env(safe-area-inset-bottom)); margin-top: var(--s-2); background: var(--bg); border-top: 1px solid var(--line); }
.list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list:empty { display: none; }
.list > .muted { padding: var(--s-5) var(--s-4); text-align: center; }
.list-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); background: transparent; border: 0; border-bottom: 1px solid var(--line); text-align: left; width: 100%; min-height: 60px; font-size: var(--fs-base); color: var(--fg); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row.clickable { cursor: pointer; }
.list-row.clickable:hover { background: var(--hover); }
.list-row > .i { color: var(--fg-2); }
.list-row .grow > div:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .grow > .muted.small { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row > .chips { margin: 0; flex: none; max-width: 40%; justify-content: flex-end; }
.list-row > .btn { flex: none; }
.list.audit .list-row { align-items: flex-start; }
.list.audit .list-row > .avatar, .list.audit .list-row > .i { margin-top: 2px; }
.list.audit .grow > .muted.small { white-space: normal; }
.list + .btn { margin-top: var(--s-3); }
@media (max-width: 599px) { .list-row > .chips { display: none; } }
.roles-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--s-8); margin-top: var(--s-5); align-items: start; }
@media (max-width: 1099px) { .roles-layout { grid-template-columns: 1fr; gap: var(--s-5); } }
.role-list { display: grid; gap: 2px; position: sticky; top: 0; }
@media (max-width: 1099px) { .role-list { position: static; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-1); } }
.role-row { display: flex; align-items: center; gap: var(--s-2); min-height: var(--row); padding: 0 var(--s-1) 0 var(--s-3); border-radius: var(--radius-md); cursor: pointer; font-size: var(--fs-base); }
.role-row:hover { background: var(--hover); }
.role-row.active { background: var(--active); font-weight: 500; }
.role-row .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-row .row-btns { display: flex; }
.role-row .icon-btn { width: 28px; height: 28px; }
@media (pointer: coarse) { .role-row .icon-btn { width: 44px; height: 44px; } }
.role-row > .i { color: var(--fg-3); }
.role-editor .set-section { margin-bottom: var(--s-6); }
.role-editor .set-section h3 { margin-bottom: 0; }
.details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s-2) var(--s-5); margin: 0; font-size: var(--fs-base); }
.details dt { color: var(--fg-2); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.user-pick { margin-top: var(--s-3); max-height: 50dvh; overflow-y: auto; }
.user-pick .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Multi-select user picker (private channel members). */
.user-picker .user-pick { max-height: 40dvh; border: 1px solid var(--line); border-radius: var(--radius); }
.pick-row { min-height: 48px; }
.pick-row[aria-pressed="true"] { background: var(--hover); }
.pick-row:disabled { cursor: default; opacity: 1; }
.pick-check { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid var(--line); border-radius: 6px; color: var(--primary-fg); }
.pick-row[aria-pressed="true"] .pick-check { background: var(--primary); border-color: var(--primary); }
.pick-empty { padding: var(--s-3) var(--s-4); }
.member-list { margin-top: var(--s-3); border: 1px solid var(--line); border-radius: var(--radius); }
.member-list .list-row { min-height: 48px; }
.member-list .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal .set-section { margin-bottom: var(--s-6); }
.modal .set-section:last-child { margin-bottom: 0; }
.modal .set-section h3 { font-size: var(--fs-base); }
.modal .row > .avatar + div { min-width: 0; }
.modal-body > div > .row:first-child:has(> .avatar) { margin-bottom: var(--s-6); gap: var(--s-4); }

/* ---------- voice ---------- */
.voice-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.voice-body { flex: 1; display: flex; min-height: 0; }
.voice-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--stage); position: relative; }
.voice-lobby { flex: 1; display: flex; }
.voice-lobby .btn { margin-top: var(--s-4); min-width: 160px; }
.voice-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: var(--s-4); gap: var(--s-3); }
/* Tiles keep 16:9 and are as large as the stage allows: the grid is a size
   container and each tile's width comes from the columns/rows (layout()). */
.voice-grid {
  --cols: 1; --rows: 1; --gap: var(--s-3);
  flex: 1; min-height: 0; container-type: size;
  display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: var(--gap);
}
.voice-grid > .tile {
  width: calc(min((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols), (100cqh - (var(--rows) - 1) * var(--gap)) / var(--rows) * 16 / 9) - 1px);
  max-height: none;
}
.voice-strip { display: none; gap: var(--s-2); overflow-x: auto; flex: none; height: 120px; padding: var(--s-1); margin: calc(-1 * var(--s-1)); }
.voice-stage.has-pin .voice-strip { display: flex; }
.voice-strip .tile { width: 196px; height: 100%; aspect-ratio: auto; flex: none; }
.tile {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  background: var(--tile); border: 1px solid var(--line);
  display: grid; place-items: center; min-height: 0; aspect-ratio: 16 / 9; max-height: 100%; width: 100%;
  cursor: pointer; transition: box-shadow .12s;
  container-type: size;
}
.voice-stage.has-pin .voice-grid > .tile { aspect-ratio: auto; width: 100%; height: 100%; }
.tile.speaking { box-shadow: 0 0 0 2px var(--stage), 0 0 0 4px var(--ok-ring); }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile.screen video { object-fit: contain; }
.tile.mirror video { transform: scaleX(-1); }
.tile-face { position: relative; z-index: 1; }
.tile-face .avatar { --size: clamp(32px, 40cqh, var(--av-xl)); }
.tile-face > .i { width: 40px; height: 40px; color: var(--fg-3); }
.tile:not(.has-glow) .tile-face .avatar:not(.has-img) { background: var(--bg); color: var(--fg-2); box-shadow: var(--shadow-sm); }
.tile-label { position: absolute; left: var(--s-2); bottom: var(--s-2); max-width: calc(100% - 2 * var(--s-2)); display: flex; align-items: center; gap: var(--s-2); min-height: 28px; padding: 0 var(--s-3); border-radius: var(--radius-md); background: rgba(0, 0, 0, .62); color: #fff; font-size: var(--fs-sm); font-weight: 500; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tile-badges { display: flex; gap: var(--s-1); flex: none; }
.tile-badges:empty { display: none; }
.tile-badges .i { color: #e5e5e5; width: var(--icon-sm); height: var(--icon-sm); }
.tile-badges .i.red { color: #ff8a8a; }
.voice-strip .tile-label { font-size: var(--fs-xs); min-height: 24px; padding: 0 var(--s-2); left: 6px; bottom: 6px; max-width: calc(100% - 12px); }
.tile-actions { position: absolute; top: var(--s-2); right: var(--s-2); display: flex; gap: var(--s-1); opacity: 0; transition: opacity .12s; }
.tile-actions .icon-btn { background: rgba(0, 0, 0, .62); color: #fff; width: 36px; height: 36px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.tile-actions .icon-btn:hover { background: rgba(0, 0, 0, .8); }
.tile-actions .icon-btn .i { width: 18px; height: 18px; }
.tile:hover .tile-actions, .tile:focus-within .tile-actions { opacity: 1; }
@media (pointer: coarse) { .tile-actions { opacity: 1; } .tile-actions .icon-btn { width: 44px; height: 44px; } }
.voice-strip .tile-actions { display: none; }
.tile:fullscreen { border-radius: 0; aspect-ratio: auto; border: 0; }

.voice-controls { flex: none; display: flex; justify-content: center; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-3) var(--s-4) max(var(--s-5), env(safe-area-inset-bottom)); }
.ctl { width: 52px; height: 52px; padding: 0; border-radius: 50%; border: 1px solid var(--line); cursor: pointer; display: grid; place-items: center; background: var(--card); color: var(--fg); touch-action: manipulation; box-shadow: var(--shadow-sm); transition: background .15s, transform .1s; }
@media (pointer: coarse) { .ctl { width: 56px; height: 56px; } }
.ctl:hover { background: var(--muted); }
.ctl:active { transform: scale(.96); }
.ctl.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.ctl.active { background: var(--primary); color: var(--primary-fg); border-color: transparent; }
.ctl.hangup { background: var(--danger-solid); color: #fff; border-color: transparent; width: 64px; border-radius: var(--radius-full); }
@media (pointer: coarse) { .ctl.hangup { width: 72px; } }
.ctl.hangup:hover { background: color-mix(in srgb, var(--danger-solid) 88%, #000); }
.ctl .i { width: 22px; height: 22px; }
@media (max-width: 359px) {
  .voice-controls { gap: var(--s-2); padding-left: var(--s-3); padding-right: var(--s-3); }
  .ctl { width: 48px; height: 48px; }
  .ctl.hangup { width: 60px; }
}
.ctl:disabled { opacity: .4; cursor: not-allowed; }

.meter { position: relative; height: 10px; border-radius: var(--radius-full); background: var(--muted); overflow: hidden; margin: var(--s-2) 0; }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--fg-3); transition: width 60ms linear; }
.meter-fill.open { background: var(--ok-ring); }
.meter-threshold { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--warn); display: none; }
.meter.gated .meter-threshold { display: block; }

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