/* ============================================================
   Chat-UI — Sky Blue design system
   Light-blue accent · cool airy neutrals
   ============================================================ */

:root {
  /* brand — Sky (cyan → blue → indigo) */
  --accent: #2f9bf5;
  --accent-hover: #1d87e6;
  --accent-soft: #e3f1ff;
  --accent-ink: #1568bf;
  --accent-contrast: #ffffff;

  /* gradient brand — sky → blue → indigo */
  --accent-grad: linear-gradient(159deg, #0a7fb9 0%, #497ec0 50%, #3251bb 100%);
  --accent-grad-soft: linear-gradient(135deg, #eaf7ff 0%, #e6f1ff 50%, #eef0ff 100%);
  --accent-grad-hover: linear-gradient(135deg, #49bdff 0%, #1d8cee 50%, #5a7cff 100%);
  --grad-1: #5fcaff;
  --grad-2: #2f9bf5;
  --grad-3: #6a8bff;

  /* cool airy neutrals */
  --bg: #eef4fb;
  --panel: #ffffff;
  --panel-2: #eef3fa;
  --panel-3: #e0e9f4;
  --line: #e4edf7;
  --line-strong: #cbdcee;

  --ink: #142539;
  --ink-2: #586a82;
  --ink-3: #93a4b8;

  /* bubbles */
  --bubble-in: #ffffff;
  --bubble-in-line: #e4edf7;
  --bubble-out: var(--accent);
  --bubble-out-ink: #ffffff;
  --bubble-out-mention: #d7ecff;

  /* avatars */
  --avatar-bg: #eef3fa;
  --avatar-text: #586a82;
  --accent-muted: rgba(47, 155, 245, 0.30);

  /* tags */
  --tag-question-bg: #e8f0ff; --tag-question-fg: #2563eb;
  --tag-help-bg: #fff4e6;     --tag-help-fg: #c05621;
  --tag-bug-bg: #feeaea;      --tag-bug-fg: #c0392b;
  --tag-request-bg: #f0ebff;  --tag-request-fg: #6b5ce7;
  --tag-internal-bg: #ede9fe; --tag-internal-fg: #4338a8;
  --tag-festival-bg: #fce8f4; --tag-festival-fg: #be185d;
  --tag-broadcast-bg: #fff8e6;--tag-broadcast-fg: #b45309;
  --tag-mention-bg: #e8e4ff;  --tag-mention-fg: #5a4bd6;

  /* call */
  --call-bg: #0b1b2e;
  --call-surface: rgba(255,255,255,0.08);
  --call-text-muted: rgba(255,255,255,0.55);

  --status-online: #22c7a9;
  --status-away: #f5a623;
  --status-offline: #93a4b8;

  /* semantic base */
  --white: #ffffff;
  --black: #000000;

  /* danger / destructive */
  --danger: #c0392b;
  --danger-soft: #feeaea;
  --danger-soft-hover: #f5d0d0;
  --danger-bg: #fbe6e6;
  --danger-bg-hover: #f5d0d0;
  --danger-bg-dark: rgba(192, 57, 43, 0.2);
  --setting-danger-bg-hover: #f5d0d0;
  --member-remove-hover-bg: #feeaea;

  /* file type colors */
  --file-pdf: #d9534f;
  --file-doc: #3b7dd8;
  --file-xls: #2e9e5b;
  --file-zip: #7c6a9a;
  --file-icon-text: #ffffff;

  /* overlays & scrims */
  --overlay-drawer: rgba(20, 25, 22, 0.35);
  --overlay-modal: rgba(8, 16, 28, 0.55);
  --overlay-lightbox: rgba(8, 16, 28, 0.94);
  --overlay-glass: rgba(255, 255, 255, 0.12);
  --overlay-glass-hover: rgba(255, 255, 255, 0.24);
  --overlay-glass-strong: rgba(255, 255, 255, 0.26);
  --overlay-chip-hover: rgba(0, 0, 0, 0.08);
  --overlay-local-tag: rgba(0, 0, 0, 0.45);
  --overlay-call-hover: rgba(255, 255, 255, 0.16);
  --overlay-accent-card-icon: rgba(255, 255, 255, 0.2);
  --overlay-accent-card-sub: rgba(255, 255, 255, 0.85);

  /* shadows (color only — combine in box-shadow) */
  --shadow-color: rgba(20, 45, 75, 0.30);
  --shadow-color-strong: rgba(20, 45, 75, 0.45);
  --shadow-color-soft: rgba(20, 45, 75, 0.15);
  --shadow-color-date: rgba(28, 27, 51, 0.2);
  --shadow-color-bubble-in: rgba(20, 45, 75, 0.18);
  --shadow-color-black: rgba(0, 0, 0, 0.75);
  --shadow-color-black-soft: rgba(0, 0, 0, 0.6);
  --shadow-color-black-mid: rgba(0, 0, 0, 0.5);
  --shadow-color-black-light: rgba(0, 0, 0, 0.15);
  --shadow-color-black-subtle: rgba(0, 0, 0, 0.12);
  --shadow-color-black-faint: rgba(0, 0, 0, 0.08);
  --shadow-color-black-ghost: rgba(0, 0, 0, 0.06);
  --shadow-color-black-whisper: rgba(0, 0, 0, 0.05);
  --shadow-color-black-bare: rgba(0, 0, 0, 0.04);
  --shadow-color-lightbox: rgba(0, 0, 0, 0.8);

  --shadow: 0 12px 40px -18px var(--shadow-color);

  /* chat wallpaper */
  --chat-dark-grad: linear-gradient(150deg, #0f1c2e 0%, #0a121d 45%, #14233a 100%);
  --wallpaper-sand: rgba(245, 200, 120, 0.12);
  --wallpaper-mint: rgba(34, 211, 160, 0.12);
  --wallpaper-slate: rgba(120, 130, 160, 0.12);
  --chat-icons-opacity: 0.6;

  /* bubble & reply tints */
  --bubble-reply-in-bg: rgba(0, 0, 0, 0.04);
  --bubble-reply-out-bg: rgba(255, 255, 255, 0.14);
  --bubble-reply-out-border: rgba(255, 255, 255, 0.7);
  --attach-in-bg: rgba(0, 0, 0, 0.05);
  --attach-out-bg: rgba(255, 255, 255, 0.14);
  --attach-dl-in-bg: rgba(0, 0, 0, 0.06);
  --attach-dl-in-hover: rgba(0, 0, 0, 0.12);
  --attach-dl-out-bg: rgba(255, 255, 255, 0.18);

  /* voice / video media */
  --media-bg: #000000;
  --voice-in-bg: rgba(0, 0, 0, 0.05);
  --voice-out-bg: rgba(255, 255, 255, 0.18);
  --voice-play-icon: #ffffff;
  --voice-play-out-bg: #ffffff;
  --voice-wave-out: rgba(255, 255, 255, 0.7);
  --voice-wave-out-opacity: 0.6;
  --voice-progress-out: #ffffff;
  --voice-time-out: rgba(255, 255, 255, 0.9);
  --video-play-bg: rgba(255, 255, 255, 0.92);
  --video-badge-bg: rgba(20, 12, 18, 0.6);
  --gallery-overlay-bg: rgba(20, 18, 40, 0.55);
  --gallery-overlay-text: #ffffff;

  /* call UI */
  --call-decline: #e0584f;
  --call-text: #ffffff;
  --call-pip-bg: #0d1a2a;
  --call-pip-border: rgba(255, 255, 255, 0.22);
  --call-cam-off-grad: linear-gradient(160deg, #16273c, #0c1a2b);
  --call-cam-off-text: rgba(255, 255, 255, 0.72);
  --call-voice-grad: linear-gradient(160deg, #0c1d31 0%, #07121f 55%, #122a44 100%);
  --call-avatar-border: rgba(255, 255, 255, 0.16);

  /* demo call canvas (JS reads via themeColor) */
  --demo-call-bg-1: #0c1d31;
  --demo-call-bg-2: #07121f;
  --demo-call-bg-3: #122a44;
  --demo-call-halo: rgba(47, 155, 245, 0.28);
  --demo-call-halo-rgb: 47, 155, 245;
  --demo-call-text: #ffffff;
  --demo-call-text-primary: #eaf3ff;
  --demo-call-text-muted: rgba(234, 243, 255, 0.55);

  /* toggle */
  --toggle-knob: #ffffff;

  --radius: 16px;

  --rail-w: 78px;
  --list-w: 348px;
  --drawer-w: 372px;

  /* chat layout */
  --chat-gutter: 14px;
  --header-av-size: 48px;
  --composer-radius: 20px;
  --composer-send-disabled-bg: var(--panel-3);
  --composer-send-disabled-fg: var(--ink-3);
  --mention-picker-w: 300px;
  --bubble-out-mention-staff: #dce8ff;
  --bubble-out-mention-customer: #e8dcff;

  /* reply quote + reactions */
  --reply-accent: #16b364;
  --reply-bar-bg: color-mix(in srgb, #16b364 10%, var(--panel));
  --reply-bar-border: color-mix(in srgb, #16b364 22%, var(--line));
  --reply-quote-bg: color-mix(in srgb, #16b364 9%, var(--panel));
  --reply-quote-border: #16b364;
  --reaction-bg: var(--panel);
  --reaction-border: var(--line);
  --reaction-mine-bg: var(--accent-soft);
  --reaction-mine-border: color-mix(in srgb, var(--accent) 38%, var(--line));

  /* projects */
  --project-accent: #7c5cff;
  --project-accent-soft: color-mix(in srgb, #7c5cff 14%, var(--panel));
  --project-ok: #16a34a;
  --project-ok-soft: color-mix(in srgb, #16a34a 13%, var(--panel));
  --project-risk: #e0962a;
  --project-risk-soft: color-mix(in srgb, #e0962a 16%, var(--panel));
}

[data-theme="dark"] {
  --accent: #57b5ff;
  --accent-hover: #7cc6ff;
  --accent-soft: rgba(87, 181, 255, 0.16);
  --accent-ink: #9fd2ff;
  --accent-contrast: #06243f;

  --accent-grad: linear-gradient(135deg, #5fcaff 0%, #3b9bf0 52%, #6a8bff 100%);
  --accent-grad-soft: linear-gradient(135deg, rgba(95,202,255,.16) 0%, rgba(59,155,240,.16) 52%, rgba(106,139,255,.16) 100%);
  --accent-grad-hover: linear-gradient(135deg, #6fd0ff 0%, #4aa6f4 52%, #7c98ff 100%);
  --grad-1: #5fcaff;
  --grad-2: #3b9bf0;
  --grad-3: #6a8bff;

  --bg: #0b131f;
  --panel: #131d2b;
  --panel-2: #1a2636;
  --panel-3: #233146;
  --line: #213044;
  --line-strong: #324562;

  --ink: #e9f2fc;
  --ink-2: #9fb2c8;
  --ink-3: #6b7d93;

  --bubble-in: #1a2636;
  --bubble-in-line: #2a3a50;
  --bubble-out: var(--accent);
  --bubble-out-ink: #06243f;
  --bubble-out-mention: #cfe8ff;

  --avatar-bg: #233146;
  --avatar-text: #9fb2c8;
  --accent-muted: rgba(87, 181, 255, 0.32);

  --tag-question-bg: rgba(37,99,235,.18);  --tag-question-fg: #7eb0ff;
  --tag-help-bg: rgba(192,86,33,.18);      --tag-help-fg: #f0a060;
  --tag-bug-bg: rgba(192,57,43,.2);        --tag-bug-fg: #f08080;
  --tag-request-bg: rgba(107,92,231,.22);  --tag-request-fg: #b4abff;
  --tag-internal-bg: rgba(67,56,168,.25);  --tag-internal-fg: #c4bfff;
  --tag-festival-bg: rgba(190,24,93,.2);   --tag-festival-fg: #f090b8;
  --tag-broadcast-bg: rgba(180,83,9,.2);   --tag-broadcast-fg: #f0b050;
  --tag-mention-bg: rgba(90,75,214,.22);   --tag-mention-fg: #b4abff;

  --call-bg: #07121f;
  --call-text: #ffffff;
  --call-pip-bg: #0a1524;
  --call-cam-off-grad: linear-gradient(160deg, #111f32, #081220);
  --call-voice-grad: linear-gradient(160deg, #081220 0%, #040a14 55%, #0d1e33 100%);
  --overlay-drawer: rgba(0, 0, 0, 0.55);
  --overlay-modal: rgba(0, 0, 0, 0.65);
  --overlay-lightbox: rgba(0, 0, 0, 0.94);
  --bubble-reply-in-bg: rgba(255, 255, 255, 0.06);
  --attach-in-bg: rgba(255, 255, 255, 0.06);
  --attach-dl-in-bg: rgba(255, 255, 255, 0.08);
  --attach-dl-in-hover: rgba(255, 255, 255, 0.14);
  --voice-in-bg: rgba(255, 255, 255, 0.06);
  --setting-danger-bg: var(--danger-bg-dark);
  --setting-danger-bg-hover: rgba(192, 57, 43, 0.28);
  --member-remove-hover-bg: rgba(192, 57, 43, 0.18);
  --chat-dark-grad: linear-gradient(150deg, #0a121d 0%, #060b12 45%, #0f1c2e 100%);
  --chat-icons-opacity: 0.18;
  --shadow: 0 18px 50px -20px var(--shadow-color-black);

  --reply-accent: #34d399;
  --reply-bar-bg: color-mix(in srgb, #34d399 15%, var(--panel));
  --reply-bar-border: color-mix(in srgb, #34d399 28%, var(--line));
  --reply-quote-bg: color-mix(in srgb, #34d399 12%, var(--panel));
  --reply-quote-border: #34d399;

  --project-accent: #a98bff;
  --project-accent-soft: color-mix(in srgb, #a98bff 20%, var(--panel));
  --project-ok: #4ade80;
  --project-ok-soft: color-mix(in srgb, #4ade80 18%, var(--panel));
  --project-risk: #fbbf57;
  --project-risk-soft: color-mix(in srgb, #fbbf57 20%, var(--panel));
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ── App shell ── */
.app {
  height: 100vh;
  display: flex;
}

/* ── Left icon rail ── */
.rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 18px;
  gap: 14px;
}

.rail-brand {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--accent-grad);
  color: var(--accent-contrast);
  display: grid; place-items: center;
  font-weight: 800; font-size: 21px;
  flex-shrink: 0;
  box-shadow: 0 6px 18px -6px var(--accent-muted);
}

.rail-filters {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 8px;
  width: 100%; align-items: center;
}

.rail-filter, .rail-btn, .rail-profile {
  position: relative;
  width: 48px; height: 48px;
  border-radius: 15px;
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: background .15s, color .15s, transform .1s;
}
.rail-filter svg, .rail-btn svg { width: 22px; height: 22px; }
.rail-filter:hover, .rail-btn:hover { background: var(--panel-2); color: var(--ink); }
.rail-filter:active { transform: scale(.92); }
.rail-filter.active { background: var(--accent-soft); color: var(--accent-ink); }
.rail-filter.active::before {
  content: ''; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 24px; border-radius: 0 4px 4px 0; background: var(--accent);
}

/* count badge on rail icons */
.rail-count {
  position: absolute; top: 5px; right: 5px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px;
  background: var(--accent); color: var(--accent-contrast);
  font-size: 10px; font-weight: 800;
  display: grid; place-items: center;
  border: 2px solid var(--panel);
}
.rail-filter.active .rail-count { border-color: var(--accent-soft); }

/* tooltip */
.rail-filter::after, .rail-btn::after, .rail-profile::after {
  content: attr(data-label);
  position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%) translateX(-4px);
  background: var(--ink); color: var(--bg);
  padding: 7px 11px; border-radius: 9px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
  opacity: 0; pointer-events: none;
  box-shadow: var(--shadow);
  transition: opacity .14s, transform .14s;
  z-index: 70;
}
.rail-filter:hover::after, .rail-btn:hover::after, .rail-profile:hover::after {
  opacity: 1; transform: translateY(-50%) translateX(0);
}

.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rail-profile {
  width: 48px; height: 48px;
  border-radius: 50%;
  padding: 2.5px;
  background: var(--status-online);
}
.rail-profile img {
  width: 100%; height: 100%;
  border-radius: 50%; object-fit: cover;
  border: 2.5px solid var(--panel);
  display: block; box-sizing: border-box;
}
.rail-status { display: none; }

/* ── Body ── */
.body {
  flex: 1;
  display: grid;
  grid-template-columns: var(--list-w) 1fr;
  min-height: 0;
}

/* ── List pane ── */
.list-pane {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.list-head {
  padding: 20px 20px 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.list-title { display: flex; align-items: center; gap: 10px; }
.list-title h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.counter {
  background: var(--accent-grad); color: var(--accent-contrast);
  font-size: 12px; font-weight: 800;
  min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 11px;
  display: grid; place-items: center;
}
.btn-new {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  background: var(--accent-grad); color: var(--accent-contrast);
  border-radius: 12px;
  flex-shrink: 0;
  transition: filter .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 6px 16px -6px var(--accent-muted);
}
.btn-new svg { width: 18px; height: 18px; }
.btn-new:hover { filter: brightness(1.07); box-shadow: 0 8px 20px -6px var(--accent-muted); }
.btn-new:active { transform: scale(.96); }

.finder {
  margin: 0 20px 14px;
  display: flex; align-items: center; gap: 9px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 13px;
  transition: border-color .15s, background .15s;
}
.finder:focus-within { border-color: var(--accent); background: var(--panel); }
.finder svg { width: 17px; height: 17px; color: var(--ink-3); flex-shrink: 0; }
.finder input {
  border: none; background: none; outline: none;
  width: 100%; padding: 11px 0;
  font-size: 13.5px; color: var(--ink); font-family: inherit;
}
.finder input::placeholder { color: var(--ink-3); }

.conv-list { flex: 1; overflow-y: auto; padding: 6px 12px 14px; list-style: none; }

.conv {
  position: relative;
  display: flex; gap: 12px; align-items: center;
  padding: 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: background .14s;
}
.conv:hover { background: var(--panel-2); }
.conv.active { background: var(--accent-soft); }
.conv.active .conv-name { color: var(--accent-ink); }

/* Avatar status ring — circular live indicator */
.av-ring {
  position: relative; flex-shrink: 0;
  width: 52px; height: 52px;
  border-radius: 50%;
  padding: 2.5px;
  background: var(--status-offline);
  transition: background .2s;
}
.av-ring.status-online { background: var(--status-online); }
.av-ring.status-away { background: var(--status-away); }
.av-ring.status-offline { background: var(--status-offline); }
.av-ring.status-online::before {
  content: '';
  position: absolute; inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--status-online);
  opacity: 0;
  animation: statusPulse 2.4s ease infinite;
}
.av-ring.no-status {
  padding: 0;
  background: transparent;
}
.av-ring.no-status .av-ring-inner { border-color: var(--line); }
.av-ring.no-status::before { display: none; }
@keyframes statusPulse {
  0%, 100% { transform: scale(1); opacity: 0; }
  50% { transform: scale(1.08); opacity: 0.35; }
}
.av-ring-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 2.5px solid var(--panel);
  box-sizing: border-box;
  background: var(--avatar-bg);
}
.conv.active .av-ring-inner { border-color: var(--accent-soft); }
.av-ring img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.av-ring-initials {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--accent-grad);
  color: var(--accent-contrast);
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px;
}

.conv-av-wrap { position: relative; flex-shrink: 0; }
.conv-av { width: 100%; height: 100%; object-fit: cover; display: block; }
.conv-av-group { width: 100%; height: 100%; }
.conv-cat {
  position: absolute; right: -3px; bottom: -3px;
  width: 19px; height: 19px; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800;
  border: 2.5px solid var(--panel);
}
.conv.active .conv-cat { border-color: var(--accent-soft); }
.conv-cat.mention { background: var(--tag-mention-bg); color: var(--tag-mention-fg); }
.conv-cat.broadcast { background: var(--tag-broadcast-bg); color: var(--tag-broadcast-fg); }
.conv-cat.group { background: var(--tag-question-bg); color: var(--tag-question-fg); }
.conv-cat.project { background: var(--project-accent-soft); color: var(--project-accent); }
.conv-cat svg { width: 11px; height: 11px; }

.conv-main { flex: 1; min-width: 0; }
.conv-row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conv-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.conv-meta { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.conv-time { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.conv-unread-badge {
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px;
  background: var(--accent-grad); color: var(--accent-contrast);
  font-size: 10.5px; font-weight: 800;
  display: grid; place-items: center;
  line-height: 1;
  box-shadow: 0 2px 8px -3px var(--accent-muted);
}
.conv.active .conv-unread-badge { box-shadow: none; }
.conv-snippet {
  color: var(--ink-2); font-size: 13px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-tags { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }

.conv.unread .conv-name { font-weight: 800; }
.conv.unread .conv-snippet { color: var(--ink); font-weight: 600; }

.chip {
  font-size: 10.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 7px;
  background: var(--panel-3); color: var(--ink-2);
}
.tag-question { background: var(--tag-question-bg); color: var(--tag-question-fg); }
.tag-help { background: var(--tag-help-bg); color: var(--tag-help-fg); }
.tag-bug { background: var(--tag-bug-bg); color: var(--tag-bug-fg); }
.tag-request { background: var(--tag-request-bg); color: var(--tag-request-fg); }
.tag-internal { background: var(--tag-internal-bg); color: var(--tag-internal-fg); }
.tag-festival { background: var(--tag-festival-bg); color: var(--tag-festival-fg); }
.tag-broadcast { background: var(--tag-broadcast-bg); color: var(--tag-broadcast-fg); }
.tag-mention { background: var(--tag-mention-bg); color: var(--tag-mention-fg); }
.tag-project { background: var(--project-accent-soft); color: var(--project-accent); }
.tag-ontrack { background: var(--project-ok-soft); color: var(--project-ok); }
.tag-atrisk { background: var(--project-risk-soft); color: var(--project-risk); }

/* ── Project info banner (collapsible) ── */
.project-banner {
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  margin: 12px var(--chat-gutter) 0;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 6px 22px -14px var(--shadow-color-soft);
  overflow: hidden;
}
.project-banner.is-collapsed { box-shadow: 0 3px 12px -10px var(--shadow-color-soft); }

.pb-head {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .14s;
}
.pb-head:hover { background: var(--panel-2); }
.pb-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--project-accent-soft); color: var(--project-accent);
  flex-shrink: 0;
}
.pb-icon svg { width: 19px; height: 19px; }
.pb-title-text { min-width: 0; flex: 1; }
.pb-title-text h3 { font-size: 15.5px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-sub { display: block; font-size: 12px; color: var(--ink-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-head-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pb-health {
  font-size: 11px; font-weight: 800;
  padding: 5px 11px; border-radius: 999px;
  background: var(--project-ok-soft); color: var(--project-ok);
  white-space: nowrap;
}
.pb-health.risk { background: var(--project-risk-soft); color: var(--project-risk); }
.pb-health.off { background: var(--tag-bug-bg); color: var(--tag-bug-fg); }
.pb-tasks-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--project-accent-soft); color: var(--project-accent);
  font-size: 12px; font-weight: 700;
  transition: filter .14s, transform .1s;
}
.pb-tasks-btn svg { width: 15px; height: 15px; }
.pb-tasks-btn:hover { filter: brightness(.97); }
.pb-tasks-btn:active { transform: scale(.96); }
.pb-tasks-count { font-weight: 800; opacity: .8; }
.pb-toggle {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; color: var(--ink-2);
  transition: background .14s, transform .2s;
}
.pb-toggle:hover { background: var(--panel-3); }
.pb-toggle svg { width: 18px; height: 18px; transition: transform .2s; }
.project-banner:not(.is-collapsed) .pb-toggle svg { transform: rotate(180deg); }

.pb-body {
  display: flex; flex-direction: column; gap: 12px;
  padding: 6px 10px 12px;
  animation: pbExpand .2s ease;
}
@keyframes pbExpand { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.pb-desc { font-size: 13px; line-height: 1.5; color: var(--ink-2); margin: 0; }
.pb-members { display: flex; align-items: center; }
.pb-av {
  width: 30px; height: 30px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  border: 2px solid var(--panel);
  margin-left: -8px;
  background: var(--panel-3);
  display: grid; place-items: center;
}
.pb-av:first-child { margin-left: 0; }
.pb-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pb-av-fallback { font-size: 12px; font-weight: 800; color: var(--ink-2); }
.pb-av-more { font-size: 11px; font-weight: 800; color: var(--ink-2); }

.pb-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pb-stat {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
}
.pb-stat-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.pb-stat-value { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-time.soon { color: var(--project-risk); }
.pb-time.overdue { color: var(--danger); }
.pb-time.ok { color: var(--project-ok); }

.pb-progress { display: flex; align-items: center; gap: 10px; }
.pb-progress-label { font-size: 11px; font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0; }
.pb-progress-track {
  flex: 1; height: 8px; border-radius: 999px;
  background: var(--panel-3); overflow: hidden;
}
.pb-progress-fill {
  display: block; height: 100%; border-radius: 999px;
  background: var(--accent-grad);
  transition: width .4s ease;
}
.pb-progress-pct { font-size: 12px; font-weight: 800; color: var(--ink-2); flex-shrink: 0; min-width: 34px; text-align: right; }
.pb-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pb-foot-tasks {
  font-size: 12.5px; font-weight: 700; color: var(--project-accent);
  padding: 6px 12px; border-radius: 999px;
  background: var(--project-accent-soft);
  transition: filter .14s, transform .1s;
}
.pb-foot-tasks:hover { filter: brightness(.97); }
.pb-foot-tasks:active { transform: scale(.97); }

/* ── Project intro card (pinned, in-thread) ── */
.project-intro {
  align-self: stretch;
  position: relative;
  margin: 4px 0 14px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--project-accent) 5%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--project-accent) 22%, var(--line));
  border-radius: 16px;
  box-shadow: 0 6px 20px -14px var(--shadow-color-soft);
  display: flex; flex-direction: column; gap: 11px;
}
.pi-flag {
  display: inline-flex; align-items: center; gap: 6px;
  align-self: flex-start;
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  color: var(--project-accent);
  text-transform: uppercase;
}
.pi-flag svg { width: 13px; height: 13px; }
.pi-head { display: flex; align-items: center; gap: 11px; }
.pi-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--project-accent-soft); color: var(--project-accent);
  flex-shrink: 0;
}
.pi-icon svg { width: 21px; height: 21px; }
.pi-head-text { flex: 1; min-width: 0; }
.pi-head-text h3 { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.pi-sub { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.pi-desc { font-size: 13.5px; line-height: 1.55; color: var(--ink); margin: 0; }
.pi-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pi-fact {
  display: flex; flex-direction: column; gap: 2px;
  padding: 9px 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  min-width: 0;
}
.pi-fact-k { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.pi-fact-v { font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-progress { display: flex; align-items: center; gap: 10px; }
.pi-progress .pb-progress-track { flex: 1; }
.pi-progress-pct { font-size: 12px; font-weight: 800; color: var(--ink-2); flex-shrink: 0; white-space: nowrap; }
.pi-tasks-btn {
  flex-shrink: 0;
  font-size: 12.5px; font-weight: 700; color: var(--accent-contrast);
  padding: 7px 14px; border-radius: 999px;
  background: var(--accent-grad);
  box-shadow: 0 4px 14px -5px var(--accent-muted);
  transition: filter .14s, transform .1s;
}
.pi-tasks-btn:hover { filter: brightness(1.05); }
.pi-tasks-btn:active { transform: scale(.97); }

/* ── Tasks drawer ── */
.task-summary {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 14px;
}
.task-summary-top { display: flex; align-items: baseline; justify-content: space-between; }
.task-summary-count { font-size: 22px; font-weight: 800; color: var(--ink); }
.task-summary-count span { font-size: 13px; font-weight: 700; color: var(--ink-3); }
.task-summary-pct { font-size: 15px; font-weight: 800; color: var(--project-accent); }
.task-summary-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.task-chip { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.task-chip.progress { background: var(--project-risk-soft); color: var(--project-risk); }
.task-chip.todo { background: var(--panel-3); color: var(--ink-2); }
.task-chip.done { background: var(--project-ok-soft); color: var(--project-ok); }

.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.task-card.open { border-color: color-mix(in srgb, var(--project-accent) 35%, var(--line)); box-shadow: 0 6px 18px -12px var(--shadow-color-soft); }
.task-row {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 11px 13px;
  text-align: left;
  transition: background .12s;
}
.task-row:hover { background: var(--panel-2); }
.task-check {
  width: 22px; height: 22px; border-radius: 7px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border: 2px solid var(--line);
  color: var(--white);
}
.task-check svg { width: 13px; height: 13px; }
.task-check.done { background: var(--project-ok); border-color: var(--project-ok); }
.task-check.progress { border-color: var(--project-risk); border-style: dashed; }
.task-check.todo { border-color: var(--ink-3); }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.task-title { font-size: 13.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-card.is-done .task-title { color: var(--ink-2); text-decoration: line-through; }
.task-sub { display: flex; align-items: center; gap: 6px; font-size: 11.5px; }
.task-status { font-weight: 800; }
.task-status.done { color: var(--project-ok); }
.task-status.progress { color: var(--project-risk); }
.task-status.todo { color: var(--ink-3); }
.task-due { color: var(--ink-3); font-weight: 600; }
.task-due.soon { color: var(--project-risk); }
.task-due.overdue { color: var(--danger); }
.task-av {
  width: 30px; height: 30px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  background: var(--panel-3);
  display: grid; place-items: center;
  border: 1px solid var(--line);
}
.task-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.task-av-fallback { font-size: 12px; font-weight: 800; color: var(--ink-2); }
.task-detail {
  padding: 0 13px 13px 46px;
  display: flex; flex-direction: column; gap: 11px;
  animation: pbExpand .2s ease;
}
.task-desc { font-size: 13px; line-height: 1.5; color: var(--ink-2); margin: 0; }
.task-desc-empty { font-style: italic; opacity: .7; }
.task-meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.task-meta {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: 10px;
}
.tm-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.tm-value { font-size: 12.5px; font-weight: 700; color: var(--ink); }

/* ── Chat pane ── */
.chat-pane {
  display: flex; flex-direction: column;
  min-height: 0; position: relative;
  background:
    url('assets/chat-bg.svg') center / cover no-repeat,
    var(--bg);
}
/* icon doodle wallpaper (chat / pen / cloud / user / group / mic / record / voice) */
.chat-pane::after {
  content: '';
  position: absolute; inset: 0;
  background: url('assets/chat-icons.svg') repeat;
  background-size: 340px 340px;
  opacity: var(--chat-icons-opacity);
  pointer-events: none;
  z-index: 0;
}
/* soft top wash so the header blends into the background */
.chat-pane::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--panel) 35%, transparent) 0%, transparent 60%);
  pointer-events: none;
  z-index: 1;
}
[data-theme="dark"] .chat-pane {
  background:
    var(--chat-dark-grad),
    var(--bg);
}
[data-theme="dark"] .chat-pane::after {
  filter: invert(1) brightness(1.5);
  opacity: var(--chat-icons-opacity);
}
.chat-pane[data-wallpaper="sand"]::before { background: radial-gradient(120% 80% at 50% 0%, var(--wallpaper-sand), transparent 60%); }
.chat-pane[data-wallpaper="mint"]::before { background: radial-gradient(120% 80% at 50% 0%, var(--wallpaper-mint), transparent 60%); }
.chat-pane[data-wallpaper="slate"]::before { background: radial-gradient(120% 80% at 50% 0%, var(--wallpaper-slate), transparent 60%); }
.chat-pane[data-wallpaper="none"] { background: var(--bg); }
.chat-pane[data-wallpaper="none"]::before,
.chat-pane[data-wallpaper="none"]::after { display: none; }
.chat-bar {
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  height: 84px;
  padding: 0 var(--chat-gutter);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  overflow: visible;
}
.thread-scroll {
  position: relative;
  z-index: 1;
}

.chat-who { display: flex; align-items: center; gap: 13px; }
.chat-back {
  display: none;
  width: 38px; height: 38px; border-radius: 11px;
  place-items: center; color: var(--ink-2);
}
.chat-back svg { width: 20px; height: 20px; }
.chat-back:hover { background: var(--panel-2); color: var(--ink); }
.who-av {
  position: relative;
  width: var(--header-av-size); height: var(--header-av-size);
  border-radius: 50%;
  padding: 3px;
  background: var(--status-offline);
  flex-shrink: 0;
}
.who-av-btn {
  cursor: pointer;
  border: none;
  transition: transform .12s, box-shadow .15s;
}
.who-av-btn:hover { transform: scale(1.04); box-shadow: 0 4px 14px -4px var(--accent-muted); }
.who-av-btn:active { transform: scale(.98); }
.who-av.status-online { background: var(--status-online); }
.who-av.status-away { background: var(--status-away); }
.who-av.status-offline { background: var(--status-offline); }
.who-av.status-online::before {
  content: '';
  position: absolute; inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--status-online);
  opacity: 0;
  animation: statusPulse 2.4s ease infinite;
}
.who-av.no-status {
  padding: 0;
  background: transparent;
}
.who-av.no-status img { border-color: var(--line); }
.who-av.no-status::before { display: none; }
.who-av img {
  width: 100%; height: 100%;
  border-radius: 50%; object-fit: cover;
  display: block; box-sizing: border-box;
  border: 2.5px solid var(--panel);
}
.who-dot { display: none; }
.who-text h2 { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; cursor: pointer; }
.who-text { cursor: pointer; }
.who-text:hover h2 { color: var(--accent-ink); }
.who-sub { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.who-sub #headerStatus { text-transform: capitalize; color: var(--accent-ink); font-weight: 700; }
.who-sub #headerStatus::after { content: '·'; margin-left: 7px; color: var(--ink-3); }

.chat-tools { display: flex; align-items: center; gap: 8px; overflow: visible; }
.ctool {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-2);
  background: var(--panel-2);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  transition: background .15s, color .15s, transform .12s, box-shadow .15s;
}
.ctool svg { width: 19px; height: 19px; }
.ctool:hover {
  background: var(--panel);
  color: var(--accent-ink);
  box-shadow: 0 4px 12px -5px var(--shadow-color-soft);
  transform: translateY(-1px);
}
.ctool:active { transform: translateY(0) scale(.95); }
.ctool.active { background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }

.menu-anchor { position: relative; z-index: 30; }
.chat-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 220px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 7px;
  z-index: 100;
  animation: pop .14s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.chat-menu button {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 10px 11px;
  border-radius: 9px;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  text-align: left;
  transition: background .12s;
}
.chat-menu button svg { width: 17px; height: 17px; color: var(--ink-2); }
.chat-menu button:hover { background: var(--panel-2); }
.chat-menu button.danger { color: var(--danger); }
.chat-menu button.danger svg { color: var(--danger); }
.chat-menu button.hidden { display: none; }
.menu-line { border: none; border-top: 1px solid var(--line); margin: 6px 4px; }

/* ── Thread ── */
.thread-scroll {
  flex: 1; overflow-y: auto;
  padding: 14px var(--chat-gutter) 10px;
  display: flex; flex-direction: column; gap: 3px;
  background: transparent;
}

.date-chip {
  position: sticky;
  top: 6px;
  z-index: 6;
  align-self: center;
  margin: 12px 0 16px;
  padding: 6px 16px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink-2);
  font-size: 11.5px; font-weight: 800;
  letter-spacing: .02em;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  box-shadow: 0 4px 14px -6px var(--shadow-color-date);
}

.bubble-row { display: flex; gap: 10px; align-items: flex-end; max-width: min(92%, 720px); margin-bottom: 10px; position: relative; }
.bubble-row.in { align-self: flex-start; }
.bubble-row.out { align-self: flex-end; flex-direction: row-reverse; }
.bubble-row:hover .msg-more,
.bubble-row:hover .msg-react { opacity: 1; pointer-events: auto; }
/* tighten spacing within a group so consecutive messages line up as one block */
.bubble-row.grp-next { margin-bottom: 2px; }

.bubble-av-slot {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  height: 34px;
}
.bubble-row.out .bubble-av-slot { flex-direction: row-reverse; }
.bubble-av-wrap {
  width: 34px; height: 34px;
  flex-shrink: 0;
  position: relative;
}
.bubble-av-btn {
  padding: 0; border: none; background: none; cursor: pointer;
  transition: transform .12s;
}
.bubble-av-btn:not(.ghost):hover { transform: scale(1.06); }
.bubble-av-btn:not(.ghost):active { transform: scale(.98); }
/* keep the avatar's space reserved so grouped bubbles stay aligned with the first */
.bubble-av-wrap.ghost {
  visibility: hidden;
}
.bubble-av {
  width: 34px; height: 34px;
  border-radius: 50%; object-fit: cover;
  display: block;
  border: 2px solid var(--panel);
  box-shadow: 0 1px 4px var(--shadow-color-black-faint);
}
.bubble-row.out .bubble-av-wrap::before {
  content: '';
  position: absolute; inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.5;
}
.msg-more {
  width: 26px; height: 26px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-2);
  opacity: 0; pointer-events: none;
  flex-shrink: 0;
  transition: opacity .14s, background .14s, color .14s;
  box-shadow: 0 1px 3px var(--shadow-color-black-ghost);
}
.bubble-row.out .msg-more {
  background: var(--panel);
  color: var(--ink-2);
}
.msg-more svg { width: 14px; height: 14px; }
.msg-more:hover { background: var(--panel-2); color: var(--accent-ink); }
.msg-react {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-2);
  opacity: 0; pointer-events: none;
  flex-shrink: 0;
  transition: opacity .14s, background .14s, color .14s, transform .1s;
  box-shadow: 0 1px 3px var(--shadow-color-black-ghost);
}
.msg-react svg { width: 15px; height: 15px; }
.msg-react:hover { background: var(--accent-soft); color: var(--accent-ink); transform: scale(1.08); }

.bubble-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; position: relative; }
.bubble-row.out .bubble-col { align-items: flex-end; }
.bubble-sender { font-size: 11.5px; font-weight: 700; color: var(--accent-ink); margin-left: 4px; }

.bubble-wrap { position: relative; max-width: 100%; }

.bubble {
  padding: 9px 13px;
  font-size: 14px; line-height: 1.45;
  border-radius: 18px;
  word-wrap: break-word;
  max-width: 100%;
  transition: transform .14s ease, box-shadow .14s ease;
}
.bubble-row:hover .bubble { transform: translateY(-1px); }
.bubble-row.in .bubble {
  background: var(--bubble-in);
  border: 1px solid var(--bubble-in-line);
  color: var(--ink);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  box-shadow: 0 3px 12px -6px var(--shadow-color-bubble-in);
}
.bubble-row.out .bubble {
  background: var(--accent-grad);
  color: var(--bubble-out-ink);
  border-radius: 18px;
  border-bottom-right-radius: 6px;
  box-shadow: 0 6px 18px -8px var(--accent-muted);
}
/* grouped corners: tail (6px) only on the last bubble of a group */
.bubble-row.in.grp-prev .bubble { border-top-left-radius: 6px; }
.bubble-row.in.grp-next .bubble { border-bottom-left-radius: 18px; }
.bubble-row.out.grp-prev .bubble { border-top-right-radius: 6px; }
.bubble-row.out.grp-next .bubble { border-bottom-right-radius: 18px; }
/* media-only bubble: let the media fill edge to edge */
.bubble.media-only {
  padding: 4px;
  overflow: hidden;
}
.bubble-text { white-space: pre-wrap; }
.bubble.media-only .bubble-text { padding: 6px 9px 4px; }
.bubble-edited { font-size: 10px; opacity: 0.65; margin-left: 6px; font-style: italic; }

.bubble-reply {
  border-left: 3px solid var(--reply-quote-border);
  padding: 7px 11px; margin-bottom: 8px;
  border-radius: 9px;
  background: var(--reply-quote-bg);
  font-size: 12px;
}
.bubble-row.out .bubble-reply { background: var(--bubble-reply-out-bg); border-left-color: var(--bubble-reply-out-border); }
.bubble-reply .reply-author { font-weight: 800; display: block; margin-bottom: 3px; font-size: 11.5px; color: var(--reply-quote-border); }
.bubble-row.out .bubble-reply .reply-author { color: var(--bubble-reply-out-border); }
.bubble-reply .reply-text { opacity: 0.9; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bubble-row.out .bubble-reply .reply-text { color: inherit; }

/* ── Reactions ── */
.bubble-reactions {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-top: 5px;
}
.bubble-row.out .bubble-reactions { justify-content: flex-end; }
.reaction-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px 2px 7px;
  height: 26px;
  border-radius: 999px;
  background: var(--reaction-bg);
  border: 1px solid var(--reaction-border);
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  box-shadow: 0 1px 4px var(--shadow-color-black-faint);
  transition: transform .1s, background .12s, border-color .12s;
}
.reaction-pill .r-emoji { font-size: 14px; line-height: 1; }
.reaction-pill .r-count { font-variant-numeric: tabular-nums; }
.reaction-pill:hover { transform: translateY(-1px); }
.reaction-pill.mine {
  background: var(--reaction-mine-bg);
  border-color: var(--reaction-mine-border);
  color: var(--accent-ink);
}
.reaction-add {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--reaction-bg);
  border: 1px solid var(--reaction-border);
  color: var(--ink-3);
  box-shadow: 0 1px 4px var(--shadow-color-black-faint);
  transition: transform .1s, color .12s, background .12s;
}
.reaction-add svg { width: 15px; height: 15px; }
.reaction-add:hover { color: var(--accent-ink); background: var(--panel-2); transform: translateY(-1px); }

/* quick reaction popover */
.reaction-pop {
  position: fixed;
  z-index: 80;
  display: flex; align-items: center; gap: 2px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  animation: pop .14s ease;
}
.reaction-pop button {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 21px; line-height: 1;
  transition: transform .12s, background .12s;
}
.reaction-pop button:hover { transform: scale(1.25); background: var(--panel-2); }
.reaction-pop button.picked { background: var(--accent-soft); }

.msg-media { margin-top: 6px; border-radius: 14px; overflow: hidden; max-width: 300px; }
.bubble.media-only > .msg-media:first-child { margin-top: 0; }
.msg-media img { width: 100%; display: block; cursor: pointer; transition: transform .25s ease; }
.msg-media img:hover { transform: scale(1.03); }
.msg-media video { width: 100%; display: block; border-radius: 14px; background: var(--media-bg); }

/* multi-image gallery grid */
.msg-gallery {
  margin-top: 6px;
  display: grid;
  gap: 3px;
  border-radius: 14px;
  overflow: hidden;
  max-width: 300px;
}
.bubble.media-only > .msg-gallery:first-child { margin-top: 0; }
.msg-gallery.n2 { grid-template-columns: 1fr 1fr; }
.msg-gallery.n3 { grid-template-columns: 1fr 1fr; }
.msg-gallery.n3 .gal-item:first-child { grid-column: 1 / -1; }
.msg-gallery.n4, .msg-gallery.nmore { grid-template-columns: 1fr 1fr; }
.gal-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
}
.gal-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.gal-item:hover img { transform: scale(1.05); }
.gal-more {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--gallery-overlay-bg);
  color: var(--gallery-overlay-text); font-size: 22px; font-weight: 800;
  backdrop-filter: blur(2px);
}

/* ── Voice message player ── */
.msg-voice {
  margin-top: 6px;
  display: flex; align-items: center; gap: 11px;
  min-width: 240px; max-width: 280px;
  padding: 9px 12px 9px 9px;
  border-radius: 14px;
  background: var(--voice-in-bg);
}
.bubble-row.out .msg-voice { background: var(--voice-out-bg); }
.voice-play {
  width: 40px; height: 40px; border-radius: 50%;
  flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--accent-grad); color: var(--voice-play-icon);
  box-shadow: 0 3px 10px -3px var(--accent-muted);
  transition: transform .1s;
}
.bubble-row.out .voice-play { background: var(--voice-play-out-bg); color: var(--accent-ink); }
.voice-play:active { transform: scale(.92); }
.voice-play svg { width: 18px; height: 18px; }
.voice-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.voice-wave {
  position: relative;
  display: flex; align-items: center; gap: 2px;
  height: 26px; cursor: pointer;
  overflow: hidden;
}
.voice-wave > span {
  flex: 1;
  min-width: 2px;
  border-radius: 2px;
  background: var(--ink-3);
  opacity: 0.5;
}
.bubble-row.out .voice-wave > span { background: var(--voice-wave-out); opacity: var(--voice-wave-out-opacity); }
.voice-progress {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--accent);
  mix-blend-mode: color;
  pointer-events: none;
  transition: width .1s linear;
}
.bubble-row.out .voice-progress { background: var(--voice-progress-out); }
.msg-voice.playing .voice-play { box-shadow: 0 0 0 4px var(--accent-muted); }
.voice-time {
  font-size: 11px; font-weight: 700;
  color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.bubble-row.out .voice-time { color: var(--voice-time-out); }

/* ── Video message player ── */
.msg-video {
  position: relative;
  margin-top: 6px;
  border-radius: 14px; overflow: hidden;
  max-width: 300px;
  background: var(--media-bg);
  cursor: pointer;
}
.bubble.media-only > .msg-video:first-child { margin-top: 0; }
.msg-video video { width: 100%; display: block; max-height: 360px; }
.video-play {
  position: absolute; inset: 0; margin: auto;
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--video-play-bg); color: var(--accent-ink);
  box-shadow: 0 6px 20px -6px var(--shadow-color-black-mid);
  transition: transform .12s, opacity .15s;
}
.video-play svg { width: 26px; height: 26px; margin-left: 3px; }
.video-play:hover { transform: scale(1.08); }
.msg-video.playing .video-play { opacity: 0; pointer-events: none; }
.video-badge {
  position: absolute; top: 8px; left: 8px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 20px;
  background: var(--video-badge-bg);
  color: var(--white); font-size: 11px; font-weight: 700;
  backdrop-filter: blur(4px);
  transition: opacity .15s;
}
.video-badge svg { width: 13px; height: 13px; }
.msg-video.playing .video-badge { opacity: 0; }

.msg-files { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.msg-file {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 11px;
  background: var(--attach-in-bg);
  min-width: 200px;
}
.bubble-row.out .msg-file { background: var(--attach-out-bg); }
.msg-file-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 9px; font-weight: 800; color: var(--file-icon-text); flex-shrink: 0;
}
.msg-file-icon.pdf { background: var(--file-pdf); }
.msg-file-icon.doc { background: var(--file-doc); }
.msg-file-icon.xls { background: var(--file-xls); }
.msg-file-icon.zip { background: var(--file-zip); }
.msg-file-icon.file { background: var(--ink-2); }
.msg-file-info { flex: 1; min-width: 0; }
.msg-file-name { font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-file-meta { font-size: 11px; opacity: 0.75; }
.msg-file-dl {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--attach-dl-in-bg); transition: background .12s;
}
.bubble-row.out .msg-file-dl { background: var(--attach-dl-out-bg); color: var(--white); }
.msg-file-dl svg { width: 16px; height: 16px; }
.msg-file-dl:hover { background: var(--attach-dl-in-hover); }

.bubble-time {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; color: var(--ink-3); padding: 0 6px; font-weight: 600;
}
.bubble-row.out .bubble-time { color: var(--accent-ink); }
.bubble-check { width: 14px; height: 14px; color: var(--grad-2); flex-shrink: 0; }
.bubble-check svg { width: 100%; height: 100%; display: block; }
.mention-hl { color: var(--accent-ink); font-weight: 700; }
.mention-hl.mention-staff { color: var(--tag-internal-fg); }
.mention-hl.mention-customer { color: var(--tag-request-fg); }
.bubble-row.out .mention-hl { color: var(--bubble-out-mention); }
.bubble-row.out .mention-hl.mention-staff { color: var(--bubble-out-mention-staff); }
.bubble-row.out .mention-hl.mention-customer { color: var(--bubble-out-mention-customer); }

/* message context menu */
.msg-menu {
  position: fixed;
  min-width: 168px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 75;
  animation: pop .14s ease;
}
.msg-menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 11px;
  border-radius: 9px;
  font-size: 13.5px; font-weight: 600;
  text-align: left; transition: background .12s;
}
.msg-menu button svg { width: 16px; height: 16px; color: var(--ink-2); }
.msg-menu button:hover { background: var(--panel-2); }
.msg-menu button.danger { color: var(--danger); }
.msg-menu button.danger svg { color: var(--danger); }
.msg-menu button.hidden { display: none; }

.sys-note {
  align-self: center;
  max-width: 80%;
  text-align: center;
  background: var(--tag-broadcast-bg);
  color: var(--tag-broadcast-fg);
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 13.5px; line-height: 1.5; font-weight: 600;
  margin: 6px 0;
}

.empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--ink-3); gap: 8px;
}
.empty svg { width: 44px; height: 44px; opacity: .5; }

/* ── Composer (unified card) ── */
.composer {
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  padding: 8px var(--chat-gutter) 16px;
  background: linear-gradient(to top, color-mix(in srgb, var(--panel) 98%, transparent) 40%, transparent);
}
.composer-stack {
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
}
.reply-bar, .edit-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px;
  background: var(--reply-bar-bg);
  border: 1px solid var(--reply-bar-border);
  border-radius: 14px;
  font-size: 13px;
  position: relative;
}
.reply-bar { padding-left: 16px; }
.reply-bar-accent {
  position: absolute; left: 7px; top: 9px; bottom: 9px;
  width: 4px; border-radius: 4px;
  background: var(--reply-accent);
}
.reply-bar-body { min-width: 0; flex: 1; }
.reply-label { display: block; font-size: 12px; font-weight: 800; color: var(--reply-accent); }
.reply-snippet { display: block; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.edit-bar span { font-weight: 700; color: var(--accent-ink); }
.reply-cancel {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 20px; line-height: 1; color: var(--ink-2);
  flex-shrink: 0; margin-left: 10px;
}
.reply-cancel:hover { background: var(--panel-2); }

.attach-preview {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--composer-radius);
}
.attach-chip {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: 11px;
  max-width: 220px;
  border: 1px solid var(--line);
}
.attach-chip-thumb {
  width: 44px; height: 44px; border-radius: 9px;
  object-fit: cover; flex-shrink: 0;
  background: var(--panel-3);
  display: grid; place-items: center;
}
.attach-chip-thumb svg { width: 20px; height: 20px; color: var(--ink-2); }
.attach-chip-info { min-width: 0; flex: 1; }
.attach-chip-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-chip-size { font-size: 10.5px; color: var(--ink-2); }
.attach-chip-remove {
  position: absolute; top: -6px; right: -6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  font-size: 14px; line-height: 1;
  display: grid; place-items: center;
  border: 2px solid var(--panel);
}
.attach-chip-remove:hover { background: var(--danger); color: var(--white); }

/* floating message bar */
.composer-bar {
  position: relative;
  display: flex; align-items: flex-end; gap: 8px;
  padding: 7px 8px 7px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow:
    0 10px 30px -12px var(--shadow-color-soft),
    0 2px 8px -4px var(--shadow-color-black-whisper);
  transition: border-color .18s, box-shadow .18s;
}
.composer-bar:focus-within {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  box-shadow:
    0 12px 34px -12px var(--accent-muted),
    0 0 0 3px var(--accent-soft);
}
.composer-bar textarea {
  flex: 1; min-width: 0;
  border: none; outline: none; resize: none; background: none;
  font-family: inherit; font-size: 15px; color: var(--ink);
  line-height: 1.5;
  padding: 9px 0;
  min-height: 24px;
  max-height: 140px;
}
.composer-bar textarea::placeholder { color: var(--ink-3); font-weight: 500; }
.composer-bar textarea:disabled { opacity: 0.55; cursor: not-allowed; }

.composer-actions {
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}
.bar-icon {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: background .12s, color .12s, transform .1s;
}
.bar-icon svg { width: 21px; height: 21px; }
.bar-icon:hover { background: var(--panel-2); color: var(--accent-ink); }
.bar-icon:active { transform: scale(.92); }
.bar-icon.active { background: var(--accent-soft); color: var(--accent-ink); }

.composer-send-fab {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-grad);
  color: var(--accent-contrast);
  flex-shrink: 0;
  margin-left: 2px;
  transition: filter .15s, transform .1s, box-shadow .15s, opacity .15s;
  box-shadow: 0 5px 16px -5px var(--accent-muted);
}
.composer-send-fab svg { width: 19px; height: 19px; }
.composer-send-fab:hover:not(:disabled) { filter: brightness(1.07); transform: scale(1.05); }
.composer-send-fab:active:not(:disabled) { transform: scale(.94); }
.composer-send-fab:disabled {
  background: var(--composer-send-disabled-bg);
  color: var(--composer-send-disabled-fg);
  box-shadow: none;
  cursor: not-allowed;
}

/* "+" attachments popover */
.plus-menu {
  position: absolute;
  right: 8px; bottom: calc(100% + 10px);
  width: 210px;
  z-index: 50;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  animation: pop .14s ease;
}
.plus-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 10px;
  border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  text-align: left;
  transition: background .12s;
}
.plus-item:hover { background: var(--panel-2); }
.plus-item-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink);
  flex-shrink: 0;
}
.plus-item-icon svg { width: 17px; height: 17px; }

/* ── Mention picker (@ staff · @@ customers) ── */
.mention-picker {
  position: absolute;
  left: 14px;
  bottom: calc(100% + 10px);
  width: min(var(--mention-picker-w), calc(100% - 28px));
  max-width: var(--mention-picker-w);
  z-index: 50;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 36px -14px var(--shadow-color-soft), 0 4px 12px -6px var(--shadow-color-black-whisper);
  overflow: hidden;
  animation: pop .14s ease;
}
.mention-picker-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 9px;
  border-bottom: 1px solid var(--line);
}
.mention-picker.is-staff .mention-picker-head {
  background: color-mix(in srgb, var(--tag-internal-bg) 55%, var(--panel));
}
.mention-picker.is-customer .mention-picker-head {
  background: color-mix(in srgb, var(--tag-request-bg) 55%, var(--panel));
}
.mention-picker-badge {
  font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  padding: 3px 8px; border-radius: 6px; flex-shrink: 0;
}
.mention-picker.is-staff .mention-picker-badge {
  background: var(--tag-internal-bg); color: var(--tag-internal-fg);
}
.mention-picker.is-customer .mention-picker-badge {
  background: var(--tag-request-bg); color: var(--tag-request-fg);
}
.mention-picker-title {
  font-size: 11.5px; font-weight: 600; color: var(--ink-2); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mention-picker-list {
  max-height: 200px; overflow-y: auto;
  padding: 4px;
}
.mention-picker-empty {
  padding: 16px 12px; text-align: center;
  font-size: 12.5px; color: var(--ink-3); font-weight: 600;
}
.mention-picker-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 8px;
  border-radius: 10px;
  text-align: left;
  transition: background .12s;
}
.mention-picker-item:hover,
.mention-picker-item.active { background: var(--panel-2); }
.mention-picker-item.selected {
  background: var(--accent-soft);
}
.mention-picker-item.selected.active {
  background: color-mix(in srgb, var(--accent-soft) 80%, var(--panel-2));
}
.mention-picker-check {
  width: 18px; height: 18px; flex-shrink: 0;
  border-radius: 5px; border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800; color: transparent;
  transition: background .12s, border-color .12s, color .12s;
}
.mention-picker-item.selected .mention-picker-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.mention-picker-item img {
  width: 32px; height: 32px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.mention-picker-meta { min-width: 0; flex: 1; }
.mention-picker-name {
  display: block; font-size: 13px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mention-picker-role {
  display: block; font-size: 11px; color: var(--ink-2); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mention-picker-foot {
  padding: 6px 8px 8px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}
.mention-picker-apply {
  width: 100%; padding: 8px 12px;
  border-radius: 9px;
  background: var(--accent-grad);
  color: var(--accent-contrast);
  font-size: 12.5px; font-weight: 700;
  transition: filter .12s, transform .1s;
}
.mention-picker-apply:hover { filter: brightness(1.06); }
.mention-picker-apply:active { transform: scale(.98); }

/* ── Emoji picker ── */
.emoji-picker {
  position: absolute; bottom: 88px; left: var(--chat-gutter);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  z-index: 50;
}
.emoji-picker button { font-size: 22px; padding: 6px; border-radius: 9px; transition: background .12s; }
.emoji-picker button:hover { background: var(--panel-2); }

/* ── Details drawer ── */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: var(--overlay-drawer);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
  z-index: 50;
}
.drawer-backdrop.visible { opacity: 1; pointer-events: auto; }

.details-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: var(--drawer-w); max-width: 90vw;
  background: var(--panel);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  z-index: 60;
  display: flex; flex-direction: column;
}
.details-drawer.open { transform: translateX(0); }

.drawer-panel-head {
  flex-shrink: 0;
  padding: 18px 18px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.drawer-panel-head h2 { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }

.drawer-close {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  color: var(--ink-2); background: var(--panel-2);
  flex-shrink: 0; transition: background .15s, color .15s;
}
.drawer-close svg { width: 18px; height: 18px; }
.drawer-close:hover { background: var(--panel-3); color: var(--ink); }

.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 28px; }

/* inline hero inside overview drawer */
.drawer-hero {
  text-align: center;
  padding: 8px 0 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.drawer-hero img {
  width: 76px; height: 76px; border-radius: 22px;
  object-fit: cover; margin-bottom: 11px;
  border: 3px solid var(--panel);
  box-shadow: var(--shadow);
}
.drawer-quick-actions { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.drawer-quick-actions button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 74px; padding: 11px 6px; border-radius: 14px;
  background: var(--panel-2); color: var(--accent-ink);
  font-size: 11.5px; font-weight: 700;
  border: 1px solid var(--line);
  transition: background .15s, transform .1s;
}
.drawer-quick-actions button svg { width: 19px; height: 19px; }
.drawer-quick-actions button:hover { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }

.drawer-search {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2); font-family: inherit;
  font-size: 14px; color: var(--ink); outline: none;
  margin-bottom: 14px;
}
.drawer-search:focus { border-color: var(--accent); background: var(--panel); }

.search-hit {
  padding: 11px 12px; border-radius: 12px;
  background: var(--panel-2); margin-bottom: 8px; cursor: pointer;
  transition: background .12s;
}
.search-hit:hover { background: var(--accent-soft); }
.search-hit .hit-text { font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.search-hit .hit-meta { font-size: 11px; color: var(--ink-2); margin-top: 4px; font-weight: 600; }

.settings-group { margin-bottom: 22px; }
.settings-group-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-3); margin-bottom: 10px;
}
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 14px; border-radius: 12px;
  background: var(--panel-2); margin-bottom: 8px;
}
.setting-row.col { flex-direction: column; align-items: stretch; gap: 10px; }
.setting-info { min-width: 0; }
.setting-label { font-size: 14px; font-weight: 700; color: var(--ink); }
.setting-desc { font-size: 12px; color: var(--ink-2); margin-top: 3px; line-height: 1.4; }

.toggle {
  width: 46px; height: 26px; border-radius: 13px;
  background: var(--line-strong); position: relative;
  flex-shrink: 0; transition: background .2s;
}
.toggle.on { background: var(--accent-grad); }
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--toggle-knob); transition: transform .2s;
  box-shadow: 0 1px 3px var(--shadow-color-black-light);
}
.toggle.on::after { transform: translateX(20px); }

