/* Yeetline UI
 *
 * Design notes, so future changes stay coherent:
 *
 * - No webfonts. This is a self-hosted LAN tool that must work on a network
 *   with no internet, so type comes from system stacks. The personality is
 *   carried by weight, tracking and the monospace face instead.
 * - Two accents with distinct jobs, not one decorative accent: amber is
 *   "you can act on this", mint is "this is cryptographically sound". They
 *   never swap roles.
 * - The signature element is the seal strip plus fingerprint-derived identity
 *   colours (see identityHue in crypto.js). A person's colour comes from their
 *   key, not their name — so if someone's key is swapped, their colour changes
 *   and you notice. It encodes something true rather than decorating.
 */

:root {
  --void: #0b0e14;
  --slab: #12161f;
  --slab-2: #171c27;
  --line: #232a38;
  --text: #e2e7f0;
  --muted: #8994a8;
  --amber: #f2b544;
  --mint: #56d3a6;
  --alarm: #ff6b6b;
  --own: #1b2740;
  --radius: 12px;
  --rail-w: 268px;
  --details-w: 300px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="light"] {
  --void: #f4f6fa;
  --slab: #ffffff;
  --slab-2: #eef1f7;
  --line: #dde3ed;
  --text: #141922;
  --muted: #5d6a80;
  --amber: #b97a06;
  --mint: #17795a;
  --alarm: #c0322b;
  --own: #e2ecff;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--void);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ── wordmark ─────────────────────────────────────────────────────── */
.wordmark {
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.035em;
}
.wordmark__y { color: var(--amber); }
.wordmark--small { font-size: 17px; }

/* ── connect ──────────────────────────────────────────────────────── */
.connect {
  min-height: 100%;
  display: grid;
  place-items: center;
  grid-template-rows: 1fr auto;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
           max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}
.connect__card {
  width: min(400px, 100%);
  background: var(--slab);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px 24px;
  align-self: center;
}
.connect__sub {
  color: var(--muted);
  font-size: 13.5px;
  margin: 6px 0 26px;
}
.field { display: block; margin-bottom: 14px; }
.field__label {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 11px 13px;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
}
.field input:focus-visible { border-color: var(--amber); }
.field__hint { font-size: 12.5px; color: var(--muted); margin: 0 0 16px; }

.notice { font-size: 13px; border-radius: 8px; padding: 9px 11px; margin: 0 0 14px; }
.notice--error {
  color: var(--alarm);
  background: color-mix(in srgb, var(--alarm) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--alarm) 35%, transparent);
}

.disclose { margin-top: 20px; font-size: 12.5px; color: var(--muted); }
.disclose summary { cursor: pointer; }
.disclose p { margin: 8px 0 0; }
.connect__foot { color: var(--muted); font-size: 12px; text-align: center; margin: 16px 0 0; }

/* ── buttons ──────────────────────────────────────────────────────── */
.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  background: var(--slab-2);
}
.btn--primary { width: 100%; background: var(--amber); color: #17130a; transition: filter 0.1s; }
.btn--primary:hover { filter: brightness(1.07); }
.btn--primary:disabled { opacity: 0.55; cursor: default; filter: none; }
.btn--ghost {
  width: auto;
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  padding: 7px 12px;
  font-size: 13px;
  transition: color 0.1s, border-color 0.1s;
}
.btn--ghost:hover { color: var(--text); border-color: var(--muted); }

.icon-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  font-size: 16px;
  line-height: 1;
  transition: background 0.1s, color 0.1s;
}
.icon-btn:hover { color: var(--text); background: var(--slab-2); }
.icon-btn--tiny { width: 22px; height: 22px; font-size: 15px; }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ── app shell ────────────────────────────────────────────────────── */
.app {
  height: 100%;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) 0;
}
.app.app--details { grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--details-w); }

