/* ============================================================
   Tact — call overlay (shared by sub + dominant surfaces)
   Deliberately dark regardless of theme: it's a video surface.
   ============================================================ */

.call-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: #0c0d12; color: #f2f3f7;
  display: flex; flex-direction: column;
  font-family: 'Nunito', system-ui, sans-serif;
}
.call-picker-lock { position: fixed; inset: 0; z-index: 1000; cursor: wait; }

.call-top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; flex: 0 0 auto;
}
.call-top h2 { font-family: 'Fredoka', sans-serif; font-size: 18px; margin: 0; font-weight: 600; }
.call-top .call-sub { font-size: 12px; opacity: .65; }
.call-top .sp { flex: 1; }

.call-btn {
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06);
  color: inherit; border-radius: 12px; padding: 8px 12px; cursor: pointer;
  font: inherit; font-size: 14px; line-height: 1;
  transition: background .15s, border-color .15s;
}
.call-btn:hover { background: rgba(255,255,255,.12); }
.call-btn.on { background: #3f6df0; border-color: #3f6df0; }
.call-btn.danger { background: #d64550; border-color: #d64550; }
.call-btn.join { background: #23864b; border-color: #23864b; font-weight: 800; }
.call-btn.warn.on { background: #b58a1f; border-color: #b58a1f; }
.call-btn:disabled { opacity: .45; cursor: default; }

@media (max-width: 1219px) {
  .call-top { gap: 7px; }
  .call-top .call-btn {
    position: relative; flex: 0 0 38px; width: 38px; height: 36px;
    display: grid; place-items: center; padding: 0; font-size: 17px;
  }
  .call-top .call-btn .lbl { display: none; }
  .call-top .call-btn[data-label]::after {
    content: attr(data-label); position: absolute; top: calc(100% + 7px); right: 0;
    z-index: 80; display: none; width: max-content; max-width: min(240px, calc(100vw - 16px));
    box-sizing: border-box; padding: 6px 9px; border: 1px solid rgba(255,255,255,.16);
    border-radius: 5px; background: #171922; color: #f2f3f7;
    box-shadow: 0 5px 18px rgba(0,0,0,.45); font-size: 11px; font-weight: 700;
    line-height: 1.25; text-align: right; white-space: normal; pointer-events: none;
  }
  .call-top .call-btn[data-label]:hover::after,
  .call-top .call-btn[data-label]:focus-visible::after { display: block; }
}

/* ---- stage: focused tile + right column (strip on top, docked panel
   below) + rotated tab rail on the far right edge ---- */
.call-stage { flex: 1; display: flex; gap: 8px; min-height: 0; padding: 0 14px 12px; position: relative; }
.call-stage.idle { display: block; padding-bottom: 64px; }
.call-idle-board { height: 100%; max-width: 1180px; margin: 0 auto; position: relative; }
.call-idle-board > .call-pane { height: 100%; border-radius: 8px; }
.call-pane { position: relative; }
.call-pane-title { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.call-pane-title h3 { margin: 0; }
.call-pane-title .sp { flex: 1; }
.call-pane-action { width: 30px; height: 30px; padding: 0; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: inherit; font-size: 17px; cursor: pointer; border-radius: 5px; }
.call-pane-action { display: grid; place-items: center; line-height: 1; }
.call-pane-action svg { display: block; }
.call-pane-action:disabled { opacity: .3; cursor: not-allowed; }
.call-history { position: fixed; right: auto; z-index: 900; overflow: auto; background: #171922; color: #f2f3f7; border: 1px solid rgba(255,255,255,.14); padding: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.65); }
.call-history-head { display: flex; align-items: center; margin-bottom: 4px; }
.call-history-head h3 { margin: 0; flex: 1; font: 600 14px 'Fredoka', sans-serif; }
.call-history-head button { border: 0; background: none; color: inherit; cursor: pointer; }
.call-history-row { display: flex; align-items: center; gap: 9px; padding: 8px 4px; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.call-history-row .ic { width: 24px; height: 24px; display: grid; place-items: center; font-size: 18px; }
.call-history-row .ic img { max-width: 22px; max-height: 22px; }
.call-history-row .tx { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.call-history-row strong { font-size: 13px; }
.call-history-row small { opacity: .55; }
.call-history time { opacity: .65; }
.manage-full { z-index: 700; }
.manage-window { width: min(1200px, calc(100% - 24px)); height: calc(100% - 24px); display: flex; flex-direction: column; }
.manage-window .sp, .manage-item .sp { flex: 1; }
.unified-manage { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.unified-manage .dom-grid-head { position: sticky; top: -16px; z-index: 10; padding: 16px 0 10px; background: var(--surface); }
.unified-manage .btn-edit-item .mini:last-child { font-size: 19px; padding: 5px 7px; }
.unified-manage .btn-edit-item .mini[title^="Move"] { filter: grayscale(1); }
.manage-add { cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.manage-add:hover { background: var(--bg-2); border-color: var(--ink-faint); color: var(--ink); }
.manage-add { min-height: 54px; border: 1px dashed var(--line); background: transparent; color: inherit; border-radius: 6px; }
.move-dialog { width: min(420px, calc(100% - 24px)); }
.move-list { display: grid; gap: 7px; }
.move-list > button { display: flex; align-items: center; gap: 9px; min-height: 42px; text-align: left; }
.move-list .dot { width: 12px; height: 12px; border-radius: 50%; }
.tact-wordmark { display: flex; align-items: center; gap: 8px; }
.tact-wordmark img { width: 28px; height: 28px; border-radius: 6px; }
.call-presence { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255,255,255,.07); }
.call-presence.offline { background: #d64550; }
.call-presence.joined { background: #45be72; }
.call-presence.idle { background: #4b91e2; }
.call-person { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12px; font-weight: 800; }
.call-main { flex: 1; min-width: 0; position: relative; }
.call-side {
  flex: 0 0 280px; min-width: 280px; min-height: 0;
  display: flex; flex-direction: column; gap: 10px;
  /* Reserve the bottom-right corner where the tab rail floats. */
  padding-bottom: 52px;
}
.call-splitter {
  flex: 0 0 6px; align-self: stretch; cursor: col-resize;
  border-radius: 3px; background: rgba(255,255,255,.07);
  touch-action: none;
}
.call-splitter:hover { background: rgba(255,255,255,.18); }
/* The strip keeps its natural size while there's room; when a docked panel
   is at its minimum height the strip yields (scrolls) rather than crushing
   the panel below usability. */
.call-strip {
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; flex: 0 1 auto; min-height: 0; max-height: 100%; padding-bottom: 2px;
}
.call-strip .call-tile { flex: 0 0 auto; }

/* Floating panels (settings / receiving / stats): overlays anchored to the
   bottom-right, above the tab rail, allowed to sit on top of the stage. */
.call-float {
  position: absolute; right: 14px; bottom: 64px; z-index: 20;
  width: min(340px, calc(100% - 28px));
  max-height: calc(100% - 76px);
  display: flex;
}
.call-float.big { width: min(440px, calc(100% - 28px)); }
.call-float .call-pane { flex: 1 1 auto; box-shadow: 0 12px 40px rgba(0,0,0,.55); }
/* Settings: sized by content — all tabs render stacked in one grid cell
   (.call-settings-stack), so the panel is exactly as tall as its tallest tab
   and switching tabs never resizes it. Capped by the stage and the visible
   viewport; past the cap the pane scrolls internally. */
.call-float.big {
  height: auto;
  max-height: calc(100% - 76px);
  max-height: min(calc(100% - 76px), calc(100dvh - 140px));
}
.call-settings-stack { display: grid; }
.call-settings-stack > div { grid-area: 1 / 1; min-width: 0; }
.call-settings-stack > div[data-off] { visibility: hidden; pointer-events: none; }

/* Segmented switch groups + bitrate sliders (quality tab) */
.call-seg {
  display: flex; margin: 4px 0 8px;
  border: 1px solid rgba(255,255,255,.14); border-radius: 10px;
  overflow: hidden; background: rgba(255,255,255,.04);
}
.call-seg button {
  flex: 1 1 0; border: none; background: none; color: inherit; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 700; padding: 8px 4px;
  white-space: nowrap;
}
.call-seg button + button { border-left: 1px solid rgba(255,255,255,.12); }
.call-seg button:hover:not(:disabled) { background: rgba(255,255,255,.08); }
.call-seg button.on { background: #3f6df0; }
.call-seg button:disabled { opacity: .32; cursor: default; }

.call-slider { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; }
.call-slider input[type=range] { flex: 1 1 auto; accent-color: #3f6df0; }
.call-slider span { flex: 0 0 auto; font-size: 12px; font-weight: 800; min-width: 74px; text-align: right; }
.call-camera-exposure-auto { margin-top: 8px; }
.call-camera-exposure { display: grid; grid-template-columns: 62px minmax(0, 1fr) 68px; align-items: center; gap: 8px; font-size: 12px; }
.call-camera-exposure input { min-width: 0; width: 100%; accent-color: #3f6df0; }
.call-camera-exposure output { text-align: right; font-variant-numeric: tabular-nums; }

/* Centered upload-ceiling readout. Class names are fully prefixed — the
   surrounding PWA has global `.sub` / `.num`-style classes that must not
   bleed in here. */
.call-ceiling { text-align: center; margin-top: 14px; }
.call-ceiling-num { font-size: 22px; font-weight: 800; }
.call-ceiling-sub { font-size: 12px; opacity: .65; margin-top: 2px; min-height: 0; }

/* Icon tab rail: a single connected segmented control floating in the
   bottom-right corner — an overlay, so the sidebar keeps its full width
   (it reserves this corner via .call-side padding). */
.call-rail {
  position: absolute; right: 14px; bottom: 12px; z-index: 15;
  display: flex; gap: 8px;
}
.call-rail-solo {
  border: 1px solid rgba(255,255,255,.14); border-radius: 12px;
  background: rgba(20,22,30,.85); color: inherit; cursor: pointer;
  font-size: 17px; line-height: 1; padding: 11px 12px;
}
.call-rail-solo:hover { background: rgba(255,255,255,.10); }
.call-rail-solo.on { background: #3f6df0; }
.call-rail-group {
  display: flex; flex-direction: row;
  border: 1px solid rgba(255,255,255,.14); border-radius: 12px;
  overflow: hidden; background: rgba(20,22,30,.85);
}
.call-rail-group button {
  border: none; background: none; color: inherit; cursor: pointer;
  font-size: 17px; line-height: 1; padding: 11px 12px;
}
.call-rail-group button + button { border-left: 1px solid rgba(255,255,255,.12); }
.call-rail-group button:hover { background: rgba(255,255,255,.10); }
.call-rail-group button.on { background: #3f6df0; }
.call-rail-group button:disabled,
.call-rail-group button:disabled:hover { opacity: .28; cursor: not-allowed; background: none; filter: grayscale(1); }

@media (max-width: 720px) {
  .call-stage { flex-direction: column; padding: 0 8px 8px; }
  .call-side { flex: 0 0 auto; min-width: 0; padding-bottom: 0; }
  .call-splitter { display: none; }
  .call-side[style] { flex: 0 0 auto !important; }
  .call-strip { flex: 0 0 110px; max-height: none; flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .call-strip .call-tile { flex: 0 0 150px; }
  .call-rail { position: static; justify-content: center; margin-top: 2px; }
  .call-top .call-sub { display: none; }
}

/* ---- tiles ---- */
.call-tile {
  position: relative; border-radius: 14px; overflow: hidden;
  background: #191b23; border: 1px solid rgba(255,255,255,.08);
  aspect-ratio: 16 / 9; cursor: pointer; user-select: none;
}
/* The main tile is clickable too (opens the grid overview), so it keeps a
   pointer cursor like every other actionable tile. */
.call-main .call-tile { position: absolute; inset: 0; aspect-ratio: auto; cursor: pointer; }
.call-tile video { width: 100%; height: 100%; object-fit: cover; background: #000; display: block; }
.call-tile.screen video { object-fit: contain; }
.call-main .call-tile video { object-fit: contain; }

.call-tile .ph {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
}
.call-tile .ph .big { font-size: 34px; }
.call-tile .ph .who { font-weight: 800; font-size: 15px; }
.call-tile .ph .dev { font-size: 12px; opacity: .6; }

.call-tile .tag {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px);
  background: rgba(0,0,0,.55); border-radius: 8px; padding: 3px 8px;
  font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.call-tile .corner {
  position: absolute; right: 8px; top: 8px; display: flex; gap: 6px;
}
.call-tile .corner .call-btn { padding: 4px 8px; font-size: 12px; border-radius: 8px; }
.call-tile.me { outline: 2px solid rgba(63,109,240,.55); outline-offset: -2px; }

/* ---- persistent status subtitle ("gone to the shop") ---- */
.call-status-msg {
  position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%);
  max-width: 88%; z-index: 5; pointer-events: none;
  background: rgba(0,0,0,.62); border-radius: 10px; padding: 5px 12px;
  font-size: 13px; font-weight: 800; line-height: 1.35; text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.call-main .call-tile .call-status-msg { font-size: 21px; padding: 8px 18px; border-radius: 12px; }
.call-fs-minis .call-tile .call-status-msg { font-size: 11px; padding: 3px 8px; }

/* ---- status editor: floats top-center over the stage ---- */
.call-status-edit {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 35; display: flex; gap: 8px; align-items: center;
  width: min(460px, calc(100% - 28px));
  background: #171922; border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px; padding: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
}
.call-status-edit input {
  flex: 1 1 auto; min-width: 0; padding: 9px 12px; border-radius: 10px;
  background: #0f1118; color: inherit; border: 1px solid rgba(255,255,255,.16);
  font: inherit; font-size: 14px;
}
.call-status-edit .call-btn { flex: 0 0 auto; }

/* ---- bottom bar ---- */
.call-bar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 12px 14px; flex-wrap: wrap;
}
.call-bar .grp { display: flex; gap: 8px; align-items: center; }

/* Compact one-row bar on phones: icons only, labels hidden. */
@media (max-width: 720px) {
  .call-bar { gap: 6px; padding: 10px 8px; flex-wrap: nowrap; }
  .call-bar .grp { gap: 5px; }
  .call-bar .call-btn { padding: 10px 11px; font-size: 16px; }
  .call-bar .lbl, .call-top .lbl { display: none; }
}

/* ---- panel card (shared look) ----
   In .call-float it's an overlay; in .call-side (soundboard only) it takes
   just the leftover space under the strip — never covering a feed. */
.call-pane {
  min-height: 0; overflow-x: hidden; overflow-y: auto;
  background: #171922; border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px; padding: 14px;
  text-align: left;
}
.call-sounds-pane { container-type: inline-size; }
.call-sounds-sticky { position: sticky; top: -14px; z-index: 8; margin: -14px -14px 8px; padding: 14px 14px 6px; background: #171922; }
.call-sounds-sticky .call-pane-title { margin-bottom: 0; min-width: 0; min-height: 30px; }
.call-sounds-sticky .call-pane-title h3 { margin: 0; display: flex; align-items: center; }
.call-sb-filter { min-width: 0; height: 30px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid rgba(255,255,255,.14); border-radius: 5px; background: #0f1118; color: rgba(255,255,255,.65); }
.call-sb-filter input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: #f2f3f7; font: inherit; font-size: 12px; }
.call-sb-filter input::-webkit-search-cancel-button { cursor: pointer; }
.call-sb-filter.inline { flex: 1 1 auto; margin: 0 8px; }
.call-sb-filter.compact { display: none; margin-top: 8px; }
.call-pane-action.filter-toggle { display: none; }
.call-pane-action.on { background: #3f6df0; border-color: #3f6df0; }

/* ---- volume popover (portal; fixed so tiles/panes never clip it) ---- */
.call-voldrop {
  position: fixed; z-index: 950; width: 200px;
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: #171922; color: #f2f3f7; border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.65);
}
.call-voldrop .ic { font-size: 15px; line-height: 1; }
.call-voldrop input[type="range"] { flex: 1; min-width: 0; }
.call-voldrop output { font-size: 12px; opacity: .8; min-width: 34px; text-align: right; }

/* ---- master volume row (settings → devices) ---- */
.call-volume-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.call-volume-row .ic { font-size: 15px; line-height: 1; }
.call-volume-row input[type="range"] { flex: 1; min-width: 0; }
.call-volume-row output { font-size: 12px; opacity: .8; min-width: 38px; text-align: right; }
@container (max-width: 430px) {
  .call-sb-filter.inline { display: none; }
  .call-sb-filter.compact { display: flex; }
  .call-pane-action.filter-toggle { display: grid; margin-left: auto; }
}
.call-side .call-pane { flex: 1 1 0; min-height: 150px; }

/* Mobile: floating panels become a bottom sheet above the rail + bar; the
   docked soundboard gets a height cap in the column flow. */
@media (max-width: 720px) {
  .call-float {
    position: fixed; left: 8px; right: 8px; bottom: 66px;
    width: auto; max-height: 50vh; z-index: 25;
  }
  .call-float.big { width: auto; }
  .call-side .call-pane { flex: 0 0 auto; max-height: 40vh; }
}
.call-pane h3 { margin: 0 0 10px; font-family: 'Fredoka', sans-serif; font-size: 16px; }
.call-pane label.row {
  display: flex; align-items: center; gap: 10px; margin: 4px 0;
  font-size: 14px; min-height: 42px; cursor: pointer;
  border-radius: 10px; padding: 0 8px;
}
.call-pane label.row:hover { background: rgba(255,255,255,.05); }
.call-pane label.row input[type=checkbox] {
  width: 20px; height: 20px; flex: 0 0 auto; accent-color: #3f6df0;
}

/* ---- settings tabs ---- */
.call-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.call-tabs button {
  flex: 1; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.05);
  color: inherit; font: inherit; font-size: 13px; font-weight: 700;
}
.call-tabs button.on { background: #3f6df0; border-color: #3f6df0; }
.call-pane select {
  width: 100%; margin: 4px 0 10px; padding: 8px; border-radius: 10px;
  background: #0f1118; color: inherit; border: 1px solid rgba(255,255,255,.14);
  font: inherit; font-size: 13px;
}
.call-pane .hint { font-size: 12px; opacity: .6; margin: 2px 0 8px; }

.call-meter { height: 8px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; margin: 6px 0 10px; }
.call-meter i { display: block; height: 100%; width: 0%; background: #52c273; transition: width .08s linear; }
.call-processing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; margin: 0 0 8px; }
.call-processing-grid label.row { min-height: 36px; margin: 0; padding: 0 5px; font-size: 12px; }

/* ---- soundboard ---- */
.call-sb-cat { margin-bottom: 6px; }
.call-sb-cat > button {
  width: 100%; text-align: left; background: none; border: none; color: inherit;
  font: inherit; font-weight: 800; font-size: 13px; padding: 6px 4px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.call-sb-cat .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
/* Discord-style sound buttons: icon left, label right, uniform width from
   the grid — at least two per row in the docked column. */
.call-sb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; padding: 4px 0 8px; }
.call-sb-grid button {
  border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 8px;
  background: rgba(255,255,255,.05); color: inherit; font: inherit; font-size: 12px;
  cursor: pointer; display: flex; flex-direction: row; align-items: center; gap: 6px;
  min-width: 0; text-align: left;
}
.call-sb-grid button:hover { background: rgba(255,255,255,.12); }
.call-sb-grid button.locked, .call-sb-grid button.locked:hover { cursor: not-allowed; background: none; opacity: .55; }
.call-sb-grid button.filter-match { position: relative; z-index: 1; background: rgba(63,109,240,.28); border-color: #79a1ff; box-shadow: 0 0 0 2px rgba(121,161,255,.42), 0 0 18px rgba(63,109,240,.55); transform: translateY(-1px); }
.call-sb-grid .ic { width: 20px; height: 20px; display: grid; place-items: center; font-size: 16px; flex: 0 0 20px; line-height: 1; overflow: hidden; }
.call-sb-grid .ic img { width: 18px; height: 18px; max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.call-sb-grid .tx { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- label gate / errors ---- */
.call-center {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.call-card {
  width: min(420px, 100%); background: #171922; border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; padding: 22px;
}
.call-card h3 { margin: 0 0 8px; font-family: 'Fredoka', sans-serif; }
.call-card p { font-size: 14px; opacity: .75; margin: 0 0 14px; }
.call-card input[type=text] {
  width: 100%; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px;
  background: #0f1118; color: inherit; border: 1px solid rgba(255,255,255,.16);
  font: inherit;
}
.call-card .actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---- grid overview ----
   The container is measured in JS, which picks the column count that
   maximizes tile size; flexbox here centers the resulting block. */
.call-grid {
  flex: 1; min-height: 0; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 14px; overflow: hidden;
}
.call-grid-inner {
  display: grid; gap: 10px;
  justify-content: center; align-content: center;
  max-height: 100%; max-width: 100%; overflow: auto;
}
.call-grid .call-tile { cursor: grab; touch-action: none; }
.call-grid .call-tile:active { cursor: grabbing; }
.call-grid .call-tile.dragging { opacity: .5; outline: 2px dashed rgba(63,109,240,.8); outline-offset: -2px; }

/* ---- fullscreen: focused tile + draggable mini-strip ---- */
.call-fsbtn {
  position: absolute; right: 10px; bottom: 10px; z-index: 6;
  padding: 6px 10px; font-size: 15px;
}
.call-fs-minis {
  position: absolute; z-index: 8; width: 300px;
  display: flex; flex-direction: column; gap: 8px;
  touch-action: none;
}
.call-fs-minis.c-tl { top: 12px; left: 12px; }
.call-fs-minis.c-tr { top: 12px; right: 12px; }
.call-fs-minis.c-bl { bottom: 12px; left: 12px; }
.call-fs-minis.c-br { bottom: 12px; right: 12px; }
/* Undo the `.call-main .call-tile` stage rules for minis — without this the
   minis inherit position:absolute/inset:0 and collapse to zero height. */
.call-fs-minis .call-tile {
  flex: 0 0 auto; position: relative; inset: auto;
  aspect-ratio: 16 / 9; cursor: pointer;
}
.call-fs-minis .call-tile video { object-fit: cover; }

/* ---- link health ---- */
.call-health {
  position: absolute; left: 8px; top: 8px;
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(0,0,0,.55); border-radius: 8px; padding: 2px 8px;
  font-size: 11px; pointer-events: none;
}
.call-health i, .call-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto;
  background: #9aa0ae;
}
.call-health.ok i, .call-dot.ok { background: #52c273; }
.call-health.warn i, .call-dot.warn { background: #e0b34c; }
.call-health.bad i, .call-dot.bad { background: #d64550; }

.call-stats-dev { margin-top: 12px; }
.call-stats-dev h4 { margin: 0 0 6px; font-size: 13px; font-weight: 800; }
/* One row per link, fixed column widths + tabular digits so changing
   numbers never shift the layout or wrap the line. */
.call-link {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 4px 0; flex-wrap: nowrap;
}
.call-link-to { flex: 1 1 auto; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-link-ms {
  flex: 0 0 auto; min-width: 52px; text-align: right; font-weight: 800;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.call-link-path { flex: 0 0 auto; width: 20px; text-align: center; cursor: help; }
.call-link-media { display: flex; gap: 3px; flex: 0 0 auto; }
.call-media-stat {
  width: 19px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  filter: grayscale(1); opacity: .45; font-size: 14px; cursor: default;
}
.call-media-stat.on { filter: none; opacity: 1; cursor: help; }
.call-media-stat.historical { cursor: help; }
.call-media-stat.feed-camera, .call-camera-icon { transform: translateY(-1px); }
.call-camera-icon { display: inline-block; }
.call-link-cap {
  flex: 0 0 auto; width: 60px; text-align: right; font-size: 10px;
  font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; cursor: help;
}
/* JS-driven tooltip, position:fixed so scroll containers can't clip it. */
.call-tipbox {
  position: fixed;
  background: #0c0d12; border: 1px solid rgba(255,255,255,.2); color: #f2f3f7;
  padding: 6px 9px; border-radius: 8px; font-size: 11px; font-weight: 600;
  white-space: nowrap; z-index: 950; pointer-events: none;
  max-width: 320px; white-space: normal; text-align: center;
}
.call-tipbox.wide {
  width: max-content; min-width: 320px; max-width: min(390px, calc(100vw - 20px));
  overflow: visible; padding: 10px 12px; text-align: left; pointer-events: none;
}
.call-tipbox.wide.compact { min-width: 270px; }
.call-tipbox.wide.above { transform: translateY(-100%); }
.call-stream-tip-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 7px; font-size: 13px; }
.call-stream-tip-head span { text-align: right; font-size: 11px; }
.call-transfer-values { display: flex; justify-content: flex-start; gap: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.call-transfer-values i { font-style: normal; }
.call-transfer-values .up { color: #ff8d7e; }
.call-transfer-values .dn { color: #52c273; }
.call-stat-warn { color: #ff6f78; font-weight: 800; }
.call-stream-warning { display: flex; align-items: flex-start; gap: 7px; margin-top: 8px; color: #ff8d7e; line-height: 1.35; }
.call-stream-warning svg { flex: 0 0 auto; margin-top: 1px; }
.call-stream-stat + .call-stream-stat { border-top: 1px solid rgba(255,255,255,.13); margin-top: 8px; padding-top: 8px; }
.call-stream-stopped { color: #e0b34c; margin-bottom: 4px; font-weight: 800; }
.call-stream-stat-title { font-weight: 800; margin-bottom: 5px; }
.call-stream-stat dl { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 3px 10px; margin: 0; }
.call-stream-stat dt { color: #aeb3c2; }
.call-stream-stat dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.call-capture-summary { display: grid; gap: 2px; margin-top: 9px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.14); border-radius: 5px; font-size: 11px; }
.call-capture-summary strong { text-transform: capitalize; }
.call-capture-summary span { color: var(--muted); }
.call-capture-summary .warn { color: #ff8d7e; font-weight: 800; }

/* ---- soundboard toast stack: newest on top, pushed down by newcomers ---- */
.call-sound-toasts {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  z-index: 30; pointer-events: none;
}
.call-sound-toast {
  display: flex; align-items: center; gap: 8px;
  background: rgba(23,25,34,.95); border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px; padding: 8px 14px; font-size: 13px; font-weight: 700;
  animation: call-toast-in .22s ease-out;
  white-space: nowrap; max-width: 70vw; overflow: hidden; text-overflow: ellipsis;
}
.call-sound-toast .ic { font-size: 16px; line-height: 1; }
.call-sound-toast .ic img { width: 18px; height: 18px; object-fit: contain; display: block; }
@keyframes call-toast-in {
  from { opacity: 0; transform: translateY(-10px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- toasts inside call ---- */
.call-toast {
  position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%);
  background: rgba(23,25,34,.95); border: 1px solid rgba(255,255,255,.14);
  padding: 8px 14px; border-radius: 12px; font-size: 13px; z-index: 6;
  white-space: nowrap;
}
.call-meta-sep { color: rgba(255,255,255,.42); font-weight: 700; }
.call-overlay .tz-panel { background: #171922; color: #f2f3f7; border-color: rgba(255,255,255,.14); box-shadow: 0 18px 48px rgba(0,0,0,.65); }
.call-overlay .tz-panel-top, .call-overlay .tz-head, .call-overlay .tz-slot, .call-overlay .tz-head span + span, .call-overlay .tz-slot span + span { border-color: rgba(255,255,255,.12); }
.call-overlay .tz-head { background: #20232d; }
.call-overlay .tz-slot { color: #f2f3f7; }
.call-overlay .tz-slot small { color: rgba(255,255,255,.55); }
.call-overlay .tz-slot:hover { background: rgba(255,255,255,.08); }
/* Weather hover card opened from the call surface: it portals to <body>, so
   the dark styling rides on a .call-dark class instead of the overlay scope. */
.wx-tip.call-dark { background: #171922; color: #f2f3f7; border-color: rgba(255,255,255,.14); box-shadow: 0 18px 48px rgba(0,0,0,.65); }
.wx-tip.call-dark .wx-tip-icon { color: rgba(255,255,255,.8); }
.wx-tip.call-dark .wx-tip-title small, .wx-tip.call-dark .wx-tip-temp small, .wx-tip.call-dark .wx-tip-grid span { color: rgba(255,255,255,.55); }
.wx-tip.call-dark .wx-tip-grid { border-color: rgba(255,255,255,.12); }
.call-overlay .tz-wx svg, .wx-tip.call-dark .wx-tip-icon svg {
  --wx-sun: #f6c445; --wx-cloud: #dfe5ec; --wx-rain: #6db4f0; --wx-snow: #d6e9f8; --wx-fog: #aeb9c5;
}
.call-overlay .tz-wx { border-color: rgba(255,255,255,.14); }
.call-overlay .tz-wx-temp { color: rgba(255,255,255,.72); }
.call-overlay .tz-plan-btn, .call-overlay .tz-close { color: #f2f3f7; background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); }

/* ---- persistent chat ---- */
.call-chat-tab { position: relative; }
.call-chat-tab > i { position: absolute; width: 7px; height: 7px; right: 5px; top: 5px; border-radius: 50%; background: #ef5b67; box-shadow: 0 0 0 2px #171922; }
.chat-pane { position: relative; min-height: 300px; display: flex; flex-direction: column; overflow: hidden; padding: 0; background: #171922; color: #f2f3f7; }
.chat-pane.inactive { display: none; }
.chat-pane.wide { width: 100%; height: 100%; }
.chat-drop-overlay { position: absolute; z-index: 850; inset: 8px; display: grid; place-content: center; justify-items: center; gap: 8px; border: 2px dashed #6da6b2; background: rgba(17,25,31,.94); color: #f2f3f7; pointer-events: none; }
.chat-drop-overlay strong { font-size: 14px; }
.chat-head { min-height: 45px; padding: 0 10px 0 14px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid rgba(255,255,255,.1); flex: 0 0 auto; }
.chat-head h3 { margin: 0; font-size: 15px; }
.chat-head .sp { flex: 1; }
.chat-head button, .chat-actions button, .chat-compose > button, .chat-replying button, .chat-error button, .chat-pins-head button, .chat-emoji-head button { width: 30px; height: 30px; padding: 0; border: 0; background: transparent; color: #c8cbd4; font-size: 16px; cursor: pointer; display: inline-grid; place-items: center; line-height: 1; }
.chat-head button svg, .chat-actions button svg, .chat-compose > button svg, .chat-replying button svg, .chat-error button svg, .chat-pins-head button svg, .chat-emoji-head button svg { display: block; }
.chat-head button:hover, .chat-compose > button:hover { color: #fff; background: rgba(255,255,255,.08); }
.chat-head button:disabled { opacity: .35; cursor: not-allowed; background: transparent; color: #c8cbd4; }
.chat-search { display: grid; grid-template-columns: minmax(0,1fr) auto 30px 30px 30px 30px; align-items: center; gap: 3px; width: 100%; }
.chat-search input { min-width: 0; height: 30px; padding: 0 9px; background: #0d0e13; border: 1px solid rgba(255,255,255,.15); color: #fff; }
.chat-search span { color: #aeb3c2; font-size: 11px; font-variant-numeric: tabular-nums; }
.chat-list { flex: 1 1 auto; width: 100%; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 10px 0 14px; overflow-anchor: none; }
.chat-loading, .chat-empty { padding: 12px; text-align: center; color: #9398a6; font-size: 12px; }
.chat-date, .chat-unread { position: relative; height: 25px; margin: 9px 12px 1px; border-top: 1px solid rgba(255,255,255,.12); text-align: center; }
.chat-date span, .chat-unread span { position: relative; top: -9px; padding: 0 8px; background: #171922; color: #9fa4b1; font-size: 10px; font-weight: 800; }
.chat-unread { border-color: #ef5b67; }
.chat-unread { text-align: right; }
.chat-unread span { display: inline-block; color: #ef7680; }
.chat-message { position: relative; display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 8px; width: 100%; max-width: 100%; padding: 5px 12px; box-sizing: border-box; }
.chat-message.grouped { padding-top: 1px; padding-bottom: 1px; }
.chat-message:hover { background: rgba(255,255,255,.035); }
.chat-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #3c6975; color: #fff; font-size: 13px; font-weight: 800; }
.chat-message.grouped .chat-avatar { visibility: hidden; height: 20px; }
.chat-message-body, .chat-attachments, .chat-attachment { min-width: 0; }
.chat-author { display: flex; align-items: baseline; gap: 7px; min-height: 20px; }
.chat-author strong { font-size: 14px; }
.chat-author time { color: #9196a3; font-size: 9px; cursor: help; }
.chat-author > span { font-size: 10px; }
.chat-content { user-select: text; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.4; color: #dedfe5; }
.chat-content.emoji-only { font-size: 38px; line-height: 1.2; }
.chat-content.emoji-only .chat-inline-emoji { width: 1.12em; height: 1.12em; vertical-align: -.18em; }
.chat-content code { padding: 1px 4px; background: #0d0e13; border: 1px solid rgba(255,255,255,.12); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92em; }
.chat-content blockquote { display: inline-block; margin: 1px 0; padding-left: 8px; border-left: 3px solid #737986; color: #c9cbd2; }
.chat-spoiler { display: inline; padding: 0 2px; border: 0; background: #0b0c10; color: transparent; cursor: pointer; font: inherit; line-height: inherit; }
.chat-spoiler.revealed { background: rgba(255,255,255,.1); color: inherit; }
.chat-format-toolbar { position: fixed; z-index: 900; width: 246px; height: 34px; display: grid; grid-template-columns: repeat(7, 1fr); padding: 2px; border: 1px solid rgba(255,255,255,.17); background: #101116; box-shadow: 0 5px 18px rgba(0,0,0,.55); }
.chat-format-toolbar button { min-width: 0; height: 28px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: #c8cbd4; cursor: pointer; }
.chat-format-toolbar button:hover { background: #315f69; color: #fff; }
.chat-message.replying-target { background: rgba(85,150,164,.18); box-shadow: inset 3px 0 #6da6b2; }
.chat-inline-emoji { width: 1.45em; height: 1.45em; object-fit: contain; vertical-align: -.35em; }
.chat-native-emoji { display: inline-block; width: 1.35em; height: 1.35em; object-fit: contain; vertical-align: -.28em; }
.chat-reply-ref { display: block; max-width: 100%; padding: 0; border: 0; background: transparent; color: #9ea4b3; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.chat-actions { display: none; position: absolute; z-index: 5; right: 8px; top: -19px; height: 30px; padding: 2px; background: #22252f; border: 1px solid rgba(255,255,255,.16); box-shadow: 0 3px 10px rgba(0,0,0,.4); }
.chat-message:hover .chat-actions, .chat-actions:focus-within { display: flex; }
.chat-actions > button { width: 27px; height: 26px; font-size: 13px; }
.chat-actions > button:hover { background: rgba(255,255,255,.09); color: #fff; }
.chat-menu { z-index: 600; overflow-y: auto; padding: 5px; background: #101116; border: 1px solid rgba(255,255,255,.16); box-shadow: 0 8px 24px rgba(0,0,0,.55); }
.chat-menu button { display: grid; grid-template-columns: 20px minmax(0,1fr); align-items: center; gap: 7px; width: 100%; min-height: 34px; padding: 0 8px; text-align: left; border: 0; background: transparent; color: #dddfe5; font-size: 11px; }
.chat-menu button:hover { background: #315f69; color: #fff; }
.chat-menu button.danger { color: #ff7a84; }
.chat-reactions { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.chat-reactions button { min-width: 34px; height: 23px; padding: 0 6px; border: 1px solid rgba(255,255,255,.13); background: rgba(255,255,255,.055); color: #dddfe5; cursor: pointer; }
.chat-reactions button.mine { border-color: #5596a4; background: rgba(58,117,130,.28); }
.chat-reactions img { width: 16px; height: 16px; }
.chat-replying, .chat-error { display: flex; justify-content: space-between; align-items: center; min-height: 28px; padding: 3px 10px; background: #22252f; color: #b9bdc8; font-size: 10px; }
.chat-replying span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-error { color: #ff8d94; }
.chat-compose { position: relative; flex: 0 0 auto; display: grid; grid-template-columns: 34px minmax(0,1fr) 34px 34px 34px 34px; align-items: end; gap: 3px; margin: 0 10px 10px; padding: 5px; background: #252833; }
.chat-compose textarea { min-width: 0; max-height: 120px; resize: none; border: 0; outline: 0; padding: 7px 4px; background: transparent; color: #f2f3f7; font: inherit; font-size: 13px; }
.chat-compose .send { color: #7fb2bd; }
.chat-compose button:disabled { opacity: .35; cursor: default; }
.chat-voice-compose { flex: 0 0 auto; min-height: 44px; display: grid; grid-template-columns: 32px 10px 43px minmax(70px,1fr) 32px 32px; align-items: center; gap: 5px; margin: 0 10px 10px; padding: 5px; background: #252833; }
.chat-voice-compose button { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: #c8cbd4; cursor: pointer; }
.chat-voice-compose button:hover { color: #fff; background: rgba(255,255,255,.08); }
.chat-voice-compose button:disabled { opacity: .35; cursor: not-allowed; }
.chat-voice-compose button.danger { color: #ef7680; }
.chat-voice-compose button.send { color: #7fb2bd; }
.chat-record-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef5b67; animation: chat-record-pulse 1.2s ease-in-out infinite; }
.chat-record-dot.paused { animation: none; opacity: .4; }
.chat-voice-compose time { color: #d8dae1; font-size: 11px; font-variant-numeric: tabular-nums; }
.chat-voice-compose canvas { width: 100%; height: 28px; min-width: 0; }
@keyframes chat-record-pulse { 50% { opacity: .35; } }
.chat-suggestions { position: absolute; z-index: 25; left: 0; right: 0; bottom: calc(100% + 5px); padding: 5px; background: #101116; border: 1px solid rgba(255,255,255,.16); box-shadow: 0 -8px 24px rgba(0,0,0,.4); }
.chat-suggestions button { display: flex; align-items: center; gap: 8px; width: 100%; height: 31px; padding: 0 8px; border: 0; background: transparent; color: #dddfe5; }
.chat-suggestions button.on, .chat-suggestions button:hover { background: #315f69; }
.chat-suggestions img { width: 22px; height: 22px; object-fit: contain; }
.chat-emoji-picker { z-index: 600; overflow: hidden; padding: 8px; background: #101116; border: 1px solid rgba(255,255,255,.17); box-shadow: 0 10px 32px rgba(0,0,0,.6); }
.chat-emoji-picker .emoji-browser { height: 384px; }
.chat-emoji-picker .emoji-browser-top > label, .chat-emoji-picker .emoji-browser-main { border-color: rgba(255,255,255,.14); background: #171922; }
.chat-emoji-picker .emoji-browser-top input { color: #f2f3f7; }
.chat-emoji-picker .emoji-browser-tone-button, .chat-emoji-picker .emoji-browser-tone-menu { border-color: rgba(255,255,255,.14); background: #171922; color: #f2f3f7; }
.chat-emoji-picker .emoji-browser-categories { border-color: rgba(255,255,255,.12); }
.chat-emoji-picker .emoji-browser-results h3, .chat-emoji-picker .emoji-browser-grid > p { color: #9398a6; }
.chat-emoji-picker .emoji-browser-item:hover, .chat-emoji-picker .emoji-browser-item.sel, .chat-emoji-picker .emoji-browser-categories button:hover, .chat-emoji-picker .emoji-browser-categories button.on { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); }
.chat-floating { box-sizing: border-box; }
.chat-emoji-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.chat-emoji-picker small { display: block; margin: 7px 2px 4px; color: #9398a6; font-size: 9px; text-transform: uppercase; }
.chat-emoji-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.chat-emoji-grid button { aspect-ratio: 1; min-width: 0; border: 0; background: transparent; font-size: 20px; cursor: pointer; }
.chat-emoji-grid button:hover { background: rgba(255,255,255,.08); }
.chat-emoji-grid img { width: 24px; height: 24px; object-fit: contain; }
.chat-emoji-tones { position: sticky; top: -8px; z-index: 2; display: flex; justify-content: flex-end; gap: 2px; padding: 4px 0; background: #101116; }
.chat-emoji-tones button { width: 28px; height: 28px; display: grid; place-items: center; padding: 3px; border: 1px solid transparent; background: transparent; cursor: pointer; }
.chat-emoji-tones button:hover, .chat-emoji-tones button.on { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.08); }
.chat-emoji-tones img { width: 21px; height: 21px; }
.chat-emoji-group-tabs { display: grid; grid-template-columns: repeat(9, 1fr); gap: 1px; margin: 2px 0 5px; border-bottom: 1px solid rgba(255,255,255,.12); }
.chat-emoji-group-tabs button { min-width: 0; height: 30px; display: grid; place-items: center; padding: 3px; border: 0; border-bottom: 2px solid transparent; background: transparent; cursor: pointer; }
.chat-emoji-group-tabs button:hover, .chat-emoji-group-tabs button.on { background: rgba(255,255,255,.07); border-bottom-color: #6da6b2; }
.chat-emoji-group-tabs img { width: 20px; height: 20px; }
.chat-gif-label { font-size: 9px; letter-spacing: 0; }
.chat-gif-picker { z-index: 700; display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(255,255,255,.17); background: #101116; box-shadow: 0 10px 32px rgba(0,0,0,.6); }
.chat-gif-head { flex: 0 0 38px; display: flex; align-items: center; justify-content: space-between; padding: 0 7px 0 10px; }
.chat-gif-head button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: transparent; color: #c8cbd4; cursor: pointer; }
.chat-gif-search { flex: 0 0 34px; display: grid; grid-template-columns: 24px minmax(0,1fr); align-items: center; margin: 0 7px 7px; padding: 0 7px; background: #20232d; color: #9398a6; }
.chat-gif-search input { min-width: 0; height: 32px; border: 0; outline: 0; background: transparent; color: #fff; }
.chat-gif-results { flex: 1 1 auto; min-height: 100px; overflow-y: auto; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); grid-auto-rows: 112px; gap: 4px; padding: 4px; background: #101116; }
.chat-gif-results > button { min-width: 0; padding: 0; border: 0; background: #20232d; cursor: pointer; overflow: hidden; }
.chat-gif-results > button:hover { outline: 2px solid #6da6b2; outline-offset: -2px; }
.chat-gif-results img { display: block; width: 100%; height: 100%; object-fit: cover; }
.chat-gif-results p { grid-column: 1 / -1; align-self: center; margin: 14px; color: #9398a6; text-align: center; font-size: 11px; }
.chat-gif-results p.chat-gif-error { color: #ff8d94; }
.chat-gif-sentinel { grid-column: 1 / -1; height: 1px; }
.chat-gif-loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); padding: 8px 12px; background: #101116; color: #fff; }
.chat-gif-footer { flex: 0 0 30px; display: flex; align-items: center; justify-content: space-between; padding: 0 9px; border-top: 1px solid rgba(255,255,255,.12); color: #aeb3c2; font-size: 9px; }
.chat-uploads { flex: 0 0 auto; padding: 7px 12px; background: #20232d; }
.chat-uploads > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 3px 8px; font-size: 10px; }
.chat-uploads span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-uploads i { grid-column: 1 / -1; height: 3px; background: rgba(255,255,255,.12); }
.chat-uploads b { display: block; height: 100%; background: #6da6b2; transition: width .15s linear; }
.chat-attachments { display: grid; gap: 5px; margin-top: 5px; }
.chat-attachment { max-width: 440px; border: 1px solid rgba(255,255,255,.13); background: #20232d; }
.chat-attachment.visual { width: fit-content; max-width: 100%; border: 0; background: transparent; }
.chat-attachment.voice { width: min(360px, 100%); border: 0; background: transparent; }
.chat-attachment.voice audio { display: block; width: 100%; height: 36px; }
.chat-image-open { display: block; width: fit-content; max-width: min(440px, 100%); padding: 0; border: 0; background: transparent; cursor: zoom-in; overflow: hidden; }
.chat-image-open > img, .chat-image-open > video, .chat-image-open > canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 320px; object-fit: contain; }
.chat-image-open.sized > img, .chat-image-open.sized > video, .chat-image-open.sized > canvas { width: 100%; height: 100%; }
.chat-attachment > div { display: grid; grid-template-columns: 24px minmax(0,1fr) 30px; align-items: center; gap: 8px; padding: 8px; }
.chat-attachment > div > span { display: grid; min-width: 0; }
.chat-attachment strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.chat-attachment small { color: #9398a6; font-size: 9px; }
.chat-attachment.expired { opacity: .65; }
.chat-download { width: 30px; height: 30px; display: grid; place-items: center; color: #c8cbd4; }
.chat-media-viewer { position: fixed; z-index: 1000; inset: 0; overflow: hidden; background: rgba(5,6,9,.94); color: #f2f3f7; }
.chat-media-stage { position: absolute; inset: 62px 24px 24px; display: grid; place-items: center; overflow: auto; }
.chat-media-stage img, .chat-media-stage video { display: block; max-width: min(92vw, 1400px); max-height: calc(100vh - 100px); transform-origin: center; transition: transform .15s ease; }
.chat-media-meta { position: absolute; z-index: 2; left: 18px; top: 14px; display: grid; gap: 2px; }
.chat-media-meta strong { font-size: 13px; }
.chat-media-meta span { color: #afb3bf; font-size: 10px; }
.chat-media-tools { position: absolute; z-index: 3; right: 14px; top: 12px; height: 36px; display: flex; align-items: center; padding: 2px; background: #171922; border: 1px solid rgba(255,255,255,.17); }
.chat-media-tools > button, .chat-media-tools > a, .chat-media-details { width: 32px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: #c8cbd4; cursor: pointer; }
.chat-media-tools > button:hover, .chat-media-tools > a:hover, .chat-media-details:hover { background: rgba(255,255,255,.09); color: #fff; }
.chat-media-details { position: relative; cursor: help; }
.chat-media-details i { display: none; position: absolute; right: 0; top: 38px; width: max-content; max-width: min(320px, calc(100vw - 20px)); padding: 8px 10px; background: #101116; border: 1px solid rgba(255,255,255,.17); box-shadow: 0 7px 20px rgba(0,0,0,.5); font-style: normal; text-align: left; }
.chat-media-details:hover i { display: grid; gap: 3px; }
.chat-media-details i b { overflow-wrap: anywhere; font-size: 11px; }
.chat-media-details i small { color: #afb3bf; font-size: 9px; }
@media (max-width: 560px) { .chat-media-meta { top: 55px; } .chat-media-tools { left: 8px; right: 8px; justify-content: flex-end; } .chat-media-stage { inset: 88px 8px 8px; } }
.chat-edit { display: grid; gap: 4px; }
.chat-edit textarea { min-height: 54px; resize: vertical; padding: 7px; border: 1px solid #5596a4; background: #101116; color: #fff; font: inherit; }
.chat-edit span { display: flex; justify-content: flex-end; gap: 5px; }
.chat-edit button { border: 0; padding: 4px 8px; background: #315f69; color: #fff; cursor: pointer; }
.chat-emoji-modal { width: min(900px, 100%); height: min(680px, calc(100dvh - 32px)); display: flex; flex-direction: column; overflow: hidden; }
.chat-emoji-manager { display: grid; grid-template-columns: 220px minmax(0,1fr); flex: 1 1 auto; min-height: 0; }
.chat-emoji-categories { overflow-y: auto; padding: 14px; border-right: 1px solid var(--line); background: var(--bg-2); }
.chat-emoji-categories h4 { margin: 2px 8px 10px; color: var(--ink-faint); font-size: 11px; text-transform: uppercase; }
.chat-emoji-category { display: grid; grid-template-columns: 12px minmax(0,1fr) auto; align-items: center; gap: 9px; width: 100%; min-height: 40px; padding: 7px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-soft); text-align: left; cursor: pointer; }
.chat-emoji-category:hover, .chat-emoji-category.active { background: var(--surface); color: var(--ink); }
.chat-emoji-category .dot { width: 11px; height: 11px; border-radius: 50%; }
.chat-emoji-category .dot.uncategorized { border: 1px solid var(--ink-faint); }
.chat-emoji-category small { color: var(--ink-faint); }
.chat-emoji-add-category { width: 100%; margin-top: 8px; padding: 9px; border: 1px dashed var(--line); background: transparent; color: var(--ink-faint); cursor: pointer; }
.chat-emoji-workspace { min-width: 0; min-height: 0; overflow-y: auto; padding: 16px; }
.chat-emoji-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.chat-emoji-toolbar > div { flex: 1; }
.chat-emoji-toolbar h3 { margin: 0; color: var(--ink); font-size: 20px; }
.chat-emoji-toolbar span { color: var(--ink-faint); font-size: 11px; }
.chat-emoji-toolbar .btn-ghost { display: inline-flex; align-items: center; gap: 6px; }
.chat-emoji-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap: 12px; margin-top: 16px; }
.chat-emoji-add-tile { min-height: 142px; display: grid; place-content: center; justify-items: center; gap: 8px; border: 1px dashed var(--line); border-radius: 7px; background: transparent; color: var(--ink-faint); cursor: pointer; font: inherit; font-weight: 700; }
.chat-emoji-add-tile:hover { border-color: var(--ink-faint); background: var(--surface); color: var(--ink); }
.chat-emoji-card { position: relative; min-width: 0; min-height: 142px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 14px 38px 12px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.chat-emoji-card > img { width: 64px; height: 64px; object-fit: contain; }
.chat-emoji-card > strong { max-width: 100%; color: var(--ink); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-emoji-card > button { position: absolute; top: 7px; right: 7px; width: 30px; height: 30px; display: grid; place-items: center; }
.chat-emoji-empty { grid-column: 1 / -1; padding: 30px; text-align: center; color: var(--ink-faint); }
.chat-emoji-subdialog { position: absolute; z-index: 3; }
.chat-emoji-subdialog > .modal { width: min(460px, calc(100% - 24px)); }
.chat-emoji-edit-preview { display: flex; align-items: center; gap: 12px; margin: 14px 0; padding: 10px; background: var(--bg-2); }
.chat-emoji-edit-preview img { width: 52px; height: 52px; object-fit: contain; }
.chat-emoji-edit-preview code { overflow-wrap: anywhere; color: var(--ink); }
.chat-emoji-form-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; align-items: end; }
.chat-emoji-form-grid .field { min-width: 0; }
.chat-emoji-form-grid input[type=file] { font-size: 11px; }
.chat-present { position: absolute; z-index: 8; right: 14px; bottom: 68px; border: 1px solid rgba(255,255,255,.18); background: #315f69; color: #fff; padding: 6px 10px; box-shadow: 0 5px 16px rgba(0,0,0,.35); cursor: pointer; }
.chat-pins { position: absolute; z-index: 35; inset: 45px 0 0; overflow-y: auto; padding: 10px; background: #171922; }
.chat-pins-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.chat-pins > button { display: grid; grid-template-columns: minmax(0,1fr) auto; width: 100%; gap: 3px 8px; padding: 9px; border: 0; border-bottom: 1px solid rgba(255,255,255,.1); text-align: left; background: transparent; color: #e3e4e9; }
.chat-pins > button:hover { background: rgba(255,255,255,.05); }
.chat-pins > button strong { font-size: 11px; }
.chat-pins > button span { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.chat-pins > button small { grid-column: 2; grid-row: 1; color: #79acb7; }
.chat-found { animation: chat-found 1.6s ease-out; }
.chat-time-tip { position: fixed; z-index: 950; box-sizing: border-box; padding: 7px 10px; border: 1px solid rgba(255,255,255,.2); border-radius: 6px; background: #0c0d12; box-shadow: 0 5px 18px rgba(0,0,0,.45); color: #f2f3f7; font-size: 11px; font-weight: 600; line-height: 1.3; text-align: center; pointer-events: none; }
@keyframes chat-found { 0%,45% { background: rgba(218,167,62,.25); } 100% { background: transparent; } }

@media (max-width: 680px) {
  .chat-message { padding-left: 8px; padding-right: 8px; }
  .chat-actions { right: 5px; }
  .chat-actions > button:nth-child(-n+3) { display: none; }
  .chat-emoji-manager { grid-template-columns: 1fr; }
  .chat-emoji-categories { display: flex; gap: 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .chat-emoji-categories h4 { display: none; }
  .chat-emoji-category { width: auto; min-width: max-content; grid-template-columns: 10px auto auto; }
  .chat-emoji-add-category { width: auto; min-width: max-content; margin: 0; }
  .chat-emoji-form-grid { grid-template-columns: 1fr; }
}