.setting-select {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel);
  font-family: inherit; font-size: 13px; color: var(--ink);
}

.setting-action {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--panel-2); font-weight: 700; font-size: 13.5px;
  text-align: left; transition: background .12s;
}
.setting-action:hover { background: var(--panel-3); }
.setting-action.danger { color: var(--danger); background: var(--danger-bg); }
.setting-action.danger:hover { background: var(--setting-danger-bg-hover); }
[data-theme="dark"] .setting-action.danger { background: var(--danger-bg-dark); }

.drawer-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.drawer-stat { background: var(--panel-2); border-radius: 12px; padding: 12px 6px; text-align: center; }
.drawer-stat .val { font-size: 18px; font-weight: 800; color: var(--accent-ink); }
.drawer-stat .lbl { font-size: 10.5px; color: var(--ink-2); margin-top: 2px; font-weight: 600; }

.dp-name { font-size: 18px; font-weight: 800; color: var(--ink); }
.dp-meta { font-size: 13px; color: var(--accent-ink); margin-top: 3px; font-weight: 600; }

.drawer-section-title { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 18px 0 10px; }

.member-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 8px; border-radius: 12px;
  transition: background .12s;
}
.member-row:hover { background: var(--panel-2); }
.member-row.is-admin { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
.member-av-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  padding: 0; cursor: pointer;
  transition: transform .12s;
}
.member-av-btn:hover { transform: scale(1.05); }
.member-info { flex: 1; min-width: 0; }
.member-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.member-row .name { font-weight: 700; font-size: 13.5px; }
.member-row .role { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.you-tag { font-weight: 600; color: var(--ink-3); font-size: 12px; }
.admin-badge {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 6px;
  background: var(--accent-grad); color: var(--accent-contrast);
}
.members-hint { font-size: 12px; color: var(--ink-2); margin: -4px 0 10px; line-height: 1.45; }
.member-remove {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--ink-3); flex-shrink: 0;
  transition: background .12s, color .12s;
}
.member-remove svg { width: 16px; height: 16px; }
.member-remove:hover { background: var(--member-remove-hover-bg); color: var(--danger); }