/* ── rail ─────────────────────────────────────────────────────────── */
.rail {
  background: var(--slab);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Screen-edge chrome: clear the notch/Dynamic Island on an installed PWA.
     env() is 0 on devices with no cutout, so this is a no-op elsewhere. */
  padding: max(14px, env(safe-area-inset-top)) 16px 14px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.rail__section { padding: 12px 10px 4px; min-height: 0; }
.rail__section--grow { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.rail__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0 6px 6px;
}
.rail__empty { font-size: 12.5px; color: var(--muted); padding: 2px 6px 8px; margin: 0; }
.rail__foot {
  border-top: 1px solid var(--line);
  padding: 10px 16px max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.convlist, .people { list-style: none; margin: 0; padding: 0; }

/* ── rail filter ──────────────────────────────────────────────────── */
.rail__filter-wrap {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.rail__filter {
  width: 100%;
  padding: 6px 10px;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.1s;
}
.rail__filter:focus-visible { border-color: var(--amber); }
.rail__filter::placeholder { color: var(--muted); }


.conv {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.1s;
}
.conv:hover { background: var(--slab-2); }
.conv[aria-current="true"] { background: var(--slab-2); }
.conv[aria-current="true"] .conv__name { color: var(--text); font-weight: 600; }
.conv__name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv__badge {
  margin-left: auto;
  background: var(--amber);
  color: #17130a;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
}
.conv__badge--mention { background: var(--alarm); color: #2a0d0d; }
.conv__hash { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.conv--unjoined .conv__name { font-style: italic; }
.conv__join {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
}
.conv[aria-current="true"] .conv__join,
.conv:hover .conv__join { color: var(--text); border-color: var(--muted); }

.person {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--muted);
  transition: background 0.1s, color 0.1s;
}
.person:hover { background: var(--slab-2); color: var(--text); }
.person__state { margin-left: auto; font-size: 11px; }
.person__status {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90px;
}

/* Identity colour comes from the key fingerprint, not the name. */
.chip {
  width: 22px; height: 22px;
  border-radius: 7px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #0b0e14;
  background: hsl(var(--hue, 40) 62% 62%);
}
.chip--lg { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.dot--live { background: var(--mint); }
.dot--down { background: var(--alarm); }

/* ── conversation ─────────────────────────────────────────────────── */
.convo { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.convo__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(11px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 11px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.convo__title { min-width: 0; }
.convo__title h1 {
  font-size: 16px;
  margin: 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.convo__title p { margin: 0; font-size: 12px; color: var(--muted); }
.convo__back { display: none; }

/* seal strip — the signature element */
.seal {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 18px;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--mint);
  background: color-mix(in srgb, var(--mint) 8%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--mint) 18%, transparent);
  font-family: var(--mono);
}
.seal__mark {
  width: 7px; height: 7px;
  background: var(--mint);
  /* a small sealed-envelope lozenge rather than another circle */
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.seal--warn { color: var(--alarm); background: color-mix(in srgb, var(--alarm) 10%, transparent); }
.seal--warn .seal__mark { background: var(--alarm); }

/* ── message stream ───────────────────────────────────────────────── */
.stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 8px;
  min-height: 0;
  scroll-behavior: smooth;
  scroll-padding-bottom: 32px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
@media (prefers-reduced-motion: reduce) { .stream { scroll-behavior: auto; } }

.stream::-webkit-scrollbar,
.details::-webkit-scrollbar,
.rail__section--grow::-webkit-scrollbar { width: 6px; }
.stream::-webkit-scrollbar-track,
.details::-webkit-scrollbar-track,
.rail__section--grow::-webkit-scrollbar-track { background: transparent; }
.stream::-webkit-scrollbar-thumb,
.details::-webkit-scrollbar-thumb,
.rail__section--grow::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.daymark {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin: 18px 0 12px;
}
.daymark::before, .daymark::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Grouping: consecutive messages from one person collapse into a block, so
   the eye tracks who is speaking instead of re-reading the name each line.
   This is the specific flatness the Tkinter build was criticised for. */
.group { display: flex; gap: 10px; margin-bottom: 14px; }
.group--own { flex-direction: row-reverse; }
.group__body { min-width: 0; max-width: min(660px, 78%); }
.group--own .group__body { display: flex; flex-direction: column; align-items: flex-end; }
.group__head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.group--own .group__head { flex-direction: row-reverse; }
.group__who { font-weight: 650; font-size: 13.5px; }
.group__time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.bubble {
  background: var(--slab);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-top: 3px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.group--own .bubble { background: var(--own); border-color: transparent; }
.bubble--media { padding: 5px; }
.bubble img {
  display: block;
  max-width: 100%;
  max-height: 340px;
  border-radius: 8px;
  cursor: zoom-in;
}
.bubble code, .bubble pre {
  font-family: var(--mono);
  font-size: 13px;
}
.bubble pre {
  background: var(--void);
  border-radius: 8px;
  padding: 9px 11px;
  overflow-x: auto;
  margin: 4px 0;
  white-space: pre;
}
/* Inline code spans (single backticks) never nest inside .bubble pre — fenced
 * blocks render straight into <pre>, not <pre><code> — so this only ever
 * matches the inline form and can safely give it its own pill background. */
.bubble code {
  background: var(--void);
  border-radius: 4px;
  padding: 1px 5px;
}

.voice-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
}
.voice-player__btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--mint);
  color: var(--void);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.voice-player__wave { flex: 1 1 auto; display: block; }
.voice-player__time {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--muted);
}

/* ── sticker ───────────────────────────────────────────────────────── */
/* Deliberately not a .bubble — a sticker renders large and borderless,
 * unlike every other message kind, the same visual convention Telegram/
 * WhatsApp/Discord all use to set a sticker apart from ordinary content. */
.bubble--sticker { margin-top: 3px; }
.bubble--sticker img { display: block; width: 128px; height: 128px; object-fit: contain; }
.bubble--sticker-missing { color: var(--muted); font-style: italic; }

/* ── multi-file "album" bubble ────────────────────────────────────── */
.bubble--album { padding: 5px; }
.album__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: 240px;
}
.album__tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: var(--slab-2);
  cursor: pointer;
}
.album__tile.msg--flash { outline: 2px solid var(--mint); outline-offset: 2px; }
.album__tile img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: 0;
  cursor: zoom-in;
}
.album__tile-loading {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}
.album__tile-file {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--void);
}
.album__count {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.attach {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: inherit;
}
.attach__icon { font-family: var(--mono); color: var(--amber); }
.attach__size { color: var(--muted); font-size: 12px; }

.sysline {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 10px 0;
}
.sysline--warn { color: var(--alarm); }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 48px 20px;
  font-size: 13.5px;
}

.jump {
  position: absolute;
  right: 28px;
  bottom: 118px;
  background: var(--amber);
  color: #17130a;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.28);
  transition: filter 0.1s, box-shadow 0.1s;
}
.jump:hover { filter: brightness(1.07); box-shadow: 0 6px 20px rgb(0 0 0 / 0.35); }

.typing { height: 18px; padding: 0 18px; font-size: 12px; color: var(--muted); font-style: italic; }

/* ── attachment tray ──────────────────────────────────────────────── */
.tray {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 18px 8px;
  padding: 8px 10px;
  background: var(--slab);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.tray__items {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  flex: 0 1 auto;
  min-width: 0;
}
.tray__item { position: relative; flex: 0 0 auto; }
.tray__thumb {
  width: 40px; height: 40px;
  border-radius: 7px;
  background: var(--slab-2) center/cover no-repeat;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  flex: 0 0 auto;
}
/* One remove button per staged file — separate from the tray's overall
 * clear-all button, so picking five files and changing your mind about one
 * doesn't mean restaging the other four. */
.tray__item-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--alarm);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.tray__meta { min-width: 0; font-size: 13px; display: flex; flex-direction: column; }
.tray__meta > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray .icon-btn { margin-left: auto; }

/* ── composer ─────────────────────────────────────────────────────── */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px max(18px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 180px;
  padding: 10px 13px;
  background: var(--slab);
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  line-height: 1.45;
}
.composer textarea:focus-visible { border-color: var(--amber); outline: none; }
.composer__attach { flex: 0 0 auto; height: 40px; width: 36px; font-size: 20px; }
.composer__send { width: auto; flex: 0 0 auto; }
.composer__later { flex: 0 0 auto; height: 40px; width: 36px; font-size: 16px; }

/* ── scheduled messages ───────────────────────────────────────────── */
.scheduled { margin-bottom: 14px; }
.scheduled__empty { color: var(--muted); font-size: 12.5px; margin: 0; }
.scheduled__row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--slab-2);
}
.scheduled__row--stale { border-color: var(--amber); }
.scheduled__head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 4px;
}
.scheduled__conv { font-weight: 600; }
.scheduled__when { color: var(--muted); text-align: right; }
.scheduled__row--stale .scheduled__when { color: var(--amber); }
.scheduled__text {
  margin: 0 0 6px;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.scheduled__actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── details ──────────────────────────────────────────────────────── */
.details {
  background: var(--slab);
  border-left: 1px solid var(--line);
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.details:not([hidden]) {
  animation: panel-in 0.2s ease;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) { .details:not([hidden]) { animation: none; } }
.details__head { display: flex; align-items: center; justify-content: space-between; }
.details__head h2 { font-size: 14px; margin: 0; }
.details__blurb { font-size: 12.5px; color: var(--muted); }
.details__blurb--dim { font-size: 12px; }
.safety {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.9;
  letter-spacing: 0.06em;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: center;
}

/* ── toasts + drop veil ───────────────────────────────────────────── */
.toasts {
  position: fixed;
  left: 50%;
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
  pointer-events: none;
}
.toast {
  background: var(--slab);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  box-shadow: 0 8px 26px rgb(0 0 0 / 0.32);
  animation: toast-in 0.18s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
.toast--warn { border-color: color-mix(in srgb, var(--alarm) 45%, transparent); color: var(--alarm); }

.dropveil {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: color-mix(in srgb, var(--void) 78%, transparent);
  border: 2px dashed var(--amber);
  color: var(--amber);
  font-weight: 600;
  z-index: 50;
}
.dropveil--on { display: grid; }

/* ── message actions, reactions, status ───────────────────────────── */
.msg { position: relative; }
.msg__row { display: flex; align-items: flex-start; gap: 6px; }
.group--own .msg__row { flex-direction: row-reverse; }

.msg__actions {
  display: flex;
  gap: 2px;
  align-self: center;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.msg:hover .msg__actions,
.msg:focus-within .msg__actions { opacity: 1; }
.msg__act {
  border: 1px solid var(--line);
  background: var(--slab);
  color: var(--muted);
  border-radius: 7px;
  width: 26px;
  height: 26px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.1s, color 0.1s;
}
.msg__act:hover { color: var(--text); background: var(--slab-2); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.group--own .reactions { justify-content: flex-end; }
.react-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--slab);
  color: var(--text);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  cursor: pointer;
  line-height: 1.6;
  transition: border-color 0.1s, background 0.1s;
}
.react-chip:hover { border-color: var(--muted); }
.react-chip--mine { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 16%, transparent); }
.react-chip__custom { width: 16px; height: 16px; object-fit: contain; vertical-align: middle; }
.react-chip__count { font-variant-numeric: tabular-nums; }
.react-chip--pop { animation: reactpop 320ms cubic-bezier(.2, 1.5, .5, 1); }
@keyframes reactpop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .react-chip--pop { animation: none; } }

.bubble__edited { color: var(--muted); font-size: 10.5px; margin-left: 6px; font-style: italic; }
.bubble--gone { color: var(--muted); font-style: italic; }

.bubble__quote {
  display: flex;
  gap: 6px;
  padding: 4px 8px;
  margin-bottom: 6px;
  border-left: 3px solid var(--mint);
  background: color-mix(in srgb, var(--text) 6%, transparent);
  border-radius: 4px;
  font-size: 12.5px;
  cursor: pointer;
  overflow: hidden;
}
.bubble__quote:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.bubble__quote-who { font-weight: 600; color: var(--mint); flex-shrink: 0; }
.bubble__quote-text {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg__status { font-size: 10.5px; color: var(--muted); margin-top: 2px; text-align: right; }

.mention { color: var(--mint); font-weight: 600; }
.mention--me {
  color: var(--alarm);
  background: color-mix(in srgb, var(--alarm) 15%, transparent);
  border-radius: 3px;
  padding: 0 2px;
}
.msg--mentioned > .msg__row > .bubble {
  box-shadow: inset 3px 0 0 var(--alarm);
}

/* A spoiler hides its own text and, until revealed, forces every descendant
 * (a nested @mention span included) to the same transparent color — a child
 * like .mention sets its own `color`, which would otherwise win over the
 * inherited transparent and leak through the block. */
.spoiler {
  cursor: pointer;
  border-radius: 4px;
  background: var(--text);
  color: transparent;
}
.spoiler:not(.spoiler--revealed) * { color: inherit !important; }
.spoiler--revealed {
  cursor: text;
  background: transparent;
  color: inherit;
}

.bubble__pin { display: inline-block; margin-right: 4px; font-size: 12px; }
.pinned__actions { display: flex; gap: 6px; margin-top: 6px; }

.msg--flash > .msg__row > .bubble {
  animation: flashmsg 1.4s ease;
}
@keyframes flashmsg {
  0%, 40% { background: color-mix(in srgb, var(--amber) 30%, var(--slab)); }
  100% { background: var(--slab); }
}
.group--own .msg--flash > .msg__row > .bubble { animation-name: flashmsg-own; }
@keyframes flashmsg-own {
  0%, 40% { background: color-mix(in srgb, var(--amber) 30%, var(--own)); }
  100% { background: var(--own); }
}

.picker {
  position: fixed;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px;
  max-width: min(320px, 92vw);
  background: var(--slab);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 26px rgb(0 0 0 / 0.32);
}
.picker__strip { display: flex; flex-wrap: wrap; gap: 2px; }
.picker__row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.picker__label {
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 4px;
}
.picker__emoji {
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  border-radius: 7px;
  width: 30px;
  height: 30px;
  line-height: 1;
}
.picker__emoji:hover { background: var(--slab-2); }
.picker--list { min-width: 180px; }
.picker--stickers {
  flex-direction: row;
  flex-wrap: wrap;
  max-width: min(280px, 92vw);
  max-height: 260px;
  overflow-y: auto;
}
.picker__sticker {
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  padding: 2px;
  width: 60px;
  height: 60px;
}
.picker__sticker:hover { background: var(--slab-2); }
.picker__sticker img { width: 100%; height: 100%; object-fit: contain; display: block; }
.picker__conv {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
}
.picker__conv:hover { background: var(--slab-2); }

.picker--status { min-width: 240px; padding: 9px; gap: 8px; }
.status-form__row { display: flex; gap: 6px; }
.status-input {
  font: inherit;
  color: var(--text);
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  outline: none;
}
.status-input:focus-visible { border-color: var(--amber); }
.status-input--emoji { width: 52px; text-align: center; flex: 0 0 auto; }
.status-input--text { flex: 1; min-width: 0; }
.status-form__row select.status-input { width: 100%; }
.status-form__row .btn { flex: 1; }

.bubble__forwarded { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }

/* ── edit banner + settings ───────────────────────────────────────── */
.edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 18px 8px;
  padding: 7px 11px;
  font-size: 12.5px;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
  border-radius: 10px;
}
.edit-banner .btn { width: auto; padding: 4px 10px; }

.details__section { font-size: 14px; margin: 18px 0 0; }
.settings { margin: 10px 0; }
.setting { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.setting input { margin-top: 3px; flex: 0 0 auto; }
.setting__name { display: block; font-size: 13.5px; }
.setting__hint { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ── admin panel ──────────────────────────────────────────────────── */
.admin-block { margin-top: 6px; font-size: 13px; }
.admin__dl {
  display: grid;
  grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr);
  gap: 3px 10px;
  margin: 8px 0;
}
.admin__dl dt { color: var(--muted); font-size: 12px; }
.admin__dl dd { margin: 0; font-size: 12.5px; overflow-wrap: anywhere; }
.admin__users { width: 100%; border-collapse: collapse; margin: 8px 0 2px; font-size: 12.5px; }
.admin__users th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 11.5px;
  padding: 2px 6px 4px 0;
}
.admin__users td { padding: 2px 6px 2px 0; overflow-wrap: anywhere; }
.admin__actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.btn--small { width: auto; flex: 0 0 auto; padding: 2px 7px; font-size: 11.5px; border-radius: 6px; }
.admin__form { margin: 10px 0 4px; }
.admin__form[hidden] { display: none; }
.admin__label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.admin__form input[type="text"],
.admin__upload textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 9px;
  margin-bottom: 8px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.admin__upload textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.setting--tight { margin: 6px 0 10px; }
.admin__row { display: flex; flex-wrap: wrap; gap: 8px; }
.admin__row .btn { width: auto; flex: 0 0 auto; padding: 5px 11px; }
.admin__row--mb6 { margin-bottom: 6px; }
.admin__row--mb8 { margin-bottom: 8px; }
.admin__file-label { font-size: 12px; color: var(--muted); align-self: center; }
.btn--danger { color: var(--red, #d9534f); }
.admin__upload { margin-top: 12px; }
.admin__upload summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.admin__upload .btn { width: auto; padding: 5px 11px; }
.admin__warn { color: var(--amber); }
.admin__heading {
  margin: 14px 0 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.admin__chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 46px;
  margin: 6px 0 0;
  padding: 0 1px;
  border-bottom: 1px solid var(--line);
}
.admin__bar-slot { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; }
.admin__bar {
  width: 100%;
  min-height: 1px;
  background: var(--amber);
  border-radius: 2px 2px 0 0;
}
.admin__chart-note { margin: 4px 0 0; font-size: 11.5px; color: var(--muted); }
.admin__room-growth { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 0; }
.admin__room-growth-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 90px;
  align-items: center;
  gap: 10px;
}
.admin__room-growth-title {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin__room-growth-total { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.admin__spark {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 22px;
}
.admin__spark-bar {
  flex: 1 1 0;
  min-height: 2px;
  background: var(--amber);
  border-radius: 1px 1px 0 0;
}
.admin__note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.admin__note--bad { color: var(--amber); }

/* ── search ───────────────────────────────────────────────────────── */
.search {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  justify-content: center;
  padding-top: 8vh;
  background: color-mix(in srgb, var(--void) 62%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.search__panel {
  width: min(640px, 92vw);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: var(--slab);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 60px rgb(0 0 0 / 0.45);
}
.search__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.search__bar input[type="text"] {
  flex: 1;
  padding: 9px 12px;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  outline: none;
}
.search__bar input[type="text"]:focus-visible { border-color: var(--amber); }
.pinned__title { flex: 1; font-weight: 600; color: var(--text); }
.search__scope {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}
.search__results { overflow-y: auto; padding: 6px; }
.search__filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.search__filter { display: flex; align-items: center; gap: 5px; }
.search__filters select,
.search__filters input[type="date"] {
  font: inherit;
  color: var(--text);
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 6px;
}
.search__empty { color: var(--muted); text-align: center; padding: 26px; font-size: 13px; }
.search__saved {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.search__saved-list { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
.search__saved-empty { color: var(--muted); }
.search__saved-chip {
  display: inline-flex;
  align-items: center;
  background: var(--slab-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.search__saved-go,
.search__saved-rm {
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 3px 8px;
}
.search__saved-rm { color: var(--muted); padding-left: 2px; }
.search__saved-go:hover { color: var(--amber); }
.search__saved-rm:hover { color: var(--alarm); }
.search__hit {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 9px 11px;
  cursor: pointer;
  color: inherit;
}
.search__hit:hover { background: var(--slab-2); }
.search__meta { display: flex; gap: 8px; align-items: baseline; font-size: 12px; margin-bottom: 2px; }
.search__who { font-weight: 650; }
.search__where { color: var(--amber); }
.search__time { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.search__snippet { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.search__snippet mark { background: color-mix(in srgb, var(--amber) 40%, transparent); color: var(--text); border-radius: 3px; }

/* ── responsive ───────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; position: relative; }
  .app.app--details { grid-template-columns: 1fr; }
  .rail {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    z-index: 20;
    transform: translateX(-102%);
    transition: transform 0.18s ease;
  }
  .app--rail .rail { transform: none; box-shadow: 0 0 40px rgb(0 0 0 / 0.4); }
  .convo__back { display: block; }
  .details {
    position: absolute;
    inset: 0;
    z-index: 30;
    border-left: 0;
  }
  .group__body { max-width: 88%; }
  .jump { bottom: 128px; right: 16px; }

  /* The admin panel's tables (accounts, largest conversations) are too
     dense for a phone's width — collapse each row into a labelled stack
     instead of scrolling a table sideways. */
  .admin__users tr:first-child { position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .admin__users, .admin__users tr, .admin__users td { display: block; width: 100%; }
  .admin__users tr {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }
  .admin__users tr:last-child { border-bottom: 0; }
  .admin__users td { padding: 3px 0; }
  .admin__users td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    color: var(--muted);
  }
  .admin__users td.admin__actions { margin-top: 4px; }
  .admin__users .admin__actions { justify-content: flex-start; }
  .admin__users .btn--small { padding: 6px 11px; font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) { .rail { transition: none; } }

/* ── draft indicator ──────────────────────────────────────────────── */
.conv__draft {
  font-size: 11px;
  color: var(--amber);
  opacity: 0.75;
  margin-left: auto;
}

.conv__muted { font-size: 11px; opacity: 0.6; }
.conv__call { font-size: 11px; color: var(--mint); font-weight: 600; }

.dnd-times {
  display: flex;
  gap: 14px;
  padding: 4px 0 10px 30px;
  font-size: 12.5px;
  color: var(--muted);
}
.dnd-times label { display: flex; align-items: center; gap: 6px; }
.dnd-times input[type="time"] {
  font: inherit;
  color: var(--text);
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 6px;
}

/* ── last-read indicator ──────────────────────────────────────────── */
.conv__receipt {
  font-size: 10.5px;
  color: var(--muted);
  margin-left: auto;
  letter-spacing: -1px;
}

/* ── call overlay ─────────────────────────────────────────────────── */
.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--void) 80%, transparent);
}
.call-panel {
  width: min(320px, 90vw);
  background: var(--slab);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 20px 70px rgb(0 0 0 / 0.5);
  text-align: center;
}
/* A call carrying video widens the panel: the remote picture fills it, the
   local preview sits in the corner. */
.call-panel:has(.call-panel__video:not([hidden])) { width: min(760px, 94vw); }
.call-panel__video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.call-video__remote {
  width: 100%; height: 100%;
  object-fit: contain;
  background: var(--void);
}
.call-video__local {
  position: absolute;
  right: 10px; bottom: 10px;
  width: 26%;
  max-width: 180px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--void);
  object-fit: cover;
  transform: scaleX(-1);            /* a self-view reads better mirrored */
}
.call-panel__avatar {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: var(--slab-2);
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.call-panel__avatar .chip { width: 68px; height: 68px; font-size: 26px; border-radius: 50%; }
.call-panel__who { font-weight: 650; font-size: 18px; }
.call-panel__state { font-size: 13px; color: var(--muted); min-height: 1.5em; }
.call-panel__controls {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}
.camera-panel {
  width: min(420px, 92vw);
  background: var(--slab);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 20px 70px rgb(0 0 0 / 0.5);
}
.camera-panel__preview, .camera-panel__shot {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 14px;
  object-fit: cover;
  transform: scaleX(-1);   /* a self-facing camera reads better mirrored */
}
.camera-panel__shot { object-fit: contain; transform: none; }
.camera-panel__note { color: var(--muted); font-size: 13px; text-align: center; }
.camera-panel__controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.composer__recording {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: var(--alarm);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.recording-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: currentColor;
  animation: recording-pulse 1.1s ease-in-out infinite;
}
@keyframes recording-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
.composer__mic--active { color: var(--alarm); }
.call-btn {
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 0;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.1s;
}
.call-btn:hover { filter: brightness(1.15); }
.call-btn--accept { background: var(--mint); color: #0a2e22; }
.call-btn--end    { background: var(--alarm); color: #fff; }
.call-btn--mute   { background: var(--slab-2); color: var(--text); border: 1px solid var(--line); }
.call-btn--cam,
.call-btn--share  { background: var(--slab-2); color: var(--text); border: 1px solid var(--line); }
.call-btn--muted  { background: color-mix(in srgb, var(--alarm) 30%, var(--slab-2)); color: var(--alarm); }
.call-btn--on     { background: color-mix(in srgb, var(--mint) 30%, var(--slab-2)); color: var(--mint); }
.call-btn--record { background: var(--slab-2); color: var(--text); border: 1px solid var(--line); }
.call-btn--recording {
  background: color-mix(in srgb, var(--alarm) 30%, var(--slab-2));
  color: var(--alarm);
  animation: recording-pulse 1.1s ease-in-out infinite;
}
.call-panel__recording-note {
  font-size: 12px;
  color: var(--alarm);
  font-weight: 600;
}

/* ── custom emoji in admin panel ──────────────────────────────────── */
.admin__emoji {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}
.admin__emoji-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--slab-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 7px 3px 4px;
  font-size: 12px;
}
.admin__emoji-chip img { width: 20px; height: 20px; object-fit: contain; }
.admin__emoji-chip button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0 0 3px;
  font-size: 12px;
  line-height: 1;
}
.admin__emoji-chip button:hover { color: var(--alarm); }
.admin__emoji-empty { color: var(--muted); font-size: 12.5px; }
.admin__audit-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.admin__audit-row {
  display: flex;
  gap: 10px;
  padding: 6px 10px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}
.admin__audit-row:last-child { border-bottom: 0; }
.admin__audit-time {
  color: var(--muted);
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.admin__audit-what { flex: 1 1 auto; word-break: break-word; }
.picker__custom {
  width: 28px; height: 28px;
  object-fit: contain;
  border-radius: 5px;
  cursor: pointer;
}
.picker__emoji--custom { padding: 2px; }
.admin__emoji-upload input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 9px;
  margin-bottom: 8px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* ── username availability status ──────────────────────────────── */
.field__status {
  display: block;
  font-size: 12px;
  margin-top: 3px;
  color: var(--muted);
}
.field__status--ok  { color: var(--mint); }
.field__status--bad { color: var(--alarm); }

/* ── password strength meter ───────────────────────────────────── */
.field__strength { margin: -8px 0 14px; }
.strength-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.strength-bar > div {
  height: 100%;
  border-radius: 2px;
  transition: width 0.2s, background 0.2s;
}
.strength--weak    { background: var(--alarm); }
.strength--fair    { background: var(--amber); }
.strength--strong  { background: var(--mint); }
.strength--vstrong { background: var(--mint); filter: brightness(1.15); }
.strength-label { font-size: 11.5px; color: var(--muted); }

/* ── admin promotion block ─────────────────────────────────────── */
.promote-block { margin-top: 6px; font-size: 13px; }
.promote-block__input {
  flex: 1 1 0;
  padding: 7px 9px;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  min-width: 0;
}
.promote-block__input:focus-visible { border-color: var(--amber); outline: none; }

/* ── admin / mod badges ─────────────────────────────────────────── */
.badge { margin-left: 4px; font-size: 11px; line-height: 1; vertical-align: middle; cursor: default; }
.badge--admin { color: #f5c518; }
.badge--mod   { color: var(--mint); }

/* ── devices (settings) ─────────────────────────────────────────── */
.devices { margin: 4px 0 10px; }
.device-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
}
.device-row__meta { flex: 1 1 auto; min-width: 0; }
.device-row__name { display: block; font-size: 13px; }
.device-row__seen { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.device-row__live { color: var(--mint); }
.device-row .btn { width: auto; flex: 0 0 auto; padding: 4px 9px; font-size: 12px; }

/* ── admin configuration panel ──────────────────────────────────── */
.admin__config { margin: 4px 0 10px; }
.config-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.config-row:last-child { border-bottom: 0; }
.config-row__label { flex: 1 1 auto; min-width: 0; }
.config-row__hint { display: block; color: var(--muted); font-size: 11.5px; }
.config-row input {
  width: 9em;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.config-row .btn { width: auto; flex: 0 0 auto; padding: 4px 9px; font-size: 12px; }
.config-row--overridden .config-row__label::after {
  content: " •";
  color: var(--amber);
}

/* ── admin log viewer ───────────────────────────────────────────── */
.admin__logs {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
}
.log-row { display: flex; gap: 8px; padding: 3px 8px; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: 0; }
.log-row__time { color: var(--muted); flex: 0 0 auto; }
.log-row__level { flex: 0 0 4.5em; }
.log-row__level--warning { color: var(--amber); }
.log-row__level--error { color: var(--red, #d9534f); }
.log-row__msg { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.admin__logs-empty { padding: 10px; color: var(--muted); font-size: 12px; }

/* ── group call grid ────────────────────────────────────────────── */
.call-panel:has(.call-grid:not([hidden])) { width: min(1100px, 96vw); }
.call-grid {
  width: 100%;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.call-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--void);
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.call-tile video { width: 100%; height: 100%; object-fit: cover; }
.call-tile--novideo video { display: none; }
.call-tile .chip { width: 56px; height: 56px; font-size: 22px; border-radius: 50%; }
.call-tile--self video { transform: scaleX(-1); }
.call-tile--screen video { object-fit: contain; transform: none; }
.call-tile__name {
  position: absolute;
  left: 8px; bottom: 6px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.call-tile--speaking { border-color: var(--mint); }
.call-tile--recording { border-color: var(--alarm); }
/* Active speaker / pinned layout: the featured tile takes the stage, the
 * rest shrink to a film strip underneath. */
.call-grid--speaker { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.call-grid--speaker .call-tile { aspect-ratio: 16 / 10; }
.call-grid--speaker .call-tile--lead {
  grid-column: 1 / -1;
  order: -1;
  aspect-ratio: 16 / 9;
}
.call-grid--speaker .call-tile--lead video { object-fit: contain; }
.convo__groupcall { width: auto; padding: 5px 12px; white-space: nowrap; }
.convo__groupcall--live { color: var(--mint); border-color: var(--mint); }
.setting--connect { margin: 0 0 14px; text-align: left; }

/* First-run nudge: an account whose keys are browser-only can opt into sync
   so it works on other devices. Fixed to the bottom, above the composer. */
.sync-nudge {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  z-index: 60;
  max-width: 560px;
  width: calc(100% - 32px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--panel, #171c28);
  border: 1px solid var(--accent, #5b8def);
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
  font-size: 13px;
  color: var(--text, #e6e9ef);
}
.sync-nudge span { flex: 1 1 260px; }
.sync-nudge .btn { flex: 0 0 auto; }