/* Profile drawer */
.profile-drawer { padding: 4px 0; }
.profile-hero { text-align: center; padding: 8px 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.profile-av-ring {
  width: 96px; height: 96px; border-radius: 50%;
  padding: 3px; margin: 0 auto 14px;
  display: grid; place-items: center;
}
.profile-av-ring img {
  width: 100%; height: 100%; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--panel);
  box-sizing: border-box;
}
.profile-name { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.profile-role { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }
.profile-kind {
  display: inline-block; margin-top: 10px;
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 8px;
}
.profile-kind.staff { background: var(--tag-internal-bg); color: var(--tag-internal-fg); }
.profile-kind.customer { background: var(--tag-request-bg); color: var(--tag-request-fg); }
.profile-status {
  display: inline-block; margin-left: 8px;
  font-size: 12px; font-weight: 700; text-transform: capitalize;
  color: var(--accent-ink);
}
.profile-actions {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 20px;
}
.profile-action {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 8px; border-radius: 14px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--accent-ink);
  transition: background .15s, border-color .15s, transform .1s;
}
.profile-action svg { width: 20px; height: 20px; }
.profile-action:hover { background: var(--accent-soft); border-color: var(--accent); }
.profile-action:active { transform: scale(.97); }
.profile-section-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-3); margin-bottom: 10px;
}
.profile-field {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 11px;
  background: var(--panel-2); margin-bottom: 8px;
}
.pf-label { font-size: 12.5px; color: var(--ink-2); font-weight: 600; flex-shrink: 0; }
.pf-value { font-size: 13px; font-weight: 700; color: var(--ink); text-align: right; word-break: break-word; }

.drawer-empty { color: var(--ink-3); font-size: 13px; padding: 8px 0; }

.pin-row { background: var(--tag-broadcast-bg); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.pin-text { font-size: 13px; color: var(--ink); line-height: 1.45; font-weight: 600; }
.pin-by { font-size: 11.5px; color: var(--ink-2); margin-top: 5px; }

.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.media-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 11px; cursor: pointer; transition: transform .15s; }
.media-grid img:hover { transform: scale(1.04); }

.file-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; transition: background .12s; }
.file-item:hover { background: var(--panel-2); }
.file-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: var(--file-icon-text); flex-shrink: 0; }
.file-icon.pdf { background: var(--file-pdf); }
.file-icon.doc { background: var(--file-doc); }
.file-icon.xls { background: var(--file-xls); }
.file-info { flex: 1; min-width: 0; }
.file-info .filename { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info .meta { font-size: 11.5px; color: var(--ink-2); }
.btn-download { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--ink-2); transition: background .12s; }
.btn-download svg { width: 17px; height: 17px; }
.btn-download:hover { background: var(--panel-3); color: var(--accent-ink); }

.link-row { display: flex; align-items: center; gap: 12px; padding: 11px; border-radius: 12px; text-decoration: none; color: inherit; transition: background .12s; }
.link-row:hover { background: var(--panel-2); }
.link-row svg { width: 20px; height: 20px; color: var(--accent-ink); flex-shrink: 0; }
.link-row .url { font-weight: 700; font-size: 13px; color: var(--ink); }
.link-row .domain { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--ink); color: var(--bg);
  padding: 12px 20px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0; transition: opacity .25s, transform .25s;
  z-index: 90;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Image lightbox / slider ── */
.lightbox {
  position: fixed; inset: 0; z-index: 96;
  background: var(--overlay-lightbox);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-columns: 1fr;
  animation: pop .18s ease;
}
.lightbox-stage {
  grid-row: 1; grid-column: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 60px 80px 12px;
  min-height: 0;
  overflow: hidden;
}
.lightbox-stage img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px -20px var(--shadow-color-lightbox);
  animation: lbFade .25s ease;
}
@keyframes lbFade { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
.lightbox-close {
  position: absolute; top: 18px; right: 18px; z-index: 3;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--overlay-glass); color: var(--call-text);
  transition: background .15s, transform .1s;
}
.lightbox-close svg { width: 22px; height: 22px; }
.lightbox-close:hover { background: var(--overlay-glass-hover); }
.lightbox-close:active { transform: scale(.92); }
.lightbox-counter {
  position: absolute; top: 26px; left: 50%; transform: translateX(-50%);
  color: var(--call-text); font-size: 13.5px; font-weight: 700;
  background: var(--overlay-glass); padding: 6px 14px; border-radius: 20px;
  z-index: 3;
}
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--overlay-glass); color: var(--call-text);
  transition: background .15s, transform .12s;
}
.lightbox-nav svg { width: 26px; height: 26px; }
.lightbox-nav.prev { left: 20px; }
.lightbox-nav.next { right: 20px; }
.lightbox-nav:hover { background: var(--overlay-glass-strong); }
.lightbox-nav:active { transform: translateY(-50%) scale(.9); }
.lightbox-nav:disabled { opacity: 0; pointer-events: none; }
.lightbox-thumbs {
  grid-row: 2; grid-column: 1;
  display: flex; gap: 8px; justify-content: center; flex-wrap: nowrap;
  padding: 12px 16px 22px;
  overflow-x: auto;
}
.lightbox-thumbs::-webkit-scrollbar { height: 6px; }
.lightbox-thumb {
  width: 58px; height: 58px; flex-shrink: 0;
  border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; opacity: .55;
  transition: opacity .15s, border-color .15s, transform .12s;
}
.lightbox-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox-thumb:hover { opacity: .85; }
.lightbox-thumb.active { opacity: 1; border-color: var(--accent); transform: translateY(-2px); }

@media (max-width: 560px) {
  .lightbox-stage { padding: 56px 12px 8px; }
  .lightbox-nav { width: 42px; height: 42px; }
  .lightbox-nav.prev { left: 8px; }
  .lightbox-nav.next { right: 8px; }
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--overlay-modal);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 80; padding: 20px;
}
.modal {
  background: var(--panel); border-radius: 22px;
  width: 440px; max-width: 100%; max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px -20px var(--shadow-color-strong);
  overflow: hidden; border: 1px solid var(--line);
}
.modal-head {
  padding: 22px 22px 16px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.modal-head-text h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.modal-sub { font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.4; }
.modal-close {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  color: var(--ink-2); background: var(--panel-2); flex-shrink: 0;
  transition: background .12s, color .12s;
}
.modal-close svg { width: 18px; height: 18px; }
.modal-close:hover { background: var(--panel-3); color: var(--ink); }

.new-chat-modal { width: 520px; }

.modal-tabs {
  display: flex; gap: 6px;
  margin: 0 22px 14px;
  padding: 5px;
  background: var(--panel-2);
  border-radius: 14px;
  border: 1px solid var(--line);
}
.modal-tab {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  transition: background .14s, color .14s, box-shadow .14s;
}
.modal-tab svg { width: 16px; height: 16px; flex-shrink: 0; }
.modal-tab:hover { color: var(--ink); }
.modal-tab.active {
  background: var(--panel);
  color: var(--accent-ink);
  box-shadow: 0 2px 8px -3px var(--shadow-color-soft);
}

.modal-body { padding: 0 22px 16px; overflow-y: auto; flex: 1; min-height: 0; }

.modal-search-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; margin-bottom: 14px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.modal-search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--panel);
}
.modal-search-wrap svg { width: 18px; height: 18px; color: var(--ink-3); flex-shrink: 0; }
.modal-search-wrap input {
  flex: 1; border: none; background: none; outline: none;
  padding: 13px 0; font-family: inherit; font-size: 14px; color: var(--ink);
}
.modal-search-wrap input::placeholder { color: var(--ink-3); }

.modal-selected-wrap { margin-bottom: 14px; }
.modal-selected-label {
  display: block; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-3); margin-bottom: 8px;
}
.modal-selected-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.modal-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 8px 5px 5px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--accent-ink);
}
.modal-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.modal-chip-remove {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px; line-height: 1; color: var(--ink-2);
  transition: background .12s, color .12s;
}
.modal-chip-remove:hover { background: var(--overlay-chip-hover); color: var(--ink); }

.modal-list { list-style: none; max-height: 300px; overflow-y: auto; }
.modal-contact {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 14px; cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.modal-contact:hover { background: var(--panel-2); }
.modal-contact.selected {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.modal-contact img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.modal-contact-main { flex: 1; min-width: 0; }
.modal-contact-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modal-contact .name { font-weight: 700; font-size: 14px; }
.modal-contact .role { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.modal-kind {
  font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 6px;
}
.modal-kind.staff { background: var(--tag-internal-bg); color: var(--tag-internal-fg); }
.modal-kind.customer { background: var(--tag-request-bg); color: var(--tag-request-fg); }
.modal-contact-check {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: background .12s, border-color .12s, transform .12s;
}
.modal-contact.selected .modal-contact-check {
  background: var(--accent); border-color: var(--accent); color: var(--accent-contrast);
  transform: scale(1.05);
}
.modal-contact-check svg { width: 14px; height: 14px; opacity: 0; }
.modal-contact.selected .modal-contact-check svg { opacity: 1; }

.modal-foot {
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-2) 40%, var(--panel));
}
.modal-create-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.create-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 14px 10px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line);
  text-align: center;
  transition: border-color .15s, background .15s, transform .12s, opacity .15s;
}
.create-card:disabled { opacity: 0.38; cursor: not-allowed; }
.create-card:not(:disabled):hover { border-color: var(--accent); background: var(--accent-soft); }
.create-card:not(:disabled):active { transform: scale(.97); }
.create-card.ready:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
}
.create-card.accent.ready:not(:disabled) {
  background: var(--accent-grad); border-color: transparent; color: var(--accent-contrast);
}
.create-card.accent.ready:not(:disabled) .create-card-icon { background: var(--overlay-accent-card-icon); color: var(--call-text); }
.create-card.accent.ready:not(:disabled) small { color: var(--overlay-accent-card-sub); }
.create-card-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--panel-2); color: var(--accent-ink);
}
.create-card-icon svg { width: 20px; height: 20px; }
.create-card-text { display: flex; flex-direction: column; gap: 2px; }
.create-card-text strong { font-size: 12.5px; font-weight: 800; line-height: 1.2; }
.create-card-text small { font-size: 10.5px; color: var(--ink-2); font-weight: 600; }

@media (max-width: 560px) {
  .modal-create-cards { grid-template-columns: 1fr; }
  .new-chat-modal { width: 100%; }
}

/* ── Record modal ── */
.record-modal { width: 480px; }
.record-modal .modal-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}
.record-body {
  padding: 20px 22px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.record-preview {
  width: 100%; max-height: 280px;
  border-radius: 16px; background: var(--media-bg); object-fit: cover;
}
.record-audio-ui { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 0; }
.record-mic-ring {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-ink);
  display: grid; place-items: center;
  transition: transform .2s, box-shadow .2s;
}
.record-mic-ring.recording {
  animation: micPulse 1.2s ease infinite;
  box-shadow: 0 0 0 8px var(--accent-muted);
}
@keyframes micPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.record-mic-ring svg { width: 36px; height: 36px; }
.record-timer { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.record-hint { font-size: 13px; color: var(--ink-2); text-align: center; }
.record-actions {
  display: flex; gap: 10px; padding: 16px 22px 22px;
  border-top: 1px solid var(--line);
}
.btn-record {
  flex: 1; padding: 12px 16px; border-radius: 12px;
  background: var(--accent); color: var(--accent-contrast);
  font-weight: 700; font-size: 14px;
  transition: background .15s, transform .1s;
}
.btn-record.ghost { background: var(--panel-2); color: var(--ink); }
.btn-record.send { background: var(--accent); }
.btn-record:hover { filter: brightness(1.05); }
.btn-record:active { transform: scale(.97); }

/* ── Call overlay ── */
.call-overlay { position: fixed; inset: 0; background: var(--call-bg); z-index: 95; display: flex; align-items: center; justify-content: center; }
.call-screen { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.call-ringing { text-align: center; color: var(--call-text); display: flex; flex-direction: column; align-items: center; }
.call-avatar { width: 124px; height: 124px; border-radius: 36px; object-fit: cover; margin-bottom: 22px; animation: ring 1.6s ease infinite; }
@keyframes ring { 0%,100% { box-shadow: 0 0 0 0 var(--accent-muted); } 50% { box-shadow: 0 0 0 22px transparent; } }
.call-ringing h2 { font-size: 26px; font-weight: 800; }
.call-status { color: var(--call-text-muted); margin-top: 8px; font-size: 15px; }
.call-ringing-actions { display: flex; gap: 60px; margin-top: 50px; }
.call-action { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; color: var(--call-text); transition: transform .12s; }
.call-action svg { width: 26px; height: 26px; }
.call-action:active { transform: scale(.92); }
.call-action.accept { background: var(--status-online); }
.call-action.decline { background: var(--call-decline); }

.call-active { width: 100%; height: 100%; display: flex; flex-direction: column; }
.video-area { flex: 1; position: relative; background: var(--media-bg); overflow: hidden; }
.remote-video { width: 100%; height: 100%; object-fit: cover; }

/* local picture-in-picture */
.local-video-wrap {
  position: absolute; right: 22px; bottom: 22px;
  width: 200px; height: 134px;
  border-radius: 16px; overflow: hidden;
  border: 2px solid var(--call-pip-border);
  background: var(--call-pip-bg);
  box-shadow: 0 10px 30px -10px var(--shadow-color-black-soft);
}
.local-video { width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1); }
.local-cam-off {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: var(--call-cam-off-grad);
  color: var(--call-cam-off-text); font-size: 11px; font-weight: 700;
}
.local-cam-off svg { width: 26px; height: 26px; }
.local-tag {
  position: absolute; left: 8px; bottom: 7px;
  font-size: 10.5px; font-weight: 700; color: var(--call-text);
  background: var(--overlay-local-tag); padding: 2px 8px; border-radius: 8px;
  backdrop-filter: blur(4px);
}

/* voice-call stage */
.voice-backdrop {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background:
    radial-gradient(120% 90% at 50% 18%, color-mix(in srgb, var(--grad-2) 40%, transparent), transparent 60%),
    var(--call-voice-grad);
}
.voice-stage { display: flex; flex-direction: column; align-items: center; gap: 30px; }
.voice-avatar-ring {
  position: relative;
  width: 168px; height: 168px;
  display: grid; place-items: center;
}
.voice-avatar-ring img {
  width: 148px; height: 148px; border-radius: 50%;
  object-fit: cover; position: relative; z-index: 2;
  border: 4px solid var(--call-avatar-border);
  box-shadow: 0 12px 40px -10px var(--accent-muted);
}
.voice-pulse {
  position: absolute; inset: 0; margin: auto;
  width: 148px; height: 148px; border-radius: 50%;
  background: var(--accent-grad);
  opacity: .5;
  animation: voicePulse 2.6s ease-out infinite;
}
.voice-pulse.d2 { animation-delay: 1.3s; }
@keyframes voicePulse {
  0% { transform: scale(1); opacity: .5; }
  100% { transform: scale(1.9); opacity: 0; }
}
.voice-eq {
  display: flex; align-items: center; gap: 5px;
  height: 56px;
}
.voice-eq span {
  width: 6px; border-radius: 4px;
  background: var(--accent-grad);
  height: 14px;
  animation: voiceEq 1.1s ease-in-out infinite;
}
.voice-eq span:nth-child(odd) { animation-duration: 0.9s; }
.voice-eq span:nth-child(3n) { animation-duration: 1.35s; }
.voice-eq span:nth-child(1){animation-delay:0s}.voice-eq span:nth-child(2){animation-delay:.12s}
.voice-eq span:nth-child(3){animation-delay:.24s}.voice-eq span:nth-child(4){animation-delay:.08s}
.voice-eq span:nth-child(5){animation-delay:.3s}.voice-eq span:nth-child(6){animation-delay:.18s}
.voice-eq span:nth-child(7){animation-delay:.05s}.voice-eq span:nth-child(8){animation-delay:.27s}
.voice-eq span:nth-child(9){animation-delay:.14s}.voice-eq span:nth-child(10){animation-delay:.22s}
.voice-eq span:nth-child(11){animation-delay:.09s}.voice-eq span:nth-child(12){animation-delay:.31s}
@keyframes voiceEq {
  0%, 100% { height: 12px; opacity: .65; }
  50% { height: 52px; opacity: 1; }
}
.call-active.is-muted .voice-eq span { animation-play-state: paused; height: 10px; opacity: .4; }
.voice-call-label { color: var(--call-text-muted); font-size: 14px; font-weight: 600; }
.call-info-bar { position: absolute; top: 26px; left: 50%; transform: translateX(-50%); color: var(--call-text); text-align: center; }
.call-info-bar span { display: block; }
.call-info-bar span:first-child { font-size: 19px; font-weight: 800; }
.call-timer { color: var(--call-text-muted); font-size: 14px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.call-controls { display: flex; justify-content: center; gap: 18px; padding: 26px; background: var(--call-bg); }
.call-ctrl { display: flex; flex-direction: column; align-items: center; gap: 7px; color: var(--call-text); padding: 8px; }
.call-ctrl > svg { width: 26px; height: 26px; padding: 16px; border-radius: 50%; background: var(--call-surface); box-sizing: content-box; transition: background .15s; }
.call-ctrl span { font-size: 12px; color: var(--call-text-muted); }
.call-ctrl:hover > svg { background: var(--overlay-call-hover); }
.call-ctrl.active > svg { background: var(--white); color: var(--call-bg); }
.call-ctrl.end > svg { background: var(--call-decline); }

/* ── Responsive ── */
@media (hover: none) {
  .msg-more { opacity: 1; pointer-events: auto; }
}
@media (max-width: 980px) {
  .body { grid-template-columns: 1fr; }
  .chat-pane { display: none; }
  .body.show-chat .list-pane { display: none; }
  .body.show-chat .chat-pane { display: flex; }
  .body.show-chat .chat-back { display: grid; }
  .thread-scroll, .composer { padding-left: 12px; padding-right: 12px; }
  .emoji-picker { left: 12px; }
}
@media (max-width: 560px) {
  .details-drawer { width: 100vw; }
  :root { --header-av-size: 44px; --chat-gutter: 10px; }
  .chat-bar { height: 76px; }
  .composer-bar { padding: 6px 6px 6px 14px; border-radius: 24px; gap: 4px; }
  .composer-actions { gap: 2px; }
  .bar-icon { width: 36px; height: 36px; }
  .bar-icon svg { width: 20px; height: 20px; }
  .composer-send-fab { width: 40px; height: 40px; }
  .ctool { width: 38px; height: 38px; }
  .chat-tools { gap: 6px; }
  .bubble-row { max-width: 96%; }
  .emoji-picker { bottom: 120px; }
  .mention-picker { left: 10px; width: min(280px, calc(100% - 20px)); }
  .reaction-pop button { width: 34px; height: 34px; font-size: 19px; }
  .pb-stats { grid-template-columns: repeat(2, 1fr); }
  .pi-facts { grid-template-columns: repeat(2, 1fr); }
  .pb-tasks-btn span:not(.pb-tasks-count) { display: none; }
  .pi-progress { flex-wrap: wrap; }
  .task-meta-grid { grid-template-columns: 1fr; }
}
